From 1645f75fa3b70ae13ed144d4485247297dc37eec Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 7 Dec 2017 14:05:39 +0630 Subject: [PATCH] update report excel --- .../reports/receipt_no_controller.rb | 3 +- app/views/reports/receipt_no/index.html.erb | 4 +- app/views/reports/shiftsale/index.xls.erb | 62 ++++++++++--------- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index 9564bfe1..1b449f4c 100755 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -41,7 +41,8 @@ authorize_resource :class => false def show from, to = get_date_range_from_params - +puts from +puts to @sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED) date_arr = Array.new diff --git a/app/views/reports/receipt_no/index.html.erb b/app/views/reports/receipt_no/index.html.erb index 1d613fdf..99330ae9 100755 --- a/app/views/reports/receipt_no/index.html.erb +++ b/app/views/reports/receipt_no/index.html.erb @@ -165,7 +165,8 @@ var to = to_date.getDate() + "-" + to_date.getMonth() + "-" + to_date.getFullYear(); var from_date = new Date($('#from').val()); var from = from_date.getDate() + "-" + from_date.getMonth() + "-" + from_date.getFullYear(); - + $('#from').val(from) + $('#to').val(to) var period = 0; var period_type = 1; @@ -174,7 +175,6 @@ check_arr.push(to); - console.log(check_arr.length) if(check_arr.length == 1){ show_shift_name(period,period_type,from,to,'shift_item'); } diff --git a/app/views/reports/shiftsale/index.xls.erb b/app/views/reports/shiftsale/index.xls.erb index 2730b901..aa1d0231 100755 --- a/app/views/reports/shiftsale/index.xls.erb +++ b/app/views/reports/shiftsale/index.xls.erb @@ -1,6 +1,6 @@ -
+
<%= t("views.right_panel.detail.credit_payment") %> - <%= t("views.btn.other_payment") %> + <%= t("views.btn.foc") %> <%= t :payment %> @@ -51,37 +51,42 @@ <% g_total = 0 %> <% @sale_data.each do |result|%> - - - <%= result.cashier_terminal.name rescue '-'%> - - - <%= result.employee.name rescue '-'%> - - <%= result.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> - - <%= result.shift_closed_at.strftime("%e %b %I:%M%p") rescue '-' %> - - - <%= sprintf "%.2f",result.cash_sales.to_f.to_d rescue '-'%> - <%= sprintf "%.2f",result.credit_sales.to_f.to_d rescue '-'%> - - - <%= sprintf "%.2f",result.other_sales.to_f.to_d rescue '-'%> - <%= sprintf "%.2f",result.grand_total.to_f.to_d rescue '-'%> + + + + <%= result[:cashier_terminal_name] rescue '-'%> + + + <%= result[:employee_name] rescue '-'%> + + <%= result[:shift_started_at].strftime("%e %b %I:%M%p") rescue '-' %> - + <%= result[:shift_closed_at].strftime("%e %b %I:%M%p") rescue '-' %> + + + <%= sprintf "%.2f",result[:cash_sales].to_f.to_d rescue '-'%> + <%= sprintf "%.2f",result[:credit_sales].to_f.to_d rescue '-'%> + + + <%= sprintf "%.2f",result[:other_sales].to_f.to_d rescue '-'%> + + <%= sprintf "%.2f",result[:foc_sales].to_f.to_d rescue '-'%> + + <%= sprintf "%.2f",result[:grand_total].to_f.to_d rescue '-'%> - - <% grand_total = result.grand_total.to_f %> - + + <% grand_total = result[:grand_total].to_f %> + - <% cash += result.cash_sales.to_f %> - <% credit += result.credit_sales.to_f %> - <% card += result.other_sales.to_f %> + <% cash += result[:cash_sales].to_f %> + <% credit += result[:credit_sales].to_f %> + <% card += result[:other_sales].to_f %> + <% foc += result[:foc_sales].to_f %> - <% total += result.grand_total.to_f %> + <% total += result[:grand_total].to_f %> <% g_total += grand_total.to_f %> - <% end %> + <% end %> @@ -91,6 +96,7 @@ <%= sprintf("%.2f",card) rescue '-'%> + <%= sprintf("%.2f",foc) rescue '-'%> <%= sprintf("%.2f",g_total) rescue '-'%>