view order with service charges
This commit is contained in:
@@ -88,26 +88,44 @@ if (@booking)
|
|||||||
|
|
||||||
#total tax calculation
|
#total tax calculation
|
||||||
@total_tax_amount = 0
|
@total_tax_amount = 0
|
||||||
|
@service_rate = 0
|
||||||
|
@commercial_rate = 0
|
||||||
|
@service_charges = 0.00
|
||||||
|
@commercial_tax = 0.00
|
||||||
@total_taxable = @total_amount
|
@total_taxable = @total_amount
|
||||||
if !@tax_profile.nil?
|
if !@tax_profile.nil?
|
||||||
@tax_profile.each do |tax|
|
@tax_profile.each do |tax|
|
||||||
# total_tax_amount = 0
|
total_tax_amount = 0
|
||||||
if tax.inclusive
|
if tax.inclusive
|
||||||
total_tax_amount = (@total_taxable / ((100 + tax.rate)/ tax.rate))
|
total_tax_amount = (@total_taxable / ((100 + tax.rate)/ tax.rate))
|
||||||
else
|
else
|
||||||
total_tax_amount = (@total_taxable * tax.rate / 100)
|
total_tax_amount = (@total_taxable * tax.rate / 100)
|
||||||
end
|
end
|
||||||
|
|
||||||
if @shop.calc_tax_order
|
if @shop.calc_tax_order
|
||||||
@total_taxable = @total_taxable + total_tax_amount
|
@total_taxable = @total_taxable + total_tax_amount
|
||||||
end
|
end
|
||||||
|
if tax.name.strip.downcase.include? ("service")
|
||||||
@total_tax_amount += total_tax_amount
|
@service_rate = tax.rate.to_i
|
||||||
|
@service_charges = total_tax_amount
|
||||||
|
else
|
||||||
|
@commercial_rate = tax.rate.to_i
|
||||||
|
@commercial_tax = total_tax_amount
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@total_tax_amount = @service_charges + @commercial_tax
|
||||||
end
|
end
|
||||||
|
|
||||||
#total tax calculation
|
#total tax calculation
|
||||||
json.sub_total @total_amount
|
json.sub_total @total_amount
|
||||||
json.total_tax @total_tax_amount
|
if @service_rate.to_i > 0
|
||||||
|
json.service_rate @service_rate
|
||||||
|
json.service_charges @service_charges
|
||||||
|
end
|
||||||
|
if @commercial_rate.to_i > 0
|
||||||
|
json.commercial_rate @commercial_rate
|
||||||
|
json.commercial_tax @commercial_tax
|
||||||
|
end
|
||||||
json.total @total_amount + @total_tax_amount
|
json.total @total_amount + @total_tax_amount
|
||||||
else
|
else
|
||||||
json.success false
|
json.success false
|
||||||
|
|||||||
Reference in New Issue
Block a user