update customer tax calc

This commit is contained in:
Yan
2017-08-09 17:54:22 +06:30
parent e9847272ca
commit 2794103e52
4 changed files with 57 additions and 34 deletions

View File

@@ -277,8 +277,8 @@ class Sale < ApplicationRecord
# #Creat new tax records
tax_profiles.each do |tax|
customer.tax_profiles.each do |cus_tax|
if cus_tax == tax.id
customer.tax_profiles.each do |cus_tax|
if cus_tax.to_i == tax.id
sale_tax = SaleTax.new(:sale => sale)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate
@@ -318,10 +318,11 @@ class Sale < ApplicationRecord
tax_profiles = TaxProfile.all.order("order_by asc")
customer = Customer.find(self.customer_id)
# #Create new tax records
tax_profiles.each do |tax|
customer.tax_profiles.each do |cus_tax|
if cus_tax == tax.id
if cus_tax.to_i == tax.id
sale_tax = SaleTax.new(:sale => self)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate