update sale item qty count update

This commit is contained in:
Aung Myo
2017-12-04 14:45:35 +06:30
parent 7ef75a285a
commit 79d7adf170
4 changed files with 6 additions and 6 deletions

View File

@@ -651,7 +651,7 @@ def self.get_item_query()
# "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ")
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
# query = query.where("i.item_instance_code IS NOT NULL")
query = query.group("i.product_name").order("mi.account_id, mi.menu_category_id")
query = query.group("i.product_name").order("mi.account_id")
end
def self.get_other_charges()

View File

@@ -34,7 +34,7 @@ class SaleItem < ApplicationRecord
sale_item.product_alt_name = item.product_alt_name
sale_item.account_id = item.account_id
sale_item.remark = type
if type == "FOC" || type == "promotion" || type == "void"
if type == "foc" || type == "promotion" || type == "void"
sale_item.qty = qty * (-1)
else
sale_item.qty = qty

View File

@@ -184,7 +184,7 @@ class SalePayment < ApplicationRecord
sale_items = SaleItem.where("sale_id='#{ self.sale.sale_id }'")
sale_items.each do|item|
SaleItem.update_existing_item(item.qty, item, self.sale.sale_id, "FOC", item.unit_price, item.price)
SaleItem.update_existing_item(item.qty, item, self.sale.sale_id, "foc", item.unit_price, item.price)
end
self.payment_method = "foc"