tax bug fix

This commit is contained in:
Phyo
2017-08-28 14:24:53 +06:30
parent a0fe336589
commit 087c120cc7

View File

@@ -69,7 +69,7 @@ class Promotion < ApplicationRecord
give_promotion_nett_price(same,promo_product,promo.min_qty, orderitem, sale_id)
elsif promo.promo_type == Promotion::PROMO_TYPE4
give_promotion_nett_price(same,promo_product,promo.min_qty, orderitem, sale_id)
give_promotion_discount(same,promo_product,promo.min_qty, orderitem, sale_id)
end
end
@@ -138,8 +138,8 @@ class Promotion < ApplicationRecord
sale_item.remark = type
sale_item.qty = foc_qty * (-1)
sale_item.unit_price = item_price * (-1)
sale_item.taxable_price = item_price * (-1)
sale_item.unit_price = item_price # * (-1)
sale_item.taxable_price = item_price # * (-1)
sale_item.price = foc_qty * item_price * (-1)
sale_item.is_taxable = false
@@ -170,8 +170,8 @@ class Promotion < ApplicationRecord
if same
foc_qty = orderitem[1].to_i / foc_min_qty
item = OrderItem.find_by_item_code(orderitem[0])
price = item.price - promo_product.net_price
item = OrderItem.find_by_item_code(orderitem[0]) # need to specify with menu item instance
price = item.price.to_i - promo_product.net_price.to_i
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price)
else
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
@@ -187,13 +187,15 @@ class Promotion < ApplicationRecord
if same
foc_qty = orderitem[1].to_i / foc_min_qty
item = OrderItem.find_by_item_code(orderitem[0])
total = orderitem[1].to_i * item.price
# total = orderitem[1].to_i * item.price
total = item.price
price = calculate_discount(total, promo_product.percentage)
update_existing_item(foc_qty, item, sale_id, "promotion discount", price)
else
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
item = OrderItem.find_by_item_code(promo_product.item_code)
total = item.price * foc_qty
# total = item.price * foc_qty
total = item.price
price = calculate_discount(total, promo_product.percentage)
update_existing_item(foc_qty, item, sale_id, "promotion discount", price)
end