change all sale item

This commit is contained in:
Yan
2017-11-22 12:12:27 +06:30
parent 77ce2f32ff
commit 1fd4108ac0
6 changed files with 60 additions and 29 deletions

View File

@@ -172,7 +172,9 @@ class SalePayment < ApplicationRecord
# add to sale item with foc
sale_items = SaleItem.find_by_sale_id(self.sale)
SaleItem.add_sale_items(sale_items)
sale_items.each do|item|
SaleItem.update_existing_item(item.qty, item, self.sale, "foc", item.unit_price)
end
self.payment_method = "foc"
self.payment_amount = self.received_amount