From 820b1d5e965ad326eb6222aafbe3ba07ea04d047 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 6 Jun 2017 10:19:15 +0630 Subject: [PATCH 01/17] update query in order queue printer --- app/models/printer/order_queue_printer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index 3428bb98..10757b94 100644 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -31,7 +31,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker left join bookings AS b ON b.booking_id = bo.booking_id left join dining_facilities AS df ON df.dining_facility_id = b.dining_facility_id left join customers as cus ON cus.customer_id = orders.customer_id") - .where("order_items.item_code=" + code) + .where("order_items.item_code='" + code + "'") .group("order_items.item_code") else OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining") @@ -40,7 +40,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker left join bookings AS b ON b.booking_id = bo.booking_id left join dining_facilities AS df ON df.dining_facility_id = b.dining_facility_id left join customers as cus ON cus.customer_id = orders.customer_id") - .where("orders.order_id=" + code.to_s) + .where("orders.order_id='" + code.to_s + "'") .group("order_items.item_code") end From 038a3c1696bf12161bcb3fa3ea14a7629ff4e2ba Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 6 Jun 2017 10:25:14 +0630 Subject: [PATCH 02/17] oqs print query update --- app/controllers/oqs/print_controller.rb | 2 +- app/models/printer/order_queue_printer.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/oqs/print_controller.rb b/app/controllers/oqs/print_controller.rb index 1b48fae6..8a12e439 100644 --- a/app/controllers/oqs/print_controller.rb +++ b/app/controllers/oqs/print_controller.rb @@ -2,7 +2,7 @@ class Oqs::PrintController < ApplicationController def print unique_code="OrderItemPdf" assigned_item_id=params[:id] - assigned_order_item=AssignedOrderItem.select("order_id, item_code").where('assigned_order_item_id='+assigned_item_id) + assigned_order_item=AssignedOrderItem.select("order_id, item_code").where("assigned_order_item_id='" + assigned_item_id + "'") print_settings=PrintSetting.find_by_unique_code(unique_code) order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index 10757b94..5a0eaf25 100644 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -29,7 +29,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker .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.dining_facility_id = b.dining_facility_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") .where("order_items.item_code='" + code + "'") .group("order_items.item_code") @@ -38,7 +38,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker .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.dining_facility_id = b.dining_facility_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") .where("orders.order_id='" + code.to_s + "'") .group("order_items.item_code") From e66dd33c1a21b9cd68ef89095a51762513426bcd Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 6 Jun 2017 10:27:59 +0630 Subject: [PATCH 03/17] updated order.rb --- app/models/order.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/models/order.rb b/app/models/order.rb index 3fabf91b..2ea073be 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -254,7 +254,7 @@ class Order < ApplicationRecord left join dining_facilities on dining_facilities.id = bookings.dining_facility_id left join order_items on order_items.order_id = orders.order_id") .where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,"dine_in",true) - .group("orders.order_id,order_items.id,dining_facilities.name") + .group("orders.order_id,order_items.order_item_id,dining_facilities.name") end #Origami: Cashier : to view orders @@ -270,9 +270,7 @@ class Order < ApplicationRecord left join sale_orders on sale_orders.order_id = orders.order_id left join sales on sales.sale_id = sale_orders.sale_id") .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) - - .group("orders.id,order_items.id,dining_facilities.name") - + .group("orders.order_id,order_items.order_item_id,dining_facilities.name") end From dcb8217824be452129f94e49e843cbe5dea0fb68 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 6 Jun 2017 10:32:38 +0630 Subject: [PATCH 04/17] updated order.rb for order_items_id --- app/models/order.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/models/order.rb b/app/models/order.rb index 2ea073be..e2548906 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -218,9 +218,8 @@ class Order < ApplicationRecord left join dining_facilities on dining_facilities.id = bookings.dining_facility_id left join order_items on order_items.order_id = orders.id") .where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true) - - .group("orders.id, order_items.id,dining_facilities.name") - + .group("orders.order_id, order_items.order_items_id,dining_facilities.name") + end def self.get_booking_order_table booking_orders = Booking.select("sales.receipt_no,orders.status as order_status, @@ -234,6 +233,7 @@ class Order < ApplicationRecord .group("bookings.booking_id") end + #Origami: Cashier : to view order type Room def self.get_booking_order_rooms booking_rooms = Booking.select("sales.receipt_no,orders.status as order_status,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as room_name") @@ -245,6 +245,7 @@ class Order < ApplicationRecord .where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true) .group("bookings.booking_id") end + #Origami: Cashier : to view order type Room def self.get_order_rooms order_rooms = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price, @@ -254,9 +255,10 @@ class Order < ApplicationRecord left join dining_facilities on dining_facilities.id = bookings.dining_facility_id left join order_items on order_items.order_id = orders.order_id") .where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,"dine_in",true) - .group("orders.order_id,order_items.order_item_id,dining_facilities.name") + .group("orders.order_id,order_items.order_items_id,dining_facilities.name") end + #Origami: Cashier : to view orders def self.get_orders from = Time.now.beginning_of_day.utc @@ -265,17 +267,15 @@ class Order < ApplicationRecord .joins("left join booking_orders on booking_orders.order_id = orders.order_id left join bookings on bookings.booking_id = booking_orders.order_id left join dining_facilities on dining_facilities.id = bookings.dining_facility_id - left join order_items on order_items.order_id = orders.order_id left join sale_orders on sale_orders.order_id = orders.order_id left join sales on sales.sale_id = sale_orders.sale_id") .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) - .group("orders.order_id,order_items.order_item_id,dining_facilities.name") + .group("orders.order_id,order_items.order_items_id,dining_facilities.name") end - - private + def generate_custom_id self.order_id = SeedGenerator.generate_id(self.class.name, "ODR") end @@ -283,4 +283,5 @@ class Order < ApplicationRecord def set_order_date self.date = Time.now.utc end + end From 231eec6a01c8b9e33529ce2e9548fa5b300690f3 Mon Sep 17 00:00:00 2001 From: PhyoTheingi Date: Tue, 6 Jun 2017 10:50:51 +0630 Subject: [PATCH 05/17] Payment delete bug fix --- app/views/settings/menu_item_options/show.html.erb | 3 +-- app/views/settings/payment_method_settings/index.html.erb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/settings/menu_item_options/show.html.erb b/app/views/settings/menu_item_options/show.html.erb index fdcb9d09..611f3165 100644 --- a/app/views/settings/menu_item_options/show.html.erb +++ b/app/views/settings/menu_item_options/show.html.erb @@ -2,8 +2,7 @@