diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index d98e25e0..e1eff050 100755 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -45,22 +45,7 @@ class Api::BillController < Api::ApiController @sale_id = booking.sale_id @sale_data = Sale.find_by_sale_id(@sale_id) end - - if ENV["SERVER_MODE"] != "cloud" #no print in cloud server - - unique_code = "CheckInOutPdf" - printer = PrintSetting.find_by_unique_code(unique_code) - - # print when complete click - order_queue_printer = Printer::OrderQueuePrinter.new(printer) - - if !printer.nil? - order_queue_printer.print_check_in_out(printer, booking, table) - end - end end - - elsif (params[:order_id]) order = Order.find(params[:order_id]) @sale = Sale.new @@ -75,6 +60,22 @@ class Api::BillController < Api::ApiController # @sale_data.shift_sale_id = shift_by_terminal.id # @sale_data.save + #check checkInOut pdf print + check_booking = Booking.find_by_sale_id(@sale_id) + checkout_time = Lookup.collection_of('checkout_time') + if (!checkout_time.empty?) && (ENV["SERVER_MODE"] != "cloud") #no print in cloud server + + unique_code = "CheckInOutPdf" + printer = PrintSetting.find_by_unique_code(unique_code) + + # print when complete click + order_queue_printer = Printer::OrderQueuePrinter.new(printer) + + if !printer.nil? + order_queue_printer.print_check_in_out(printer, check_booking, table) + end + end + Promotion.promo_activate(@sale) #BillBroadcastJob.perform_later(table) diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 8cf0b07b..5b71141e 100755 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -67,9 +67,10 @@ class Origami::RequestBillsController < ApplicationController result = {:status=> @status, :data => @sale.sale_id } render :json => result.to_json else - - if ENV["SERVER_MODE"] != "cloud" #no print in cloud server - + #check checkInOut pdf print + check_booking = Booking.find_by_sale_id(@sale_id) + checkout_time = Lookup.collection_of('checkout_time') + if (!checkout_time.empty?) && (ENV["SERVER_MODE"] != "cloud") #no print in cloud server unique_code = "CheckInOutPdf" printer = PrintSetting.find_by_unique_code(unique_code) diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 5b89c1d1..9aac5236 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -12,8 +12,8 @@ class SalePayment < ApplicationRecord self.sale = invoice self.received_amount = cash_amount self.payment_reference = remark - puts action_by - puts "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + # puts action_by + # puts "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" self.action_by = action_by #get all payment for this invoices if payment_for