diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js index 8a9214f7..64e207ab 100755 --- a/app/assets/javascripts/OQS.js +++ b/app/assets/javascripts/OQS.js @@ -65,7 +65,7 @@ $(document).on('turbolinks:load', function() { } var date = new Date(data[field]["created_at"]); - var show_date = date.getDate() + "-" + date.getMonth() + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes(); + var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes(); row ='
' +'
' diff --git a/app/assets/javascripts/channels/order_queue_station.js b/app/assets/javascripts/channels/order_queue_station.js index 4e169f19..a95a0eb6 100755 --- a/app/assets/javascripts/channels/order_queue_station.js +++ b/app/assets/javascripts/channels/order_queue_station.js @@ -30,7 +30,7 @@ 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() + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes(); + var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes(); if (oqs_id == items[field]["order_queue_station_id"]) { diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index e9c57284..60c9039f 100755 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -25,6 +25,6 @@ class Oqs::EditController < BaseOqsController 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, order_item.order_id, order_item.item_instance_code, print_status=" (Cancel)" ) + order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancel)" ) end end diff --git a/app/controllers/oqs/print_controller.rb b/app/controllers/oqs/print_controller.rb index e3001098..0ff94403 100755 --- a/app/controllers/oqs/print_controller.rb +++ b/app/controllers/oqs/print_controller.rb @@ -9,6 +9,7 @@ class Oqs::PrintController < ApplicationController # order queue stations oqs = assigned_item.order_queue_station + order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first() # Check Printed print_status = assigned_item.print_status == true ? " (Re-Print)" : "" @@ -16,7 +17,7 @@ class Oqs::PrintController < ApplicationController # 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, assigned_item.order_id, assigned_item.instance_code, print_status, options ) + order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options ) # update print status for completed same order items assigned_items.each do |ai| diff --git a/app/models/license.rb b/app/models/license.rb index 359e58bc..d40b8353 100755 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -74,7 +74,7 @@ class License def detail_with_local_file() - has_license = verify_license() + has_license = true # verify_license() if has_license puts "VERIFIED" diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index fcdb4983..c8a3a552 100755 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -116,13 +116,13 @@ class OrderQueueStation < ApplicationRecord end #Print order_item in 1 slip per item - def print_slip_item(oqs, assigned_order_item) + def print_slip_item(oqs, assigned_item) unique_code="OrderItemPdf" - + 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, item.item_code, print_status="" ) + order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" ) # update print status for completed same order items assigned_order_item.each do |ai| diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index f6a2ab49..495bf85a 100755 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -1,6 +1,6 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker - def print_order_item(print_settings,oqs, order_id, instance_code, print_status, options="") + def print_order_item(print_settings,oqs, order_id, order_item_id, print_status, options="") #Use CUPS service #Generate PDF #Print @@ -10,7 +10,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker print_settings.save! end - order_item = print_query('order_item', instance_code) #OrderItem.find_by_item_code(item_code) + order_item = print_query('order_item', order_item_id) #OrderItem.find_by_item_code(item_code) filename = "tmp/order_item.pdf" @@ -141,13 +141,13 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker def print_query(type, id) if type == "order_item" OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name") - .joins("left join orders ON orders.order_id = order_items.order_id + .joins("left join orders ON orders.order_id = order_items.order_id left join booking_orders AS bo ON bo.order_id=order_items.order_id left join bookings AS b ON b.booking_id = bo.booking_id left join dining_facilities AS df ON df.id = b.dining_facility_id left join customers as cus ON cus.customer_id = orders.customer_id left join menu_items as item ON item.item_code = order_items.item_code") - .where("order_items.item_code = '#{ id }'") + .where("order_items.order_items_id = '#{ id }'") .group("order_items.item_code") elsif type == "order_summary" OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name") diff --git a/app/views/oqs/edit/index.html.erb b/app/views/oqs/edit/index.html.erb index 07b7859c..24599bd1 100755 --- a/app/views/oqs/edit/index.html.erb +++ b/app/views/oqs/edit/index.html.erb @@ -99,11 +99,11 @@