calculate commission in sale_edit, void, foc

This commit is contained in:
Zin Lin Phyo
2017-09-04 12:09:04 +06:30
parent c2d86cb17c
commit 2330a1a33e
3 changed files with 110 additions and 95 deletions

View File

@@ -25,6 +25,7 @@ class Origami::SaleEditController < BaseOrigamiController
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
end
def item_foc
@@ -44,6 +45,7 @@ class Origami::SaleEditController < BaseOrigamiController
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
end
# def item_edit
@@ -105,6 +107,7 @@ class Origami::SaleEditController < BaseOrigamiController
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
ProductCommission.remove_product_commission(saleitemObj)
end
# remove all void items
@@ -118,6 +121,7 @@ class Origami::SaleEditController < BaseOrigamiController
item.remark = nil
end
item.save
ProductCommission.remove_product_commission(item)
end
# re-calc tax
@@ -128,5 +132,8 @@ class Origami::SaleEditController < BaseOrigamiController
sale_id = params[:sale_id]
saleObj = Sale.find(sale_id)
saleObj.compute_without_void
saleObj.sale_items.each do |item|
ProductCommission.remove_product_commission(item)
end
end
end