add staff meal

This commit is contained in:
NyanLinHtut
2019-11-18 09:57:55 +06:30
parent 891995f531
commit 0d9e363648
13 changed files with 1291 additions and 199 deletions

View File

@@ -56,9 +56,9 @@
<select class="form-control select" name="shift_name" id="shift_name" >
</select>
</div>
<div class="col-lg-12 col-md-12 col-sm-12 margin-top-20 mbl-right-btn">
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20 mbl-right-btn" style="margin-top: 4px;">
<br>
<input type="submit" value="Generate Report" class='btn btn-primary float_right'>
<input type="submit" value="Generate Report" class='btn btn-primary'>
</div>
</div>
<% end %>

View File

@@ -10,7 +10,7 @@
</div>
<div class="row">
<div class="col-md-12">
<%= render :partial=>'shift_sale_report_filter',
<%= render :partial=>'hourly_saleitem_report_filter',
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_hourly_saleitem_index_path} %>
<hr />
<div class="text-right">

View File

@@ -5,142 +5,139 @@
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="row">
<div class="col-md-12">
<div class="margin-top-20">
<div class="card">
<div class="table-responsive">
<div class="margin-top-20">
<div class="card">
<div class="row">
<div class="col-md-12">
<div class="margin-top-20">
<div class="card">
<table class="table table-striped" border="0">
<% time_arr = Array.new %>
<% acc_arr = Array.new %>
<% sale_item_count =0 %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
<% count = 0 %>
<% waste_and_spoil_item_count = 0%>
<% total_qty = 0 %>
<% time_count = 0 %>
<% grand_total = 0 %>
<% @sale_data.each do |sale| %>
<% if !time_arr.include?(sale.date_format) %>
<% sale_item_count =1 %>
<% time_count = time_count + 1 %>
<thead>
<td>&nbsp;</td>
<tr>
<td>
<strong>Time :<%= sale.date_format %></strong>
</td>
<td></td>
<td></td>
<td colspan="3" style="text-align:right"><strong></strong></td>
</tr>
<tr>
<td><strong>Menu Category</strong></td>
<td><strong>Item Code</strong></td>
<td><strong>Item Name</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
</thead>
<% time_arr.push(sale.date_format) %>
<% menu_cat_arr.clear %>
<% count = 0 %>
<% else %>
<% sale_item_count =sale_item_count +1 %>
<% end %>
<tbody>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end
%>
<!-- all total qty sum -->
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
<% if sale.status_type == "Discount"
total_qty += sale.total_item*(-1)
end %>
<% if sale.status_type =="promotion" && @type == "promotion"
total_qty += sale.total_item*(-1)
end %>
<table class="table table-striped" border="0">
<% time_arr = Array.new %>
<% acc_arr = Array.new %>
<% sale_item_count =0 %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
<% count = 0 %>
<% waste_and_spoil_item_count = 0%>
<% total_qty = 0 %>
<% time_count = 0 %>
<% grand_total = 0 %>
<% @sale_data.each do |sale| %>
<% if !time_arr.include?(sale.date_format) %>
<% sale_item_count =1 %>
<% time_count = time_count + 1 %>
<thead>
<td>&nbsp;</td>
<tr>
<td>
<strong>Time :<%= sale.date_format %></strong>
</td>
<td></td>
<td></td>
<td colspan="3" style="text-align:right"><strong></strong></td>
</tr>
<tr>
<td><strong>Menu Category</strong></td>
<td><strong>Item Code</strong></td>
<td><strong>Item Name</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
</thead>
<% time_arr.push(sale.date_format) %>
<% menu_cat_arr.clear %>
<% count = 0 %>
<!-- end all total qty -->
<% if sale.status_type == "foc" && sale.grand_total < 0
grand_total += sale.grand_total*(-1)
end %>
<% if sale.status_type == "Discount" && sale.grand_total < 0
grand_total += sale.grand_total*(-1)
end %>
<% if sale.status_type == "promotion" && sale.grand_total < 0
grand_total += sale.grand_total*(-1)
end %>
<% grand_total += sale.grand_total %>
<% if !sale.item_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<tr>
<% if !menu_cat_arr.include?(sale.menu_category_name) %>
<td><%= sale.menu_category_name %></td>
<% menu_cat_arr.push(sale.menu_category_name) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code %></td>
<td><%= sale.product_name %></td>
<td><%= sale.total_item.to_i %></td>
<td><%= number_with_precision(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
<td><%= number_with_precision(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
<!-- <td><%= sale.date_format %></td> -->
</tr>
<% end %>
<!-- new tr -->
<% count = count + 1 %>
<% @hourly_total_qty.each do |hr| %>
<% if hr["date"].to_s == sale.date_format.to_s && hr["total_qty"].to_i ==sale_item_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><%= total_qty.to_i %></strong>
<% total_qty = 0%>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= number_with_precision(grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></strong>
<% grand_total = 0 %>
</span>
</td>
</tr>
<% footer_arr.push(sale.sale_id) %>
<% else %>
<% sale_item_count =sale_item_count +1 %>
<% end %>
<tbody>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end
%>
<!-- all total qty sum -->
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
<% if sale.status_type == "Discount"
total_qty += sale.total_item*(-1)
end %>
<% if sale.status_type =="promotion" && @type == "promotion"
total_qty += sale.total_item*(-1)
end %>
<!-- end all total qty -->
<% if sale.status_type == "foc" && sale.grand_total < 0
grand_total += sale.grand_total*(-1)
end %>
<% if sale.status_type == "Discount" && sale.grand_total < 0
grand_total += sale.grand_total*(-1)
end %>
<% if sale.status_type == "promotion" && sale.grand_total < 0
grand_total += sale.grand_total*(-1)
end %>
<% grand_total += sale.grand_total %>
<% if !sale.item_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<tr>
<% if !menu_cat_arr.include?(sale.menu_category_name) %>
<td><%= sale.menu_category_name %></td>
<% menu_cat_arr.push(sale.menu_category_name) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code %></td>
<td><%= sale.product_name %></td>
<td><%= sale.total_item.to_i %></td>
<td><%= sale.unit_price.to_i %></td>
<td><%= sale.grand_total.to_i %></td>
<td><%= sale.date_format %></td>
</tr>
<% end %>
<!-- new tr -->
<% count = count + 1 %>
<% @hourly_total_qty.each do |hr| %>
<% if hr["date"].to_s == sale.date_format.to_s && hr["total_qty"].to_i ==sale_item_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><%= total_qty.to_i %></strong>
<% total_qty = 0%>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= grand_total.to_i %></strong>
<% grand_total = 0 %>
</span>
</td>
</tr>
<% footer_arr.push(sale.sale_id) %>
<% else %>
<% end %>
<% end %>
</tbody>
<% end %>
</table>
</div>
</div>
</div>
</tbody>
<% end %>
</table>
</div>
</div>
</div>
</div>
</body>
</html>