tax
This commit is contained in:
@@ -486,15 +486,18 @@ class Sale < ApplicationRecord
|
||||
# substract , to give after discount
|
||||
total_tax = total_taxable - total_discount
|
||||
#include or execulive
|
||||
if tax.inclusive
|
||||
tax_incl_exec = "inclusive"
|
||||
rate = tax.rate
|
||||
divided_value = (100 + rate)/rate
|
||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||
if tax.tax_type.to_s =="Net"
|
||||
sale_tax.tax_payable_amount = tax.rate
|
||||
else
|
||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||
if tax.inclusive
|
||||
tax_incl_exec = "inclusive"
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
|
||||
@@ -609,16 +612,19 @@ class Sale < ApplicationRecord
|
||||
|
||||
# substract , to give after discount
|
||||
total_tax = total_taxable - self.total_discount
|
||||
#include or execulive
|
||||
if tax.inclusive
|
||||
tax_incl_exec = "inclusive"
|
||||
rate = tax.rate
|
||||
divided_value = (100 + rate)/rate
|
||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||
if tax.tax_type.to_s =="Net"
|
||||
sale_tax.tax_payable_amount = tax.rate
|
||||
else
|
||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||
#include or execulive
|
||||
if tax.inclusive
|
||||
tax_incl_exec = "inclusive"
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
|
||||
@@ -2048,7 +2054,6 @@ def self.get_sale_data_for_other_payment_credit(sale_id)
|
||||
end
|
||||
|
||||
def unique_tax_profiles(order_source, customer_id)
|
||||
puts "unique_tax_profiles unique_tax_profiles"
|
||||
tax_data = TaxProfile.where(group_type: order_source)
|
||||
|
||||
customer_tax_profiles = Customer.select(:tax_profiles).where(customer_id: customer_id).first
|
||||
|
||||
@@ -7,7 +7,7 @@ class TaxProfile < ApplicationRecord
|
||||
def self.calculate_tax(group_type)
|
||||
divided_value =0.0
|
||||
exclusive =0.0
|
||||
tax_profiles = TaxProfile.where(group_type: group_type)
|
||||
tax_profiles = TaxProfile.where(group_type: group_type,tax_type: 'Percentage')
|
||||
if !tax_profiles.empty?
|
||||
tax_profiles.each do |tax|
|
||||
#include or execulive
|
||||
|
||||
Reference in New Issue
Block a user