fix api addorder and foc payment status

This commit is contained in:
Thein Lin Kyaw
2019-12-20 16:38:21 +06:30
parent 33afe167f7
commit 99c943a865
4 changed files with 25 additions and 18 deletions

View File

@@ -230,7 +230,7 @@ class Origami::AddordersController < BaseOrigamiController
end
end
def process_order_queue(order_id,table_id,order_source)
def process_order_queue(order_id, table_id, order_source)
#Send to background job for processing
order = Order.find(order_id)
sidekiq = Lookup.find_by_lookup_type("sidekiq")

View File

@@ -550,11 +550,14 @@ class Origami::PaymentsController < BaseOrigamiController
current_balance = nil
order_source = params[:type]
if(Sale.exists?(sale_id))
if Sale.exists?(sale_id)
saleObj = Sale.find(sale_id)
#calculate cash acmount
cash = saleObj.total_amount
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, current_user, cash, "foc" ,remark)
if saleObj.discount_type == "member_discount"
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
saleObj.compute_by_sale_items(0, nil, order_source)
@@ -562,9 +565,6 @@ class Origami::PaymentsController < BaseOrigamiController
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, current_user, cash, "foc" ,remark)
bookings = Booking.where("sale_id='#{sale_id}'")
if bookings[0].dining_facility_id.to_i > 0
table = DiningFacility.find(bookings[0].dining_facility_id)
@@ -573,8 +573,6 @@ class Origami::PaymentsController < BaseOrigamiController
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
end
# For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'")