From f03d8654e71b8d5460d339c3f1edfe8355ad0b73 Mon Sep 17 00:00:00 2001 From: Zin Lin Phyo Date: Tue, 29 Aug 2017 18:36:46 +0630 Subject: [PATCH] commission report --- .idea/sxrestaurant.iml | 3 + .idea/workspace.xml | 695 +++++++----------- Gemfile | 5 +- Gemfile.lock | 14 + app/assets/javascripts/application.js | 3 + app/assets/stylesheets/application.scss | 2 + .../reports/commission_controller.rb | 21 +- app/models/commission.rb | 1 - app/models/product_commission.rb | 11 +- app/models/promotion.rb | 2 +- app/views/layouts/_header.html.erb | 2 +- .../_commission_report_filter.html.erb | 134 ++-- app/views/reports/commission/index.html.erb | 192 +---- app/views/reports/commission/index.xls.erb | 100 +-- dump.rdb | Bin 616 -> 743 bytes 15 files changed, 412 insertions(+), 773 deletions(-) diff --git a/.idea/sxrestaurant.iml b/.idea/sxrestaurant.iml index 0413cc5e..7db49a58 100644 --- a/.idea/sxrestaurant.iml +++ b/.idea/sxrestaurant.iml @@ -38,6 +38,7 @@ + @@ -80,6 +81,7 @@ + @@ -112,6 +114,7 @@ + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index bda1b51d..e3687c57 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,32 +2,21 @@ + + - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - + + + + @@ -42,7 +31,7 @@ - + @@ -69,51 +58,58 @@ - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - + + @@ -122,28 +118,38 @@ - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + @@ -173,6 +179,8 @@ green reports_dailysale_index_path mom + gem "select2-rails" + custom_excel @@ -181,7 +189,6 @@ @@ -255,11 +263,11 @@ - + @@ -294,78 +302,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -373,70 +315,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -452,71 +336,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - + +
- - -
-
- - + + <% @commissioner.each do |c| %> + + <% end %>
@@ -44,76 +28,42 @@
\ No newline at end of file + diff --git a/app/views/reports/commission/index.html.erb b/app/views/reports/commission/index.html.erb index 9f75c8d5..4715b00c 100644 --- a/app/views/reports/commission/index.html.erb +++ b/app/views/reports/commission/index.html.erb @@ -6,112 +6,66 @@
- <%= render :partial=>'commission_report_filter', - :locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_commission_index_path} %> -
+ <%= render :partial => 'commission_report_filter', + :locals => {:period_type => true, :shift_name => true, :report_path => reports_commission_index_path} %> +
-
- + - <% if @shift_from %> - - <% if @shift_data.employee %> - <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> - <% end %> - - - <% end %> - - - - - - - - - - - - + + + + + + - <% void = 0%> - <% cash = 0%> - <% credit = 0%> - <% accept_credit = 0%> - <% foc = 0%> - <% card = 0%> - <% total = 0%> - <% rounding_adj = 0%> - <% g_total = 0 %> + <% total_qty = 0 %> + <% total_price = 0 %> + <% total_amount = 0 %> - <% @sale_data.each do |result|%> + <% @transaction.each do |result| %> - - - - - - - - - - - <% 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 %> - - <% total += result.grand_total.to_f %> - <% g_total += grand_total.to_f %> - + <% total_qty += result.qty.to_f %> + <% total_price += result.price.to_f %> + <% total_amount += result.amount.to_f %> <% end %> - - - - - - - - - - + + + + +
From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%> - - From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
Cashier StationCashier NameShift NameCash PaymentCredit PaymentOther PaymentGrand TotalCommissioner NameProduct NameQtyCommission PriceCommission AmountDate
- <%= result.cashier_terminal.name rescue '-'%> + <%= result.commissioner.name rescue '-' %> - <%= result.employee.name rescue '-'%> + <%= result.commission.menu_item.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 '-'%><%= sprintf "%.2f", result.qty.to_f.to_d rescue '-' %><%= sprintf "%.2f", result.price.to_f.to_d rescue '-' %><%= sprintf "%.2f", result.amount.to_f.to_d rescue '-' %><%= result.updated_at.strftime("%e %b %Y %I:%M%p") rescue '-' %>
<%= sprintf("%.2f",cash) rescue '-'%><%= sprintf("%.2f",credit) rescue '-'%><%= sprintf("%.2f",card) rescue '-'%><%= sprintf("%.2f",g_total) rescue '-'%><%= sprintf("%.2f", total_qty) rescue '-' %><%= sprintf("%.2f", total_price) rescue '-' %><%= sprintf("%.2f", total_amount) rescue '-' %>
@@ -119,91 +73,7 @@
diff --git a/app/views/reports/commission/index.xls.erb b/app/views/reports/commission/index.xls.erb index e3daaca2..4ea1f2f0 100644 --- a/app/views/reports/commission/index.xls.erb +++ b/app/views/reports/commission/index.xls.erb @@ -1,100 +1,52 @@
-
- + - <% if @shift_from %> - - <% if @shift_data.employee %> - <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> - <% end %> - - - <% end %> - - - - - - - - - - - - - + + + + + + - <% void = 0%> - <% cash = 0%> - <% credit = 0%> - <% accept_credit = 0%> - <% foc = 0%> - <% card = 0%> - <% total = 0%> - <% rounding_adj = 0%> - <% g_total = 0 %> + <% total_qty = 0 %> + <% total_price = 0 %> + <% total_amount = 0 %> - <% @sale_data.each do |result|%> + <% @transaction.each do |result| %> - - - - - - - - - - - <% 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 %> - - <% total += result.grand_total.to_f %> - <% g_total += grand_total.to_f %> - + <% total_qty += result.qty.to_f %> + <% total_price += result.price.to_f %> + <% total_amount += result.amount.to_f %> <% end %> - - - - - - - - - - + + + + +
From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%> - - From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
Cashier StationCashier NameShift NameCash PaymentCredit PaymentOther PaymentGrand TotalCommissioner NameProduct NameQtyCommission PriceCommission AmountDate
- <%= result.cashier_terminal.name rescue '-'%> + <%= result.commissioner.name rescue '-' %> - <%= result.employee.name rescue '-'%> + <%= result.commission.menu_item.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 '-'%><%= sprintf "%.2f", result.qty.to_f.to_d rescue '-' %><%= sprintf "%.2f", result.price.to_f.to_d rescue '-' %><%= sprintf "%.2f", result.amount.to_f.to_d rescue '-' %><%= result.updated_at.strftime("%e %b %Y %I:%M%p") rescue '-' %>
<%= sprintf("%.2f",cash) rescue '-'%><%= sprintf("%.2f",credit) rescue '-'%><%= sprintf("%.2f",card) rescue '-'%><%= sprintf("%.2f",g_total) rescue '-'%><%= sprintf("%.2f", total_qty) rescue '-' %><%= sprintf("%.2f", total_price) rescue '-' %><%= sprintf("%.2f", total_amount) rescue '-' %>
-
\ No newline at end of file +
diff --git a/dump.rdb b/dump.rdb index 6e3e4bdb58d80e5ac055cb301f0b9693f2a197d4..3826c8c680e6f574d0deefd76b08b063e554adee 100644 GIT binary patch delta 443 zcma)&y-LGS0ELqpTk9_ltx+kKtB6QbZqlU5&0@iKDE@$Yo7~z!n$+9`tRjj}(9p%r zMOSebA?O2$Zf-j1GpMLRanQ;28_qf3dFGyaJCI*oI$eJ03n(##CTU((PR5vb=5>S( zI}6Ygjgi=D;=^e|lEvMCJyG7eIu&qmqgcQAmW!0>S zq^2PhcE-CmEYGQeRE`64g9FsZzFxllIO5yxm(=0*$PTLI{+;7g)Q+1boP`uLzd{OdEY7v5xe8A44`v|?F-Wh84K=hd0{ I!|KufC#n^X)&Kwi delta 366 zcmY+AJ4?er0LOFn+6aoE)wVvM@dl@~HC@#-xvJorj+Gj8eW&wc-kVS5Q*_h`nNQjj87PfJA_^G^ z7`2;(Ap%vj&9D^)4AD*C2~j$PX<@oBY)7&#R5sqiGAf(oO6_)IX%R>!xZAfUe0 zLx!x1=BUr5$Le#}Qo2*`s8 cuA~9@;!L`f84hthY7e=e>$|tDwb9MvFJlXERR910