diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 6203d513..0c4363db 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -834,7 +834,6 @@ $(function() { option_name = ' '; data_option = '[]'; } -console.log(d_option) var rowCount = $('.summary-items tbody tr').length+1; var item_row = $('.summary-items tbody tr'); @@ -842,7 +841,7 @@ console.log(d_option) item_code = $(item_row[i]).attr('data-code'); instance_code = $(item_row[i]).attr('data-instance-code'); r_option = $(item_row[i]).attr('data-opt'); - console.log(r_option) + if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option == d_option) { if (qty > 1) { qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty; diff --git a/app/controllers/origami/pending_order_controller.rb b/app/controllers/origami/pending_order_controller.rb index 9a413316..4fa6002b 100644 --- a/app/controllers/origami/pending_order_controller.rb +++ b/app/controllers/origami/pending_order_controller.rb @@ -4,11 +4,12 @@ class Origami::PendingOrderController < BaseOrigamiController # @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d')) @sale = Sale.pending_sale @order = Sale.pending_order - + @completed = Sale.completed_sale end def show @sales = Sale.pending_sale @orders = Sale.pending_order + @completed = Sale.completed_sale @id = params[:sale_id] if(@id[0,3] == "SAL") @sale = Sale.find(@id) @@ -41,4 +42,27 @@ class Origami::PendingOrderController < BaseOrigamiController end end + + def completed_sale + @sales = Sale.pending_sale + @orders = Sale.pending_order + @completed = Sale.completed_sale + @id = params[:sale_id] + + @sale = Sale.find(@id) + @order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id + @booking = BookingOrder.find_by_order_id(@order).booking_id + @bookings = Booking.find(@booking) + @status = "sale" + + if @bookings.dining_facility_id.to_i > 0 + @table_id = Booking.find(@bookings.booking_id).dining_facility_id + @dining = DiningFacility.find(@table_id) + else + @table_id = nil + @dining = nil + end + + end + end diff --git a/app/models/menu_category.rb b/app/models/menu_category.rb index 6440444a..948ffe69 100755 --- a/app/models/menu_category.rb +++ b/app/models/menu_category.rb @@ -45,16 +45,21 @@ class MenuCategory < ApplicationRecord from_t = Time.parse(menu.valid_time_from.strftime("%H:%M:%S")) to_t = Time.parse(menu.valid_time_to.strftime("%H:%M:%S")) current_t = Time.parse(Time.now.utc.getlocal.strftime("%H:%M:%S")) - + from = from_t.hour * 3600 + from_t.min*60 + from_t.sec to = to_t.hour * 3600 + to_t.min* 60 + to_t.sec current = current_t.hour * 3600 + current_t.min*60+current_t.sec + if from > to h = to_t.hour if h < 12 # before noon if h == 0 to = 24 to = to * 3600 + to_t.min* 60 + to_t.sec + else + + h += 24 + to = h*3600 + to_t.min* 60 + to_t.sec end else # (after) noon if h > 12 @@ -64,13 +69,9 @@ class MenuCategory < ApplicationRecord end end - # from = from.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b} - # to = to.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b} - # current = current.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b} - day = Date.today.wday dayresult = menu.valid_days.include?(day.to_s) - + if current.between?(from, to) && menu.valid_days.include?(day.to_s) return true else diff --git a/app/models/sale.rb b/app/models/sale.rb index 522fcd62..acf76f0d 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -2604,6 +2604,13 @@ end query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","quick_service") .group("bookings.booking_id") end + def self.completed_sale + query = Sale.all + query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id") + .joins("join orders as orders on orders.order_id = sale_orders.order_id") + query = query.where("sales.sale_status != 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service") + .group("sales.sale_id") + end def self.all_receipts query = Sale.select("sale_payments.created_at as receipt_close_time, diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index fe42bbf3..95a6a277 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -206,7 +206,7 @@ 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/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb old mode 100755 new mode 100644 index fd823182..7e8cbb2c --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -1,14 +1,16 @@ <%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %> -
+ <% type = request.path_info.include?('quick_service')%> <% modify_order = request.path_info.include?('modify_order')%> - -