update sale item reoprt for item dis and foc

This commit is contained in:
Aung Myo
2017-12-05 18:19:18 +06:30
parent 97bb6ae211
commit f4a7e1baa0
3 changed files with 11 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ class Reports::SaleitemController < BaseReportController
@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) @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)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil) @sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
puts @sale_taxes.to_json puts @sale_data.to_json
@account_cate_count = Hash.new {|hash, key| hash[key] = 0} @account_cate_count = Hash.new {|hash, key| hash[key] = 0}

View File

@@ -646,7 +646,7 @@ end
def self.get_item_query() def self.get_item_query()
query = Sale.select("acc.title as account_name,mi.account_id, i.item_instance_code as item_code,i.account_id as account_id, " + query = Sale.select("acc.title as account_name,mi.account_id, i.item_instance_code as item_code,i.account_id as account_id, " +
"SUM(i.qty * i.unit_price) as grand_total,SUM(i.qty) as total_item," + "SUM(i.qty * i.unit_price) as grand_total,SUM(i.qty) as total_item,i.qty as qty," +
"i.remark as status_type,"+ "i.remark as status_type,"+
" i.unit_price as unit_price,i.product_name as product_name, mc.name as" + " i.unit_price as unit_price,i.product_name as product_name, mc.name as" +
" menu_category_name,mc.id as menu_category_id ") " menu_category_name,mc.id as menu_category_id ")

View File

@@ -65,10 +65,18 @@
<% @sale_data.each do |sale| %> <% @sale_data.each do |sale| %>
<% if sale.total_item > 0 && sale.status_type != "Discount" && sale.status_type != "foc" <% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item total_qty += sale.total_item
end %> end %>
<% if sale.status_type == "foc" && sale.grand_total < 0
total_item_foc += sale.grand_total*(-1)
end %>
<% if sale.status_type == "Discount" && sale.grand_total < 0
total_item_dis += sale.grand_total*(-1)
end %>
<% if !acc_arr.include?(sale.account_id) %> <% if !acc_arr.include?(sale.account_id) %>
<tr> <tr>
<td><b><%= sale.account_name %></b></td> <td><b><%= sale.account_name %></b></td>
@@ -111,13 +119,6 @@
<td><%= t("views.right_panel.detail.sub_total") %></td> <td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span class="underline"><%= sub_total %></span></td> <td ><span class="underline"><%= sub_total %></span></td>
</tr> </tr>
<% if sale.status_type === "foc"
total_item_foc += sale.grand_total
end %>
<% if sale.status_type === "Discount"
total_item_dis += sale.grand_total
end %>
<% sub_total = 0.0%> <% sub_total = 0.0%>
<% count = 0%> <% count = 0%>
<% end %> <% end %>