shop code

This commit is contained in:
Myat Zin Wai Maw
2019-11-22 18:24:02 +06:30
parent 5a3f328789
commit d1ab2c194d
106 changed files with 834 additions and 895 deletions

View File

@@ -311,11 +311,11 @@ class SaleItem < ApplicationRecord
cancel_foc = self.status_before_last_save == "foc"
if is_void or cancel_void or is_edit or is_foc or cancel_foc
found, inventory_definition = InventoryDefinition.find_product_in_inventory(self)
found, inventory_definition = InventoryDefinition.find_product_in_inventory(self,self.sale.shop_code)
if found
stock = StockJournal.where('item_code=?', self.item_instance_code).order("id DESC").first
stock = StockJournal.where("shop_code='#{self.sale.shop_code}' and item_code=?", self.item_instance_code).order("id DESC").first
unless stock.nil?
check_item = StockCheckItem.where('item_code=?', self.item_instance_code).order("id DESC").first
check_item = StockCheckItem.where("shop_code='#{self.sale.shop_code}' and item_code=?", self.item_instance_code).order("id DESC").first
if is_void or cancel_void or is_edit
if is_void
qty = -self.qty