add inclc in receipt bill

This commit is contained in:
phyusin
2018-05-25 15:25:39 +06:30
parent b3e0e7e453
commit 5d63d38e4e
3 changed files with 31 additions and 26 deletions

View File

@@ -421,7 +421,7 @@ class Sale < ApplicationRecord
end end
total_tax_amount = 0 total_tax_amount = 0
tax_incl_exec = "execulsive" tax_incl_exec = "exclusive"
#tax_profile - list by order_by #tax_profile - list by order_by
tax_profiles = TaxProfile.all.order("order_by asc") tax_profiles = TaxProfile.all.order("order_by asc")
customer = Customer.find(sale.customer_id) customer = Customer.find(sale.customer_id)
@@ -440,6 +440,7 @@ class Sale < ApplicationRecord
total_tax = total_taxable - total_discount total_tax = total_taxable - total_discount
#include or execulive #include or execulive
if tax.inclusive if tax.inclusive
tax_incl_exec = "inclusive"
rate = tax.rate rate = tax.rate
divided_value = (100 + rate)/rate divided_value = (100 + rate)/rate
sale_tax.tax_payable_amount = total_tax / divided_value sale_tax.tax_payable_amount = total_tax / divided_value
@@ -465,6 +466,7 @@ class Sale < ApplicationRecord
total_tax = total_taxable - total_discount total_tax = total_taxable - total_discount
#include or execulive #include or execulive
if tax.inclusive if tax.inclusive
tax_incl_exec = "inclusive"
rate = tax.rate rate = tax.rate
divided_value = (100 + rate)/rate divided_value = (100 + rate)/rate
sale_tax.tax_payable_amount = total_tax / divided_value sale_tax.tax_payable_amount = total_tax / divided_value
@@ -484,7 +486,7 @@ class Sale < ApplicationRecord
end end
end end
end end
sale.tax_type = sale.tax_type = tax_incl_exec
sale.total_tax = total_tax_amount sale.total_tax = total_tax_amount
end end
@@ -499,6 +501,7 @@ class Sale < ApplicationRecord
end end
total_tax_amount = 0 total_tax_amount = 0
tax_incl_exec = "exclusive"
#tax_profile - list by order_by #tax_profile - list by order_by
tax_profiles = TaxProfile.all.order("order_by asc") tax_profiles = TaxProfile.all.order("order_by asc")
@@ -520,6 +523,7 @@ class Sale < ApplicationRecord
total_tax = total_taxable - self.total_discount total_tax = total_taxable - self.total_discount
#include or execulive #include or execulive
if tax.inclusive if tax.inclusive
tax_incl_exec = "inclusive"
rate = tax.rate rate = tax.rate
divided_value = (100 + rate)/rate divided_value = (100 + rate)/rate
sale_tax.tax_payable_amount = total_tax / divided_value sale_tax.tax_payable_amount = total_tax / divided_value
@@ -539,6 +543,7 @@ class Sale < ApplicationRecord
# end # end
end end
end end
self.tax_type = tax_incl_exec
self.total_tax = total_tax_amount self.total_tax = total_tax_amount
end end

View File

@@ -304,7 +304,7 @@ class ReceiptBillA5Pdf < Prawn::Document
if sale_data.sale_taxes.length > 0 if sale_data.sale_taxes.length > 0
incl_tax = "" incl_tax = ""
if sale_data.tax_type == "inculsive" if sale_data.tax_type == "inclusive"
incl_tax = "Incl." incl_tax = "Incl."
end end
sale_data.sale_taxes.each do |st| sale_data.sale_taxes.each do |st|

View File

@@ -291,7 +291,7 @@ class ReceiptBillPdf < Prawn::Document
if sale_data.sale_taxes.length > 0 if sale_data.sale_taxes.length > 0
incl_tax = "" incl_tax = ""
if sale_data.tax_type == "inculsive" if sale_data.tax_type == "inclusive"
incl_tax = "Incl." incl_tax = "Incl."
end end