fix shift_sale double update

This commit is contained in:
Thein Lin Kyaw
2020-06-23 10:29:46 +06:30
parent 3e27990ac4
commit 276e437a07
4 changed files with 19 additions and 34 deletions

View File

@@ -40,7 +40,7 @@
<th><%= @shift.total_receipt %></th>
<th><%= @shift.dining_count %></th>
<th><%= @shift.takeaway_count %></th>
<th>(<%= @shift.total_void.round(2) %>)</th>
<th>(<%= @shift.total_void %>)</th>
</tr>
<tr>
@@ -50,7 +50,7 @@
<tr>
<th></th>
<td style="text-align: right;"> Total <%= amount.account_name %> Amount</td>
<td><%= amount.total_price.round(2) %></td>
<td><%= amount.total_price %></td>
</tr>
<%end%>
<tr>
@@ -63,7 +63,7 @@
<tr>
<th></th>
<td style="text-align: right;"> Total <%= amount.account_name %> Discount</td>
<td><%= amount.total_price.round(2) %></td>
<td><%= amount.total_price %></td>
</tr>
<%end%>
@@ -94,7 +94,7 @@
<tr>
<th></th>
<td style="text-align: right;"> <%= tax.tax_name %> </td>
<td><%= tax.st_amount.round(2) %></td>
<td><%= tax.st_amount %></td>
</tr>
<%end%>
<tr>
@@ -105,30 +105,28 @@
<tr>
<th></th>
<th style="text-align: right;"> Rounding Adj </th>
<th><%= @shift.total_rounding.round(2) %></th>
<th><%= @shift.total_rounding %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;"> Grand Total </th>
<th><%= @shift.grand_total.round(2) %></th>
<th><%= @shift.grand_total %></th>
</tr>
</table>
</td>
<td colspan="6">
<table width="100%">
<% total_other_amount = 0 %>
<tr>
<th></th>
<th style="text-align: right;">Cash Payment </th>
<th><%=@shift.cash_sales %></th>
<th><%= @shift.cash_sales %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;">Credit Payment </th>
<th><%=@shift.credit_sales %></th>
<th><%= @shift.credit_sales %></th>
</tr>
<% @total_amount = 0
@total_other_amount = 0
@other_payment.each do |other| %>
<tr>
<th></th>
<th style="text-align: right;">Other Payment Detail </th>
@@ -138,29 +136,26 @@
<tr>
<th></th>
<td style="text-align: right;"><%= method %> Payment</td>
<td><%= other[method.parameterize.to_sym].round(2) rescue '-' %></td>
<% @total_other_amount = @total_other_amount + other[method.parameterize.to_sym] rescue 0.0 %>
<td><%= @other_payment[method.parameterize.to_sym] || 0.0 %></td>
<% total_other_amount = total_other_amount + (@other_payment[method.parameterize.to_sym] || 0.0) %>
</tr>
<% end %>
<tr>
<th></th>
<td style="text-align: right;"><strong>FOC </strong></td>
<td><%=other.foc_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount + other.foc_amount rescue 0.0 %>
<td><%= @other_payment.foc_amount rescue 0.0 %></td>
</tr>
<%end%>
<tr>
<th></th>
<th style="text-align: right;">Total Other Payment </th>
<th><%= @total_other_amount %></th>
<th><%= total_other_amount %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;">Total Payment </th>
<th><%= @total_amount+@shift.cash_sales+@shift.credit_sales %></th>
<th><%= total_other_amount + @other_payment.foc_amount + @shift.cash_sales + @shift.credit_sales %></th>
</tr>
</table>
</td>
</tr>