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

@@ -18,7 +18,12 @@
<option value="9">Last year</option>
</select>
</div>
<% if defined? filter_for_credit %>
<div class="form-group col-md-2">
<label class="font-20">Select Paid/ Unpaid</label>
<%= select_tag "filter_check", options_for_select(@filter_for_credit, :selected => params[:filter_check]), :class => "form-control", :style => "height: 37px;" %>
</div>
<% end %>
<div class="form-group col-md-2">
<!-- <label class="">Select Shift Period</label> -->
<label class="font-20">From</label>
@@ -28,7 +33,7 @@
<label class="font-20">To</label>
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
</div>
<div class="form-group col-md-3">
<div class="form-group col-md-2">
<label class="font-20">All Shift</label>
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;">
</select>

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 %>

View File

@@ -20,13 +20,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>
@@ -37,8 +45,17 @@
<td><%= credit.cashier_name rescue '-' %></td>
<td><%= credit.sale.customer.name rescue '-' %></td>
<td><%= credit.payment_amount 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><%= credit.credit_payment rescue '-' %></td>
</tr>
<% end %>
<tr>
<td colspan="4"><b>Total</b></td>
<td colspan="4"><b><%= total_credit_amount rescue '-' %></b></td>
<td><b><%= total_credit_payment rescue '-' %></b></td>
</tr>
</tbody>
</table>
<% end %>