From bb4c00440658e5170357bf58bd782ea44f0230de Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Fri, 4 May 2018 18:00:44 +0630 Subject: [PATCH 1/2] 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 7cc7419b67d696d6ce89295e7864d97012280ad8 Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Mon, 7 May 2018 10:22:15 +0630 Subject: [PATCH 2/2] Edit waste and spoile report excel --- .../reports/waste_and_spoilage/index.xls.erb | 113 +++++++++++------- 1 file changed, 69 insertions(+), 44 deletions(-) diff --git a/app/views/reports/waste_and_spoilage/index.xls.erb b/app/views/reports/waste_and_spoilage/index.xls.erb index 4b4fa0a3..48f26650 100755 --- a/app/views/reports/waste_and_spoilage/index.xls.erb +++ b/app/views/reports/waste_and_spoilage/index.xls.erb @@ -5,52 +5,77 @@
Report For <%= @sale_type? @sale_type : 'Waste' %>
- <% @sale_data.each do |sale| %> + <% receipt_arr = Array.new %> + <% menu_cat_arr = Array.new %> + <% footer_arr = Array.new %> + <% count = 0 %> <% waste_and_spoil_item_count = 0%> - - - - - - - - - - - - - - - + + <% @sale_data.each do |sale| %> + <% if !receipt_arr.include?(sale.receipt_no) %> + + + + + + + + + + + + + + + + + + <% receipt_arr.push(sale.receipt_no) %> + <% menu_cat_arr.clear %> + <% count = 0 %> + <% end %> - <% sale.sale_items.each do |item| %> - <% if !item.item_instance_code.nil?%> - <% waste_and_spoil_item_count += item.qty.to_i%> - - - - - - - - <% end %> - <% end %> - - - - - - - - <% end %> + + + <% if !sale.item_instance_code.nil?%> + <% waste_and_spoil_item_count += sale.qty.to_i %> + + <% if !menu_cat_arr.include?(sale.name) %> + + <% menu_cat_arr.push(sale.name) %> + <% else %> + + <% end %> + + + + + + + <% end %> + <% count = count + 1 %> + <% if sale.sale_items.count == count %> + + + + + + + + <% footer_arr.push(sale.sale_id) %> + <% end %> + + <% end %>
- Receipt No :<%= sale.receipt_no %> - Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %>
Item NameItem CodeQtyPriceTotal Price
 
+ Receipt No :<%= sale.receipt_no %> + Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %>
Menu CategoryItem NameItem CodeQtyPriceTotal Price
<%= item.product_name %><%= item.product_code %><%= item.qty %><%= item.price %><%= item.price %>
Total Qty: - <%= waste_and_spoil_item_count %> - Grand Total: - - <%= sale.grand_total %> - -
<%= sale.name %> <%= sale.product_name %><%= sale.product_code %><%= sale.qty.to_i %><%= sale.unit_price %><%= sale.price %>
Total Qty: + + <%= waste_and_spoil_item_count %> + <% waste_and_spoil_item_count = 0%> + Grand Total: + + <%= sale.grand_total %> + +