diff --git a/app/assets/javascripts/channels/order_reservation.js b/app/assets/javascripts/channels/order_reservation.js index e1c67b76..1d7dfa97 100644 --- a/app/assets/javascripts/channels/order_reservation.js +++ b/app/assets/javascripts/channels/order_reservation.js @@ -76,6 +76,11 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel' if (typeof customTableClick !== 'undefined' && $.isFunction(customTableClick)) { customTableClick(); } + + if(parseInt(getOnlineOrderCount()) > 0){ + $('.order_no').addClass("order-badge"); + $('.order_no').html(parseInt(getOnlineOrderCount())); + } } } }); diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index 005d6c6a..33316a31 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -64,7 +64,17 @@ $(document).ready(function() { $('#modal-set-slimscroll').slimScroll({ height: height-$('#modal-set-slimscroll').attr('data-height'), - size: '5px', + size: '10px', + color: 'rgba(0,0,0,0.5)', + alwaysVisible: false, + borderRadius: '0', + railBorderRadius: '0', + touchScrollStep : 45 + }); + + $('#set-menu-item-slimscroll').slimScroll({ + height: height-$('#set-menu-item-slimscroll').attr('data-height'), + size: '10px', color: 'rgba(0,0,0,0.5)', alwaysVisible: false, borderRadius: '0', @@ -176,4 +186,25 @@ function audioPlayBackground(shop_code,audio){ audio.play(); // },10000); } -/* end order reservation function */ \ No newline at end of file +/* end order reservation function */ + +/* online order count*/ +function getOnlineOrderCount(){ + var count = 0; + //Start Ajax + $.ajax({ + async: false, + type: "GET", + url: "/origami/get_order_info", + dataType: "json", + success: function(data){ + if(parseInt(data) > 0){ + count = parseInt(data); + } + } + }); + //end Ajax + // alert(count); + return count; +} +/* online order count*/ \ No newline at end of file diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js index 46d035fe..d1ed693e 100644 --- a/app/assets/javascripts/order_reservation.js +++ b/app/assets/javascripts/order_reservation.js @@ -20,6 +20,7 @@ $(function() { $('#cancel').hide(); $(".tbl_customer").hide(); $(".order_close_cashier").hide(); + $(".order_btns").show(); refreshDetailData(); if (type == "pending") { $(".first-1").click(); @@ -41,6 +42,7 @@ $(function() { }else if(type == "processed"){ $(".fifth-1").click(); $(".order_close_cashier").show(); + $(".order_btns").hide(); // $('#accepted').hide(); // $('#cancel').hide(); } @@ -501,6 +503,10 @@ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reas // } // } // }); + if(parseInt(getOnlineOrderCount()) > 0){ + $('.order_no').addClass("order-badge"); + $('.order_no').html(parseInt(getOnlineOrderCount())); + } } function showNewOrderAlert(order_reservation,shop_code){ @@ -601,4 +607,25 @@ function timeFormat(date){ (isPM ? ' PM' : ' AM'); return time; } -/* end order reservation function */ \ No newline at end of file +/* end order reservation function */ + +/* online order count*/ +function getOnlineOrderCount(){ + var count = 0; + //Start Ajax + $.ajax({ + async: false, + type: "GET", + url: "/origami/get_order_info", + dataType: "json", + success: function(data){ + if(parseInt(data) > 0){ + count = parseInt(data); + } + } + }); + //end Ajax + // alert(count); + return count; +} +/* online order count*/ \ No newline at end of file diff --git a/app/assets/stylesheets/order_reservation.scss b/app/assets/stylesheets/order_reservation.scss index 4a5c591a..e46ce76d 100644 --- a/app/assets/stylesheets/order_reservation.scss +++ b/app/assets/stylesheets/order_reservation.scss @@ -54,6 +54,7 @@ .custom-card-footer .table td:first-child, .custom-card-footer .table td:nth-child(2){ border-top:0px solid !important; + height: 20px; } .custom-card-footer .footer-td , @@ -62,13 +63,16 @@ border-bottom:0px solid !important; font-weight: bold; padding:6px 10px; + height: 64px; } .custom-card-header{ border-bottom: 1px solid #F8BBD0 !important; padding:13px 5px !important; + height: 50px; } .custom-card-footer{ border-top: 1px solid #F8BBD0 !important; + border-bottom: 1px solid #FAFAFA !important; } .custom-card-block, .grand-card-footer, @@ -87,8 +91,12 @@ background-color : #FFCDD2; } .div_order_margin { - margin: 0px 0px 0px -5px !important + margin: -4px 0px 0px -5px !important } .div_card_order { margin: 0px -5px !important +} +td.grand-total-padding { + font-size: 17px; + padding-top: 20px !important; } \ No newline at end of file diff --git a/app/assets/stylesheets/reset.css b/app/assets/stylesheets/reset.css index 78f23e15..1326a293 100644 --- a/app/assets/stylesheets/reset.css +++ b/app/assets/stylesheets/reset.css @@ -283,4 +283,41 @@ section.content { padding: 0.5rem 0.44rem; } /* End Reset Theme */ + +/* shop name margin */ +.shop-name-margin { + margin-left : 20%; +} +/* shop name margin */ + +/* online order margin */ +.online-order-margin { + margin-left : 22%; + margin-bottom : 9.9999px; +} +/* online order margin */ +/* default-header-color */ +div.online-order-margin > div > span { + color : #FAFAFA; +} +/* default-header-color */ +/* order-no color */ +.order-badge { + position: absolute; + background: #ff6600; + height: 1.8rem; + bottom: -0.1rem; + right: -1.3rem; + width: 1.8rem; + text-align: center; + line-height: 1.7rem; + font-size: 0.9rem; + border-radius: 50%; + color: white; + border: 1px solid #ff6600; + font-family: sans-serif; + font-weight: bold; +} +/* order-no color */ + /* *************************************************** */ \ No newline at end of file diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index e52abeea..38b7ea0b 100755 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -99,11 +99,11 @@ class Crm::DiningQueuesController < BaseCrmController table_id = params[:table_id] dining_facility = DiningFacility.find(params[:table_id]) - if dining_facility.type == "Table" + # if dining_facility.type == "Table" type = "TableBooking" - else - type = "RoomBooking" - end + # else + # type = "RoomBooking" + # end booking = Booking.create({:dining_facility_id => params[:table_id],:type => type, :checkin_at => Time.now.utc,:customer_id => queue.customer_id,:booking_status => "assign" }) diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index fcfdcbb4..f4f993d5 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -96,4 +96,9 @@ class Origami::OrderReservationController < BaseOrigamiController render :json => response end + def get_order_info + order_reservation = OrderReservation.where("status = 'new' OR status='accepted' OR status='send_to_kitchen' OR status = 'ready_to_delivery'").count() + render :json => order_reservation + end + end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index d45e4039..304e0d90 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -91,7 +91,7 @@ class Origami::PaymentsController < BaseOrigamiController printer = Printer::ReceiptPrinter.new(print_settings) - filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount) + filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount,nil) result = { :filepath => filename, @@ -111,6 +111,7 @@ class Origami::PaymentsController < BaseOrigamiController type = params[:type] tax_type = params[:tax_type] path = request.fullpath + latest_order_no = nil if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) @@ -204,6 +205,11 @@ class Origami::PaymentsController < BaseOrigamiController table_id = 0 end + latest_order = booking.booking_orders.order("order_id DESC").limit(1).first() + if !latest_order.nil? + latest_order_no = latest_order.order_id + end + booking.booking_orders.each do |order| # Order.pay_process_order_queue(order.order_id, table_id) oqs = OrderQueueStation.new @@ -237,7 +243,7 @@ class Origami::PaymentsController < BaseOrigamiController other_amount = SaleItem.calculate_other_charges(sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data,other_amount) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data,other_amount,latest_order_no) render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name}) @@ -442,11 +448,17 @@ class Origami::PaymentsController < BaseOrigamiController def reprint sale_id = params[:sale_id] member_info = nil - + latest_order_no = nil saleObj = Sale.find(sale_id) # For Cashier by Zone bookings = Booking.where("sale_id='#{sale_id}'") + + booking = Booking.find_by_sale_id(sale_id) + latest_order = booking.booking_orders.joins(" JOIN orders ON orders.order_id = booking_orders.order_id").where("orders.source = 'quick_service'").order("order_id DESC").limit(1).first() + if !latest_order.nil? + latest_order_no = latest_order.order_id + end # if bookings.count > 1 # # for Multiple Booking # table = DiningFacility.find(bookings[0].dining_facility_id) @@ -514,7 +526,7 @@ class Origami::PaymentsController < BaseOrigamiController other_amount = SaleItem.calculate_other_charges(saleObj.sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data,other_amount) + filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data,other_amount,latest_order_no) result = { :status => true, @@ -600,7 +612,7 @@ class Origami::PaymentsController < BaseOrigamiController printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "FOC",nil,nil,other_amount) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "FOC",nil,nil,other_amount,nil) result = { :status => true, :filepath => filename, diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index e9c17ca1..1e9acafb 100755 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -126,7 +126,7 @@ class Origami::VoidController < BaseOrigamiController discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items) other_amount = SaleItem.calculate_other_charges(sale.sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount,nil) result = { :filepath => filename, :printer_model => print_settings.brand_name, diff --git a/app/controllers/origami/waste_spoile_controller.rb b/app/controllers/origami/waste_spoile_controller.rb index 2aa1bb77..6d2bb094 100755 --- a/app/controllers/origami/waste_spoile_controller.rb +++ b/app/controllers/origami/waste_spoile_controller.rb @@ -107,7 +107,7 @@ class Origami::WasteSpoileController < BaseOrigamiController discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items) other_amount = SaleItem.calculate_other_charges(sale.sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil,other_amount) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil,other_amount,nil) result = { :filepath => filename, :printer_model => print_settings.brand_name, diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb index 7568a39a..c1e58f6f 100755 --- a/app/controllers/transactions/sales_controller.rb +++ b/app/controllers/transactions/sales_controller.rb @@ -363,7 +363,7 @@ class Transactions::SalesController < ApplicationController other_amount = SaleItem.calculate_other_charges(sale.sale_items) #other charges printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount,nil) result = { :filepath => filename, :printer_model => print_settings.brand_name, diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb index f77fc96c..607232af 100755 --- a/app/models/printer/receipt_printer.rb +++ b/app/models/printer/receipt_printer.rb @@ -188,19 +188,19 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker end #Bill Receipt Print - def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data,other_amount) + def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data,other_amount,latest_order_no) #Use CUPS service #Generate PDF #Print - pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount) + pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no) receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf if !receipt_bill_a5_pdf.empty? receipt_bill_a5_pdf.each do |receipt_bilA5| if receipt_bilA5[0] == 'ReceiptBillA5Pdf' if receipt_bilA5[1] == '1' - pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount) + pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no) else - pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount) + pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no) end end end diff --git a/app/pdf/receipt_bill_a5_pdf.rb b/app/pdf/receipt_bill_a5_pdf.rb index 3a02eeef..945ca437 100644 --- a/app/pdf/receipt_bill_a5_pdf.rb +++ b/app/pdf/receipt_bill_a5_pdf.rb @@ -2,7 +2,7 @@ class ReceiptBillA5Pdf < Prawn::Document include ActionView::Helpers::NumberHelper attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move - def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount) + def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount,latest_order_no) self.page_width = printer_settings.page_width self.page_height = printer_settings.page_height self.header_font_size = printer_settings.header_font_size.to_i @@ -56,7 +56,7 @@ class ReceiptBillA5Pdf < Prawn::Document stroke_horizontal_rule - cashier_info(sale_data, customer_name) + cashier_info(sale_data, customer_name, latest_order_no) line_items(sale_items,printer_settings.precision,delimiter) all_total(sale_data,printer_settings.precision,delimiter) @@ -112,7 +112,7 @@ class ReceiptBillA5Pdf < Prawn::Document stroke_horizontal_rule end - def cashier_info(sale_data, customer_name) + def cashier_info(sale_data, customer_name, latest_order_no) move_down line_move # move_down 2 y_position = cursor @@ -160,6 +160,14 @@ class ReceiptBillA5Pdf < Prawn::Document # :size => self.item_font_size,:align => :right # end + if !latest_order_no.nil? + y_position = cursor + move_down line_move + bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do + text "OrderNo : #{ latest_order_no }",:size => self.item_font_size,:align => :left + end + end + move_down line_move stroke_horizontal_rule end @@ -659,7 +667,7 @@ class ReceiptBillA5Pdf < Prawn::Document move_down line_move y_position = cursor - text "#{shop.note}", :size => self.item_font_size,:align => :center + text "#{shop.note}", :size => self.item_font_size,:align => :left move_down line_move end diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 92f2e3c9..5902469f 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -3,7 +3,7 @@ class ReceiptBillPdf < Prawn::Document attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move - def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount) + def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,other_charges_amount,latest_order_no) self.page_width = printer_settings.page_width self.page_height = printer_settings.page_height self.header_font_size = printer_settings.header_font_size.to_i @@ -57,7 +57,7 @@ class ReceiptBillPdf < Prawn::Document stroke_horizontal_rule - cashier_info(sale_data, customer_name) + cashier_info(sale_data, customer_name, latest_order_no) line_items(sale_items,printer_settings.precision,delimiter) all_total(sale_data,printer_settings.precision,delimiter) @@ -112,7 +112,7 @@ class ReceiptBillPdf < Prawn::Document stroke_horizontal_rule end - def cashier_info(sale_data, customer_name) + def cashier_info(sale_data, customer_name, latest_order_no) move_down line_move # move_down 2 @@ -153,7 +153,13 @@ class ReceiptBillPdf < Prawn::Document # - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" , # :size => self.item_font_size,:align => :right # end - + if !latest_order_no.nil? + y_position = cursor + move_down line_move + bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do + text "OrderNo : #{ latest_order_no }",:size => self.item_font_size,:align => :left + end + end move_down line_move stroke_horizontal_rule end @@ -659,7 +665,7 @@ class ReceiptBillPdf < Prawn::Document move_down line_move y_position = cursor - text "#{shop.note}", :size => self.item_font_size,:align => :center + text "#{shop.note}", :size => self.item_font_size, :align => :left move_down line_move end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index d21b1743..c8cec5ea 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -36,12 +36,22 @@ -