rescue member call and update oqs and js route bug

This commit is contained in:
Yan
2017-06-18 03:20:19 +06:30
parent 80320b6d3e
commit f33f11df64
12 changed files with 102 additions and 51 deletions

View File

@@ -195,28 +195,28 @@ class Sale < ApplicationRecord
existing_tax.delete
end
total_tax_amount = 0
#tax_profile - list by order_by
tax_profiles = TaxProfile.all.order("order_by asc")
# total_tax_amount = 0
# #tax_profile - list by order_by
# tax_profiles = TaxProfile.all.order("order_by asc")
#Creat new tax records
tax_profiles.each do |tax|
sale_tax = SaleTax.new(:sale => self)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate
#include or execulive
# sale_tax.tax_payable_amount = total_taxable * tax.rate
sale_tax.tax_payable_amount = total_taxable * tax.rate / 100
#new taxable amount
total_taxable = total_taxable + sale_tax.tax_payable_amount
# #Creat new tax records
# tax_profiles.each do |tax|
# sale_tax = SaleTax.new(:sale => self)
# sale_tax.tax_name = tax.name
# sale_tax.tax_rate = tax.rate
# #include or execulive
# # sale_tax.tax_payable_amount = total_taxable * tax.rate
# sale_tax.tax_payable_amount = total_taxable * tax.rate / 100
# #new taxable amount
# total_taxable = total_taxable + sale_tax.tax_payable_amount
sale_tax.inclusive = tax.inclusive
sale_tax.save
# sale_tax.inclusive = tax.inclusive
# sale_tax.save
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
end
# total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
# end
self.total_tax = total_tax_amount
# self.total_tax = total_tax_amount
end