check inventory
This commit is contained in:
@@ -208,19 +208,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
||||||
|
|
||||||
if params[:type] == "quick_service"
|
#end
|
||||||
booking = Booking.find_by_sale_id(sale_id)
|
|
||||||
if booking.dining_facility_id.to_i>0
|
|
||||||
table_id = booking.dining_facility_id
|
|
||||||
else
|
|
||||||
table_id = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
booking.booking_orders.each do |order|
|
|
||||||
Order.pay_process_order_queue(order.order_id,table_id)
|
|
||||||
end
|
|
||||||
# end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class InventoryDefinition < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.find_product_in_inventory(item)
|
def self.find_product_in_inventory(item)
|
||||||
product = InventoryDefinition.find_by_item_code(item.product_code)
|
product = InventoryDefinition.find_by_item_code(item.item_instance_code)
|
||||||
if product.nil?
|
if product.nil?
|
||||||
return false, nil
|
return false, nil
|
||||||
else
|
else
|
||||||
@@ -21,7 +21,7 @@ class InventoryDefinition < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.check_balance(item,inventory_definition) # item => saleItemOBj
|
def self.check_balance(item,inventory_definition) # item => saleItemOBj
|
||||||
stock = StockJournal.where('item_code=?', item.product_code).order('created_at desc').take
|
stock = StockJournal.where('item_code=?', item.item_instance_code).order('created_at desc').take
|
||||||
unless stock.nil?
|
unless stock.nil?
|
||||||
modify_balance(item, stock, inventory_definition)
|
modify_balance(item, stock, inventory_definition)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class StockJournal < ApplicationRecord
|
|||||||
balance = calculate_balance(balance, item.qty)
|
balance = calculate_balance(balance, item.qty)
|
||||||
|
|
||||||
journal = StockJournal.new
|
journal = StockJournal.new
|
||||||
journal.item_code = item.product_code
|
journal.item_code = item.item_instance_code
|
||||||
journal.inventory_definition_id = inventory_definition.id
|
journal.inventory_definition_id = inventory_definition.id
|
||||||
journal.debit = item.qty
|
journal.debit = item.qty
|
||||||
journal.balance = balance
|
journal.balance = balance
|
||||||
|
|||||||
Reference in New Issue
Block a user