change credit payment query

This commit is contained in:
phyusin
2018-07-13 14:44:29 +06:30
parent dd4db6d2e7
commit 533a3999fb
5 changed files with 99 additions and 20 deletions

View File

@@ -9,7 +9,7 @@
</div>
<!-- <div class="container"> -->
<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_credit_payment_index_path} %>
:locals=>{ :period_type => true, :filter_for_credit => true, :shift_name => true, :report_path =>reports_credit_payment_index_path} %>
<hr />
<!-- </div> -->
@@ -48,13 +48,21 @@
<th> <%= t("views.right_panel.detail.shift_name") %> </th>
<th> <%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
<th> <%= t :credit %> <%= t :payment %> <br>
<%= t("views.right_panel.detail.shift_name") %></th>
<th> <%= t :credit %> <%= t("views.right_panel.detail.receipt_date") %></th>
<th> <%= t :credit %> <%= t :payment %> <br> <%= t :cashier_name %></th>
<th> <%= t :credit %> <%= t :payment %> <%= t("views.right_panel.detail.amount") %></th>
</tr>
</thead>
<tbody>
<% total_credit_amount = 0
total_credit_payment = 0 %>
<% @sale_data.each do |credit| %>
<% total_credit_amount += credit.payment_amount %>
<% total_credit_payment += credit.credit_payment %>
<tr>
<% if @shift_from.nil? && @shift_to.nil? %>
<td><%= credit.sale_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-'%></td>
@@ -65,8 +73,17 @@
<td><%= credit.cashier_name rescue '-' %></td>
<td><%= credit.sale.customer.name rescue '-' %></td>
<td><%= number_with_precision(credit.payment_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= credit.credit_payment_shift_name rescue '-' %></td>
<td><%= credit.credit_payment_receipt_date rescue '-' %></td>
<td><%= credit.credit_payment_cashier_name rescue '-' %></td>
<td><%= number_with_precision(credit.credit_payment, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
</tr>
<% end %>
<tr>
<td colspan="4"><b>Total</b></td>
<td colspan="4"><b><%= number_with_precision(total_credit_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= number_with_precision(total_credit_payment, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
</tr>
</tbody>
</table>
<% end %>