From ca98efc756715e1925dd4af7cf920e8f837fc9b3 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 16 Jan 2018 10:15:28 +0630 Subject: [PATCH 01/12] change checkout time and checkout alert time process --- README.md | 36 ++++++++++++++++--- .../api/check_in_process_controller.rb | 25 +++++++------ .../origami/check_in_process_controller.rb | 12 ++++--- app/models/dining_facility.rb | 24 ++++++++----- 4 files changed, 70 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 5be96143..ec64ef45 100755 --- a/README.md +++ b/README.md @@ -36,11 +36,12 @@ java -jar ~/Documents/Jade.jar http://192.168.1.88:3002 Person and Extra Time category_code = SPL... //for menu categories -Extra Time - instance_code = Extim30, Extim60 //for morning menu - instance_code = Extie30, Extie60 //for evening menu +For Extra Time + item_instance_code + * must start with 'Ext'[a..z]'_'[1..100] + * note : don't add character after '_' -Order Item & Order Summary Slim +For Order Item & Order Summary Slim *** change OrderItemPdf to OrderItemSlimPdf and OrderSummaryPdf to OrderSummarySlimPdf 1) settings/print_settings 2) app/controllers/oqs/edit_controller.rb @@ -53,6 +54,33 @@ For Bank Integration setting 1) rake db:migrate for card_sale_trans, card_settle_trans 2) settings/lookups => { type:bank_integration, name: Bank Integration, value:1 } +For checkout time and checkout alert time + 1) checkout time => { type: checkout_time, name: 9:00AM - 12:00 PM, value: 120 } + 2) checkout alert time => { type: checkout_alert_time, name: 8:00AM - 12:00 PM, value: 60 } + * you can add multiple record for checkout time and checkout alert time + * type must be 'checkout_time' and 'checkout_alert_time' + * you can change name and value + * name must be time range [8:30 AM - 1:45 PM] + * value must be minutes[60] + +For call waiter pdf + * Backend > Printer > Print Settings > New + i) Name : Calling Waiter + ii) Unique Code: CallWaiterPdf + iii)Template: ... + iv) Font: Zawgyi-One + v) Printer: #printer name + +Membership Actions SQL + * update membership_actions set additional_parameter='{\"campaign_type_id\":5}' where id=10; + +SQL Update after rake clear:data runned + * update seed_generators + i) TableBooking, Order, OrderItem, sale, SaleOrder, SaleItem, SaleTax, SalePayment, SaleAudit, AssignedOrderItem => { current:0, next:0 } + ** Note :: do not update Customer + + + * ToDo list 1. Cloud Sync diff --git a/app/controllers/api/check_in_process_controller.rb b/app/controllers/api/check_in_process_controller.rb index ac43bfd9..7ad00d67 100644 --- a/app/controllers/api/check_in_process_controller.rb +++ b/app/controllers/api/check_in_process_controller.rb @@ -16,11 +16,15 @@ class Api::CheckInProcessController < Api::ApiController lookup_checkout_time = Lookup.collection_of("checkout_alert_time") alert_time_min = 0 if !lookup_checkout_time.nil? - if lookup_checkout_time[0][0] == 'min' - alert_time_min = (lookup_checkout_time[0][1]).to_i - else - alert_time_min = 15 - end + now = Time.now.utc + lookup_checkout_time.each do |checkout_time| + arr_time = checkout_time[0].split("-") + start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p") + end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p") + if start_time <= now && now <= end_time + alert_time_min = checkout_time[1].to_i + end + end end render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min, :extra_minutes => extra_minutes } @@ -39,11 +43,12 @@ class Api::CheckInProcessController < Api::ApiController if !lookup_checkout_time.empty? checkout_at = Time.now.utc - if !lookup_checkout_time.nil? - if lookup_checkout_time[0][0] == 'hr' - checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour - else - checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes + lookup_checkout_time.each do |checkout_time| + arr_time = checkout_time[0].split("-") + start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p") + end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p") + if start_time <= checkout_at && checkout_at <= end_time + checkout_at = checkout_at + (checkout_time[1]).to_i.minutes end end diff --git a/app/controllers/origami/check_in_process_controller.rb b/app/controllers/origami/check_in_process_controller.rb index 37f58d8f..40a28398 100644 --- a/app/controllers/origami/check_in_process_controller.rb +++ b/app/controllers/origami/check_in_process_controller.rb @@ -3,12 +3,14 @@ class Origami::CheckInProcessController < BaseOrigamiController def check_in_process lookup_checkout_time = Lookup.collection_of("checkout_time") checkout_at = Time.now.utc - if !lookup_checkout_time.nil? - if lookup_checkout_time[0][0] == 'hr' - checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour - else - checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes + lookup_checkout_time.each do |checkout_time| + arr_time = checkout_time[0].split("-") + start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p") + end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p") + if start_time <= checkout_at && checkout_at <= end_time + checkout_at = checkout_at + (checkout_time[1]).to_i.minutes + end end end @dining_facility = DiningFacility.find(params[:dining_id]) diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb index bd6f3436..1feab5d9 100755 --- a/app/models/dining_facility.rb +++ b/app/models/dining_facility.rb @@ -81,10 +81,14 @@ class DiningFacility < ApplicationRecord lookup_checkout_time = Lookup.collection_of("checkout_alert_time") free_time_min = 0 if !lookup_checkout_time.nil? - if lookup_checkout_time[0][0] == 'min' - free_time_min = (lookup_checkout_time[0][1]).to_i - else - free_time_min = 15 + now = Time.now.utc + lookup_checkout_time.each do |checkout_time| + arr_time = checkout_time[0].split("-") + start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p") + end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p") + if start_time <= now && now <= end_time + free_time_min = checkout_time[1].to_i + end end end @@ -116,10 +120,14 @@ class DiningFacility < ApplicationRecord lookup_checkout_time = Lookup.collection_of("checkout_alert_time") free_time_min = 0 if !lookup_checkout_time.nil? - if lookup_checkout_time[0][0] == 'min' - free_time_min = (lookup_checkout_time[0][1]).to_i - else - free_time_min = 15 + now = Time.now.utc + lookup_checkout_time.each do |checkout_time| + arr_time = checkout_time[0].split("-") + start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p") + end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p") + if start_time <= now && now <= end_time + free_time_min = checkout_time[1].to_i + end end end From 2703c3c37a8614afe840fe62780a637e17faf216 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 16 Jan 2018 11:39:37 +0630 Subject: [PATCH 02/12] add printer lists of system --- app/models/printer/printer_worker.rb | 4 ++-- app/views/print_settings/_form.html.erb | 2 +- app/views/settings/cashier_terminals/_form.html.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/printer/printer_worker.rb b/app/models/printer/printer_worker.rb index ad844cfe..c0485187 100755 --- a/app/models/printer/printer_worker.rb +++ b/app/models/printer/printer_worker.rb @@ -24,11 +24,11 @@ class Printer::PrinterWorker end end - def printers() + def self.printers() Cups.show_destinations end - def default_printer() + def self.default_printer() Cups.default_printer end diff --git a/app/views/print_settings/_form.html.erb b/app/views/print_settings/_form.html.erb index 38e55330..b8804dcc 100755 --- a/app/views/print_settings/_form.html.erb +++ b/app/views/print_settings/_form.html.erb @@ -11,7 +11,7 @@ <%= f.input :unique_code %> <%= f.input :template %> <%= f.input :font %> - <%= f.input :printer_name %> + <%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %> <%= f.input :api_settings %> <%= f.input :page_width %> <%= f.input :page_height %> diff --git a/app/views/settings/cashier_terminals/_form.html.erb b/app/views/settings/cashier_terminals/_form.html.erb index cb4014dd..d5693561 100755 --- a/app/views/settings/cashier_terminals/_form.html.erb +++ b/app/views/settings/cashier_terminals/_form.html.erb @@ -12,7 +12,7 @@ <%= f.input :auto_print_receipt %> <%= f.label "Select Zones", :class => 'control-label' %> <%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'checkbox form-group'%> - <%= f.input :printer_name %> + <%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %> <%= f.input :font %> <%= f.input :font_size %> <%= f.input :show_tax %> From 468914fb3c4b3da8c6363b7be892b97ac26292df Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 16 Jan 2018 11:44:21 +0630 Subject: [PATCH 03/12] add printer lists in settings/oqs --- app/views/settings/order_queue_stations/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/settings/order_queue_stations/_form.html.erb b/app/views/settings/order_queue_stations/_form.html.erb index 86ca2237..0ffa8f9a 100755 --- a/app/views/settings/order_queue_stations/_form.html.erb +++ b/app/views/settings/order_queue_stations/_form.html.erb @@ -16,7 +16,7 @@ div.form-inputs span{ <%= f.input :station_name %> <%= f.input :is_active %> - <%= f.input :printer_name %> + <%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %> <%= f.input :print_copy %> <%= f.hidden_field :processing_items %> From 2837e4dd405c3d1dd4ddb47b84a4e29952065aff Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 16 Jan 2018 13:22:58 +0630 Subject: [PATCH 04/12] check booking in movetable --- app/views/origami/movetable/move_dining.html.erb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/views/origami/movetable/move_dining.html.erb b/app/views/origami/movetable/move_dining.html.erb index 01be4bb3..131407f0 100755 --- a/app/views/origami/movetable/move_dining.html.erb +++ b/app/views/origami/movetable/move_dining.html.erb @@ -94,11 +94,13 @@ <% else %>
<% end %> - ORDER DETAILS | Table <%= @dining.name rescue "" %> - <% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %> - <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> - <% else %> - Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> + <% if !@booking.nil? %> + ORDER DETAILS | Table <%= @dining.name rescue "" %> + <% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %> + <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> + <% else %> + Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> + <% end %> <% end %>
<% elsif @status_sale == 'sale' %> @@ -149,10 +151,10 @@
- <% if @status_sale == 'sale' %> + <% if @status_sale == 'sale' && !@sale_array.empty? %>   Customer : <%= @sale_array[0].customer.name rescue '' %> - <% elsif @status_order == 'order' + <% elsif @status_order == 'order' && !@customer.nil? %>   Customer : <%= @customer.name rescue "" %> From 7c6fedebe9786f0e2b7d5e8cb0f13123e71aae24 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 16 Jan 2018 13:33:29 +0630 Subject: [PATCH 05/12] update open print service --- app/controllers/oqs/edit_controller.rb | 20 +++--- app/controllers/oqs/print_controller.rb | 94 +++++++++++++------------ app/models/order_queue_station.rb | 68 ++++++++++-------- 3 files changed, 99 insertions(+), 83 deletions(-) diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index 368255e5..0130d823 100755 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -16,15 +16,17 @@ class Oqs::EditController < BaseOqsController order_item.remark = remarks order_item.save - # print - # assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code) - # # order queue stations - # oqs = assigned_item.order_queue_station - - # unique_code="OrderItemPdf" + if ENV["SERVER_MODE"] != "cloud" #no print in cloud server + # print + assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code) + # order queue stations + oqs = assigned_item.order_queue_station + + unique_code="OrderItemPdf" - # print_settings=PrintSetting.find_by_unique_code(unique_code) - # order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) - # order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" ) + print_settings=PrintSetting.find_by_unique_code(unique_code) + order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) + order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" ) + end end end diff --git a/app/controllers/oqs/print_controller.rb b/app/controllers/oqs/print_controller.rb index cc5556e9..1ae8ee04 100755 --- a/app/controllers/oqs/print_controller.rb +++ b/app/controllers/oqs/print_controller.rb @@ -1,61 +1,65 @@ class Oqs::PrintController < ApplicationController # Print Order Item def print - # unique_code="OrderItemPdf" - # assigned_item_id = params[:id] - # options = params[:options] - # assigned_item = AssignedOrderItem.find(assigned_item_id) - # assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); + if ENV["SERVER_MODE"] != "cloud" #no print in cloud server + unique_code="OrderItemPdf" + assigned_item_id = params[:id] + options = params[:options] + assigned_item = AssignedOrderItem.find(assigned_item_id) + assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); - # # order queue stations - # oqs = assigned_item.order_queue_station - # order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first() + # order queue stations + oqs = assigned_item.order_queue_station + order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first() - # # Check Printed - # print_status = assigned_item.print_status == true ? " (Re-Print)" : "" + # Check Printed + print_status = assigned_item.print_status == true ? " (Re-Print)" : "" - # # print when complete click - # print_settings = PrintSetting.find_by_unique_code(unique_code) - # order_queue_printer = Printer::OrderQueuePrinter.new(print_settings) - # order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options ) - - # # update print status for completed same order items - # assigned_items.each do |ai| - # ai.print_status=true - # ai.save - # end + # print when complete click + print_settings = PrintSetting.find_by_unique_code(unique_code) + order_queue_printer = Printer::OrderQueuePrinter.new(print_settings) + order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options ) + + # update print status for completed same order items + assigned_items.each do |ai| + ai.print_status=true + ai.save + end + end end # Print Order Details with booking id def print_order_summary - # unique_code="OrderSummaryPdf" - # assigned_item_id = params[:id] - # table_name = params[:table_name] - # assigned_item = AssignedOrderItem.find(assigned_item_id) - # assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); + if ENV["SERVER_MODE"] != "cloud" #no print in cloud server + unique_code="OrderSummaryPdf" + assigned_item_id = params[:id] + table_name = params[:table_name] + assigned_item = AssignedOrderItem.find(assigned_item_id) + assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); - # # order queue stations - # oqs = assigned_item.order_queue_station + # order queue stations + oqs = assigned_item.order_queue_station - # # Check Printed - # print_status = assigned_item.print_status == true ? " (Re-Print)" : "" + # Check Printed + print_status = assigned_item.print_status == true ? " (Re-Print)" : "" - # # get dining - # # dining = DiningFacility.find_by_name(table_name); - # # booking = Booking.find_by_dining_facility_id(dining.id) + # get dining + # dining = DiningFacility.find_by_name(table_name); + # booking = Booking.find_by_dining_facility_id(dining.id) - # # Get Booking ID - # booking_id = BookingOrder.where("order_id='#{assigned_item.order_id}'").pluck(:booking_id)[0] - - # # print when complete click - # print_settings = PrintSetting.find_by_unique_code(unique_code) - # order_queue_printer = Printer::OrderQueuePrinter.new(print_settings) - # order_queue_printer.print_booking_summary(print_settings,oqs, booking_id, print_status) + # Get Booking ID + booking_id = BookingOrder.where("order_id='#{assigned_item.order_id}'").pluck(:booking_id)[0] + + # print when complete click + print_settings = PrintSetting.find_by_unique_code(unique_code) + order_queue_printer = Printer::OrderQueuePrinter.new(print_settings) + order_queue_printer.print_booking_summary(print_settings,oqs, booking_id, print_status) - # # update print status for completed same order items - # assigned_items.each do |ai| - # ai.print_status = true - # ai.save - # end + # update print status for completed same order items + assigned_items.each do |ai| + ai.print_status = true + ai.save + end + end end -end +end \ No newline at end of file diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 8b1d6d7d..7b6b7eac 100755 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -14,6 +14,7 @@ class OrderQueueStation < ApplicationRecord validates_presence_of :station_name, :printer_name def process_order (order, table_id) + oqs_stations = OrderQueueStation.active dining=DiningFacility.find(table_id) # oqpbz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id) @@ -77,14 +78,23 @@ class OrderQueueStation < ApplicationRecord end end end - - # if oqs.auto_print - # if oqs_order_items.length > 0 - # print_slip(oqs, order, oqs_order_items) - # is_auto_printed = true - # end - # end - end + + if oqs.auto_print + if oqs_order_items.length > 0 + print_slip(oqs, order, oqs_order_items) + is_auto_printed = true + end + end + end + # if oqs.id == oqpbz.order_queue_station_id + # # Auto Printing + # if oqs.auto_print + # if oqs_order_items.length > 0 + # print_slip(oqs, order, oqs_order_items) + # is_auto_printed = true + # end + # end + # end end # end end @@ -92,32 +102,32 @@ class OrderQueueStation < ApplicationRecord private #Print order_items in 1 slip def print_slip(oqs, order, order_items) - # unique_code="OrderSummaryPdf" - - # print_settings=PrintSetting.find_by_unique_code(unique_code) - # order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) - # order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="") + unique_code="OrderSummaryPdf" + print_settings=PrintSetting.find_by_unique_code(unique_code) + order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) + order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="") - # AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai| - # # update print status for order items - # ai.print_status=true - # ai.save - # end + AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai| + # update print status for order items + ai.print_status=true + ai.save + end + end #Print order_item in 1 slip per item def print_slip_item(oqs, assigned_item) - # unique_code="OrderItemPdf" - # order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first() - # # print when complete click - # print_settings=PrintSetting.find_by_unique_code(unique_code) - # order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) - # order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" ) + unique_code="OrderItemPdf" + order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first() + # print when complete click + print_settings=PrintSetting.find_by_unique_code(unique_code) + order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) + order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" ) - # # update print status for completed same order items - # assigned_order_item.each do |ai| - # ai.print_status=true - # ai.save - # end + # update print status for completed same order items + assigned_order_item.each do |ai| + ai.print_status=true + ai.save + end end end From f2daaae8018c6d9c8511ac4b52a5d0634ec3289e Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 16 Jan 2018 14:13:01 +0630 Subject: [PATCH 06/12] update control payment multiple --- app/models/order_queue_station.rb | 2 +- app/views/origami/payments/show.html.erb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 7b6b7eac..ae6c877e 100755 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -78,7 +78,7 @@ class OrderQueueStation < ApplicationRecord end end end - + if oqs.auto_print if oqs_order_items.length > 0 print_slip(oqs, order, oqs_order_items) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 97c4d216..ff155525 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -316,14 +316,15 @@ if ($("#server_mode").val() != "cloud") { // first bill not used in cloud if (member_id && member_discount) { + if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){ $("#credit_payment").hide(); } else{ $("#credit_payment").show(); } - if(parseInt(jQuery.inArray("MPU", payment_type)) > 0 || parseInt(jQuery.inArray("VISA", payment_type)) > 0 || parseInt(jQuery.inArray("JCB", payment_type)) > 0 || parseInt(jQuery.inArray("Master", payment_type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) > 0 || parseInt(jQuery.inArray("Redeem", payment_type)) > 0){ - $("#card_payment").show(); + if(parseInt(jQuery.inArray("MPU", payment_type)) !=-1 || parseInt(jQuery.inArray("VISA", payment_type)) !=-1 || parseInt(jQuery.inArray("JCB", payment_type)) !=-1 || parseInt(jQuery.inArray("Master", payment_type)) !=-1 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Redeem", payment_type)) !=-1){ + $("#card_payment").show(); } else{ $("#card_payment").hide(); } From 5a5f47c94679e37140f52991cb62c19cc6b43598 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 16 Jan 2018 14:21:50 +0630 Subject: [PATCH 07/12] add order_slim_pdf in settings/lookups and change order_slim_pdf --- README.md | 13 +++-- app/controllers/oqs/edit_controller.rb | 9 +++- app/controllers/oqs/print_controller.rb | 14 ++++++ app/models/order_queue_station.rb | 18 ++++++- app/models/printer/order_queue_printer.rb | 58 ++++++++++++++++++++--- app/models/printer/receipt_printer.rb | 36 ++++++++++++++ 6 files changed, 134 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index ec64ef45..ec82b44a 100755 --- a/README.md +++ b/README.md @@ -44,11 +44,14 @@ For Extra Time For Order Item & Order Summary Slim *** change OrderItemPdf to OrderItemSlimPdf and OrderSummaryPdf to OrderSummarySlimPdf 1) settings/print_settings - 2) app/controllers/oqs/edit_controller.rb - 3) app/controllers/oqs/print_controller.rb - 4) app/models/order_queue_station.rb - 5) app/models/printer/order_queue_printer.rb - 6) app/models/printer/receipt_printer.rb + 2) settings/lookups => { type:order_slim_pdf, name:OrderSlimPdf, value:1 } + * no need to change these page + { app/controllers/oqs/edit_controller.rb + app/controllers/oqs/print_controller.rb + app/models/order_queue_station.rb + app/models/printer/order_queue_printer.rb + app/models/printer/receipt_printer.rb + } For Bank Integration setting 1) rake db:migrate for card_sale_trans, card_settle_trans diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index 0130d823..08ce6709 100755 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -21,8 +21,15 @@ class Oqs::EditController < BaseOqsController assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code) # order queue stations oqs = assigned_item.order_queue_station + + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf - unique_code="OrderItemPdf" + unique_code="OrderItemPdf" + if !order_slim_pdf.nil? + if order_slim_pdf[0][1] == '1' + unique_code="OrderItemSlimPdf" + end + end print_settings=PrintSetting.find_by_unique_code(unique_code) order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) diff --git a/app/controllers/oqs/print_controller.rb b/app/controllers/oqs/print_controller.rb index 1ae8ee04..6f3afbd5 100755 --- a/app/controllers/oqs/print_controller.rb +++ b/app/controllers/oqs/print_controller.rb @@ -2,7 +2,14 @@ class Oqs::PrintController < ApplicationController # Print Order Item def print if ENV["SERVER_MODE"] != "cloud" #no print in cloud server + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf unique_code="OrderItemPdf" + if !order_slim_pdf.nil? + if order_slim_pdf[0][1] == '1' + unique_code="OrderItemSlimPdf" + end + end + assigned_item_id = params[:id] options = params[:options] assigned_item = AssignedOrderItem.find(assigned_item_id) @@ -31,7 +38,14 @@ class Oqs::PrintController < ApplicationController # Print Order Details with booking id def print_order_summary if ENV["SERVER_MODE"] != "cloud" #no print in cloud server + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf unique_code="OrderSummaryPdf" + if !order_slim_pdf.nil? + if order_slim_pdf[0][1] == '1' + unique_code="OrderSummarySlimPdf" + end + end + assigned_item_id = params[:id] table_name = params[:table_name] assigned_item = AssignedOrderItem.find(assigned_item_id) diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 7b6b7eac..fee3f9ea 100755 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -101,8 +101,15 @@ class OrderQueueStation < ApplicationRecord private #Print order_items in 1 slip - def print_slip(oqs, order, order_items) + def print_slip(oqs, order, order_items) + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf unique_code="OrderSummaryPdf" + if !order_slim_pdf.nil? + if order_slim_pdf[0][1] == '1' + unique_code="OrderSummarySlimPdf" + end + end + print_settings=PrintSetting.find_by_unique_code(unique_code) order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="") @@ -117,7 +124,14 @@ class OrderQueueStation < ApplicationRecord #Print order_item in 1 slip per item def print_slip_item(oqs, assigned_item) - unique_code="OrderItemPdf" + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf + unique_code="OrderItemPdf" + if !order_slim_pdf.nil? + if order_slim_pdf[0][1] == '1' + unique_code="OrderItemSlimPdf" + end + end + order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first() # print when complete click print_settings=PrintSetting.find_by_unique_code(unique_code) diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index cc08f9ba..4a6dd0ed 100755 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -14,9 +14,19 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf" + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf + # check for item not to show # if order_item[0].price != 0 - pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name) + if !order_slim_pdf.nil? + if order_slim_pdf[0][1] == '1' + pdf = OrderItemSlimPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name) + else + pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name) + end + else + pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name) + end pdf.render_file filename if oqs.print_copy @@ -43,6 +53,8 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker print_settings.save! end + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf + order=print_query('order_summary', order_id) # For Print Per Item if oqs.cut_per_item @@ -55,7 +67,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker # check for item not to show #if odi.price != 0 - pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name) + if !order_slim_pdf.nil? + if order_slim_pdf[0][1] == '1' + pdf = OrderItemSlimPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name) + else + pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name) + end + else + pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name) + end # pdf.render_file "tmp/order_item.pdf" pdf.render_file filename if oqs.print_copy @@ -71,7 +91,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker # For Print Order Summary else filename = "tmp/order_summary_#{order_id}" + ".pdf" - pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name) + if !order_slim_pdf.nil? + if order_slim_pdf[0][1] == '1' + pdf = OrderSummarySlimPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name) + else + pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name) + end + else + pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name) + end pdf.render_file filename if oqs.print_copy self.print(filename, oqs.printer_name) @@ -94,6 +122,8 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker print_settings.save! end + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf + order=print_query('booking_summary', booking_id) # For Print Per Item if oqs.cut_per_item @@ -104,7 +134,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker # check for item not to show #if odi.price != 0 - pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name) + if !order_slim_pdf.nil? + if order_slim_pdf[0][1] == '1' + pdf = OrderItemSlimPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name) + else + pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name) + end + else + pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name) + end pdf.render_file filename if oqs.print_copy @@ -122,8 +160,16 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker end # For Print Order Summary else - filename = "tmp/booking_summary_#{booking_id}" + ".pdf" - pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name) + filename = "tmp/booking_summary_#{booking_id}" + ".pdf" + if !order_slim_pdf.nil? + if order_slim_pdf[0][1] == '1' + pdf = OrderSummarySlimPdf.new(print_settings,order, print_status,oqs.use_alternate_name) + else + pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name) + end + else + pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name) + end pdf.render_file filename if oqs.print_copy self.print(filename, oqs.printer_name) diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb index ed4fad91..ec7ad601 100755 --- a/app/models/printer/receipt_printer.rb +++ b/app/models/printer/receipt_printer.rb @@ -4,7 +4,13 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker #Use CUPS service #Generate PDF #Print + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf pdf = OrderItemPdf.new + if !order_slim_pdf.nil? + if order_slim_pdf[0][1] == '1' + pdf = OrderItemSlimPdf.new + end + end pdf.render_file "tmp/order_item_queue_#{order_id}_#{order_item_id}" + ".pdf" self.print("tmp/receipt.pdf") end @@ -14,7 +20,13 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker #Generate PDF #Print filename = "tmp/order_summary_#{booking_id}" + ".pdf" + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf pdf = OrderSummaryPdf.new + if !order_slim_pdf.nil? + if order_slim_pdf[1] == '1' + pdf = OrderSummarySlimPdf.new + end + end pdf.render_file filename self.print(filename) @@ -24,8 +36,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker #Use CUPS service #Generate PDF #Print + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf filename = "tmp/order_summary_#{booking_id}" + ".pdf" pdf = OrderSummaryPdf.new + if !order_slim_pdf.nil? + if order_slim_pdf[1] == '1' + pdf = OrderSummarySlimPdf.new + end + end pdf.render_file filename self.print(filename) @@ -35,8 +53,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker #Use CUPS service #Generate PDF #Print + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf filename = "tmp/order_summary_#{booking_id}" + ".pdf" pdf = OrderSummaryPdf.new + if !order_slim_pdf.nil? + if order_slim_pdf[1] == '1' + pdf = OrderSummarySlimPdf.new + end + end pdf.render_file filename self.print(filename) @@ -46,8 +70,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker #Use CUPS service #Generate PDF #Print + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf filename = "tmp/order_summary_#{booking_id}" + ".pdf" pdf = OrderSummaryPdf.new + if !order_slim_pdf.nil? + if order_slim_pdf[1] == '1' + pdf = OrderSummarySlimPdf.new + end + end pdf.render_file filename self.print(filename) @@ -57,8 +87,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker #Use CUPS service #Generate PDF #Print + order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf filename = "tmp/order_summary_#{booking_id}" + ".pdf" pdf = OrderSummaryPdf.new + if !order_slim_pdf.nil? + if order_slim_pdf[1] == '1' + pdf = OrderSummarySlimPdf.new + end + end pdf.render_file filename self.print(filename) From 7fadeeed2e57319a3844b7f975b44adafb37ad9b Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 16 Jan 2018 14:32:24 +0630 Subject: [PATCH 08/12] update suppervisor ability and room & table first bill --- app/models/ability.rb | 1 + app/views/origami/home/show.html.erb | 2 +- app/views/origami/rooms/show.html.erb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index d3082a1b..8877fc61 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -165,6 +165,7 @@ class Ability can :create, :discount can :remove_discount_items, :discount can :remove_all_discount, :discount + can :member_discount, :discount can :manage, Customer can :manage, DiningQueue diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 372efa83..91f25ad2 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -605,7 +605,7 @@ var sale_id = $('#sale_id').val(); type = $('.payment_method').val(); if(parseInt(jQuery.inArray("Credit", type)) == -1){ - if (parseInt(jQuery.inArray("MPU", type)) > 0 || parseInt(jQuery.inArray("VISA", type)) > 0 || parseInt(jQuery.inArray("JCB", type)) > 0 || parseInt(jQuery.inArray("Master", type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", type)) > 0 || parseInt(jQuery.inArray("Redeem", type)) > 0) { + if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) { calculate_member_discount(sale_id,"Card"); }else{ diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 00350f1b..af581777 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -608,7 +608,7 @@ $(".choose_payment").on('click', function () { var sale_id = $('#sale_id').val(); type = $('.payment_method').val(); if(parseInt(jQuery.inArray("Credit", type)) == -1){ - if (parseInt(jQuery.inArray("MPU", type)) > 0 || parseInt(jQuery.inArray("VISA", type)) > 0 || parseInt(jQuery.inArray("JCB", type)) > 0 || parseInt(jQuery.inArray("Master", type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", type)) > 0 || parseInt(jQuery.inArray("Redeem", type)) > 0) { + if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) { calculate_member_discount(sale_id,"Card"); }else{ From d8c62b0d44bab8f954f570c6f30584f2caf1e285 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 16 Jan 2018 14:55:33 +0630 Subject: [PATCH 09/12] change and check order_slim_pdf --- app/controllers/oqs/edit_controller.rb | 2 +- app/controllers/oqs/print_controller.rb | 5 +++-- app/models/order_queue_station.rb | 4 ++-- app/models/printer/order_queue_printer.rb | 10 +++++----- app/models/printer/receipt_printer.rb | 22 +++++++++++----------- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index 08ce6709..53a6bf53 100755 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -25,7 +25,7 @@ class Oqs::EditController < BaseOqsController order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf unique_code="OrderItemPdf" - if !order_slim_pdf.nil? + if !order_slim_pdf.empty? if order_slim_pdf[0][1] == '1' unique_code="OrderItemSlimPdf" end diff --git a/app/controllers/oqs/print_controller.rb b/app/controllers/oqs/print_controller.rb index 6f3afbd5..2007934c 100755 --- a/app/controllers/oqs/print_controller.rb +++ b/app/controllers/oqs/print_controller.rb @@ -4,7 +4,8 @@ class Oqs::PrintController < ApplicationController if ENV["SERVER_MODE"] != "cloud" #no print in cloud server order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf unique_code="OrderItemPdf" - if !order_slim_pdf.nil? + + if !order_slim_pdf.empty? if order_slim_pdf[0][1] == '1' unique_code="OrderItemSlimPdf" end @@ -40,7 +41,7 @@ class Oqs::PrintController < ApplicationController if ENV["SERVER_MODE"] != "cloud" #no print in cloud server order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf unique_code="OrderSummaryPdf" - if !order_slim_pdf.nil? + if !order_slim_pdf.empty? if order_slim_pdf[0][1] == '1' unique_code="OrderSummarySlimPdf" end diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index fee3f9ea..6f2fb04c 100755 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -104,7 +104,7 @@ class OrderQueueStation < ApplicationRecord def print_slip(oqs, order, order_items) order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf unique_code="OrderSummaryPdf" - if !order_slim_pdf.nil? + if !order_slim_pdf.empty? if order_slim_pdf[0][1] == '1' unique_code="OrderSummarySlimPdf" end @@ -126,7 +126,7 @@ class OrderQueueStation < ApplicationRecord def print_slip_item(oqs, assigned_item) order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf unique_code="OrderItemPdf" - if !order_slim_pdf.nil? + if !order_slim_pdf.empty? if order_slim_pdf[0][1] == '1' unique_code="OrderItemSlimPdf" end diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index 4a6dd0ed..3bd2df4c 100755 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -18,7 +18,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker # check for item not to show # if order_item[0].price != 0 - if !order_slim_pdf.nil? + if !order_slim_pdf.empty? if order_slim_pdf[0][1] == '1' pdf = OrderItemSlimPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name) else @@ -67,7 +67,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker # check for item not to show #if odi.price != 0 - if !order_slim_pdf.nil? + if !order_slim_pdf.empty? if order_slim_pdf[0][1] == '1' pdf = OrderItemSlimPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name) else @@ -91,7 +91,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker # For Print Order Summary else filename = "tmp/order_summary_#{order_id}" + ".pdf" - if !order_slim_pdf.nil? + if !order_slim_pdf.empty? if order_slim_pdf[0][1] == '1' pdf = OrderSummarySlimPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name) else @@ -134,7 +134,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker # check for item not to show #if odi.price != 0 - if !order_slim_pdf.nil? + if !order_slim_pdf.empty? if order_slim_pdf[0][1] == '1' pdf = OrderItemSlimPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name) else @@ -161,7 +161,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker # For Print Order Summary else filename = "tmp/booking_summary_#{booking_id}" + ".pdf" - if !order_slim_pdf.nil? + if !order_slim_pdf.empty? if order_slim_pdf[0][1] == '1' pdf = OrderSummarySlimPdf.new(print_settings,order, print_status,oqs.use_alternate_name) else diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb index ec7ad601..a1375204 100755 --- a/app/models/printer/receipt_printer.rb +++ b/app/models/printer/receipt_printer.rb @@ -6,7 +6,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker #Print order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf pdf = OrderItemPdf.new - if !order_slim_pdf.nil? + if !order_slim_pdf.empty? if order_slim_pdf[0][1] == '1' pdf = OrderItemSlimPdf.new end @@ -22,8 +22,8 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker filename = "tmp/order_summary_#{booking_id}" + ".pdf" order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf pdf = OrderSummaryPdf.new - if !order_slim_pdf.nil? - if order_slim_pdf[1] == '1' + if !order_slim_pdf.empty? + if order_slim_pdf[0][1] == '1' pdf = OrderSummarySlimPdf.new end end @@ -39,8 +39,8 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf filename = "tmp/order_summary_#{booking_id}" + ".pdf" pdf = OrderSummaryPdf.new - if !order_slim_pdf.nil? - if order_slim_pdf[1] == '1' + if !order_slim_pdf.empty? + if order_slim_pdf[0][1] == '1' pdf = OrderSummarySlimPdf.new end end @@ -56,8 +56,8 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf filename = "tmp/order_summary_#{booking_id}" + ".pdf" pdf = OrderSummaryPdf.new - if !order_slim_pdf.nil? - if order_slim_pdf[1] == '1' + if !order_slim_pdf.empty? + if order_slim_pdf[0][1] == '1' pdf = OrderSummarySlimPdf.new end end @@ -73,8 +73,8 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf filename = "tmp/order_summary_#{booking_id}" + ".pdf" pdf = OrderSummaryPdf.new - if !order_slim_pdf.nil? - if order_slim_pdf[1] == '1' + if !order_slim_pdf.empty? + if order_slim_pdf[0][1] == '1' pdf = OrderSummarySlimPdf.new end end @@ -90,8 +90,8 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf filename = "tmp/order_summary_#{booking_id}" + ".pdf" pdf = OrderSummaryPdf.new - if !order_slim_pdf.nil? - if order_slim_pdf[1] == '1' + if !order_slim_pdf.empty? + if order_slim_pdf[0][1] == '1' pdf = OrderSummarySlimPdf.new end end From bc2d6e07f10e676d867b1d663728f592801d52dd Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 16 Jan 2018 14:59:47 +0630 Subject: [PATCH 10/12] check empty for checkout time and checkout alert time --- app/controllers/api/check_in_process_controller.rb | 2 +- app/controllers/origami/check_in_process_controller.rb | 2 +- app/models/dining_facility.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/check_in_process_controller.rb b/app/controllers/api/check_in_process_controller.rb index 7ad00d67..883fb1ea 100644 --- a/app/controllers/api/check_in_process_controller.rb +++ b/app/controllers/api/check_in_process_controller.rb @@ -15,7 +15,7 @@ class Api::CheckInProcessController < Api::ApiController lookup_checkout_time = Lookup.collection_of("checkout_alert_time") alert_time_min = 0 - if !lookup_checkout_time.nil? + if !lookup_checkout_time.empty? now = Time.now.utc lookup_checkout_time.each do |checkout_time| arr_time = checkout_time[0].split("-") diff --git a/app/controllers/origami/check_in_process_controller.rb b/app/controllers/origami/check_in_process_controller.rb index 40a28398..14d5c90c 100644 --- a/app/controllers/origami/check_in_process_controller.rb +++ b/app/controllers/origami/check_in_process_controller.rb @@ -3,7 +3,7 @@ class Origami::CheckInProcessController < BaseOrigamiController def check_in_process lookup_checkout_time = Lookup.collection_of("checkout_time") checkout_at = Time.now.utc - if !lookup_checkout_time.nil? + if !lookup_checkout_time.empty? lookup_checkout_time.each do |checkout_time| arr_time = checkout_time[0].split("-") start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p") diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb index 1feab5d9..c4da3475 100755 --- a/app/models/dining_facility.rb +++ b/app/models/dining_facility.rb @@ -80,7 +80,7 @@ class DiningFacility < ApplicationRecord if booking lookup_checkout_time = Lookup.collection_of("checkout_alert_time") free_time_min = 0 - if !lookup_checkout_time.nil? + if !lookup_checkout_time.empty? now = Time.now.utc lookup_checkout_time.each do |checkout_time| arr_time = checkout_time[0].split("-") @@ -119,7 +119,7 @@ class DiningFacility < ApplicationRecord if bookings lookup_checkout_time = Lookup.collection_of("checkout_alert_time") free_time_min = 0 - if !lookup_checkout_time.nil? + if !lookup_checkout_time.empty? now = Time.now.utc lookup_checkout_time.each do |checkout_time| arr_time = checkout_time[0].split("-") From d5b42b0ff0c5ccde990c85e0a6c835cb665eb69b Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 16 Jan 2018 17:19:14 +0630 Subject: [PATCH 11/12] update cable for cloud --- app/views/origami/payments/show.html.erb | 5 +++-- config/routes.rb | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index ff155525..96f69da9 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -312,9 +312,10 @@ receipt_no = ($("#receipt_no").html()).trim(); } - payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment") + payment_type = ''; + if ($("#server_mode").val() != "cloud") { // first bill not used in cloud - + payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment") if (member_id && member_discount) { if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){ diff --git a/config/routes.rb b/config/routes.rb index a31dcb5c..7fe033a0 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,7 +7,10 @@ scope "(:locale)", locale: /en|mm/ do mount Sidekiq::Web => '/kiq' # Action Cable Creation - mount ActionCable.server => "/cable" + if ENV["SERVER_MODE"] != "cloud" + mount ActionCable.server => "/cable" + end + #--------- SmartSales Activation ------------# get 'activate' => 'install#index' From 21a39dc390e86d51bbe353300dfec4c391a22322 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 16 Jan 2018 17:39:46 +0630 Subject: [PATCH 12/12] update route cable --- config/routes.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 7fe033a0..73f37207 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,9 +7,9 @@ scope "(:locale)", locale: /en|mm/ do mount Sidekiq::Web => '/kiq' # Action Cable Creation - if ENV["SERVER_MODE"] != "cloud" + # if ENV["SERVER_MODE"] != "cloud" mount ActionCable.server => "/cable" - end + # end #--------- SmartSales Activation ------------#