diff --git a/app/models/sale.rb b/app/models/sale.rb index 29607c11..b97c529e 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -659,7 +659,7 @@ def self.get_item_query() # "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.where("i.item_instance_code IS NOT NULL") - query = query.group("i.product_name").order("mi.account_id asc","mi.menu_category_id asc") + query = query.group("i.product_name").order("mi.account_id desc") end def self.get_other_charges() diff --git a/app/views/reports/saleitem/index.html.erb b/app/views/reports/saleitem/index.html.erb index 7fa72521..97ba9c3f 100644 --- a/app/views/reports/saleitem/index.html.erb +++ b/app/views/reports/saleitem/index.html.erb @@ -49,6 +49,7 @@ <% acc_arr = Array.new %> <% cate_arr = Array.new %> + <% sub_qty = 0 %> <% sub_total = 0 %> <% other_sub_total = 0 %> <% count = 0 %> @@ -108,18 +109,23 @@ <%= sale.grand_total rescue '-' %> + <% @menu_cate_count.each do |key,value| %> <% if sale.menu_category_id == key %> <% count = count + 1 %> <% sub_total += sale.grand_total %> + <% sub_qty += sale.total_item %> <% if count == value %> -   +   + Total <%= sale.account_name %> Qty + <%= sub_qty %> <%= t("views.right_panel.detail.sub_total") %> <%= sub_total %> <% sub_total = 0.0%> + <% sub_qty = 0 %> <% count = 0%> <% end %> <% end %> @@ -127,7 +133,7 @@ <% end %> - + <% if @other_charges.present? %> Other Charges   @@ -157,7 +163,7 @@ <%= t("views.right_panel.detail.sub_total") %> <%= other_sub_total %> - + <%end%>