fixed inventory

This commit is contained in:
NyanLinHtut
2019-09-12 14:50:14 +06:30
parent 719d5637c2
commit e0b54728f7
7 changed files with 111 additions and 40 deletions

View File

@@ -2,9 +2,9 @@ class Origami::SalesController < BaseOrigamiController
def show
@webview = false
if check_mobile
@webview = true
@webview = true
end
@tables = Table.unscoped.all.active.order('status desc')
@rooms = Room.unscoped.all.active.order('status desc')
@complete = Sale.completed_sale("cashier")
@@ -36,7 +36,7 @@ class Origami::SalesController < BaseOrigamiController
if booking.sale_id.nil?
order_array = []
booking.booking_orders.each do |booking_order|
booking.booking_status = 'moved'
order = Order.find(booking_order.order_id)
order.status = 'billed'
@@ -60,16 +60,16 @@ class Origami::SalesController < BaseOrigamiController
booking.save
order_array.push(order.order_id)
end
receipt_no = Sale.find(sale_id).receipt_no
action_by = current_user.name
type = "ADD_TO_EXISTING"
remark = "#{action_by} add to existing order #{order_array} to Receipt No=>#{receipt_no} in #{table.name}"
sale_audit = SaleAudit.record_audit_sale(sale_id,remark,action_by,type )
booking_order = BookingOrder.where('booking_id=?',booking)
booking_order.each do |bo|
bo.booking_id = existing_booking.booking_id
@@ -77,9 +77,9 @@ class Origami::SalesController < BaseOrigamiController
end
end
end
if !sale_data.empty?
# if !sale_data.empty?
# InventoryJob.perform_now(self.id)
InventoryDefinition.calculate_product_count(nil,sale_data)
# InventoryDefinition.calculate_product_count(nil,sale_data)
end
end