seed generator fun:

This commit is contained in:
phyusin
2018-10-16 17:38:33 +06:30
parent ed2398a495
commit a6393a5140
2 changed files with 8 additions and 6 deletions

View File

@@ -536,10 +536,13 @@ class Sale < ApplicationRecord
shop = Shop.first
#if tax is not apply create new record
SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax|
#delete existing and create new
existing_tax.delete
end
# SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax|
# #delete existing and create new
# existing_tax.delete
# end
taxes = SaleTax.where("sale_id='#{self.sale_id}'").pluck(:sale_tax_id)
SaleTax.where("sale_tax_id IN (?)", taxes).destroy_all
total_tax_amount = 0
tax_incl_exec = "exclusive"