update sale item report

This commit is contained in:
Aung Myo
2018-03-28 11:10:37 +06:30
parent f126d2faf6
commit 204f622876
3 changed files with 18 additions and 10 deletions

View File

@@ -17,8 +17,7 @@ class Reports::SaleitemController < BaseReportController
end
@type = params[:sale_type]
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type)
puts @other_charges.to_json
puts "oooooooooooooooooooooooo"
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}

View File

@@ -22,7 +22,7 @@
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14">Select Type</label>
<select name="sale_type" id="sel_sale_type" class="form-control">
<option value="">Select Typess</option>
<option value="">Select Type</option>
<option value="revenue" selected>Revenue Only</option>
<option value="all">All Type</option>
<option value="discount">Discount Only</option>

View File

@@ -77,16 +77,18 @@
<% unless @sale_data.blank? %>
<% @sale_data.each do |sale| %>
<!-- all total qty sum -->
<!--
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
-->
<% if sale.status_type == "Discount"
total_qty += sale.total_item*(-1)
end %>
<!-- end all total qty -->
<!--
<% if sale.status_type == "foc" && sale.grand_total < 0
total_item_foc += sale.grand_total*(-1)
end %>
@@ -94,7 +96,7 @@
<% if sale.status_type == "Discount" && sale.grand_total < 0
total_item_dis += sale.grand_total*(-1)
end %>
-->
<% if !acc_arr.include?(sale.account_id) %>
<tr>
<td><b><%= sale.account_name %></b></td>
@@ -121,7 +123,12 @@
<% end %>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue '-' %></td>
<% if sale.status_type != "Discount" %>
<td><%= sale.total_item rescue '-' %></td>
<%else%>
<td><%= sale.total_item*(-1) rescue '-' %></td>
<% end %>
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
@@ -132,10 +139,12 @@
<% count = count + 1 %>
<% sub_total += sale.grand_total %>
<% #sub_qty += sale.total_item %>
<% if sale.status_type!="Discount" && (!sale.product_name.include? "FOC")
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC")
sub_qty += sale.total_item
end %>
<% if sale.status_type =="Discount"
sub_qty += sale.total_item*(-1)
end %>
<% if count == value %>
<tr>
<td colspan="3">&nbsp;</td>