updated for receipt rpt for shift

This commit is contained in:
Yan
2017-07-08 18:20:42 +06:30
parent 9158f0e93a
commit 94555bc325
3 changed files with 19 additions and 12 deletions

View File

@@ -7,17 +7,19 @@ authorize_resource :class => false
# else
# @shift = ShiftSale.where("(shift_started_at between ? and ? OR shift_closed_at between ? and ? )", from, to, from, to).take
# end
puts "2017-07-07T10:46:09.000Z - 2017-07-07T11:12:51.000Z"
puts "2017-06-25 17:30:00 UTC 2017-07-02 17:29:59 UTC"
puts params[:shift_name]
puts from.utc
puts to.utc
# puts "2017-07-07T10:46:09.000Z - 2017-07-07T11:12:51.000Z"
# puts "2017-06-25 17:30:00 UTC 2017-07-02 17:29:59 UTC"
# puts params[:shift_name]
# puts from.utc
# puts to.utc
if params[:shift_name].to_i != 0
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at =?',from,to).take
puts @shift.to_json
@sale_data = Sale.where('shift_sale_id = ? ',@shift.id)
@sale_taxes = Sale.get_separate_tax(from,to)
@shift = ShiftSale.where('shift_started_at >= ? and shift_closed_at <= ?',from,to).take
# puts @shift.to_json
if @shift.present?
@sale_data = Sale.where('shift_sale_id = ? ',@shift.id)
@sale_taxes = Sale.get_separate_tax(from,to)
end
else
@sale_data = Sale.where("sale_status=? and receipt_date between ? and ?","completed",from.utc,to.utc)
@sale_taxes = Sale.get_separate_tax(from.utc,to.utc)