From aeb729c8f49b406c47903932011ed81125dc47eb Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 30 Aug 2018 17:45:51 +0630 Subject: [PATCH] change query for report --- .../javascripts/channels/order_reservation.js | 2 ++ .../reports/order_reservation_controller.rb | 14 ++++++++++---- .../transactions/order_reservations/show.html.erb | 2 ++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/channels/order_reservation.js b/app/assets/javascripts/channels/order_reservation.js index fc8662b8..e1c67b76 100644 --- a/app/assets/javascripts/channels/order_reservation.js +++ b/app/assets/javascripts/channels/order_reservation.js @@ -24,6 +24,8 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel' delivery_type = "DELIVERY"; }else if(value.provider == "pick_up"){ delivery_type = "PICK-UP"; + }else if(value.provider == "turbo"){ + delivery_type = "TURBO"; }else{ delivery_type = "DIRECT DELIVERY"; } diff --git a/app/controllers/reports/order_reservation_controller.rb b/app/controllers/reports/order_reservation_controller.rb index 0966c619..b64c41bb 100644 --- a/app/controllers/reports/order_reservation_controller.rb +++ b/app/controllers/reports/order_reservation_controller.rb @@ -6,16 +6,22 @@ class Reports::OrderReservationController < BaseReportController from, to = get_date_range_from_params - @shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) + @shift_sale_range = '' @shift = '' if params[:shift_name].to_i != 0 + + @shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) + shift_sale = ShiftSale.find(params[:shift_name]) - if to.blank? + if to.blank? @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at) else - - @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at) + if shift_sale.shift_closed_at.blank? + @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',shift_sale.shift_started_at) + else + @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at) + end end end diff --git a/app/views/transactions/order_reservations/show.html.erb b/app/views/transactions/order_reservations/show.html.erb index 6b3d226a..510fe59e 100755 --- a/app/views/transactions/order_reservations/show.html.erb +++ b/app/views/transactions/order_reservations/show.html.erb @@ -252,6 +252,8 @@ provider = "Pick-Up" elsif @delivery.provider == 'direct_delivery' provider = "Direct Delivery" + elsif @delivery.provider == 'turbo' + provider = "TURBO" else provider = @delivery.provider end