add foc amount in saleitem report

This commit is contained in:
Myat Zin Wai Maw
2019-09-11 17:12:15 +06:30
parent ac24499319
commit a4e8869234
3 changed files with 41 additions and 5 deletions

View File

@@ -8,7 +8,6 @@ class Origami::VoidController < BaseOrigamiController
access_code = params[:access_code] access_code = params[:access_code]
if Sale.exists?(sale_id) if Sale.exists?(sale_id)
sale = Sale.find_by_sale_id(sale_id) sale = Sale.find_by_sale_id(sale_id)
puts sale.to_json
if sale.discount_type == "member_discount" if sale.discount_type == "member_discount"
sale.update_attributes(total_discount: 0) sale.update_attributes(total_discount: 0)
sale.compute_by_sale_items(sale_id, sale.sale_items,0,order_source) sale.compute_by_sale_items(sale_id, sale.sale_items,0,order_source)

View File

@@ -95,7 +95,6 @@
total_qty += sale.total_item*(-1) total_qty += sale.total_item*(-1)
end %> end %>
<!-- end all total qty --> <!-- end all total qty -->
<% if sale.status_type == "foc" && sale.grand_total < 0 <% if sale.status_type == "foc" && sale.grand_total < 0
total_item_foc += sale.grand_total*(-1) total_item_foc += sale.grand_total*(-1)
end %> end %>
@@ -249,9 +248,21 @@
<td colspan="3">&nbsp;</td> <td colspan="3">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td> <td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
<td><span><%= total_qty%></span></td> <td><span><%= total_qty%></span></td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td> <td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td> <td><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr> </tr>
<% if @type =="" || @type =="all" || @type.nil? %>
<tr class="foc_payment">
<td colspan="5">&nbsp;</td>
<td>Total FOC Amount</td>
<td><span><%= number_with_precision(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<tr class="foc_payment" style="border-top:2px solid grey;border-bottom:2px solid grey;">
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.net_amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<% end %>
<% end %> <% end %>
<% if @type == "other"%> <% if @type == "other"%>
@@ -296,6 +307,7 @@
<script> <script>
$(function(){ $(function(){
var check_arr = []; var check_arr = [];
var search = '<%= params[:period_type] %>'; var search = '<%= params[:period_type] %>';

View File

@@ -226,6 +226,18 @@
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td> <td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td> <td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr> </tr>
<% if @type =="" || @type =="all" %>
<tr>
<td colspan="5">&nbsp;</td>
<td>Total FOC Amount</td>
<td><span><%= number_with_precision(@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<tr style="border-top:2px solid grey;border-bottom:2px solid grey;">
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.net_amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<% end %>
<% end %> <% end %>
<% if @type == "other"%> <% if @type == "other"%>
@@ -268,3 +280,16 @@
</div> </div>
</body> </body>
</html> </html>
<script type="text/javascript">
$(function(){
var type =<%=@type %>;
console.log(type);
$('.foc_payment').hide();
if (type =="" || type =="all" ){
$('.foc_payment').show();
}
else{
$('.foc_payment').hide();
}
});
</script>