update conflix split pull

This commit is contained in:
Aung Myo
2018-02-28 17:04:35 +06:30
52 changed files with 2027 additions and 437 deletions

View File

@@ -1,6 +1,7 @@
<div class="container-fluid">
<div class="block-header">
<h2><%= t :dashboard %></h2>
<!-- <h2><%= t :dashboard %></h2> -->
<h2><%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></h2>
</div>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
@@ -65,8 +66,28 @@
<!-- #END# Widgets -->
<!-- CPU Usage -->
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
<!-- Date range for dashboard -->
<div class="row clearfix">
<div class="col-lg-4 col-md-4 col-sm-4">
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker" name="from" id="from" type="text" value="<%= Time.now.utc.strftime('%d-%m-%Y') %>" placeholder="From date" style="height: 35px;">
<span id="fromErr" style="color:red;"></span>
</div>
<div class="col-lg-4 col-md-4 col-sm-4">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker" name="to" id="to" type="text" value="<%= Time.now.utc.strftime('%d-%m-%Y') %>" placeholder="To date" style="height: 35px;">
<span id="toErr" style="color:red;"></span>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<label></label><br>
<input type="button" value="Generate" class='btn btn-primary btn_generate'>
</div>
</div>
<br>
<!-- Date range for dashboard -->
<div class="row">
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
@@ -122,10 +143,18 @@
</div>
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<% end %>
<% if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'cashier' %>
<% if !@summ_sale.nil? %>
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<% else %>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="row">
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<% end %>
<div class="card">
<div class="body">
<h6><%= t :sale %></h6>
@@ -136,19 +165,19 @@
</tr>
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t :sale %> : </td>
<td align="right"><%= number_with_precision( @summ_sale.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
<td align="right"><%= number_with_precision( @summ_sale.total_amount, precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
</tr>
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : </td>
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
</tr>
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : </td>
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter)%></td>
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
</tr>
<tr>
<td><%= t("views.right_panel.detail.grand_total") %> : </td>
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
</tr>
</table>
<table class="table">
@@ -161,7 +190,7 @@
<td align="right">
<% @sale_data.each do |data| %>
<% pay_mth = payment.payment_method %>
<%= data[""+pay_mth+""] %>
<%= number_with_precision(data[""+pay_mth+""], precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
<% end %>
</td>
</tr>
@@ -174,7 +203,7 @@
<tr>
<td><%= t("views.right_panel.detail.card_sale") %> : </td>
<td align="right">
<%= total_card["card"].to_f %>
<%= number_with_precision(total_card["card"], precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
</td>
</tr>
<% end %>
@@ -184,11 +213,17 @@
</div>
</div>
</div>
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
</div>
<% end %>
<% end %>
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<% else %>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<% end %>
<div class="card">
<div class="body">
<h6><%= t :customer %></h6>
@@ -227,10 +262,16 @@
</div>
</div>
</div>
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
</div>
<% end %>
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<% else %>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<% end %>
<div class="card">
<div class="body">
<h6><%= t("views.right_panel.detail.order") %></h6>
@@ -274,6 +315,41 @@
</div>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var from = '<%= @from.strftime('%d-%m-%Y') rescue '' %>';
var to = '<%= @to.strftime('%d-%m-%Y') rescue '' %>';
if((from!=undefined) && (from != null) && (from != '')){
$('#from').val(from);
}
if((to!=undefined) && (to != null) && (to != '')){
$('#to').val(to);
}
});
$('.btn_generate').on('click',function(){
var from = $("#from").val();
var to = $("#to").val();
if((from=='') && (to=='')){
$('#fromErr').html("can't be blank");
$('#toErr').html("can't be blank");
}else if((from!='') && (to=='')){
$('#fromErr').html("");
$('#toErr').html("can't be blank");
}else if((from=='') && (to!='')){
$('#fromErr').html("can't be blank");
$('#toErr').html("");
}else{
$('#fromErr').html("");
$('#toErr').html("");
}
if((from!='') && (to!='')){
window.location.href = '/dashboard?from='+from+'&to='+to;
}
});
</script>

View File

@@ -124,6 +124,9 @@
<li>
<a href="<%= reports_saleitem_index_path %>">Sale Items</a>
</li>
<li>
<a href="<%= reports_product_sale_index_path %>">Product Sale</a>
</li>
<li>
<a href="<%= reports_receipt_no_index_path %>">Receipt</a>
</li>

View File

@@ -88,13 +88,13 @@
<span class="order-qty">
<%= qid.qty %>
</span> ]
<% if !qid.set_menu_items.nil?
qid.set_menu_items.each do |item_instance|%>
<br><span class="font-12">
<% if !qid.set_menu_items.nil? %>
<% qid.set_menu_items.each do |item_instance|%>
<br><span class="font-12">
<%= item_instance %>
</span>
<% end
end %>
</span>
<% end %>
<% end %>
</p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>

View File

@@ -425,7 +425,10 @@
<%= t("views.btn.back") %>
</button>
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
<% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "supervisor" || current_login_employee.role == "cashier" || current_login_employee.role == "waiter" %>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<% end %>
<% if current_login_employee.role != "waiter" %>
<% if @dining.status != "available" %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
@@ -512,6 +515,7 @@
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>

View File

@@ -277,39 +277,19 @@
sub_total = sub_total + (order_item.price * order_item.qty)
# unless order_item.price == 0 %>
<% if !@assigned_order_items.nil? %>
<% @assigned_order_items.each do |assigned_order_item| %>
<% if assigned_order_item.include? (order_item.order_items_id) %>
<tr class="edit_order" data-id='<%= assigned_order_item[order_item.order_items_id] %>'>
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.set_menu_items.nil?
order_item.set_menu_items.each do |item_instance| %>
<br><span class="font-13"><%= item_instance %></span>
<% end
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<% end %>
<% end %>
<% else %>
<tr>
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.set_menu_items.nil?
order_item.set_menu_items.each do |item_instance| %>
<br><span class="font-13"><%= item_instance %></span>
<% end
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<% end %>
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.set_menu_items.nil?
order_item.set_menu_items.each do |item_instance| %>
<br><span class="font-13"><%= item_instance %></span>
<% end
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
# end
@@ -365,26 +345,7 @@
@order_items.each do |order_item |
count += 1
%>
<% if !@assigned_order_items.nil? %>
<% @assigned_order_items.each do |assigned_order_item| %>
<% if assigned_order_item.include? (order_item.order_items_id) %>
<tr class="edit_order" data-id='<%= assigned_order_item[order_item.order_items_id] %>'>
<td><%= count %>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.set_menu_items.nil?
order_item.set_menu_items.each do |item_instance| %>
<br><span class="font-13"><%= item_instance %></span>
<% end
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<% end %>
<% end %>
<% else %>
<tr>
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<td><%= count %>
<td class='item-name'>
<%= order_item.item_name %>
@@ -397,7 +358,6 @@
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<% end %>
<%
end
@@ -436,7 +396,10 @@
<!-- Waiter Buttons -->
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i> Back</button>
<button type="button" id="add_order" class="btn btn-block btn- bg-blue waves-effect">Add Order</button>
<% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "supervisor" || current_login_employee.role == "cashier" || current_login_employee.role == "waiter" %>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect">Survey</button>
<% end %>
<% if current_login_employee.role != "waiter" %>
<% if @room.bookings.length >= 1 %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<!-- <button type="button" class="btn bg-blue btn-block" >Add Order</button> -->
@@ -522,6 +485,7 @@
<% end %>
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block" >Re.Print</button> -->
<% end %>
<% end %>
</div>
</div>
</div>

View File

@@ -198,7 +198,7 @@
<th>#</th>
<th>Receipt No.</th>
<th>Total</th>
<% if !@current_user.nil? && @current_user.role == 'cashier' %>
<% if !@current_user.nil? && @current_user.role != 'waiter' %>
<th>Action</th>
<% end %>
</thead>
@@ -214,7 +214,7 @@
<td><span id="receipt_no"><%= sale_data.receipt_no %></span></td>
<td><span id="grand_total"><%= sale_data.grand_total %></span></td>
<% if !@current_user.nil? && @current_user.role == 'cashier' %>
<% if !@current_user.nil? && @current_user.role != 'waiter' %>
<td>
<button type="button" class="btn btn-block waves-effect btn-primary btn_pay" id=<%= sale_data.sale_id %> >Pay</button>
</td>
@@ -238,7 +238,9 @@
<div>
<button type="button" class="btn bg-default btn-block waves-effect" id="back" ><i class="material-icons">reply</i> Back </button>
<% if !@current_user.nil? && @current_user.role != 'waiter' %>
<button id="equal_split" class="btn btn-block waves-effect bg-blue">= Split</button>
<% if !@sale_data.empty? %>
<button id="equal_split" class="btn btn-block waves-effect bg-blue">= Split</button>
<% end %>
<% end %>
<% if !@orders.empty? %>
<button id="order_split" class="btn btn-block waves-effect bg-blue">By Order</button>

View File

@@ -91,37 +91,37 @@
<tr>
<td style='text-align:right;'><%= count %></td>
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
<td style='color:red;text-align:right;'><%= number_with_precision(sale[:void_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:mpu_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:master_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:visa_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:jcb_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:paypar_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision:precision, delimiter: delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='color:red;text-align:right;'><%= number_with_precision(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:mpu_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:master_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:visa_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:jcb_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:paypar_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<% count = count + 1 %>
<% end %>
<tr style="font-weight:600;">
<td colspan="3" style='text-align:center;'>Total</td>
<td style='text-align:right;'><%= number_with_precision(mpu , precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(master, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(mpu , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(master, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(visa, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(jcb, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(paypar, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(cash, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(jcb, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(paypar, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision,delimiter:delimiter) rescue '-'%>)</td>
<td style='text-align:right;'><%= number_with_precision(total, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
<td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<% total_tax = 0 %>
@@ -130,7 +130,7 @@
<% total_tax += tax.tax_amount.to_f %>
<tr style="font-weight:600;">
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
@@ -138,7 +138,7 @@
<% net = total - total_tax %>
<tr style="font-weight:600;">
<td colspan="12" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
<td style='text-align:right;'><%= number_with_precision(net, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% end %>

View File

@@ -0,0 +1,113 @@
<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.sale_item_report") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
</ol>
</div>
<div class="row">
<div class="col-md-12">
<div class="text-right">
<a href="javascript:export_to('<%=reports_product_sale_index_path%>.xls')" class = "btn btn-info wave-effects "><%= t("views.btn.exp_to_excel") %></a>
</div>
<div class="margin-top-20">
<div class="card">
<div class="p-l-20 p-t-20 p-b-20">
<div class="col-md-6">
<label class="font-16" for="order_by">Order by Qty</label>
<select name="order_by" id="order_by" class="form-control" style="width:10%">
<option value="asc">ASC</option>
<option value="desc">DESC</option>
</select>
</div>
</div>
<div class="table-responsive">
<% 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 %>
<table class="table table-striped" id="items_table" border="0">
<thead>
<tr>
<th>&nbsp;</th>
<th><%= t("views.right_panel.header.menu_category") %></th>
<th><%= t("views.right_panel.detail.code") %></th>
<th><%= t("views.right_panel.detail.product") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
<th><%= t("views.right_panel.detail.unit_price") %></th>
<th><%= t("views.right_panel.detail.total") %></th>
</tr>
</thead>
<tbody id="tbd_data">
<% unless @sale_data.blank? %>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% grand_total = 0 %>
<% total_qty = 0 %>
<% @sale_data.each do |sale| %>
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
grand_total += sale.grand_total
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
grand_total += sale.grand_total
end %>
<tr>
<td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
<td><%= sale.menu_category_name %></td>
<% cate_arr.push(sale.menu_category_id) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue '-' %></td>
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
</tr>
<!-- sub total -->
<!-- end sub total -->
<% end %>
<tr>
<td colspan="3"></td>
<td><strong>Total</strong></td>
<td><strong><%= total_qty %></strong></td>
<td></td>
<td><strong><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></strong></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
$('#order_by').val('<%= @order_by %>');
});
$('#order_by').on('change', function(){
var order_by = $("#order_by").val();
window.location.href = "?order_by=" + order_by;
});
</script>

View File

@@ -0,0 +1,64 @@
<div class="row">
<div class="col-md-12">
<div class="margin-top-20">
<div class="card">
<div class="table-responsive">
<table class="table table-striped" id="items_table" border="0">
<thead>
<tr>
<th>&nbsp;</th>
<th><%= t("views.right_panel.header.menu_category") %></th>
<th><%= t("views.right_panel.detail.code") %></th>
<th><%= t("views.right_panel.detail.product") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
<th><%= t("views.right_panel.detail.unit_price") %></th>
<th><%= t("views.right_panel.detail.total") %></th>
</tr>
</thead>
<tbody>
<% unless @sale_data.blank? %>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% grand_total = 0 %>
<% total_qty = 0 %>
<% @sale_data.each do |sale| %>
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
grand_total += sale.grand_total
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
grand_total += sale.grand_total
end %>
<tr>
<td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
<td><%= sale.menu_category_name %></td>
<% cate_arr.push(sale.menu_category_id) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue '-' %></td>
<td><%= sale.unit_price rescue '-' %></td>
<td><%= sale.grand_total rescue '-' %></td>
</tr>
<% end %>
<tr>
<td colspan="3"></td>
<td><strong>Total</strong></td>
<td><strong><%= total_qty %></strong></td>
<td></td>
<td><strong><%= grand_total rescue '-' %></strong></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View File

@@ -101,7 +101,7 @@
<td>
<% @totalByAccount.each do |account, total| %>
<% if sale.account_id == account %>
<b><%= number_with_precision(total, precision:precision,delimiter:delimiter) %></b>
<b><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) %></b>
<% grand_total += total %>
<% end %>
<% end %>
@@ -120,8 +120,8 @@
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue '-' %></td>
<td><%= number_with_precision(sale.unit_price , precision:precision,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.grand_total , precision:precision,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
@@ -140,7 +140,7 @@
<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"><%= number_with_precision(sub_total , precision:precision,delimiter:delimiter)%> </span></td>
<td ><span class="underline"><%= number_with_precision(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
</tr>
<% sub_total = 0.0%>
<% sub_qty = 0 %>
@@ -168,8 +168,8 @@
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>
<td><%= other.total_item rescue '-' %></td>
<td> <%= number_with_precision(other.unit_price , precision:precision,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_with_precision(other.grand_total , precision:precision,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
@@ -179,7 +179,7 @@
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_with_precision(other_sub_total , precision:precision,delimiter:delimiter)%></span></td>
<td ><span><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
<!-- End Other Charges -->
@@ -188,29 +188,35 @@
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
<td><span><%= total_qty%></span></td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision,delimiter:delimiter)%></span></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.foc_item") %> <%= t("views.right_panel.detail.amount") %></td>
<td><span><%= number_with_precision(total_item_foc , precision:precision,delimiter:delimiter) %></span></td>
<td><span><%= number_with_precision(total_item_foc , precision:precision.to_i,delimiter:delimiter) %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(total_item_dis , precision:precision,delimiter:delimiter) %></span></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(total_item_dis , precision:precision.to_i,delimiter:delimiter) %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.foc_sales") %></td>
<td><span><%= number_with_precision(@foc_data , precision:precision,delimiter:delimiter) %></span></td>
<td>
<span><%= number_with_precision(@foc_data, precision:precision.to_i, delimiter:delimiter) %></span>
</td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(@discount_data , precision:precision,delimiter:delimiter) %></span></td>
<td style="border-bottom:2px solid grey;">
<span>
<%= number_with_precision(@discount_data , precision: precision.to_i,delimiter: delimiter) %>
</span>
</td>
</tr>
<% @sale_taxes.each do |tax| %>
@@ -226,7 +232,7 @@
<td colspan="5">&nbsp;</td>
<td style="border-top:2px solid grey;">Net Amount</td>
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
<td style="border-top:2px solid grey;"><%= number_with_precision(grand_total.to_f - @discount_data.to_f , precision:precision,delimiter:delimiter)%></td>
<td style="border-top:2px solid grey;"><%= number_with_precision(grand_total.to_f - @discount_data.to_f , precision:precision.to_i,delimiter:delimiter)%></td>
</tr>
<!-- <tr>
<td colspan="5">&nbsp;</td>

View File

@@ -98,16 +98,16 @@
<%= result[:shift_closed_at].strftime("%e %b %I:%M%p") rescue '-' %>
</td>
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
<td><%= number_with_precision(result[:cash_sales].to_f, precision:precision,delimiter:delimiter) %></td>
<td><%= number_with_precision(result[:credit_sales].to_f, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(result[:cash_sales].to_f, precision:precision.to_i,delimiter:delimiter) %></td>
<td><%= number_with_precision(result[:credit_sales].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<!-- <td><%= sprintf "%.2f",result.accept_credit_amount.to_f.to_d rescue '-'%></td> -->
<!-- <td><%= sprintf "%.2f",result.foc_amount.to_f.to_d rescue '-'%></td>
<td><%= sprintf "%.2f",result.card_amount.to_f.to_d rescue '-'%></td> -->
<td><%= number_with_precision(result[:other_sales].to_f, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(result[:other_sales].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td>
<%= number_with_precision(result[:foc_sales].to_f, precision:precision,delimiter:delimiter) rescue '-'%>
<%= number_with_precision(result[:foc_sales].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%>
</td>
<td><%= number_with_precision(result[:grand_total].to_f, precision:precision,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(result[:grand_total].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<!-- <td><%= sprintf "%.2f",result[:rounding_adj].to_f.to_d rescue '-'%></td> -->
<% grand_total = result[:grand_total].to_f %>
@@ -126,15 +126,15 @@
<tr style="border-top: 3px solid grey;">
<td colspan="3"></td>
<!-- <td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td> -->
<td><b><%= number_with_precision(cash, precision:precision,delimiter:delimiter) rescue '-'%></b></td>
<td><b><%= number_with_precision(credit, precision:precision,delimiter:delimiter) rescue '-'%></b></td>
<td><b><%= number_with_precision(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
<td><b><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
<!-- <td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
<td><b><%= number_with_precision(card, precision:precision,delimiter:delimiter) rescue '-'%></b></td>
<td><b><%= number_with_precision(foc, precision:precision,delimiter:delimiter) rescue '-'%></b></td>
<td><b><%= number_with_precision(card, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
<td><b><%= number_with_precision(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
<td><b><%= number_with_precision(g_total, precision:precision,delimiter:delimiter) rescue '-'%></b></td>
<td><b><%= number_with_precision(g_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></b></td>
</tr>
</tbody>
</table>

View File

@@ -28,6 +28,18 @@
<div class="margin-top-20">
<div class="card">
<div class="table-responsive">
<% 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
%>
<table class="table table-striped">
<thead>
<tr>
@@ -63,7 +75,7 @@
<% end %>
</td>
<td><%= result.stock_count rescue '-' %></td>
<td><%= result.stock_balance rescue '-' %></td>
<td><%= number_with_precision(result.stock_balance, precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
<td><%= result.different rescue '-' %></td>
<td><%= result.remark rescue '-' %></td>
<td><%= result.created_at.strftime('%e %b %Y %I:%M %p') rescue '-' %></td>
@@ -76,7 +88,7 @@
<tr style="border-top: 3px solid grey;">
<td colspan="3"></td>
<td><b><%= total_stock_count rescue '-' %></b></td>
<td><b><%= total_stock_balance rescue '-' %></b></td>
<td><b><%= number_with_precision(total_stock_balance, precision:precision.to_i,delimiter:delimiter) rescue '-' %></b></td>
<td><b><%= total_different rescue '-' %></b></td>
<td colspan="2"></td>
</tr>