change query for report

This commit is contained in:
phyusin
2018-08-30 17:45:51 +06:30
parent 78da662a57
commit aeb729c8f4
3 changed files with 14 additions and 4 deletions

View File

@@ -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";
}

View File

@@ -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

View File

@@ -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