Pull from master

This commit is contained in:
San Wai Lwin
2018-07-05 15:42:58 +06:30
parent ebaf4ad418
commit e5eb9b90ad
11 changed files with 78 additions and 104 deletions

View File

@@ -412,13 +412,15 @@ class Sale < ApplicationRecord
# Tax Re-Calculte
def compute_tax(sale, total_taxable, total_discount = 0, order_source = nil, tax_type=nil)
shop = Shop.first();
shop = Shop.first
#if tax is not apply create new record
SaleTax.where("sale_id='#{sale.sale_id}'").find_each do |existing_tax|
#delete existing and create new
existing_tax.delete
end
# SaleTax.where("sale_id='#{sale.sale_id}'").find_each do |existing_tax|
# #delete existing and create new
# existing_tax.delete
# end
taxes = SaleTax.where("sale_id='#{sale.sale_id}'").pluck(:sale_tax_id)
SaleTax.where("sale_tax_id IN (?)", taxes).destroy_all
total_tax_amount = 0
tax_incl_exec = "exclusive"
@@ -495,7 +497,7 @@ class Sale < ApplicationRecord
# Tax Calculate
def apply_tax(total_taxable, order_source = nil)
shop = Shop.first();
shop = Shop.first
#if tax is not apply create new record
SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax|