updated for receipt rpt for shift
This commit is contained in:
@@ -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
|
||||
@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)
|
||||
|
||||
@@ -583,7 +583,7 @@ def self.get_by_shift_sale(from,to,status)
|
||||
" grand_total AS grand_total, cash_sales AS cash," +
|
||||
"total_taxes AS total_tax,total_discounts As total_discount")
|
||||
.order("shift_sales.id DESC")
|
||||
return query = query.where("shift_sales.shift_started_at between ? and ?" + " or shift_sales.shift_closed_at between ? and ?",from,to ,from,to )
|
||||
return query = query.where("shift_sales.shift_started_at >= ?" + " AND shift_sales.shift_closed_at <= ?", from,to)
|
||||
end
|
||||
|
||||
def self.get_separate_tax(from,to,payment_type=nil)
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
<% total_nett = 0 %>
|
||||
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
|
||||
|
||||
<% @sale_data.each do |result| %>
|
||||
<%
|
||||
if @sale_data!=nil
|
||||
@sale_data.each do |result| %>
|
||||
|
||||
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
|
||||
<% total_tax += result.total_tax.to_f %>
|
||||
@@ -83,7 +85,10 @@
|
||||
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="2"> </td>
|
||||
<td><b><%= total_sum rescue '-'%></b></td>
|
||||
|
||||
Reference in New Issue
Block a user