<% unless @sale_data.empty? %>

<%=current_active_location.name%>

Sales Summary Report (BreadTalk)

<% if params[:from]%>

From Date : <%= params[:from] %> , To Date : <%= params[:to] %>

<% end %> <% void = 0 %> <% card = 0 %> <% credit_payment = 0 %> <% cash = 0 %> <% credit = 0 %> <% foc = 0 %> <% discount = 0 %> <% total = 0 %> <% count = 1 %> <% discount_rev = 0 %> <% total_rev = 0 %> <% grand_rev = 0 %> <% total_other_charges=0 %> <% total_tax=0 %> <% cash_received = 0 %> <% total_cash_received = 0 %> <% today_credit_payment_amount = 0 %> <% old_location_id = 0%> <% sub_total = 0 %> <% count_of_void = 0 %> <% flag = false %> <% @sale_data.each do |sale| %> <% credit_payment += sale[:credit_payment].to_f %> <% card += sale[:card_amount].to_f %> <% cash += sale[:cash_amount].to_f %> <% credit += sale[:credit_amount].to_f %> <% foc += sale[:foc_amount].to_f %> <% discount += sale[:total_discount].to_f %> <% total += sale[:grand_total].to_f %> <% total_other_charges +=sale[:other_charges].to_f %> <% total_tax +=sale[:total_tax].to_f %> <% cash_received = sale[:cash_amount].to_f + sale[:credit_payment].to_f%> <% total_cash_received = cash.to_f + credit_payment.to_f%> <% today_credit_payment_amount += sale[:today_credit_payment].to_f %> <% total_void_amount = 0 %> <% if !@daily_void.nil? %> <% @daily_void.each do |d_v|%> <% if d_v[:daily_void_amt].to_i > 0 %> <% if d_v[:location_id] == sale[:location_id] %> <% if d_v[:date].utc.getlocal.strftime("%Y-%m-%d").to_s == sale[:sale_date].to_s%> <%count_of_void+=1%> <%total_void_amount += d_v[:daily_void_amt].to_f%> <% flag = true %> <%end %> <% end%> <% end%> <% end%> <% end%> <% if flag == true%> <% void += total_void_amount.to_f %> <% flag = false %> <% end%> <%if count_of_void == 0%> <%end %> <%count_of_void= 0%> <% count = count + 1 %> <% end %> <% end %>
Location Name Date Cash Sales Credit Sales Credit Received Card Payment Total Discount Total Taxes Total Other Charges FOC Sales Void Sales Grand Total
<%= sale[:location].to_s rescue '-' %> <%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %> <%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:credit_payment].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:card_amount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:total_discount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:total_tax].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:other_charges].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",total_void_amount.to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",0.to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",((sale[:cash_amount].to_f + sale[:credit_amount].to_f + sale[:card_amount].to_f + sale[:credit_payment].to_f) - sale[:today_credit_payment].to_f) ).to_f, :delimiter => ',') %>
Grand Total <%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",credit ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",credit_payment ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",card ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",discount ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",total_tax ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",total_other_charges ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",foc ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",void ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f", (cash.to_f + credit.to_f + card.to_f + credit_payment.to_f) - today_credit_payment_amount.to_f ).to_f, :delimiter => ',') %>