Promotion Tax bug fix
This commit is contained in:
@@ -120,6 +120,10 @@ class Promotion < ApplicationRecord
|
||||
def self.give_promotion_second_product(orderitem_count, foc_min_qty, promo_product, orderitem, sale_id)
|
||||
puts "..... orderitem_count: " + orderitem_count.to_s + " / foc_min_qty: " + foc_min_qty.to_s + " /promo_product: " + promo_product + " orderitem: " + orderitem.to_s
|
||||
promotion_qty = orderitem_count.to_i / foc_min_qty.to_i # get foc item qty
|
||||
foc_qty = find_second_item_qty(sale_id, promo_product)
|
||||
if (foc_qty < promotion_qty)
|
||||
promotion_qty = foc_qty
|
||||
end
|
||||
item = OrderItem.find_by_item_code(promo_product)
|
||||
update_existing_item(promotion_qty, item, sale_id, "promotion", item.price)
|
||||
end
|
||||
@@ -135,13 +139,15 @@ class Promotion < ApplicationRecord
|
||||
sale_item.qty = foc_qty * (-1)
|
||||
|
||||
sale_item.unit_price = item_price * (-1)
|
||||
sale_item.taxable_price = item_price
|
||||
sale_item.taxable_price = item_price * (-1)
|
||||
sale_item.price = foc_qty * item_price * (-1)
|
||||
|
||||
sale_item.is_taxable = item.taxable
|
||||
sale_item.is_taxable = false
|
||||
sale_item.sale_id = sale_id
|
||||
|
||||
sale_item.save
|
||||
sale = Sale.find(sale_id).
|
||||
sale.compute_by_sale_items(sale.id, sale.sale_items, sale.total_discount)
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user