From 621596690eacf3d968b375bdd8abb911436b3ee4 Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 4 May 2018 14:30:17 +0630 Subject: [PATCH 1/4] change UI in order reservation --- app/assets/javascripts/order_reservation.js | 4 ++-- app/views/origami/order_reservation/index.html.erb | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js index 990e4a74..07eab9e1 100644 --- a/app/assets/javascripts/order_reservation.js +++ b/app/assets/javascripts/order_reservation.js @@ -282,8 +282,8 @@ function callback_url(callback,ref_no,order_id,status,time,exptime){ function timeFormat(date){ var isPM = date.getHours() >= 12; var isMidday = date.getHours() == 12; - var time = [date.getHours() - (isPM && !isMidday ? 12 : 0), - date.getMinutes() || '00'].join(':') + + var time = [(date.getHours()>10? date.getHours() : '0'+date.getHours()) - (isPM && !isMidday ? 12 : 0), + (date.getMinutes()>10? date.getMinutes() : '0'+date.getMinutes()) || '00'].join(':') + (isPM ? ' PM' : ' AM'); return time; } diff --git a/app/views/origami/order_reservation/index.html.erb b/app/views/origami/order_reservation/index.html.erb index 89c4b4e9..34664428 100644 --- a/app/views/origami/order_reservation/index.html.erb +++ b/app/views/origami/order_reservation/index.html.erb @@ -378,7 +378,7 @@ - + @@ -411,4 +411,6 @@
-
\ No newline at end of file +
+ + From 6eecd2bdb7043f2ebdf7b6d75759df8253ba3739 Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 4 May 2018 14:59:15 +0630 Subject: [PATCH 2/4] change rounding adj: error --- app/controllers/origami/payments_controller.rb | 3 +++ app/views/origami/sales/show.html.erb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 3c5219af..7df42118 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -279,6 +279,9 @@ class Origami::PaymentsController < BaseOrigamiController new_total = Sale.get_rounding_adjustment(saleObj.grand_total) @rounding_adj = new_total-saleObj.grand_total saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj) + @sale_data.grand_total = new_total + @sale_data.old_grand_total = saleObj.grand_total + @sale_data.rounding_adjustment = @rounding_adj else @rounding_adj = @sale_data.rounding_adjustment end diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb index d5c47376..7e3fc7e1 100755 --- a/app/views/origami/sales/show.html.erb +++ b/app/views/origami/sales/show.html.erb @@ -387,6 +387,6 @@ $('#re-print').click(function() { var sale_id = $('#sale_id').val(); window.location.href = '/origami/'+ sale_id + "/reprint" - return false; + // return false; }); From 2f398bcfebef8c25c77cf6796257bd9ff713402d Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Fri, 4 May 2018 16:08:45 +0630 Subject: [PATCH 3/4] Pull from master --- app/models/order_queue_station.rb | 43 +++++++++++++++++++-------- config/puma.rb | 48 ------------------------------- 2 files changed, 31 insertions(+), 60 deletions(-) delete mode 100755 config/puma.rb diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 889491ed..1541828c 100755 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -57,7 +57,11 @@ class OrderQueueStation < ApplicationRecord if oqs.auto_print && order_source != "quick_service" if oqs_order_items.length > 0 - print_slip(oqs, order, oqs_order_items) + if oqs.cut_per_item + print_slip_item(oqs, order, oqs_order_items) + else + print_slip(oqs, order, oqs_order_items) + end is_auto_printed = true end end @@ -91,8 +95,12 @@ class OrderQueueStation < ApplicationRecord end if oqs.auto_print && order_source != "quick_service" - if oqs_order_items.length > 0 - print_slip(oqs, order, oqs_order_items) + if oqs_order_items.length > 0 + if oqs.cut_per_item + print_slip_item(oqs, order, oqs_order_items) + else + print_slip(oqs, order, oqs_order_items) + end is_auto_printed = true end end @@ -137,8 +145,12 @@ class OrderQueueStation < ApplicationRecord end if oqs.auto_print - if oqs_order_items.length > 0 - print_slip(oqs, order, oqs_order_items) + if oqs_order_items.length > 0 + if oqs.cut_per_item + print_slip_item(oqs, order, oqs_order_items) + else + print_slip(oqs, order, oqs_order_items) + end is_auto_printed = true end end @@ -165,8 +177,12 @@ class OrderQueueStation < ApplicationRecord end if oqs.auto_print - if oqs_order_items.length > 0 - print_slip(oqs, order, oqs_order_items) + if oqs_order_items.length > 0 + if oqs.cut_per_item + print_slip_item(oqs, order, oqs_order_items) + else + print_slip(oqs, order, oqs_order_items) + end is_auto_printed = true end end @@ -211,7 +227,7 @@ class OrderQueueStation < ApplicationRecord end #Print order_item in 1 slip per item - def print_slip_item(oqs, assigned_item) + def print_slip_item(oqs, order, assigned_items) order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf unique_code="OrderItemPdf" if !order_slim_pdf.empty? @@ -232,14 +248,17 @@ class OrderQueueStation < ApplicationRecord end end - order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first() + # 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="" ) - + if !assigned_items.nil? + assigned_items.each do |order_item| + order_queue_printer.print_order_item(print_settings, oqs,order_item.order_id, order_item.order_items_id, print_status="" ) + end + end # update print status for completed same order items - assigned_order_item.each do |ai| + AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai| ai.print_status=true ai.save end diff --git a/config/puma.rb b/config/puma.rb deleted file mode 100755 index c8e0145e..00000000 --- a/config/puma.rb +++ /dev/null @@ -1,48 +0,0 @@ -# Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers a minimum and maximum. -# Any libraries that use thread pools should be configured to match -# the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum, this matches the default thread size of Active Record. -# -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i -threads threads_count, threads_count - -# Specifies the `port` that Puma will listen on to receive requests, default is 3000. -# -port ENV.fetch("PORT") { 3000 } - -# Specifies the `environment` that Puma will run in. -# -environment ENV.fetch("RAILS_ENV") { "development" } - -# Specifies the number of `workers` to boot in clustered mode. -# Workers are forked webserver processes. If using threads and workers together -# the concurrency of the application would be max `threads` * `workers`. -# Workers do not work on JRuby or Windows (both of which do not support -# processes). -# -# workers ENV.fetch("WEB_CONCURRENCY") { 2 } - -# Use the `preload_app!` method when specifying a `workers` number. -# This directive tells Puma to first boot the application and load code -# before forking the application. This takes advantage of Copy On Write -# process behavior so workers use less memory. If you use this option -# you need to make sure to reconnect any threads in the `on_worker_boot` -# block. -# -# preload_app! - -# The code in the `on_worker_boot` will be called if you are using -# clustered mode by specifying a number of `workers`. After each worker -# process is booted this block will be run, if you are using `preload_app!` -# option you will want to use this block to reconnect to any threads -# or connections that may have been created at application boot, Ruby -# cannot share connections between processes. -# -# on_worker_boot do -# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) -# end - -# Allow puma to be restarted by `rails restart` command. - -plugin :tmp_restart From ddc759926b346951d0a61dd3db5ec08092ff7efa Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 4 May 2018 16:52:18 +0630 Subject: [PATCH 4/4] check sale_status for split bill --- app/controllers/origami/split_bill_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 5f074bb5..2d2ca4fb 100755 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -19,7 +19,9 @@ class Origami::SplitBillController < BaseOrigamiController table_bookings = Booking.where("dining_facility_id = #{dining_id} and sale_id IS NOT NULL") if !table_bookings.nil? table_bookings.each do |table_booking| - @sale_data.push(table_booking.sale) + if table_booking.sale.sale_status != 'waste' && table_booking.sale.sale_status != 'spoile' + @sale_data.push(table_booking.sale) + end end end