From d800a5d28d5165598e6d68c4a60c69131b8d0c29 Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 12 Apr 2018 11:11:51 +0630 Subject: [PATCH 01/39] 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/39] 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/39] 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 c6f654808ce22b9a44f3b2c7b26cfc831c9aa6fd Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 4 May 2018 14:09:58 +0630 Subject: [PATCH 04/39] add dine-in cashier settings in lookups --- README.md | 4 ++++ app/controllers/origami/dashboard_controller.rb | 7 +++++++ app/controllers/origami/order_reservation_controller.rb | 2 +- app/models/order_reservation.rb | 5 +++-- app/views/origami/dashboard/index.html.erb | 2 ++ 5 files changed, 17 insertions(+), 3 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/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/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/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' %>
From 727070a1b8c9823d9863170dfcc612b85d545f05 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 4 May 2018 14:19:17 +0630 Subject: [PATCH 05/39] 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 ddc759926b346951d0a61dd3db5ec08092ff7efa Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 4 May 2018 16:52:18 +0630 Subject: [PATCH 09/39] 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 d0b14cf81b44e3bffbfdc97ee7439467d9ec04f1 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 4 May 2018 18:10:00 +0630 Subject: [PATCH 10/39] 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 13/39] 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 23/39] 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' %>