This commit is contained in:
Myat Zin Wai Maw
2019-12-05 11:06:12 +06:30
parent cab37a6bfb
commit fabf3f613e
5 changed files with 46 additions and 33 deletions

View File

@@ -161,7 +161,7 @@ class Api::PaymentsController < Api::ApiController
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
render json: JSON.generate({:status => true, :balance_amount => card_balance_amount,:receipt_no => sale.receipt_no, :message => "Payment successful."})
render json: JSON.generate({:status => true, :balance_amount => card_balance_amount,:receipt_no => sale.receipt_no,:order_no => latest_order_no, :message => "Payment successful."})
else
if @membership_data
if @membership_data["card_balance_amount"] != "null"

View File

@@ -63,18 +63,19 @@ class Foodcourt::OrdersController < BaseFoodcourtController
@customer_id =@booking.customer_id
@booking_id =@booking.booking_id
@order_id =@booking.order_id
@sale_data = Sale.find_by_sale_id(@booking.sale_id)
end
@bookings = Booking.select("bookings.*,customers.*")
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("orders.source='app' and DATE(bookings.created_at) = '#{Date.today}' and bookings.shop_code='#{Shop.current_shop.shop_code}'").order("bookings.created_at desc").uniq
.where("orders.source='app' and bookings.shop_code='#{Shop.current_shop.shop_code}'").order("bookings.created_at desc").uniq
end
def completed
customer =Customer.find_by_customer_id(params[:customer_id])
phone_number =customer.contact_no
if Order.send_message(phone_number,params[:order_id])
if Order.send_message(phone_number,params[:order_id],Shop.current_shop.name)
booking =Booking.find(params[:booking_id])
booking.booking_status ='completed'
booking.save!