change query in sale item report
This commit is contained in:
@@ -25,7 +25,7 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}
|
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}
|
||||||
|
|
||||||
@menu_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
@menu_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||||
@sale_data.each {|cate| @menu_cate_count[cate.menu_category_id] += 1}
|
@sale_data.each {|cate| @menu_cate_count[cate.account_id] += 1}
|
||||||
|
|
||||||
|
|
||||||
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
||||||
@@ -64,6 +64,9 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
date_arr.push(str)
|
date_arr.push(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
||||||
|
@sale_data.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total}
|
||||||
|
|
||||||
out = {:status => 'ok', :message => date_arr}
|
out = {:status => 'ok', :message => date_arr}
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|||||||
@@ -665,7 +665,7 @@ def self.get_item_query()
|
|||||||
# "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ")
|
# "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ")
|
||||||
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
||||||
# query = query.where("i.item_instance_code IS NOT NULL")
|
# query = query.where("i.item_instance_code IS NOT NULL")
|
||||||
query = query.group("i.product_name").order("acc.title desc")
|
query = query.group("acc.title,mi.account_id,i.product_name").order("acc.title desc, mi.account_id desc")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_other_charges()
|
def self.get_other_charges()
|
||||||
|
|||||||
@@ -110,9 +110,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<!-- sub total -->
|
<!-- sub total -->
|
||||||
|
|
||||||
<% @menu_cate_count.each do |key,value| %>
|
<% @menu_cate_count.each do |key,value| %>
|
||||||
<% if sale.menu_category_id == key %>
|
<% if sale.account_id == key %>
|
||||||
|
|
||||||
<% count = count + 1 %>
|
<% count = count + 1 %>
|
||||||
<% sub_total += sale.grand_total %>
|
<% sub_total += sale.grand_total %>
|
||||||
<% sub_qty += sale.total_item %>
|
<% sub_qty += sale.total_item %>
|
||||||
@@ -128,10 +127,10 @@
|
|||||||
<% sub_qty = 0 %>
|
<% sub_qty = 0 %>
|
||||||
<% count = 0%>
|
<% count = 0%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<!-- end sub total -->
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<!-- end sub total -->
|
||||||
|
<% end %>
|
||||||
<!--Other Charges -->
|
<!--Other Charges -->
|
||||||
<% if @other_charges.present? %>
|
<% if @other_charges.present? %>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user