From d800a5d28d5165598e6d68c4a60c69131b8d0c29 Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 12 Apr 2018 11:11:51 +0630 Subject: [PATCH 01/70] license --- config/initializers/action_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 802324cf..2facee87 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -20,11 +20,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 From a009f359fadb2cec92c0e5cc00ef62602383a8b2 Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Wed, 18 Apr 2018 14:44:25 +0630 Subject: [PATCH 02/70] update puma production --- config/puma.rb | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100755 config/puma.rb 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 924edd823a96221c707d7637981342996ef36689 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 19 Apr 2018 10:49:58 +0630 Subject: [PATCH 03/70] update shift_sale migration file and secret yml --- config/secrets.yml | 2 +- db/migrate/20170626191519_create_shift_sales.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/secrets.yml b/config/secrets.yml index 6e8b73d4..b0d7c5c8 100755 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -24,7 +24,7 @@ test: # instead read values from the environment. production: secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22 - sx_provision_url: connect.smartsales.asia/api #192.168.1.147:3002/api + sx_provision_url: https://connect.pos-myanmar.com/api #192.168.1.147:3002/api server_mode: application cipher_type: AES-256-CBC sx_key: Wh@t1$C2L diff --git a/db/migrate/20170626191519_create_shift_sales.rb b/db/migrate/20170626191519_create_shift_sales.rb index f18a2c1c..bd19a8cf 100755 --- a/db/migrate/20170626191519_create_shift_sales.rb +++ b/db/migrate/20170626191519_create_shift_sales.rb @@ -21,7 +21,7 @@ class CreateShiftSales < ActiveRecord::Migration[5.1] t.integer :dining_count, :default => 0 t.integer :takeaway_count, :default => 0 t.integer :member_count, :default => 0 - t.decimal :total_rounding,, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :total_rounding, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.integer :total_receipt, :default => 0 t.decimal :total_void, :default => 0 t.timestamps From 135ccae8a68d20b5af8ccb7334ccf1a3de38b496 Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 4 May 2018 11:18:53 +0630 Subject: [PATCH 04/70] change js file --- app/assets/javascripts/order_reservation.js | 8 +++++--- config/schedule.rb | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js index c60accdf..0f438831 100644 --- a/app/assets/javascripts/order_reservation.js +++ b/app/assets/javascripts/order_reservation.js @@ -68,11 +68,13 @@ $(function() { if(waiting_time.getTime() < requested_time.getTime()){ var time_diff = (requested_time.getTime() - waiting_time.getTime()); var expected_time = (Math.floor(time_diff) / 1000) / 60; - callback_url(callback,ref_no,order_id,status,expected_time,waiting_time); }else{ - $("#waiting_time").val(""); - $("#waiting_timeErr").text("Expected waiting time is greater than requested time!"); + var time_diff = (waiting_time.getTime() - requested_time.getTime()); + var expected_time = (Math.floor(time_diff) / 1000) / 60; + // $("#waiting_time").val(""); + // $("#waiting_timeErr").text("Expected waiting time is greater than requested time!"); } + callback_url(callback,ref_no,order_id,status,expected_time,waiting_time); }); }); diff --git a/config/schedule.rb b/config/schedule.rb index 8f151e3d..fc38bc2a 100755 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -14,14 +14,14 @@ every 1.minutes do runner "DiningFacility.checkin_time" end -every 3.minutes do +every 10.minutes do runner "OrderReservation.check_new_order" end -every 5.minutes do +every 10.minutes do runner "OrderReservation.check_order_send_to_kitchen" end -every 5.minutes do +every 10.minutes do runner "OrderReservation.check_order_ready_to_delivery" end \ No newline at end of file From 162327ac4cf999d19e1796c6b864685c17cdbf59 Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 4 May 2018 11:51:14 +0630 Subject: [PATCH 05/70] receipt bill issue --- app/assets/javascripts/order_reservation.js | 4 +++- app/pdf/receipt_bill_pdf.rb | 1 - app/views/origami/order_reservation/index.html.erb | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js index 0f438831..990e4a74 100644 --- a/app/assets/javascripts/order_reservation.js +++ b/app/assets/javascripts/order_reservation.js @@ -33,6 +33,7 @@ $(function() { $("#accepted").on("click", function(){ if($(this).text().trim() == "ACCEPT"){ + $("#status").text($(this).attr("data-value")); var requested_time = $("#requested_date_time").text(); $("#requested_order_time").text(requested_time); showTimePicker(requested_time); @@ -65,6 +66,7 @@ $(function() { var waiting_time = new Date(date_time+' '+$("#waiting_time").val()); // requested_time.setHours(requested_time.getHours() - 1); // console.log(requested_time); + // console.log(date_time); if(waiting_time.getTime() < requested_time.getTime()){ var time_diff = (requested_time.getTime() - waiting_time.getTime()); var expected_time = (Math.floor(time_diff) / 1000) / 60; @@ -282,7 +284,7 @@ function timeFormat(date){ var isMidday = date.getHours() == 12; var time = [date.getHours() - (isPM && !isMidday ? 12 : 0), date.getMinutes() || '00'].join(':') + - (isPM ? ' PM' : 'AM'); + (isPM ? ' PM' : ' AM'); return time; } diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 95a6a277..59e6a320 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -206,7 +206,6 @@ class ReceiptBillPdf < Prawn::Document total_price = item.price #item.qty*item.unit_price - comment for room charges price = item.unit_price product_name = item.product_name - total_qty += item.qty y_position = cursor diff --git a/app/views/origami/order_reservation/index.html.erb b/app/views/origami/order_reservation/index.html.erb index a15b45aa..89c4b4e9 100644 --- a/app/views/origami/order_reservation/index.html.erb +++ b/app/views/origami/order_reservation/index.html.erb @@ -355,13 +355,13 @@ - + ADDRESS
- + DELEVERY
From ef8198733422d491619e0dab907a9c0713328c49 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 4 May 2018 13:16:57 +0630 Subject: [PATCH 06/70] udpate access code for supervisor and manager --- app/assets/stylesheets/addorder.scss | 23 +++++++++++++++++++++ app/controllers/base_origami_controller.rb | 2 +- app/controllers/origami/home_controller.rb | 2 +- app/views/origami/addorders/detail.html.erb | 2 +- app/views/origami/home/show.html.erb | 9 ++++++-- app/views/origami/payments/show.html.erb | 22 ++++++++++++++------ 6 files changed, 49 insertions(+), 11 deletions(-) diff --git a/app/assets/stylesheets/addorder.scss b/app/assets/stylesheets/addorder.scss index d8adba16..ba1089d2 100755 --- a/app/assets/stylesheets/addorder.scss +++ b/app/assets/stylesheets/addorder.scss @@ -247,4 +247,27 @@ i.logout_icon{ } .list-menu > a:hover{ text-decoration: none; +} +.cashier_number{ + width: 33%; + height:58px; + line-height:58px; + text-align:center; + background:#54A5AF; + // float:left; + // margin:2px; + font-size:20px; + color:white; + // cursor:pointer; +} +.border-top{ + border-top:1px solid #fff; +} + +.border-right{ + border-right:1px solid #fff; +} + +.border-left{ + border-left:1px solid #fff; } \ No newline at end of file diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index 3cb1eacc..040ee2bf 100755 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -23,7 +23,7 @@ class BaseOrigamiController < ActionController::Base end else if ENV["SERVER_MODE"] != 'cloud' - protect_from_forgery with: :exception + # protect_from_forgery with: :exception end if current_user.nil? diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index ed857104..e2f15d19 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -132,7 +132,7 @@ class Origami::HomeController < BaseOrigamiController def check_emp_access_code pin_code = params[:code] employee = Employee.find_by_emp_id(pin_code) - if employee && employee.role == "manager" + if employee && (employee.role == "manager" || employee.role == "supervisor") result = {:status=> true, :message=>"Success" } else result = {:status=> false, :message=>"Invalid Access Code" } diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 7e8cbb2c..5f451408 100644 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -313,7 +313,7 @@
9
0
00
-
Clr
+
Clr
<% end %> + <% if @dinein_cashier == '1' %>
@@ -36,6 +37,7 @@
<%= t :dine_in_cashier %>
+ <% end %> <% if @order_reservation == '1' %>
From 727070a1b8c9823d9863170dfcc612b85d545f05 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 4 May 2018 14:19:17 +0630 Subject: [PATCH 09/70] update void access code --- .../origami/addorders_controller.rb | 3 - app/views/origami/addorders/detail.html.erb | 80 ++++++------ app/views/origami/sales/show.html.erb | 120 +++++++++++++++++- 3 files changed, 156 insertions(+), 47 deletions(-) diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index 100635cd..a9820011 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -18,9 +18,6 @@ class Origami::AddordersController < BaseOrigamiController if check_mobile @webview = true end - - today = DateTime.now - day = Date.today.wday @menus = Menu.all @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') @table_id = params[:id] diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 5f451408..241fe79c 100644 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -43,46 +43,46 @@ Products <% @menu.each do |menu| %> - <% if !menu.valid_time.nil? %> - <% if menu.menu_category_id.nil? %> - - <% if type %> - <% if !menu.code.include? "SPL" %> - - <% end%> - - <% else %> - <% if @table.get_current_checkout_booking.nil? %> - <% if !menu.code.include? "SPL" %> - - <% end%> - <% else %> - - <% end%> - - <% end %> - <% end%> - <% end %> - <%end %> - + <% if !menu.valid_time.nil? %> + <% if menu.menu_category_id.nil? %> + + <% if type %> + <% if !menu.code.include? "SPL" %> + + <% end%> + + <% else %> + <% if @table.get_current_checkout_booking.nil? %> + <% if !menu.code.include? "SPL" %> + + <% end%> + <% else %> + + <% end%> + + <% end %> + <% end%> + <% end %> + <%end %> +
diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb index 0eaabce1..d5c47376 100755 --- a/app/views/origami/sales/show.html.erb +++ b/app/views/origami/sales/show.html.erb @@ -198,13 +198,74 @@
- <% if @sale.sale_status != 'void' %> - - <% end %> + <% if @sale.sale_status != 'void' %> + <% if current_login_employee.role == "cashier" %> + Void + <% else %> + + <% end %> + <% end %>
+ + + + From 2f398bcfebef8c25c77cf6796257bd9ff713402d Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Fri, 4 May 2018 16:08:45 +0630 Subject: [PATCH 13/70] 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 14/70] 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 From bb4c00440658e5170357bf58bd782ea44f0230de Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Fri, 4 May 2018 18:00:44 +0630 Subject: [PATCH 15/70] pull from master --- README.md | 4 + app/assets/javascripts/order_reservation.js | 4 +- .../origami/addorders_controller.rb | 3 - .../origami/dashboard_controller.rb | 7 + .../origami/order_reservation_controller.rb | 2 +- .../origami/payments_controller.rb | 3 + app/models/order_reservation.rb | 5 +- app/pdf/order_set_item_pdf.rb | 4 +- app/views/origami/addorders/detail.html.erb | 80 ++++++------ app/views/origami/dashboard/index.html.erb | 2 + .../origami/order_reservation/index.html.erb | 6 +- app/views/origami/sales/show.html.erb | 122 +++++++++++++++++- 12 files changed, 185 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 0605a14a..dfebed49 100755 --- a/README.md +++ b/README.md @@ -188,6 +188,10 @@ Add Base URL for DOEMAL 1) settings/lookups => { type:order_reservation, name: BaseURL, value:'{doemal url}' } 2) settings/lookups => { type:order_reservation, name: Token, value:'{doemal token}' } +Add Feature for Dine-in Cashier + ** '0' means can not use dine-in cashier and '1' means can use dine-in cashier ** + => settings/lookups => { type:dinein_cashier, name: DineInCashier, value:'{0 or 1}' } + Add Feature for Quick Service ** '0' means can not use quick service and '1' means can use quick service ** => settings/lookups => { type:quick_service, name: QuickService, value:'{0 or 1}' } 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/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index 100635cd..a9820011 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -18,9 +18,6 @@ class Origami::AddordersController < BaseOrigamiController if check_mobile @webview = true end - - today = DateTime.now - day = Date.today.wday @menus = Menu.all @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') @table_id = params[:id] diff --git a/app/controllers/origami/dashboard_controller.rb b/app/controllers/origami/dashboard_controller.rb index 8bdd5c27..027b89a5 100644 --- a/app/controllers/origami/dashboard_controller.rb +++ b/app/controllers/origami/dashboard_controller.rb @@ -56,6 +56,13 @@ class Origami::DashboardController < BaseOrigamiController # get printer info @print_settings = PrintSetting.get_precision_delimiter() @current_user = current_user + #dine-in cashier + dinein_cashier = Lookup.collection_of('dinein_cashier') + @dinein_cashier = 0 + if !dinein_cashier[0].nil? + @dinein_cashier = dinein_cashier[0][1] + end + #quick service quick_service = Lookup.collection_of('quick_service') @quick_service = 0 diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index 12a3ee2f..32f0e63d 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -1,7 +1,7 @@ class Origami::OrderReservationController < BaseOrigamiController def index - @order = OrderReservation.latest_order + @order = OrderReservation.latest_order #.active @count_on_order = OrderReservation.get_count_on_order end 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/models/order_reservation.rb b/app/models/order_reservation.rb index e5b95f8c..f4f610fc 100644 --- a/app/models/order_reservation.rb +++ b/app/models/order_reservation.rb @@ -7,6 +7,7 @@ class OrderReservation < ApplicationRecord has_many :order_reservation_items has_one :delivery + scope :active, -> { where("created_at BETWEEN '#{DateTime.now.utc.beginning_of_day}' AND '#{DateTime.now.utc.end_of_day}'") } scope :latest_order, -> { order("order_reservation_id desc, created_at desc") } SEND_TO_KITCHEN = "send_to_kitchen" @@ -218,7 +219,7 @@ class OrderReservation < ApplicationRecord def self.check_order_send_to_kitchen today = Time.now.utc - order_reservation = OrderReservation.where("status='accepted' and requested_time > '#{today}'") + order_reservation = OrderReservation.where("status='accepted' and requested_time > '#{today}' and expected_waiting_time < '#{today}'") if order_reservation.length > 0 if ENV["SERVER_MODE"] == 'cloud' ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation @@ -228,7 +229,7 @@ class OrderReservation < ApplicationRecord def self.check_order_ready_to_delivery today = Time.now.utc - order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time > '#{today}'") + order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time > '#{today}' and expected_waiting_time < '#{today}'") if order_reservation.length > 0 if ENV["SERVER_MODE"] == 'cloud' ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation diff --git a/app/pdf/order_set_item_pdf.rb b/app/pdf/order_set_item_pdf.rb index 1e7b9c7f..14a8ff62 100755 --- a/app/pdf/order_set_item_pdf.rb +++ b/app/pdf/order_set_item_pdf.rb @@ -4,8 +4,8 @@ class OrderSetItemPdf < Prawn::Document def initialize(print_settings,order_set_item, print_status, options, alt_name, before_updated_qty) self.page_width = print_settings.page_width self.page_height = print_settings.page_height - self.header_font_size = printer_settings.header_font_size.to_i - self.item_font_size = printer_settings.item_font_size.to_i + self.header_font_size = print_settings.header_font_size.to_i + self.item_font_size = print_settings.item_font_size.to_i self.margin = 0 self.price_width = 40 # No Need for item self.qty_width = 40 diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 5f451408..241fe79c 100644 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -43,46 +43,46 @@ Products <% @menu.each do |menu| %> - <% if !menu.valid_time.nil? %> - <% if menu.menu_category_id.nil? %> - - <% if type %> - <% if !menu.code.include? "SPL" %> - - <% end%> - - <% else %> - <% if @table.get_current_checkout_booking.nil? %> - <% if !menu.code.include? "SPL" %> - - <% end%> - <% else %> - - <% end%> - - <% end %> - <% end%> - <% end %> - <%end %> - + <% if !menu.valid_time.nil? %> + <% if menu.menu_category_id.nil? %> + + <% if type %> + <% if !menu.code.include? "SPL" %> + + <% end%> + + <% else %> + <% if @table.get_current_checkout_booking.nil? %> + <% if !menu.code.include? "SPL" %> + + <% end%> + <% else %> + + <% end%> + + <% end %> + <% end%> + <% end %> + <%end %> + diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb index b6b36427..bbb19c78 100644 --- a/app/views/origami/dashboard/index.html.erb +++ b/app/views/origami/dashboard/index.html.erb @@ -28,6 +28,7 @@ <% end %> + <% if @dinein_cashier == '1' %>
@@ -36,6 +37,7 @@
<%= t :dine_in_cashier %>
+ <% end %> <% if @order_reservation == '1' %>
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 +
+ + diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb index 0eaabce1..7e3fc7e1 100755 --- a/app/views/origami/sales/show.html.erb +++ b/app/views/origami/sales/show.html.erb @@ -198,13 +198,74 @@
- <% if @sale.sale_status != 'void' %> - - <% end %> + <% if @sale.sale_status != 'void' %> + <% if current_login_employee.role == "cashier" %> + Void + <% else %> + + <% end %> + <% end %>
+ + + + From d0b14cf81b44e3bffbfdc97ee7439467d9ec04f1 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 4 May 2018 18:10:00 +0630 Subject: [PATCH 16/70] update access code in spereat view --- .../origami/addorders_controller.rb | 1 + .../origami/sale_edit_controller.rb | 2 + app/views/origami/home/show.html.erb | 2 +- app/views/origami/rooms/show.html.erb | 72 ++++++++++++++- .../origami/table_invoices/show.html.erb | 88 ++++++++++++++++++- 5 files changed, 159 insertions(+), 6 deletions(-) diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index a9820011..15d896e6 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -20,6 +20,7 @@ class Origami::AddordersController < BaseOrigamiController end @menus = Menu.all @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') + @table_id = params[:id] @table = DiningFacility.find(@table_id) @booking = @table.get_booking diff --git a/app/controllers/origami/sale_edit_controller.rb b/app/controllers/origami/sale_edit_controller.rb index 1c5b5430..0b3b989d 100755 --- a/app/controllers/origami/sale_edit_controller.rb +++ b/app/controllers/origami/sale_edit_controller.rb @@ -5,8 +5,10 @@ class Origami::SaleEditController < BaseOrigamiController sale_id = params[:sale_id] if params[:table_id] @table_id = params[:table_id] + @table_type = DiningFacility.find(@table_id).type else @table_id = nil + @table_type = nil end @cashier_type = params[:type] diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index a3e26d8d..8fa42403 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -1116,7 +1116,7 @@ if (result.status == true) { createAccessCode(code); if (type == "edit") { - var dining_id = "<%= @dining.id %>"; + var dining_id = "<%= @dining.id rescue "" %> "; var sale_id = "<%= @obj_sale.sale_id rescue "" %>"; window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type +"/edit"; }else if(type == "void"){ diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index bf01647e..fb3d9a75 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -452,8 +452,13 @@ <% if current_login_employee.role != "waiter" %> + <% if current_login_employee.role == "cashier" %> + Edit + Void + <% else %> - " id="server_mode"> \ No newline at end of file diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 8fa42403..f7f51aa6 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -1010,7 +1010,27 @@ $('#add_order').on('click', function () { var dining_id = "<%= @dining.id %>"; - window.location.href = '/origami/addorders/' + dining_id; + var menus = JSON.parse(localStorage.getItem("menus")); + var menu_arr = []; + if (menus != null) { + for(var i in menus) { + var arr = {}; + arr.id = menus[i]["id"]; + arr.name = menus[i]["name"]; + menu_arr.push(arr); + } + } + menu_arr = JSON.stringify(menu_arr); + console.log(menu_arr) + $.ajax({ + type: 'POST', + data: {menus: menu_arr}, + url: '/origami/addorders/' + dining_id, + success: function(data) { + + } + }); + //window.location.href = '/origami/addorders/' + dining_id+'/'+data; }); /* check in process */ diff --git a/config/routes.rb b/config/routes.rb index 0f329c95..071f6aa1 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -97,6 +97,7 @@ scope "(:locale)", locale: /en|mm/ do post '/check_emp_access_code/:code' => 'home#check_emp_access_code', :defaults => { :format => 'json' } get "dashboard" => "dashboard#index" + get "get_all_menu" => "dashboard#get_all_menu" get "quick_service" => "quick_service#index" @@ -237,7 +238,7 @@ scope "(:locale)", locale: /en|mm/ do get '/addorders/get_menu_sub_category/:id' => "addorders#get_menu_sub_category",:as => "get_menu_sub_category", :defaults => { :format => 'json' } get '/addorders/products/list' => "addorders#get_all_product",:as => "get_all_product", :defaults => { :format => 'json' } - get '/:addorders/:id' => "addorders#detail" + post '/:addorders/:id' => "addorders#detail", as: 'addorders_detail' post '/:addorders/create' => "addorders#create",:as => "addorder_create", :defaults => { :format => 'json' } From 42a15d302353dee09b689e9e76751f705ceafdea Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 8 May 2018 15:54:15 +0630 Subject: [PATCH 20/70] update cache menu --- .../origami/addorders_controller.rb | 15 +++---- app/views/origami/addorders/detail.html.erb | 8 ++-- app/views/origami/home/show.html.erb | 40 +++++++++---------- config/routes.rb | 2 +- 4 files changed, 30 insertions(+), 35 deletions(-) diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index e8f539c8..fd298fb3 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -19,14 +19,13 @@ class Origami::AddordersController < BaseOrigamiController @webview = true end - if params[:menus].present? - @menus = JSON.parse(params[:menus], object_class: OpenStruct) - puts @menus.to_json - @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') - else + # if params[:menus].present? + # @menus = JSON.parse(params[:menus], object_class: OpenStruct) + # @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') + # else @menus = Menu.all @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') - end + # end @table_id = params[:id] @table = DiningFacility.find(@table_id) @@ -48,10 +47,6 @@ class Origami::AddordersController < BaseOrigamiController else @booking = nil end - - respond_to do |format| - format.html { redirect_to origami_addorders_detail_path } - end end def get_menu_category () diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 84c533ac..43ab6db0 100644 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -60,18 +60,18 @@ <% else %> <% if @table.get_current_checkout_booking.nil? %> <% if !menu.code.include? "SPL" %> - <% end%> <% else %> - ' ; $(sub_category).append(row); diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index fd298fb3..e4e17328 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -18,14 +18,17 @@ class Origami::AddordersController < BaseOrigamiController if check_mobile @webview = true end - - # if params[:menus].present? - # @menus = JSON.parse(params[:menus], object_class: OpenStruct) - # @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') - # else - @menus = Menu.all - @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') - # end +puts params[:menu] +puts "sssssssssssssssssssssssssss" + if params[:menus].present? + @menus = JSON.parse(params[:menus], object_class: OpenStruct) + @menu = JSON.parse(params[:category], object_class: OpenStruct) + puts @menus.to_json + puts @menu.to_json + else + @menus = Menu.all + @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') + end @table_id = params[:id] @table = DiningFacility.find(@table_id) diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 43ab6db0..46847924 100644 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -5,29 +5,16 @@ <% type = request.path_info.include?('quick_service')%> <% modify_order = request.path_info.include?('modify_order')%> -
+
-
- -
  • +
  • - <%= @menus[0].name %> - -
  • - -
    -
    -
    -
    - +
    + + + + + +
    +
    +
    +
    + + <%end %>
    +
    -
    +
    <% if type && modify_order%>
    diff --git a/config/locales/en.yml b/config/locales/en.yml index 8c19c4ee..1c03285a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -479,6 +479,7 @@ en: convenience_charge: "Convenience Charge" convenience_tax: "Convenience Tax" commercial_tax: "Commercial Tax" + select_providers: "Select Providers" code_txt: "code " charge_txt: "charge" diff --git a/config/locales/mm.yml b/config/locales/mm.yml index e6bdc2cf..3a1aa2b6 100644 --- a/config/locales/mm.yml +++ b/config/locales/mm.yml @@ -473,6 +473,7 @@ mm: convenience_charge: "Convenience Charge" convenience_tax: "Convenience Tax" commercial_tax: "Commercial Tax" + select_providers: "Select Providers" code_txt: "ကုတ်ဒ် " charge_txt: "ကောက်ခံသည်" From efa53508834e829602f8d711c31eccdda746a26c Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 9 May 2018 16:46:54 +0630 Subject: [PATCH 30/70] cache menu --- app/assets/javascripts/addorder.js | 1 - app/views/origami/addorders/detail.html.erb | 187 +++++++++--------- .../origami/dashboard/_menu.json.jbuilder | 12 ++ 3 files changed, 100 insertions(+), 100 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 87124f55..c079377f 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -102,7 +102,6 @@ $(function() { $('.sub_category_list').addClass("hidden"); var menu_id = $(this).attr("data-id"); var url = "get_menu_category/"+menu_id; - console.log(menu_id); show_menu_item_list(url,menu_id); var sub_id = $(this).attr("data-sub-id"); if (sub_id == "true") { diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 46847924..36861d05 100644 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -77,56 +77,14 @@ @@ -212,43 +170,43 @@
    <% if type %> -
    -
    - ORDER DETAILS -
    +
    +
    + ORDER DETAILS +
    - <% if modify_order %> - <% if @table.nil? %> -
    Table :
    - - - <% else%> -
    Table : <%=@table.name%>
    - - - <% end%> + <% if modify_order %> + <% if @table.nil? %> +
    Table :
    + + + + <% else%> +
    Table : <%=@table.name%>
    + + + + <% end%> - - - + + + -
    - -
    - <% else%> - -
    +
    + +
    + <% else%> + +
    -
    -
    - -
    - <% end%> - - -
    +
    +
    + +
    + <% end%> +
    <% else %>
    @@ -259,6 +217,7 @@ +
    - +
    +
    +
    + +
    + - -
    - - + +
    +
    +
    +
    MOVE --> ' <%= @dining.name %> ' to
    + + <% if @status_order == 'order' && @status_sale != 'sale' %> + <% if !@obj_order.nil? %> +
    + <% else %> +
    + <% end %> + <% 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' %> +
    INVOICE DETAILS | Table <%= @dining.name rescue "" %> + <% if !@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 %> +
    + <% else %> + ORDER DETAILS | Table <%= @dining.name rescue "" %> + <% end %> +
    +
    +
    +
    + <% if (!@sale_array.empty?) && (!@date.nil?) %> +
    +   Receipt No: + <% if @status_sale == 'sale' %> + <%= @sale_array[0].receipt_no rescue '' %> + <% end %> + +
    +
    +
    + Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %> +
    +
    + <% elsif !@date.nil? %> +
    +   Order No: + <% if @status_order == 'order' %> + <%= @obj_order.order_id rescue '' %> + <% end %> + +
    +
    +
    + Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %> +
    +
    + <% end %> +
    +
    +
    +
    + <% if @status_sale == 'sale' && !@sale_array.empty? %> + +   Customer : <%= @sale_array[0].customer.name rescue '' %> + <% elsif @status_order == 'order' && !@customer.nil? + %> + +   Customer : <%= @customer.name rescue "" %> + <% end %> + +
    +
    +
    +
    + + + + + + + + + + + <% + count = 0 + sub_total = 0 + if @status_sale == "sale" + @sale_array[0].sale_items.each do |sale_item| + count += 1 + sub_total = sub_total + sale_item.price + %> + + <% unless sale_item.price <= 0 %> + + + + + + + <% + end + end + end + + if @status_order == 'order' && @status_sale != 'sale' + unless @order_items.nil? || @order_items.empty? + count = 0 + @order_items.each do |order_item | + count += 1 + sub_total = sub_total + (order_item.price * order_item.qty) + + #unless order_item.price <= 0 %> + + + + + + + <% + #end + end + end + end + %> + +
    #ItemsQTYPrice
    <%= count %><%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.price %>
    <%= count %><%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
    +
    +
    +<% +if @status_sale == 'sale' + unless @order_items.nil? + %> + Pending New Order + + <% + @order_items.each do |order_item | + %> + + + + + + + + <% + end + %> +
    <%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
    + + <% + else + @sale_array.each do |sale| + if @sale_array.size > 1 + unless sale.receipt_no == @sale_array[0].receipt_no + %> + Pending Payment + + + + + +
    Receipt No - <%= sale.receipt_no %>
    + <% + end + end + end + end +end +%> +
    +
    +
    MOVE ROOM
    +
    +
    + + +
    + + + + +
    +
    +
    diff --git a/app/views/origami/movetable/move_dining.html.erb b/app/views/origami/movetable/move_dining.html.erb index 76f704e8..64102211 100755 --- a/app/views/origami/movetable/move_dining.html.erb +++ b/app/views/origami/movetable/move_dining.html.erb @@ -22,27 +22,27 @@
    <% @tables.each do |table| %> <% if table.status == 'occupied' %> - <% if table.get_booking.nil? %> - <% if table.get_checkout_booking.nil? %> -
    - <% else %> -
    - <% end %> -
    - <%= table.name %> -
    -
    - <% else %> - <% if table.get_checkout_booking.nil? %> -
    - <% else %> -
    - <% end %> -
    - <%= table.name %> + <% if table.get_booking.nil? %> + <% if table.get_checkout_booking.nil? %> +
    + <% else %> +
    + <% end %> +
    + <%= table.name %> +
    -
    - <% end %> + <% else %> + <% if table.get_checkout_booking.nil? %> +
    + <% else %> +
    + <% end %> +
    + <%= table.name %> +
    +
    + <% end %> <% else %>
    @@ -54,119 +54,120 @@
    +
    <% @rooms.each do |room| %> <% if room.status == 'occupied' %> - <% if room.get_booking.nil? %> -
    + <% if room.get_booking.nil? %> +
    <% else %> -
    - <% end %> -
    - <%= room.name %> -
    +
    + <% end %> +
    + <%= room.name %>
    - <% else %> -
    -
    - <%= room.name %>
    + <% else %> +
    +
    + <%= room.name %> +
    +
    + <% end %> + <% end %>
    - <% end %> - <% end %> +
    + +
    - - +
    -
    - -
    - + - -
    -
    -
    -
    MOVE --> ' <%= @dining.name %> ' to
    - - <% if @status_order == 'order' && @status_sale != 'sale' %> - <% if !@obj_order.nil? %> -
    - <% else %> -
    - <% end %> - <% 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' %> -
    INVOICE DETAILS | Table <%= @dining.name rescue "" %> - <% if !@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 %> -
    - <% else %> - ORDER DETAILS | Table <%= @dining.name rescue "" %> - <% end %> -
    -
    -
    -
    - <% if (!@sale_array.empty?) && (!@date.nil?) %> -
    -   Receipt No: - <% if @status_sale == 'sale' %> + +
    +
    +
    +
    MOVE --> ' <%= @dining.name %> ' to
    + + <% if @status_order == 'order' && @status_sale != 'sale' %> + <% if !@obj_order.nil? %> +
    + <% else %> +
    + <% end %> + <% 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' %> +
    INVOICE DETAILS | Table <%= @dining.name rescue "" %> + <% if !@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 %> +
    + <% else %> + ORDER DETAILS | Table <%= @dining.name rescue "" %> + <% end %> +
    +
    +
    +
    + <% if (!@sale_array.empty?) && (!@date.nil?) %> +
    +   Receipt No: + <% if @status_sale == 'sale' %> <%= @sale_array[0].receipt_no rescue '' %> - <% end %> - -
    -
    -
    - Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %> -
    -
    - <% elsif !@date.nil? %> -
    -   Order No: - <% if @status_order == 'order' %> - <%= @obj_order.order_id rescue '' %> + <% end %> + +
    +
    +
    + Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %> +
    +
    + <% elsif !@date.nil? %> +
    +   Order No: + <% if @status_order == 'order' %> + <%= @obj_order.order_id rescue '' %> - <% end %> - -
    + <% end %> + +
    Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %>
    - <% end %> + <% end %> +
    -
    -
    -
    - - <% if @status_sale == 'sale' && !@sale_array.empty? %> - -   Customer : <%= @sale_array[0].customer.name rescue '' %> - <% elsif @status_order == 'order' && !@customer.nil? - %> - -   Customer : <%= @customer.name rescue "" %> - <% end %> +
    +
    + + <% if @status_sale == 'sale' && !@sale_array.empty? %> + +   Customer : <%= @sale_array[0].customer.name rescue '' %> + <% elsif @status_order == 'order' && !@customer.nil? + %> + +   Customer : <%= @customer.name rescue "" %> + <% end %> +
    -
    -
    +
    @@ -243,7 +244,7 @@ if @status_sale == 'sale' end %>
    - + <% else @sale_array.each do |sale| @@ -289,30 +290,22 @@ end showHideNavbar(webview); $(".tables").on('click', function(){ - $('.tables').removeClass('selected-item'); - $(this).addClass('selected-item'); - var dining_name = $(this).attr("data-name"); - var dining_id = $(this).attr("data-id"); - var change_from = "<%= @dining.id %>"; - if (dining_id == change_from) { - /*$.alert({ - title: 'Alert!', - content: 'Please Select Another Table', - type: 'red', - typeAnimated: true, - btnClass: 'btn-danger', - });*/ - swal({ - title: "Alert!!", - text: 'Please Select Another Table !', - type: 'warning', - }); - }else{ - $('#moved').text(" ' " + dining_name + " ' ") - $('#change_table_value').val(dining_id); - } - - }) + $('.tables').removeClass('selected-item'); + $(this).addClass('selected-item'); + var dining_name = $(this).attr("data-name"); + var dining_id = $(this).attr("data-id"); + var change_from = "<%= @dining.id %>"; + if ((dining_id == change_from) || (dining_name==undefined)) { + swal({ + title: "Alert!!", + text: 'Please select another table !', + type: 'warning', + }); + }else{ + $('#moved').text(" ' " + dining_name + " ' ") + $('#change_table_value').val(dining_id); + } + }); $(".rooms").on('click', function(){ $('.rooms').removeClass('selected-item'); @@ -323,14 +316,14 @@ end if (dining_id == change_from) { swal({ title: "Alert!!", - text: 'Please Select Another Table !', + text: 'Please select another room !', type: 'warning', }); }else{ $('#moved').text(dining_name) $('#change_table_value').val(dining_id); } - }) + }); $('#move_table').on('click',function(){ change_to = $('#change_table_value').val(); @@ -362,7 +355,32 @@ end } }); } - }) + }); + + $('#add_invoice').on('click', function () { + var dining_id = "<%= @dining.id %>"; + var sale_id = $("#sale_id").val(); + var ajax_url = "/origami/sale/append_order"; + $.ajax({ + type: "POST", + url: ajax_url, + data: 'dining_id=' + dining_id + "&sale_id=" + sale_id, + success: function (result) { + swal({ + title: "Information!", + text: "Invoice updated", + html: true, + closeOnConfirm: false, + closeOnCancel: false, + allowOutsideClick: false + }, function () { + $("#first_bill").removeAttr('disabled'); + $("#pay").removeAttr('disabled'); + window.location.reload(); + }); + } + }); + }); }); $('#back').on('click',function(){ window.location.href = '/origami/table/'+ "<%= @dining.id %>"; diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index fb3d9a75..359df149 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -30,7 +30,7 @@ <% @complete.each do |sale| %>
    - <%= sale.receipt_no %><%= sale.sale_status %> + <%= sale.receipt_no %><%= sale.sale_status %>
    <% end %> @@ -135,7 +135,7 @@
    <% @orders.each do |order| %> -
    +
    text-white" data-id="<%= order.order_id %>">
    <% order_status = "" diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb index 7e3fc7e1..4bbee6a7 100755 --- a/app/views/origami/sales/show.html.erb +++ b/app/views/origami/sales/show.html.erb @@ -90,9 +90,24 @@
    <% @orders.each do |order| %> -
    +
    text-white" data-id="<%= order.order_id %>">
    - <%= order.order_id %> + <% + order_status = "" + sale_order = SaleOrder.find_by_order_id(order) + if sale_order + unless sale_order.sale_id.nil? + sale = Sale.find(sale_order.sale_id) + order_status = sale.sale_status + if order_status == 'new' + order_status = order.status + end + end + else + order_status = order.status + end + %> + <%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
    <% end %> @@ -198,7 +213,7 @@
    - <% if @sale.sale_status != 'void' %> + <% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %> <% if current_login_employee.role == "cashier" %> Void <% else %> diff --git a/app/views/reports/receipt_no/index.html.erb b/app/views/reports/receipt_no/index.html.erb index 567b056b..9581d5df 100755 --- a/app/views/reports/receipt_no/index.html.erb +++ b/app/views/reports/receipt_no/index.html.erb @@ -59,20 +59,16 @@ <% if @print_settings.precision.to_i > 0 - precision = @print_settings.precision - else - precision = 0 - end - #check delimiter - if @print_settings.delimiter - delimiter = "," - else - delimiter = "" - end - - puts precision - puts "predelidm" - puts delimiter %> + precision = @print_settings.precision + else + precision = 0 + end + #check delimiter + if @print_settings.delimiter + delimiter = "," + else + delimiter = "" + end %> <% grand_total = 0 %> <% old_grand_total = 0 %> @@ -116,12 +112,18 @@   <%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> <%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> - <% @sale_taxes.each do |tax| %> - <%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> + <% if !@sale_taxes.empty? + @sale_taxes.each do |tax| %> + <%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> + <% end %> + <% else %> + <% @tax_profiles.each do |tax| %> + 0 + <% end %> <% end %> <%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> <%= rounding_adj.to_f rescue '-' %> - <%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %> + <%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) rescue '0' %>   From a76f9068da08df182c10bc5beeb127cb8b40551b Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 11 May 2018 13:39:32 +0630 Subject: [PATCH 49/70] check nil for cus info --- app/models/customer.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/customer.rb b/app/models/customer.rb index c380f24b..557c0f0c 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -362,9 +362,9 @@ class Customer < ApplicationRecord customer = Customer.new customer.name = params[:name] customer.email = params[:email] - customer.contact_no = params[:contact_no] - customer.gender = params[:gender] - customer.address = params[:address] + customer.contact_no = params[:contact_no] ? params[:contact_no] : '' + customer.gender = gender + customer.address = params[:address] ? params[:address] : '' customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : '' customer.membership_id = params[:membership_id] customer.customer_type = "Takeaway" From baac2c33ead95435cecef463176a9a13c539320c Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 11 May 2018 13:45:04 +0630 Subject: [PATCH 50/70] move customer func: from doemal --- .../order_reservation_controller.rb | 2 +- app/models/customer.rb | 22 ------------------- app/models/order_reservation.rb | 22 +++++++++++++++++++ 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/controllers/api/order_reserve/order_reservation_controller.rb b/app/controllers/api/order_reserve/order_reservation_controller.rb index 1d9e3fab..866d3da3 100644 --- a/app/controllers/api/order_reserve/order_reservation_controller.rb +++ b/app/controllers/api/order_reserve/order_reservation_controller.rb @@ -22,7 +22,7 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController if !check_customer.nil? customer_id = check_customer.customer_id else - customer = Customer.addCustomer(params) + customer = OrderReservation.addCustomer(params) customer_id = customer.id end render :json => { :status => true, :data => { :customer_id => customer_id} } diff --git a/app/models/customer.rb b/app/models/customer.rb index 557c0f0c..b05caaf6 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -352,28 +352,6 @@ class Customer < ApplicationRecord end - #new customer for doemal - def self.addCustomer(params) - if params[:gender] == "female" - gender = "Female" - else - gender = "Male" - end - customer = Customer.new - customer.name = params[:name] - customer.email = params[:email] - customer.contact_no = params[:contact_no] ? params[:contact_no] : '' - customer.gender = gender - customer.address = params[:address] ? params[:address] : '' - customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : '' - customer.membership_id = params[:membership_id] - customer.customer_type = "Takeaway" - customer.tax_profiles = ["2"] - customer.save - - return customer - end - WALKIN = "CUS-000000000001" TAKEAWAY = "CUS-000000000002" diff --git a/app/models/order_reservation.rb b/app/models/order_reservation.rb index 64df8ee9..cd0b7e68 100644 --- a/app/models/order_reservation.rb +++ b/app/models/order_reservation.rb @@ -15,6 +15,28 @@ class OrderReservation < ApplicationRecord DELIVERED = "delivered" COMPLETED = "completed" + #new customer for doemal + def self.addCustomer(params) + if params[:gender] == "female" + gender = "Female" + else + gender = "Male" + end + customer = Customer.new + customer.name = params[:name] + customer.email = params[:email] + customer.contact_no = params[:contact_no] ? params[:contact_no] : '' + customer.gender = gender + customer.address = params[:address] ? params[:address] : '' + customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : '' + customer.membership_id = params[:membership_id] + customer.customer_type = "Takeaway" + customer.tax_profiles = ["2"] + customer.save + + return customer + end + def self.addOrderReservationInfo(order_reserve) Rails.logger.debug order_reserve.to_s check_order_reservation = OrderReservation.where("transaction_ref = ?",order_reserve[:reference]) From d141947eb01d1144b92771176ac0201f45a3198e Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 11 May 2018 14:06:23 +0630 Subject: [PATCH 51/70] update oqs and addorder qty 0 --- app/assets/javascripts/addorder.js | 9 +++++++-- .../javascripts/channels/order_queue_station.js | 11 +++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 19f56c35..344e663b 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -1001,8 +1001,13 @@ $(function() { }); //click save buttom after change qty $('#sx_itemModal').on('click','#save', function(){ - summary_items_filter(); - calculate_sub_total(); + if ($('#modal-qty').val()>0) { + summary_items_filter(); + calculate_sub_total(); + }else{ + swal("Opps", "Please enter number for qty ","warning"); + } + }); //calculate subtotal diff --git a/app/assets/javascripts/channels/order_queue_station.js b/app/assets/javascripts/channels/order_queue_station.js index c8b59231..a72a7893 100755 --- a/app/assets/javascripts/channels/order_queue_station.js +++ b/app/assets/javascripts/channels/order_queue_station.js @@ -29,18 +29,21 @@ App.order_queue_station = App.cable.subscriptions.create('OrderQueueStationChann //end count var date = new Date(items[field]["created_at"]); - var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes(); + // var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes(); + var show_date =date.getHours()+ ':' + date.getMinutes() +' '+(date.getHours() >= 12 ? 'PM' : 'AM'); if (oqs_id == items[field]["order_queue_station_id"]) { - + var table_type = (items[field]["table_type"] != null) ? items[field]["table_type"]:""; + var zone = (items[field]["zone"] != null) ? "-"+items[field]["zone"]:"No Table"; + (name === 'true') ? 'Y' :'N'; row ='
    ' +'' +'
    ' +'
    ' - +''+items[field]["table_type"]+'-'+ items[field]["zone"] +'' - +'' + +''+table_type+''+ zone+'' + +'' +''+items[field]["order_id"]+'' +'
    ' +'

    ' From 329af02a0a49abfb20e44faae6b3cca688eeff7b Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 11 May 2018 14:36:40 +0630 Subject: [PATCH 52/70] add cable .yml --- config/cable.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 config/cable.yml diff --git a/config/cable.yml b/config/cable.yml new file mode 100755 index 00000000..a383c5af --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,7 @@ +redis: &redis + adapter: redis + url: redis://localhost:6379/1 + +production: *redis +development: *redis +test: *redis \ No newline at end of file From 33e71f63a350b27c5d2525765b179de626b6bdbb Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Fri, 11 May 2018 15:29:06 +0630 Subject: [PATCH 53/70] Edit Dining Queue in CRM --- app/views/crm/dining_queues/_form.html.erb | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/app/views/crm/dining_queues/_form.html.erb b/app/views/crm/dining_queues/_form.html.erb index 51e2c097..7c50a06d 100755 --- a/app/views/crm/dining_queues/_form.html.erb +++ b/app/views/crm/dining_queues/_form.html.erb @@ -11,8 +11,8 @@ <%= f.input :queue_no , :class => "dining",:id => "dining", :readonly => true%> <%= f.hidden_field :customer_id %> <%= f.input :name %> - <%= f.input :contact_no %> - <%= f.input :seater %> + <%= f.input :contact_no , input_html: { min: 1, :onkeypress => "return isNumberKey(event);", :onkeyup => "notChar(this.value);" } %> + <%= f.input :seater , input_html: { min: 1, :onkeypress => "return isNumberKey(event);", :onkeyup => "notNegative(this.value);" } %> <%= f.input :remark %>


    @@ -111,11 +111,29 @@