Merge branch 'ui_ux_changes' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes
This commit is contained in:
@@ -1139,8 +1139,14 @@ def self.get_wastes_and_spoilages(from,to,status)
|
||||
else
|
||||
type = "and sales.sale_status = 'waste'"
|
||||
end
|
||||
query = Sale.all.where("sales.receipt_date between ? and ? #{type}",from,to)
|
||||
.group("sales.receipt_no")
|
||||
query = Sale.select("sales.sale_id,sales.receipt_no,sales.created_at,sales.total_amount,sales.grand_total,sales.rounding_adjustment,sales.shift_sale_id,sale_items.product_name,sale_items.product_code,sale_items.item_instance_code,sale_items.qty,sale_items.price,sale_items.unit_price,menu_categories.name")
|
||||
.joins("JOIN sale_items ON sales.sale_id = sale_items.sale_id" +
|
||||
" JOIN menu_item_instances ON sale_items.item_instance_code = menu_item_instances.item_instance_code" +
|
||||
" JOIN menu_items ON menu_item_instances.menu_item_id = menu_items.id" +
|
||||
" JOIN menu_categories ON menu_items.menu_category_id = menu_categories.id")
|
||||
.where("sales.receipt_date between ? and ? #{type}",from,to)
|
||||
.group("sales.receipt_no,menu_categories.id,sale_items.item_instance_code")
|
||||
.order("sales.sale_id,menu_categories.name,sale_items.product_name")
|
||||
end
|
||||
|
||||
# def self.get_separate_tax(from,to,payment_method=nil)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<div class="container-fluid">
|
||||
<div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.waste_spoilage_report") %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to 'Back', dashboard_path %>
|
||||
</span>
|
||||
</ol>
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.waste_spoilage_report") %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to 'Back', dashboard_path %>
|
||||
</span>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@@ -20,52 +20,77 @@
|
||||
<div class="card">
|
||||
|
||||
<table class="table table-striped" border="0">
|
||||
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
|
||||
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
|
||||
<% receipt_arr = Array.new %>
|
||||
<% menu_cat_arr = Array.new %>
|
||||
<% footer_arr = Array.new %>
|
||||
<% count = 0 %>
|
||||
<% waste_and_spoil_item_count = 0%>
|
||||
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% waste_and_spoil_item_count = 0%>
|
||||
<thead>
|
||||
<tr>
|
||||
<td >
|
||||
<strong>Receipt No :<%= sale.receipt_no %></strong>
|
||||
</td>
|
||||
<td></td>
|
||||
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td ><strong>Item Name</strong></td>
|
||||
<td ><strong>Item Code</strong></td>
|
||||
<td><strong>Qty</strong></td>
|
||||
<td><strong>Price</strong></td>
|
||||
<td><strong>Total Price</strong></td>
|
||||
</tr>
|
||||
|
||||
<% sale.sale_items.each do |item| %>
|
||||
<% if !item.item_instance_code.nil?%>
|
||||
<% waste_and_spoil_item_count += item.qty.to_i%>
|
||||
<tr>
|
||||
<td><%= item.product_name %></td>
|
||||
<td><%= item.product_code %></td>
|
||||
<td><%= item.qty %></td>
|
||||
<td><%= item.price %></td>
|
||||
<td><%= item.price %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !receipt_arr.include?(sale.receipt_no) %>
|
||||
<thead>
|
||||
<td> </td>
|
||||
<tr>
|
||||
<td >
|
||||
<strong>Receipt No :<%= sale.receipt_no %></strong>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Menu Category</strong></td>
|
||||
<td><strong>Item Name</strong></td>
|
||||
<td><strong>Item Code</strong></td>
|
||||
<td><strong>Qty</strong></td>
|
||||
<td><strong>Price</strong></td>
|
||||
<td><strong>Total Price</strong></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<% receipt_arr.push(sale.receipt_no) %>
|
||||
<% menu_cat_arr.clear %>
|
||||
<% count = 0 %>
|
||||
<% end %>
|
||||
|
||||
<tbody>
|
||||
<% if !sale.item_instance_code.nil?%>
|
||||
<% waste_and_spoil_item_count += sale.qty.to_i %>
|
||||
<tr>
|
||||
<% if !menu_cat_arr.include?(sale.name) %>
|
||||
<td><%= sale.name %></td>
|
||||
<% menu_cat_arr.push(sale.name) %>
|
||||
<% else %>
|
||||
<td> </td>
|
||||
<% end %>
|
||||
<td><%= sale.product_name %></td>
|
||||
<td><%= sale.product_code %></td>
|
||||
<td><%= sale.qty.to_i %></td>
|
||||
<td><%= sale.unit_price %></td>
|
||||
<td><%= sale.price %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
|
||||
<td><span class="underline" style="text-align:right">
|
||||
<strong><%= waste_and_spoil_item_count %></strong>
|
||||
</span></td>
|
||||
<td style="text-align:right"> <strong>Grand Total: </strong></td>
|
||||
<td >
|
||||
<span class="underline" style="text-align:right">
|
||||
<strong><%= sale.grand_total %></strong>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<% count = count + 1 %>
|
||||
<% if sale.sale_items.count == count %>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
|
||||
<td>
|
||||
<span class="underline" style="text-align:right">
|
||||
<strong><%= waste_and_spoil_item_count %></strong>
|
||||
<% waste_and_spoil_item_count = 0%>
|
||||
</span></td>
|
||||
<td style="text-align:right"> <strong>Grand Total: </strong></td>
|
||||
<td >
|
||||
<span class="underline" style="text-align:right">
|
||||
<strong><%= sale.grand_total %></strong>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<% footer_arr.push(sale.sale_id) %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user