From c606ca73dbd61629767027f586321172e8b30e21 Mon Sep 17 00:00:00 2001 From: Myat Zin Wai Maw Date: Tue, 10 Dec 2019 13:37:06 +0630 Subject: [PATCH] foodcourt --- app/controllers/api/payments_controller.rb | 4 ---- .../foodcourt/addorders_controller.rb | 1 - .../foodcourt/cash_ins_controller.rb | 3 +-- .../foodcourt/orders_controller.rb | 11 +++++----- .../api/orders/view_orders.json.jbuilder | 12 +++++----- config/initializers/action_controller.rb | 10 ++++----- config/puma.rb | 22 +++++++++---------- server2.pid | 2 +- 8 files changed, 29 insertions(+), 36 deletions(-) diff --git a/app/controllers/api/payments_controller.rb b/app/controllers/api/payments_controller.rb index d59b619f..47467026 100755 --- a/app/controllers/api/payments_controller.rb +++ b/app/controllers/api/payments_controller.rb @@ -46,7 +46,6 @@ class Api::PaymentsController < Api::ApiController rebate_amount = nil # For Cashier by Zone - # bookings = Booking.where("sale_id='#{sale_id}'") bookings = Booking.find_by_sale_id(sale_id) shift = ShiftSale.current_open_shift(current_login_employee) @@ -68,7 +67,6 @@ class Api::PaymentsController < Api::ApiController end # For Print - # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf unique_code = "ReceiptBillPdf" print_settings = PrintSetting.all @@ -110,7 +108,6 @@ class Api::PaymentsController < Api::ApiController end #orders print out - # if type == "quick_service" booking = Booking.find_by_sale_id(sale_id) if booking.dining_facility_id.to_i>0 table_id = booking.dining_facility_id @@ -133,7 +130,6 @@ class Api::PaymentsController < Api::ApiController ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from end - # end #for card sale data card_data = Array.new diff --git a/app/controllers/foodcourt/addorders_controller.rb b/app/controllers/foodcourt/addorders_controller.rb index 7abbdd90..2ebea143 100755 --- a/app/controllers/foodcourt/addorders_controller.rb +++ b/app/controllers/foodcourt/addorders_controller.rb @@ -25,7 +25,6 @@ class Foodcourt::AddordersController < BaseFoodcourtController else @display_type = nil end - # if params[:menu] == "true" @menus = [] @menu = [] diff --git a/app/controllers/foodcourt/cash_ins_controller.rb b/app/controllers/foodcourt/cash_ins_controller.rb index 7245ffa7..000dc420 100755 --- a/app/controllers/foodcourt/cash_ins_controller.rb +++ b/app/controllers/foodcourt/cash_ins_controller.rb @@ -15,7 +15,7 @@ class Foodcourt::CashInsController < BaseFoodcourtController p_jour.cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user) shift = ShiftSale.current_open_shift(current_user) - current_shift = ShiftSale.current_shift(Shop.current_shopshop_code) + current_shift = ShiftSale.current_shift(Shop.current_shop.shop_code) # set cashier if shift != nil shift = shift @@ -36,7 +36,6 @@ class Foodcourt::CashInsController < BaseFoodcourtController shift =current_shift end end - puts shift.to_json shift.cash_in = shift.cash_in + amount.to_f shift.save end diff --git a/app/controllers/foodcourt/orders_controller.rb b/app/controllers/foodcourt/orders_controller.rb index 7af39af0..3b3c4075 100755 --- a/app/controllers/foodcourt/orders_controller.rb +++ b/app/controllers/foodcourt/orders_controller.rb @@ -60,18 +60,17 @@ class Foodcourt::OrdersController < BaseFoodcourtController .joins("JOIN orders ON orders.order_id=booking_orders.order_id") .joins("JOIN customers ON orders.customer_id=customers.customer_id") .where("orders.source='app' and bookings.booking_id='#{params[:booking_id]}'").first - @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) + @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 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}' and DATE(bookings.created_at) = '#{Date.today}'").order("bookings.created_at desc").uniq + .where("orders.source='app' and bookings.shop_code=? and DATE(bookings.created_at)=?",Shop.current_shop.shop_code,Date.today).order("bookings.created_at desc").uniq end def completed customer =Customer.find_by_customer_id(params[:customer_id]) diff --git a/app/views/api/orders/view_orders.json.jbuilder b/app/views/api/orders/view_orders.json.jbuilder index ce8eac1d..4a396050 100755 --- a/app/views/api/orders/view_orders.json.jbuilder +++ b/app/views/api/orders/view_orders.json.jbuilder @@ -20,7 +20,7 @@ if (@booking) @total_tax = 0.00 # For YGN BBQ - adult_count = 0 + adult_count = 0 child_count = 0 adult_spent = 0 child_spent = 0 @@ -33,18 +33,18 @@ if (@booking) if (order.status == "new") order_items = order_items + order.order_items end - end + end json.order_items order_items do |item| total_set_menu = 0 # For YGN BBQ if item.item_code.include? ("PSA_") - adult_count += item.qty - adult_spent += (item.price * item.qty) + adult_count += item.qty + adult_spent += (item.price * item.qty) end if item.item_code.include? ("PSC_") child_count += item.qty - child_spent += (item.price * item.qty) + child_spent += (item.price * item.qty) end # End YGN BBQ @@ -115,7 +115,7 @@ if (@booking) end @total_tax_amount = @service_charges + @commercial_tax end - + #total tax calculation json.sub_total @total_amount if @service_rate.to_i > 0 diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 7009f08f..715140e1 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -21,11 +21,11 @@ class ActionController::Base end else # check for license file - # if check_license - # current_license(ENV["SX_PROVISION_URL"]) - # else - # redirect_to activate_path - # end + if check_license + current_license(ENV["SX_PROVISION_URL"]) + else + redirect_to activate_path + end end end diff --git a/config/puma.rb b/config/puma.rb index f0013d25..d24425ae 100755 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,11 +1,11 @@ -# application_path="#{File.expand_path("../..", __FILE__)}" -# directory application_path -# #environment ENV.fetch("RAILS_ENV") { "production" } -# environment "production" -# pidfile "#{application_path}/tmp/puma/pid" -# state_path "#{application_path}/tmp/puma/state" -# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" -# port ENV.fetch("PORT") { 62158 } -# workers 2 -# preload_app! -# threads 1,1 +application_path="#{File.expand_path("../..", __FILE__)}" +directory application_path +#environment ENV.fetch("RAILS_ENV") { "production" } +environment "production" +pidfile "#{application_path}/tmp/puma/pid" +state_path "#{application_path}/tmp/puma/state" +stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" +port ENV.fetch("PORT") { 62158 } +workers 2 +preload_app! +threads 1,1 diff --git a/server2.pid b/server2.pid index 489250e3..af5a5b0b 100644 --- a/server2.pid +++ b/server2.pid @@ -1 +1 @@ -3072 \ No newline at end of file +8746 \ No newline at end of file