inclusive tax calc by rake

This commit is contained in:
Yan
2017-08-10 14:59:16 +06:30
parent edf213d6d6
commit 1dbd6eb60a

View File

@@ -287,7 +287,9 @@ class Sale < ApplicationRecord
total_tax = total_taxable - total_discount
#include or execulive
if tax.inclusive
sale_tax.tax_payable_amount = total_tax / 21
rate = tax.rate
divided_value = (100 + rate)/rate
sale_tax.tax_payable_amount = total_tax / divided_value
else
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
@@ -330,7 +332,9 @@ class Sale < ApplicationRecord
total_tax = total_taxable - self.total_discount
#include or execulive
if tax.inclusive
sale_tax.tax_payable_amount = total_tax / 21
rate = tax.rate
divided_value = (100 + rate)/rate
sale_tax.tax_payable_amount = total_tax / divided_value
else
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount