change hardcoded payment methods
This commit is contained in:
@@ -82,44 +82,11 @@
|
||||
</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>
|
||||
<th style='text-align:center;'><%= t("views.righ_panel.detail.date") %></th>
|
||||
<% @payment_methods.each do |method| %>
|
||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.#{method}") %></th>
|
||||
<% end %>
|
||||
|
||||
<% 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>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Master") %>
|
||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.master_sales") %></th>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("VISA") %>
|
||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.visa_sales") %></th>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("JCB") %>
|
||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.jcb_sales") %></th>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("UNIONPAY") %>
|
||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("KBZPay") %>
|
||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.kbzpay_sales") %></th>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Alipay") %>
|
||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.alipay_sales") %></th>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("PAYMAL") %>
|
||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.paymal_sales") %></th>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("DINGA") %>
|
||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.dinga_sales") %></th>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("JunctionPay") %>
|
||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.junctionpay_sales") %></th>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Redeem") %>
|
||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.redeem_sales") %></th>
|
||||
<% end %>
|
||||
<% 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.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>
|
||||
@@ -140,22 +107,10 @@
|
||||
<% unless @sale_data.blank? %>
|
||||
<tbody>
|
||||
<% void = 0 %>
|
||||
<% mpu = 0 %>
|
||||
<% master = 0 %>
|
||||
<% visa = 0 %>
|
||||
<% jcb = 0 %>
|
||||
<% unionpay = 0 %>
|
||||
<% alipay = 0 %>
|
||||
<% paymal = 0 %>
|
||||
<% dinga = 0 %>
|
||||
<% junctionpay = 0 %>
|
||||
<% giftvoucher = 0 %>
|
||||
<% paypar = 0 %>
|
||||
<% cash = 0 %>
|
||||
<% credit = 0 %>
|
||||
<% foc = 0 %>
|
||||
<% discount = 0 %>
|
||||
<% kbzpay = 0 %>
|
||||
<% total = 0 %>
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 0 %>
|
||||
@@ -164,24 +119,13 @@
|
||||
<% tax = 0 %>
|
||||
<% net_sale = 0 %>
|
||||
<% count = 1 %> <% rounding_adj = 0 %>
|
||||
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% void += sale[:void_amount] %>
|
||||
<% mpu += sale[:mpu_amount] %>
|
||||
<% master += sale[:master_amount] %>
|
||||
<% visa += sale[:visa_amount] %>
|
||||
<% jcb += sale[:jcb_amount] %>
|
||||
<% unionpay += sale[:unionpay_amount] %>
|
||||
<% alipay += sale[:alipay_amount] %>
|
||||
<% paymal += sale[:paymal_amount] %>
|
||||
<% dinga += sale[:dinga_amount] %>
|
||||
<% junctionpay += sale[:junctionpay_amount] %>
|
||||
<% giftvoucher += sale[:giftvoucher_amount] %>
|
||||
<% paypar += sale[:paypar_amount] %>
|
||||
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
|
||||
<% credit += sale[:credit_amount] %>
|
||||
<% foc += sale[:foc_amount] %>
|
||||
<% discount += sale[:total_discount] %>
|
||||
<% kbzpay += sale[:kbzpay_amount] %>
|
||||
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
||||
<% grand_total += sale[:grand_total].to_f %>
|
||||
<% old_grand_total += sale[:old_grand_total].to_f %>
|
||||
@@ -193,41 +137,8 @@
|
||||
<tr>
|
||||
<td style='text-align:right;'><%= count %></td>
|
||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||
<% if @payment_methods.include? ("MPU") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:mpu_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Master") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:master_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("VISA") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:visa_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("JCB") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:jcb_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("UNIONPAY") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:unionpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Alipay") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:alipay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("KBZPay") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:kbzpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("PAYMAL") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:paymal_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("DINGA") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:dinga_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("JunctionPay") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:junctionpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Redeem") %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:paypar_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("GiftVoucher") %>
|
||||
<td style='text-align:right;'><%= number_format(sale[:giftvoucher_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% @payment_methods.each do |method| %>
|
||||
<td style='text-align:right;'><%= number_format(sale[method.parameterize.to_sym], precision:precision.to_i, delimiter: delimiter) rescue 0 %></td>
|
||||
<% end %>
|
||||
<td style='text-align:right;'><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
@@ -236,7 +147,7 @@
|
||||
|
||||
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||
<!-- <td style='text-align:right;'><%= number_format(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||
<td style='text-align:right;'><%= number_format(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(sale[:rounding_adj], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(sale[:gross_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(sale[:total_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% if @tax.blank? %>
|
||||
@@ -250,75 +161,9 @@
|
||||
<% colspan = 7 %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="2" style='text-align:center;'>Total</td>
|
||||
<% if @payment_methods.include? ("MPU") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(mpu , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end%>
|
||||
<% if @payment_methods.include? ("Master") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(master, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end%>
|
||||
<% if @payment_methods.include? ("VISA") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(visa, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end%>
|
||||
<% if @payment_methods.include? ("JCB") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(jcb, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end%>
|
||||
<% if @payment_methods.include? ("UNIONPAY") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(unionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Alipay") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(alipay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("KBZPay") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(kbzpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("PAYMAL") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(paymal, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("DINGA") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(dinga, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("JunctionPay") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(junctionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("Redeem") %>
|
||||
<% if !request.user_agent.include? "Mobile" %>
|
||||
<% colspan += 1 %>
|
||||
<% end %>
|
||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(paypar, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% end %>
|
||||
<% if @payment_methods.include? ("GiftVoucher") %>
|
||||
<% colspan += 1 %>
|
||||
<td style='text-align:right;'><%= number_format(giftvoucher, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<% @payment_methods.each do |method| %>
|
||||
<% colspan += 1 %>
|
||||
<td style='text-align:right;'><%= number_format(@sale_data.inject(0.0.to_d) { |sum, sale| sum + sale[method.parameterize.to_sym] }, precision:precision.to_i,delimiter:delimiter) rescue 0 %></td>
|
||||
<% end %>
|
||||
<td style='text-align:right;'><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
Reference in New Issue
Block a user