update edit with remark
This commit is contained in:
@@ -28,7 +28,7 @@ class SaleItem < ApplicationRecord
|
||||
|
||||
def self.update_existing_item(qty, item, sale_id, type, item_price, price)
|
||||
# Original Item to add remark
|
||||
item.remark = type
|
||||
item.status = type
|
||||
item.save
|
||||
|
||||
sale_item = SaleItem.new
|
||||
@@ -37,7 +37,7 @@ class SaleItem < ApplicationRecord
|
||||
sale_item.product_name = item.product_name + " (#{type.upcase})"
|
||||
sale_item.product_alt_name = item.product_alt_name
|
||||
sale_item.account_id = item.account_id
|
||||
sale_item.remark = type
|
||||
sale_item.status = type
|
||||
if type == "foc" || type == "promotion" || type == "void"
|
||||
sale_item.qty = qty * (-1)
|
||||
else
|
||||
@@ -99,7 +99,7 @@ class SaleItem < ApplicationRecord
|
||||
discount_account = {:name => a.title, :price => 0}
|
||||
|
||||
# Check for actual sale items
|
||||
sale_items.where("remark = 'Discount'").find_each do |si|
|
||||
sale_items.where("status = 'Discount'").find_each do |si|
|
||||
if si.account_id == a.id
|
||||
discount_account[:price] = (discount_account[:price].abs + si.price.abs) * (1)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user