fix for customer tax ui and calc tax after bind customer

This commit is contained in:
Yan
2017-08-11 12:13:30 +06:30
parent d32fbf18e0
commit 0e93eb3765
3 changed files with 16 additions and 6 deletions

View File

@@ -274,11 +274,14 @@ class Sale < ApplicationRecord
#tax_profile - list by order_by
tax_profiles = TaxProfile.all.order("order_by asc")
customer = Customer.find(sale.customer_id)
puts customer.tax_profiles
# #Creat new tax records
tax_profiles.each do |tax|
customer.tax_profiles.each do |cus_tax|
if cus_tax.to_i == tax.id
customer.tax_profiles.each do |cus_tax|
puts tax
puts cus_tax
if cus_tax.to_i == tax.id
puts "WALSS"
sale_tax = SaleTax.new(:sale => sale)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate
@@ -319,11 +322,14 @@ class Sale < ApplicationRecord
tax_profiles = TaxProfile.all.order("order_by asc")
customer = Customer.find(self.customer_id)
puts customer.tax_profiles
# #Create new tax records
tax_profiles.each do |tax|
customer.tax_profiles.each do |cus_tax|
puts tax
puts cus_tax
if cus_tax.to_i == tax.id
puts "WALSS"
sale_tax = SaleTax.new(:sale => self)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate