update sale item for sub qty and person

This commit is contained in:
Aung Myo
2017-12-15 16:26:35 +06:30
parent 60a58bc948
commit 0c83a3a8ce
2 changed files with 10 additions and 4 deletions

View File

@@ -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()

View File

@@ -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 @@
<td><%= sale.grand_total rescue '-' %></td>
</tr>
<!-- sub total -->
<% @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 %>
<tr>
<td colspan="5">&nbsp;</td>
<td colspan="3">&nbsp;</td>
<td><b>Total <%= sale.account_name %> Qty </b> </td>
<td><b><%= sub_qty %></b></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span class="underline"><%= sub_total %></span></td>
</tr>
<% sub_total = 0.0%>
<% sub_qty = 0 %>
<% count = 0%>
<% end %>
<% end %>
@@ -127,7 +133,7 @@
<!-- end sub total -->
<% end %>
<!--Other Charges -->
<% if @other_charges.present? %>
<tr>
<td><b>Other Charges</b></td>
<td colspan="4">&nbsp;</td>
@@ -157,7 +163,7 @@
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= other_sub_total %></span></td>
</tr>
<%end%>
<!-- End Other Charges -->
<tr style="border-top:2px solid grey;">
<td colspan="3">&nbsp;</td>