-
This commit is contained in:
@@ -8,6 +8,9 @@ class Reports::DailysaleController < BaseReportController
|
|||||||
@from = from
|
@from = from
|
||||||
@to = to
|
@to = to
|
||||||
@payment_methods = PaymentMethodSetting.where("is_active='1'").pluck("payment_method")
|
@payment_methods = PaymentMethodSetting.where("is_active='1'").pluck("payment_method")
|
||||||
|
count = @payment_methods.count
|
||||||
|
puts 'count+++++++++++++'
|
||||||
|
puts @payment_methods
|
||||||
|
|
||||||
# get printer info
|
# get printer info
|
||||||
@print_settings = PrintSetting.get_precision_delimiter()
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
|
|||||||
@@ -26,10 +26,60 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th colspan="18"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
<th colspan="18"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<% @payment_methods.each_slice(10) do |slice| %>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<% alph = "A" %>
|
||||||
|
<% slice.each do |payment_method| %>
|
||||||
|
<th style="text-align:center;">
|
||||||
|
<%= alph %>
|
||||||
|
</th>
|
||||||
|
<% alph = alph.ord.next.chr %>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
|
||||||
|
<% slice.each do |payment_method| %>
|
||||||
|
<th style="text-align:center;">
|
||||||
|
<%= payment_method %>
|
||||||
|
</th>
|
||||||
|
<% end %>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
||||||
|
<% if @payment_methods.include? ("GiftVoucher") %>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
|
||||||
|
<% end %>
|
||||||
|
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||||
|
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<!-- <tr>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th style='text-align:center;'><%= @payment_methods.count %></th>
|
||||||
|
|
||||||
|
<th style='text-align:center;'>B</th>
|
||||||
|
<th style='text-align:center;'>C</th>
|
||||||
|
<th style='text-align:center;'>D</th>
|
||||||
|
<th style='text-align:center;'>E</th>
|
||||||
|
<th style='text-align:center;'>F</th>
|
||||||
|
<th style='text-align:center;'>G</th>
|
||||||
|
<th style='text-align:center;'>H</th>
|
||||||
|
<th style='text-align:center;'>I</th>
|
||||||
|
<th style='text-align:center;'>J</th>
|
||||||
|
<th style='text-align:center;'>K</th>
|
||||||
|
<th style='text-align:center;'>L=</th>
|
||||||
|
</tr> -->
|
||||||
|
<!-- <tr>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
|
||||||
<% if @payment_methods.include? ("MPU") %>
|
<% if @payment_methods.include? ("MPU") %>
|
||||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.mpu_sales") %></th>
|
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.mpu_sales") %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -65,16 +115,17 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
||||||
<% if @payment_methods.include? ("GiftVoucher") %>
|
<% if @payment_methods.include? ("GiftVoucher") %>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||||
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
||||||
|
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
|
||||||
|
|
||||||
</tr>
|
</tr> -->
|
||||||
</thead>
|
</thead>
|
||||||
<% if @print_settings.precision.to_i > 0
|
<% if @print_settings.precision.to_i > 0
|
||||||
precision = @print_settings.precision
|
precision = @print_settings.precision
|
||||||
@@ -137,7 +188,6 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td style='text-align:right;'><%= count %></td>
|
<td style='text-align:right;'><%= count %></td>
|
||||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||||
<td style='color:red;text-align:right;'><%= number_with_precision(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<% if @payment_methods.include? ("MPU") %>
|
<% if @payment_methods.include? ("MPU") %>
|
||||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:mpu_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:mpu_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -173,21 +223,22 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<td style='text-align:right;'><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='color:red;text-align:right;'><%= number_with_precision(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% if @payment_methods.include? ("GiftVoucher") %>
|
<% if @payment_methods.include? ("GiftVoucher") %>
|
||||||
<td style='text-align:right;'><%= number_with_precision(sale[:giftvoucher_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:giftvoucher_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
<!-- <td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
<!-- <td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||||
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<% count = count + 1 %>
|
<% count = count + 1 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% colspan = 7 %>
|
<% colspan = 7 %>
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
<td colspan="3" style='text-align:center;'>Total</td>
|
<td colspan="2" style='text-align:center;'>Total</td>
|
||||||
<% if @payment_methods.include? ("MPU") %>
|
<% if @payment_methods.include? ("MPU") %>
|
||||||
<% if !request.user_agent.include? "Mobile" %>
|
<% if !request.user_agent.include? "Mobile" %>
|
||||||
<% colspan += 1 %>
|
<% colspan += 1 %>
|
||||||
@@ -256,6 +307,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<td style='text-align:right;'><%= number_with_precision(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='color:red;text-align:right;'><%= number_with_precision(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% if @payment_methods.include? ("GiftVoucher") %>
|
<% if @payment_methods.include? ("GiftVoucher") %>
|
||||||
<% colspan += 1 %>
|
<% colspan += 1 %>
|
||||||
@@ -263,8 +315,8 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
<!-- <td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
<!-- <td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||||
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<% total_tax = 0 %>
|
<% total_tax = 0 %>
|
||||||
|
|||||||
Reference in New Issue
Block a user