remove conflict data
This commit is contained in:
@@ -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>
|
||||
@@ -140,11 +169,11 @@
|
||||
</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.total_sale") %> : </td>
|
||||
@@ -165,7 +194,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>
|
||||
@@ -178,7 +207,7 @@
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.other_payment") %> : </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 %>
|
||||
@@ -188,11 +217,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>
|
||||
@@ -231,10 +266,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>
|
||||
@@ -278,6 +319,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>
|
||||
@@ -18,7 +18,7 @@
|
||||
<a href="javascript:void(0);" class="bars"></a>
|
||||
<a class="navbar-brand" href="<%=dashboard_path%>" style="margin-left: 20px;">
|
||||
<% else %>
|
||||
<a class="navbar-brand m-0" href="<%=dashboard_path%>">
|
||||
<a class="navbar-brand m-0" href="<%= origami_dashboard_path%>">
|
||||
<%end%>
|
||||
<img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
|
||||
<span class="navbar-brand-txt">SX Restaurant</span>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -118,13 +118,45 @@ $(document).ready(function(){
|
||||
data: params,
|
||||
success: function(result){
|
||||
// alert("Updated!");
|
||||
window.location.href = '/oqs';
|
||||
<% if !@link_type.nil? %>
|
||||
<% if @link_type == 'oqs' %>
|
||||
window.location.href = '/oqs';
|
||||
<% else %>
|
||||
<% if !@dining_type.nil? %>
|
||||
<% if @dining_type == 'Table' %>
|
||||
window.location.href = '/origami/table/'+<%=@link_type%>;
|
||||
<% else %>
|
||||
window.location.href = '/origami/room/'+<%=@link_type%>;
|
||||
<% end %>
|
||||
<% else %>
|
||||
window.location.href = '/origami/table/'+<%=@link_type%>;
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
window.location.href = '/oqs';
|
||||
<% end %>
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#back').on('click', function () {
|
||||
<% if !@link_type.nil? %>
|
||||
<% if @link_type == 'oqs' %>
|
||||
window.location.href = '/oqs';
|
||||
<% else %>
|
||||
<% if !@dining_type.nil? %>
|
||||
<% if @dining_type == 'Table' %>
|
||||
window.location.href = '/origami/table/'+<%=@link_type%>;
|
||||
<% else %>
|
||||
window.location.href = '/origami/room/'+<%=@link_type%>;
|
||||
<% end %>
|
||||
<% else %>
|
||||
window.location.href = '/origami/table/'+<%=@link_type%>;
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
window.location.href = '/oqs';
|
||||
<% end %>
|
||||
})
|
||||
|
||||
// number key pad
|
||||
|
||||
@@ -72,7 +72,12 @@
|
||||
<div class="card queue_station" data-order-no="<%= qid.order_id %>">
|
||||
<div class="card-block">
|
||||
<div class="row">
|
||||
<span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span>
|
||||
<%if qid.type.present?%>
|
||||
<span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span>
|
||||
<%else%>
|
||||
<span class="col-md-4 order-zone-type font-13"></span>
|
||||
<%end%>
|
||||
|
||||
<span class="order-zone hidden font-13"><%= qid.zone %></span>
|
||||
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
|
||||
</div>
|
||||
@@ -83,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>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
<%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %>
|
||||
<div id="oqs_loading_wrapper" style="display:none;">
|
||||
@@ -7,8 +6,8 @@
|
||||
|
||||
<% type = request.path_info.include?('quick_service')%>
|
||||
<% modify_order = request.path_info.include?('modify_order')%>
|
||||
<input type="hidden" name="type" id="type" value="<%=type%>">
|
||||
<input type="hidden" name="type" id="modify_order" value="<%=modify_order%>">
|
||||
<input type="hidden" name="type" id="role" value="<%= current_user.role%>">
|
||||
|
||||
<div class="row m-t--20">
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- <a href="javascript:void(0);" class="dropdown-toggle waves-block p-t-15 p-l-15 p-b-15" data-toggle="dropdown" aria-haspopup="" aria-expanded="true" style="background-color: #eeeeee;border-bottom: .214rem solid #fff;border-left: 1px solid #54A5AF;
|
||||
@@ -46,10 +45,10 @@
|
||||
<!--if type quick_service or cashier for table -->
|
||||
<% if type %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
|
||||
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||
<ul class="sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||
</ul>
|
||||
</a>
|
||||
</li>
|
||||
@@ -58,7 +57,7 @@
|
||||
<% else %>
|
||||
<% if @table.get_current_checkout_booking.nil? %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
|
||||
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||
@@ -67,7 +66,7 @@
|
||||
</li>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
|
||||
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||
@@ -82,46 +81,55 @@
|
||||
<%end %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10">
|
||||
<div class="card-columns custom-card-columns menu_items_list" style="column-gap: 10px;">
|
||||
<!-- append data -->
|
||||
<% @menu.each do |menu| %>
|
||||
<% if !menu.valid_time.nil? %>
|
||||
<% if menu.menu_category_id.nil? %>
|
||||
<!--if type quick_service or cashier for table -->
|
||||
<% if type %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<div class='card-block custom-card-block'>
|
||||
<p><%=menu.name%> <p>
|
||||
<p><%=menu.code%> <p>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
||||
<!-- else quick_service or cashier for table -->
|
||||
<% else %>
|
||||
<% if @table.get_current_checkout_booking.nil? %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<div class='card-block custom-card-block'>
|
||||
<p><%=menu.name%> <p>
|
||||
<p><%=menu.code%> <p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10" >
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<div id="custom-slimscroll">
|
||||
<div class="card-columns custom-card-columns menu_items_list" style="column-gap: 0.5rem;">
|
||||
<!-- append data -->
|
||||
<% @menu.each do |menu| %>
|
||||
<% if !menu.valid_time.nil? %>
|
||||
<% if menu.menu_category_id.nil? %>
|
||||
<!--if type quick_service or cashier for table -->
|
||||
<% if type %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<div class='card-block custom-card-block'>
|
||||
<p><%=menu.name%> <p>
|
||||
<p><%=menu.code%> <p>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
||||
<!-- else quick_service or cashier for table -->
|
||||
<% else %>
|
||||
<% if @table.get_current_checkout_booking.nil? %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<div class='card-block custom-card-block'>
|
||||
<p><%=menu.name%> <p>
|
||||
<p><%=menu.code%> <p>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<div class='card-block custom-card-block'>
|
||||
<p><%=menu.name%> <p>
|
||||
<p><%=menu.code%> <p>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
||||
<!-- end quick_service or cashier for table -->
|
||||
<% end %>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<div class='card-block custom-card-block'>
|
||||
<p><%=menu.name%> <p>
|
||||
<p><%=menu.code%> <p>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
||||
<!-- end quick_service or cashier for table -->
|
||||
<% end %>
|
||||
<% end%>
|
||||
<% end %>
|
||||
<%end %>
|
||||
<% end %>
|
||||
<%end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -132,15 +140,19 @@
|
||||
<!-- <i class="material-icons">reply</i> -->
|
||||
Back
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-7" id='pending_order'>Pending Order
|
||||
</button>
|
||||
|
||||
<%elsif !modify_order && type%>
|
||||
<button type="button" class="btn btn-lg btn-default waves-effect col-md-2" id='back' style=" padding: .5rem 0.15rem !important;">
|
||||
<!-- <i class="material-icons">reply</i> -->
|
||||
Back
|
||||
</button>
|
||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
|
||||
</button>
|
||||
|
||||
<a class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal" style=" padding: .5rem 0.15rem !important;">Select</a>
|
||||
<input type="hidden" name="table_id" value="" id="table_id">
|
||||
|
||||
@@ -169,7 +181,7 @@
|
||||
<% end%>
|
||||
|
||||
<p class="hidden" id="booking_id"><%=@booking_id%></p>
|
||||
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
|
||||
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : '---'%></p>
|
||||
<p class="hidden" id="sale_id"><%=@sale_id%></p>
|
||||
<% else%>
|
||||
<p class="hidden" id="table_type"></p>
|
||||
@@ -204,23 +216,29 @@
|
||||
</div>
|
||||
<div class="card-footer custom-card-footer" style="padding: 0.35rem 0.15rem !important;">
|
||||
|
||||
<!-- <table class="table" id="order-charges-table" border="0">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="sub_total">0.00</strong></td>
|
||||
<td style="padding:2px;" width="5%"></td>
|
||||
<td style="padding:2px;" width="15%"></td>
|
||||
<td style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
|
||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">0.00</strong></td>
|
||||
</tr>
|
||||
</table> -->
|
||||
</table>
|
||||
<% if type && modify_order%>
|
||||
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
|
||||
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-10" id="create_pay_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Update Order & Pay</button>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-11" id="create_pay_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Update Order & Pay</button>
|
||||
<%elsif !modify_order && type%>
|
||||
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
|
||||
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-6" id="create_pay_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Create & Pay</button>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-5" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Create Order</button>
|
||||
<% if current_user.role != "waiter"%>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-4" id="create_pay_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
|
||||
<%end%>
|
||||
<% if current_user.role == "waiter"%>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
|
||||
<%end%>
|
||||
<%else%>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-10" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Create Order</button>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-11" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
|
||||
<%end%>
|
||||
|
||||
|
||||
@@ -465,6 +483,10 @@
|
||||
</div>
|
||||
<% end %>
|
||||
<script>
|
||||
jQuery(function(){
|
||||
id = "<%=@menu[0].id%>";
|
||||
jQuery('.first_'+id).click();
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$(".tables").on('click', function () {
|
||||
$('.tables').css('background-color','');
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#table" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#room" role="tab">Rooms</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" style="max-height:650px; overflow:auto">
|
||||
|
||||
<div class="tab-pane active" id="table" role="tabpanel" style="max-height:; overflow:auto">
|
||||
<% @tables.each do |zone| %>
|
||||
<h3>Zone : <%=zone.zone.name%></h3>
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||
|
||||
<% @all_table.each do |table| %>
|
||||
<% if zone.zone_id == table.zone_id %>
|
||||
<div class="card click_table <%= table.status=="available" ? "available" : "occupied"%>" data-id = "<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden table-status"><%= table.status %></p>
|
||||
<p style="text-align: center"><%= table.name %></p>
|
||||
<p style="text-align: center">Seat : <%= table.seater %></p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %> <% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="room" role="tabpanel" style="max-height:; overflow:auto">
|
||||
<% @rooms.each do |zone| %>
|
||||
<h3>Zone : <%=zone.zone.name%></h3>
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||
|
||||
<% @all_room.each do |room| %>
|
||||
<% if zone.zone_id == room.zone_id %>
|
||||
<div class="card click_table <%= room.status=="available" ? "available" : "occupied"%>" data-id = "<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden table-status"><%= room.status %></p>
|
||||
<p style="text-align: center"><%= room.name %></p>
|
||||
<p style="text-align: center">Seat : <%= room.seater %></p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %> <% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>
|
||||
Back
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).on('click',".click_table",function(){
|
||||
|
||||
var dining_id = $(this).attr('data-id');
|
||||
var status = $(this).find(".table-status").text();
|
||||
|
||||
if (status == "available") {
|
||||
$.confirm({
|
||||
title: 'Confirmation !',
|
||||
content: 'Are you sure to assign this table',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
window.location.href = '/origami/addorders/'+dining_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$.confirm({
|
||||
title: 'Alert!',
|
||||
content: 'You cannot assign this table',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-red',
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.card-columns {
|
||||
-webkit-column-count:5;
|
||||
-moz-column-count:5;
|
||||
column-count:5;
|
||||
}
|
||||
|
||||
.occupied{
|
||||
color: #fff !important;
|
||||
background-color: red;
|
||||
}
|
||||
.available{
|
||||
color: #fff !important;
|
||||
background-color: #009900;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -14,55 +14,7 @@
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<!-- Widgets -->
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
||||
<div class="info-box bg-cyan hover-expand-effect">
|
||||
<div class="icon">
|
||||
<i class="material-icons">help</i>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="text"><%= t :sale_count %></div>
|
||||
<div class="number count-to" data-from="0" data-to="<%= @total_count%>" data-speed="1000" data-fresh-interval="20"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
||||
<div class="info-box bg-pink hover-expand-effect">
|
||||
<div class="icon">
|
||||
<i class="material-icons">attach_money</i>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="text"><%= t :total_sale %></div>
|
||||
<div class="number count-to" data-from="0" data-to="<%= @total_sale%>" data-speed="15" data-fresh-interval="20"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
||||
<div class="info-box bg-light-green hover-expand-effect">
|
||||
<div class="icon">
|
||||
<i class="material-icons">person_add</i>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="text"><%= t :total_credit %></div>
|
||||
<div class="number count-to" data-from="0" data-to="<%= @total_credit%>" data-speed="1000" data-fresh-interval="20"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
||||
<div class="info-box bg-orange hover-expand-effect">
|
||||
<div class="icon">
|
||||
<i class="material-icons">credit_card</i>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="text"><%= t :total_card %></div>
|
||||
<div class="number count-to" data-from="0" data-to="<%= @total_card%>" data-speed="1000" data-fresh-interval="20"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- #END# Widgets -->
|
||||
<!-- Widgets -->
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 qs_view">
|
||||
@@ -83,6 +35,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- #END# Widgets -->
|
||||
<% if !@current_user.nil? && @current_user.role != 'waiter' %>
|
||||
<!-- CPU Usage -->
|
||||
<div class="row clearfix">
|
||||
|
||||
@@ -234,6 +187,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
</div>
|
||||
<div id="order-detail-slimscroll" data-height="160">
|
||||
<div class="card-text dining">
|
||||
<span id="discount_itemsErr" style="color:red;"></span>
|
||||
<table class="table table-default" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -44,7 +45,7 @@
|
||||
<% @sale_data.sale_items.each do |sale_item| %>
|
||||
<%
|
||||
sub_total += sale_item.qty*sale_item.unit_price
|
||||
if sale_item.price != 0 && sale_item.remark != "void" && sale_item.remark != "foc"
|
||||
if sale_item.price != 0 && sale_item.status != "void" && sale_item.status != "foc"
|
||||
%>
|
||||
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
|
||||
<td style="width:60%; text-align:left">
|
||||
@@ -117,6 +118,7 @@
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<input type="text" id="discount-amount" name="discount-amount" value="<%= @sale_data.total_discount rescue 0 %>" class="form-control" />
|
||||
<span id="discount-amountErr" style="color:red;"></span>
|
||||
</div>
|
||||
<br>
|
||||
<div class="form-group">
|
||||
@@ -253,34 +255,29 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
if(event.handled !== true) {
|
||||
var original_value=0;
|
||||
original_value = $('#discount-amount').val();
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
$('#discount-amount').val(input_value);
|
||||
}
|
||||
else{
|
||||
$('#discount-amount').val(original_value + '' + input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
$('#discount-amount').val(input_value);
|
||||
}
|
||||
else{
|
||||
$('#discount-amount').val(original_value + '' + input_value);
|
||||
}
|
||||
break;
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value);
|
||||
$('#discount-amount').val(amount);
|
||||
break;
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value);
|
||||
$('#discount-amount').val(amount);
|
||||
break;
|
||||
case 'del' :
|
||||
var discount_text=$('#discount-amount').val();
|
||||
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
|
||||
break;
|
||||
|
||||
var discount_text=$('#discount-amount').val();
|
||||
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
|
||||
break;
|
||||
case 'clr':
|
||||
$('#discount-amount').val("0.0");
|
||||
break;
|
||||
$('#discount-amount').val("0.0");
|
||||
break;
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
@@ -334,24 +331,40 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
$("#net").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_value = parseFloat($('#discount-amount').val());
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var sub_total = parseFloat($('#order-sub-total').text());
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
if(discount_value!=""){
|
||||
if(discount_value > 0){
|
||||
if(parseFloat(discount_value) > sub_total){
|
||||
$("#discount-amount").val("");
|
||||
$("#discount-amountErr").html("Discount is greater than sub total!");
|
||||
}else{
|
||||
$("#discount-amountErr").html("");
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
// Selected Account
|
||||
var account_types = get_selected_account_types();
|
||||
|
||||
// Selected Account
|
||||
var account_types = get_selected_account_types();
|
||||
if(sale_items.length == 0 && account_types.length == 0){
|
||||
calculate_overall_discount(0, discount_value);
|
||||
}
|
||||
else {
|
||||
calculate_item_discount(0, discount_value, sale_items, account_types);
|
||||
}
|
||||
|
||||
if(sale_items.length == 0 && account_types.length == 0){
|
||||
calculate_overall_discount(0, discount_value);
|
||||
// Remove Selection
|
||||
selection_remove();
|
||||
}
|
||||
}else{
|
||||
$("#discount-amountErr").html("Discount must be greater than 0!");
|
||||
}
|
||||
}else{
|
||||
$("#discount-amountErr").html("can't be blank");
|
||||
}
|
||||
else {
|
||||
calculate_item_discount(0, discount_value, sale_items, account_types);
|
||||
}
|
||||
|
||||
// Remove Selection
|
||||
selection_remove();
|
||||
|
||||
});
|
||||
|
||||
// Calculate Percentage Discount for Payment
|
||||
@@ -362,8 +375,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
|
||||
var sale_items = get_selected_sale_items();
|
||||
// Selected Account
|
||||
var account_types = get_selected_account_types();
|
||||
|
||||
@@ -437,7 +449,6 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
console.log(sale_items.length);
|
||||
if(sale_items.length == 0){
|
||||
//swal("Information!", "You have no selected item!");
|
||||
swal ( "Oops" , "You have no selected item!" , "error" );
|
||||
@@ -671,113 +682,150 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
var dis_amount = 0;
|
||||
var sub_total = 0;
|
||||
var total_discount = 0;
|
||||
var arrItemName = "";
|
||||
$("#discount_itemsErr").html("");
|
||||
$("#discount-amountErr").html("");
|
||||
// For Net Pay
|
||||
if(type == 0){
|
||||
dis_amount = (0 - amount);
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// var discount_item_row = item_row_template(type, sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// No Needs For Auto Selected
|
||||
// if(account_types.length > 0){
|
||||
// var item_rows=get_item_rows();
|
||||
// if(item_rows.length > 0){
|
||||
// for(var k=0; k < item_rows.length; k++){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(item_rows[k].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// alert("No Items!");
|
||||
// }
|
||||
// }
|
||||
|
||||
sub_total = origin_sub_total - total_discount;
|
||||
}
|
||||
|
||||
// For Percentage Pay
|
||||
if(type == 1){
|
||||
if(amount > 100 ){
|
||||
swal({
|
||||
title:"Oops!",
|
||||
text:'Percentage Value over 100!',
|
||||
type: "error",
|
||||
confirmButtonText: 'OK',
|
||||
confirmButtonColor:"red"
|
||||
});
|
||||
}
|
||||
else{
|
||||
// Check sale items exists
|
||||
if(origin_sub_total > 0){
|
||||
if(type == 0){
|
||||
dis_amount = (0 - amount);
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
// var discount_item_row = item_row_template(type, sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
if(parseFloat(amount) > parseFloat(sale_items[i].price)){
|
||||
arrItemName += ", " + sale_items[i].name;
|
||||
}else{
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
total_discount = parseFloat(total_discount) + parseFloat(amount);
|
||||
|
||||
if(parseFloat(origin_sub_total) >= parseFloat(total_discount)){
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
}else{
|
||||
total_discount = parseFloat(total_discount) - parseFloat(amount);
|
||||
$("#discount-amountErr").html("Discount is greater than sub total!");
|
||||
}
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
sub_total = origin_sub_total + total_discount;
|
||||
}
|
||||
|
||||
if(arrItemName!=""){
|
||||
arrItemName = arrItemName.substr(2);
|
||||
if(arrItemName.match(/,/g || []) != null){
|
||||
if(arrItemName.match(/,/g || []).length >= 1){
|
||||
$("#discount_itemsErr").html("Discount is greater than "+arrItemName+" prices");
|
||||
}
|
||||
}else{
|
||||
$("#discount_itemsErr").html("Discount is greater than "+arrItemName+" price");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// No Needs For Auto Selected
|
||||
// if(account_types.length > 0){
|
||||
// var item_rows=get_item_rows();
|
||||
// if(item_rows.length > 0){
|
||||
// for(var k=0; k < item_rows.length; k++){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(item_rows[k].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// alert("No Items!");
|
||||
// }
|
||||
// }
|
||||
|
||||
sub_total = parseFloat(origin_sub_total) - parseFloat(total_discount);
|
||||
}
|
||||
// No Needs For Auto Selected
|
||||
// Check account types exists
|
||||
// if(account_types.length > 0){
|
||||
// var item_rows=get_item_rows();
|
||||
// console.log(account_types);
|
||||
// if(item_rows.length > 0){
|
||||
// for(var k=0; k < item_rows.length; k++){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(item_rows[k].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((item_rows[k].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// alert("No Items!");
|
||||
// }
|
||||
// }
|
||||
|
||||
// For Percentage Pay
|
||||
if(type == 1){
|
||||
if(amount > 100 ){
|
||||
swal({
|
||||
title:"Oops!",
|
||||
text:'Percentage Value over 100!',
|
||||
type: "error",
|
||||
confirmButtonText: 'OK',
|
||||
confirmButtonColor:"red"
|
||||
});
|
||||
}
|
||||
else{
|
||||
// Check sale items exists
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
|
||||
total_discount = total_discount + dis_amount;
|
||||
if(parseFloat(origin_sub_total) >= parseFloat(total_discount)){
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
}else{
|
||||
total_discount = total_discount - dis_amount;
|
||||
$("#discount-amountErr").html("Discount is greater than sub total!");
|
||||
}
|
||||
// }
|
||||
}
|
||||
sub_total = parseFloat(origin_sub_total) + parseFloat(total_discount);
|
||||
}
|
||||
}
|
||||
// No Needs For Auto Selected
|
||||
// Check account types exists
|
||||
// if(account_types.length > 0){
|
||||
// var item_rows=get_item_rows();
|
||||
// console.log(account_types);
|
||||
// if(item_rows.length > 0){
|
||||
// for(var k=0; k < item_rows.length; k++){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(item_rows[k].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((item_rows[k].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// alert("No Items!");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
$("#order-sub-total").text(parseFloat(sub_total).toFixed(2));
|
||||
}else{
|
||||
$("#discount-amountErr").html("Discount is greater than sub total!");
|
||||
}
|
||||
|
||||
$("#order-sub-total").text(sub_total);
|
||||
}
|
||||
|
||||
function item_row_template(type, item, discount_amount, amount){
|
||||
|
||||
@@ -276,11 +276,11 @@
|
||||
</tr>
|
||||
|
||||
<%
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
if @status_order == 'order' && @status_sale != 'sale'
|
||||
puts
|
||||
unless @order_items.nil? || @order_items.empty?
|
||||
count = 0
|
||||
@order_items.each do |order_item|
|
||||
@@ -288,19 +288,19 @@
|
||||
sub_total = sub_total + (order_item.price * order_item.qty)
|
||||
|
||||
# unless order_item.price == 0 %>
|
||||
<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>
|
||||
<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
|
||||
@@ -367,21 +367,19 @@
|
||||
@order_items.each do |order_item|
|
||||
count += 1
|
||||
%>
|
||||
|
||||
<tr>
|
||||
<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>
|
||||
|
||||
<tr class="edit_order" data-id='<%= 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
|
||||
%>
|
||||
@@ -427,8 +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 != "waiter" %>
|
||||
<% 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>
|
||||
@@ -447,13 +447,24 @@
|
||||
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" disabled> Void</button> -->
|
||||
<% end %>
|
||||
<% if @status_sale == 'sale' %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||
<% end %>
|
||||
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
|
||||
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||
<% end %>
|
||||
<% if !@split_bill.nil? %>
|
||||
<% if @split_bill == '1' %>
|
||||
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<!-- first bill not used in cloud -->
|
||||
<% if ENV["SERVER_MODE"] == "cloud" %>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
@@ -464,14 +475,9 @@
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<%end%>
|
||||
<% end %>
|
||||
<% if !@split_bill.nil? %>
|
||||
<% if @split_bill == '1' %>
|
||||
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- Cashier Buttons -->
|
||||
|
||||
<!-- <button type="button" id="re-print" class="btn btn-block bg-blue waves-effect" >Re.Print</button> -->
|
||||
@@ -513,6 +519,30 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
cashier_type = "cashier"
|
||||
$(document).ready(function () {
|
||||
@@ -845,9 +875,12 @@
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
var remark = $("#remark").val();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
success: function () {
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
@@ -898,4 +931,13 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/*edit order in oqs*/
|
||||
$('.edit_order').on('click',function(){
|
||||
var assigned_order_item_id = $(this).attr('data-id');
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
if((assigned_order_item_id!=undefined) && (assigned_order_item_id!='')){
|
||||
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -2,6 +2,21 @@
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<% if !@print_settings.nil? %>
|
||||
<% 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
|
||||
%>
|
||||
<% end %>
|
||||
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
<div class="card">
|
||||
@@ -56,9 +71,9 @@
|
||||
<% sub_total += sale_item.price%>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class="item-name"><%=sale_item.product_name%>@<%=sale_item.unit_price%></td>
|
||||
<td class="item-name"><%=sale_item.product_name%>@<%=number_with_precision( sale_item.unit_price, precision: precision.to_i )%></td>
|
||||
<td class="item-attr"><%=sale_item.qty%></td>
|
||||
<td class="item-attr"><%=(sale_item.price)%></td>
|
||||
<td class="item-attr"><%=(number_with_precision(sale_item.price, precision: precision.to_i ))%></td>
|
||||
</tr>
|
||||
<%end %>
|
||||
</tbody>
|
||||
@@ -71,7 +86,7 @@
|
||||
<tfooter>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total</strong></td>
|
||||
<td class="item-attr"><strong><span id="sub-total"><%=sub_total%></span></strong></td>
|
||||
<td class="item-attr"><strong><span id="sub-total"><%=number_with_precision(sub_total, precision: precision.to_i)%></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @sale_data.discount_type == 'member_discount'%>
|
||||
@@ -79,7 +94,7 @@
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>(Discount)</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong><span>(<%=@sale_data.total_discount rescue 0%>)</span></strong></td>
|
||||
<td class="item-attr"><strong><span>(<%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>)</span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax
|
||||
@@ -91,22 +106,36 @@
|
||||
<%end%>
|
||||
<%end %>)
|
||||
</strong></td>
|
||||
<td class="item-attr"><strong><span><%=@sale_data.total_tax rescue 0%></span></strong></td>
|
||||
<td class="item-attr"><strong><span><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong><%= @sale_data.rounding_adjustment rescue 0%></strong></td>
|
||||
<td class="item-attr"><strong><%= number_with_precision(@sale_data.rounding_adjustment, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total</strong></td>
|
||||
<td class="item-attr"><strong><span><%=@sale_data.grand_total rescue 0%></span></strong></td>
|
||||
<td class="item-attr"><strong><span><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<%if @balance > 0%>
|
||||
<tr>
|
||||
<td class="charges-name"><strong><%= @accountable_type %></strong></td>
|
||||
<td class="item-attr"><strong><span><%=@balance%></span></strong></td>
|
||||
<td class="item-attr"><strong><span><%=number_with_precision(@balance, precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@individual_total[0].nil? %>
|
||||
<tr>
|
||||
<td class="charges-name">
|
||||
<strong>Split Bill for <%= @individual_total[0]['total_customer'] %> persons</strong>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name">
|
||||
<strong>Amount Due (per person)</strong>
|
||||
</td>
|
||||
<td class="item-attr"><strong><span><%= number_with_precision(@individual_total[0]['per_person_amount'], precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tfooter>
|
||||
</table>
|
||||
</div>
|
||||
@@ -124,24 +153,24 @@
|
||||
<div class="col-md-8"><strong>Amount Due</strong></div>
|
||||
<div class="col-md-4">
|
||||
<strong>
|
||||
<span id="grand_total" class="hidden"><%= @sale_data.grand_total rescue 0%></span>
|
||||
<span id="amount_due"><%= @sale_data.grand_total rescue 0%></span></strong>
|
||||
<span id="grand_total" class="hidden"><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i)%></span>
|
||||
<span id="amount_due"><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></span></strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row payment cash-color p-l-5 p-r-5">
|
||||
<div class="col-md-8">Cash</div>
|
||||
<div class="col-md-4" id="cash" ><%= @cash %></div>
|
||||
<div class="col-md-4" id="cash" ><%= number_with_precision(@cash, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
|
||||
<div class="row payment credit-color p-l-5 p-r-5" id="credit_payment" >
|
||||
<div class="col-md-8">Credit</div>
|
||||
<div class="col-md-4" id="credit"><%= @credit %></div>
|
||||
<div class="col-md-4" id="credit"><%= number_with_precision(@credit, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0%>
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
<div class="col-md-8">Other Payments</div>
|
||||
<div class="col-md-4" id="others"><%= @other %></div>
|
||||
<div class="col-md-4" id="others"><%= number_with_precision(@other, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
@@ -156,13 +185,13 @@
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<div class="col-md-4 mpu is_card" id="others"><%= @other %></div>
|
||||
<div class="col-md-4 mpu is_card" id="others"><%= number_with_precision(@other, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<div class="col-md-4" id="others">0.0</div>
|
||||
<div class="col-md-4" id="others"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- paypar -->
|
||||
@@ -170,13 +199,13 @@
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Redeem</div>
|
||||
<div class="col-md-4" id="ppamount"><%= @ppamount %></div>
|
||||
<div class="col-md-4" id="ppamount"><%= number_with_precision(@ppamount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Redeem</div>
|
||||
<div class="col-md-4" id="ppamount">0.0</div>
|
||||
<div class="col-md-4" id="ppamount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- Visa -->
|
||||
@@ -184,13 +213,13 @@
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">VISA</div>
|
||||
<div class="col-md-4 visa is_card" id="visacount"><%= @visacount %></div>
|
||||
<div class="col-md-4 visa is_card" id="visacount"><%= number_with_precision(@visacount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">VISA</div>
|
||||
<div class="col-md-4" id="visacount">0.0</div>
|
||||
<div class="col-md-4" id="visacount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- JCB -->
|
||||
@@ -198,13 +227,13 @@
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JCB</div>
|
||||
<div class="col-md-4 jcb is_card" id="jcbcount"><%= @jcbcount %></div>
|
||||
<div class="col-md-4 jcb is_card" id="jcbcount"><%= number_with_precision(@jcbcount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JCB</div>
|
||||
<div class="col-md-4" id="jcbcount">0.0</div>
|
||||
<div class="col-md-4" id="jcbcount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- Master -->
|
||||
@@ -212,13 +241,13 @@
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MASTER</div>
|
||||
<div class="col-md-4 master is_card" id="mastercount"><%= @mastercount %></div>
|
||||
<div class="col-md-4 master is_card" id="mastercount"><%= number_with_precision(@mastercount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MASTER</div>
|
||||
<div class="col-md-4" id="mastercount">0.0</div>
|
||||
<div class="col-md-4" id="mastercount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- <br> -->
|
||||
@@ -227,18 +256,18 @@
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">UNIONPAY</div>
|
||||
<div class="col-md-4 master is_card" id="unionpaycount"><%= @unionpaycount %></div>
|
||||
<div class="col-md-4 master is_card" id="unionpaycount"><%= number_with_precision(@unionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">UNIONPAY</div>
|
||||
<div class="col-md-4" id="unionpaycount">0.0</div>
|
||||
<div class="col-md-4" id="unionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row m-l-5 m-r-5">
|
||||
<div class="col-md-8"><strong>Balance</strong></div>
|
||||
<div class="col-md-4"><strong><span id='balance'><%= @sale_data.grand_total rescue 0 %></span></strong></div>
|
||||
<div class="col-md-4"><strong><span id='balance'><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></span></strong></div>
|
||||
</div>
|
||||
<!-- <br> -->
|
||||
</div>
|
||||
@@ -295,8 +324,8 @@
|
||||
<i class="material-icons">reply</i>
|
||||
Back
|
||||
</button>
|
||||
<button type="button" class="btn bg-deep-purple btn-block" id="foc" active="<%= can? :foc, :payment %>"> FOC </button>
|
||||
<button type="button" class="btn bg-red btn-block" id="void" active="<%= can? :overall_void, :void %>"> Void </button>
|
||||
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
|
||||
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||
<% if @cashier_type=="quick_service" %>
|
||||
<hr>
|
||||
|
||||
@@ -310,8 +339,52 @@
|
||||
</div>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
</div>
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="void" active="true">VOID</button>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="focModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="focModalLabel">Please Enter Reason for FOC</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="foc_remark">
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link bg-red waves-effect " id="foc" active="true">FOC</button>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function(){
|
||||
@@ -422,7 +495,7 @@ console.log("fffffffffffff")
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
}
|
||||
}else{
|
||||
swal("Opps","You are not authorized for Discount","warning")
|
||||
swal("Oops","You are not authorized for Discount","warning")
|
||||
}
|
||||
return false;
|
||||
});
|
||||
@@ -438,7 +511,7 @@ console.log("fffffffffffff")
|
||||
}
|
||||
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
swal("Oops","You are not authorized for void","warning")
|
||||
}
|
||||
});
|
||||
|
||||
@@ -488,8 +561,13 @@ console.log("fffffffffffff")
|
||||
var unionpay1 = $('#unionpaycount').text();
|
||||
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1);
|
||||
var total = $('#amount_due').text();
|
||||
var amt = parseFloat(total) - parseFloat(othertotal);
|
||||
$('#cash').text(parseFloat(amt).toFixed(1));
|
||||
var amt = 0;
|
||||
<% if precision.to_i > 0 %>;
|
||||
amt = parseFloat(parseFloat(total) - parseFloat(othertotal)).toFixed(<%= precision %>);
|
||||
<% else %>
|
||||
amt = parseFloat(parseFloat(total) - parseFloat(othertotal));
|
||||
<% end %>
|
||||
$('#cash').text(amt);
|
||||
update_balance();
|
||||
break;
|
||||
}
|
||||
@@ -520,23 +598,23 @@ console.log("fffffffffffff")
|
||||
$('#pay').click(function() {
|
||||
sub_total = $('#sub-total').text();
|
||||
if (payment_type == 'MPU' && $('.mpu').text() == 0 && sub_total != 0.0) {
|
||||
swal("Opps","Please Pay with MPU Payment","warning");
|
||||
swal("Oops","Please Pay with MPU Payment","warning");
|
||||
}else if(payment_type == "Redeem" && $('#ppamount').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with Redeem Payment","warning");
|
||||
swal("Oops","Please Pay with Redeem Payment","warning");
|
||||
}else if(payment_type == "VISA" && $('#visacount').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with Visa Payment","warning");
|
||||
swal("Oops","Please Pay with Visa Payment","warning");
|
||||
|
||||
}else if(payment_type == "JCB" && $('#jcbcount').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with jcb Payment","warning");
|
||||
swal("Oops","Please Pay with jcb Payment","warning");
|
||||
}
|
||||
else if(payment_type == "Master" && $('#mastercount').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with Master Payment","warning");
|
||||
swal("Oops","Please Pay with Master Payment","warning");
|
||||
}
|
||||
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with UNIONPAY Payment","warning");
|
||||
swal("Oops","Please Pay with UNIONPAY Payment","warning");
|
||||
}
|
||||
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with Credit Payment","warning");
|
||||
swal("Oops","Please Pay with Credit Payment","warning");
|
||||
}else{
|
||||
|
||||
$( "#loading_wrapper").show();
|
||||
@@ -615,30 +693,55 @@ console.log("fffffffffffff")
|
||||
}
|
||||
});
|
||||
|
||||
$('#void').on('click',function () {
|
||||
if ($(this).attr('active') === "true") {
|
||||
// $('#void').on('click',function () {
|
||||
// if ($(this).attr('active') === "true") {
|
||||
// var sale_id = $('#sale_id').text();
|
||||
// var remark = $("#remark").val();
|
||||
// var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
// $.ajax({
|
||||
// type: 'POST',
|
||||
// url: ajax_url,
|
||||
// data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
// success: function () {
|
||||
// window.location.href = '/origami/';
|
||||
// }
|
||||
// })
|
||||
// }else{
|
||||
// swal("Opps","You are not authorized for void","warning")
|
||||
// }
|
||||
// });
|
||||
$('#void').on('click', function () {
|
||||
if ($(this).attr('active')=== "true") {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Are you sure want to Void !',
|
||||
}, function () {
|
||||
title: "Alert",
|
||||
text: "Are you sure want to Void?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, void it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = $('#sale_id').text();
|
||||
var remark = $("#remark").val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
success: function () {
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
swal("Oops","You are not authorized for void","warning")
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -654,43 +757,57 @@ console.log("fffffffffffff")
|
||||
var amount_due = $('#amount_due').text();
|
||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay)
|
||||
var result = parseFloat(amount_due) - parseFloat(total);
|
||||
$('#balance').text(result.toFixed(2));
|
||||
<% if precision.to_i > 0 %>
|
||||
$('#balance').text(parseFloat(result).toFixed(<%= precision %>));
|
||||
<% else %>
|
||||
$('#balance').text(parseFloat(result));
|
||||
<% end %>
|
||||
}
|
||||
|
||||
$('#foc').click(function() {
|
||||
//$( "#loading_wrapper" ).show();
|
||||
// payment
|
||||
var remark = $("#foc_remark").val();
|
||||
var cash = $('#grand_total').text();
|
||||
var sub_total = $('#sub-total').text();
|
||||
var sale_id = $('#sale_id').text();
|
||||
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total };
|
||||
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type };
|
||||
|
||||
if ($(this).attr('active')=== "true") {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%= origami_payment_foc_path %>",
|
||||
data: params,
|
||||
success:function(result){
|
||||
|
||||
//$( "#loading_wrapper" ).hide();
|
||||
|
||||
if (cash >= 0) {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Thank You !',
|
||||
}, function () {
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to FOC This Receipt?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, FOC it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%= origami_payment_foc_path %>",
|
||||
data: params,
|
||||
success:function(result){
|
||||
if (cash >= 0) {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Thank You !',
|
||||
}, function () {
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}else{
|
||||
swal("Opps","You are not authorized for foc","warning")
|
||||
swal("Oops","You are not authorized for foc","warning")
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -12,10 +12,17 @@
|
||||
<% @sale.each do |sale| %>
|
||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% @order.each do |order| %>
|
||||
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,12 +10,19 @@
|
||||
<div id="custom-slimscroll">
|
||||
<div class="card-columns">
|
||||
<% @sales.each do |sale| %>
|
||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -31,19 +38,38 @@
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No: <span id="receipt_no">
|
||||
<%= @sale.receipt_no rescue '' %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
|
||||
<% if @status == 'sale' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No: <span id="receipt_no">
|
||||
<%= @sale.receipt_no rescue '' %></span>
|
||||
</div>
|
||||
<% else%>
|
||||
<input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
Order No: <span id="receipt_no">
|
||||
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
|
||||
</div>
|
||||
<% end%>
|
||||
|
||||
|
||||
<% if @status == 'sale' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
<% else%>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
|
||||
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="card-title row customer_detail p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Customer : <%= @sale.customer.name rescue "-" %>
|
||||
|
||||
<% if @status == 'sale' %>
|
||||
Customer : <%= @sale.customer.name rescue "-" %>
|
||||
<% else%>
|
||||
Customer : <%= @order.customer.name rescue "-" %>
|
||||
<% end%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -58,55 +84,64 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
sub_total = 0
|
||||
<% if @status == 'sale' %>
|
||||
<% sub_total = 0
|
||||
@sale.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||
<% #unless sale_item.price <= 0 %>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
|
||||
#end
|
||||
end
|
||||
|
||||
%>
|
||||
sub_total = sub_total + sale_item.price %>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
<% else%>
|
||||
<% sub_total = 0
|
||||
@order_items.each do |order_item|
|
||||
sub_total = sub_total + order_item.price %>
|
||||
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
|
||||
<tr>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.price %></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
<% end%>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<% if @status == 'sale' %>
|
||||
<tr>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
<% else%>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -115,8 +150,15 @@
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<% if current_user.role != "waiter" || @status != "sale"%>
|
||||
<button type="button" id="addorder" class="btn bg-blue btn-block">Add Order</button>
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<%end%>
|
||||
<% if current_user.role != "waiter" && @status != "order"%>
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<%end%>
|
||||
<% if @status != "sale"%>
|
||||
<button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button>
|
||||
<%end%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -135,7 +177,7 @@ $(document).ready(function(){
|
||||
});
|
||||
$('#addorder').on('click', function () {
|
||||
var table_id = "<%=@table_id%>";
|
||||
var booking_id = "<%=@booking%>";
|
||||
var booking_id = "<%=@bookings.booking_id%>";
|
||||
if (table_id) {
|
||||
window.location.href = '/origami/quick_service/modify_order/' + table_id+"/"+$('#sale_id').val();
|
||||
}else{
|
||||
@@ -143,5 +185,23 @@ $(document).ready(function(){
|
||||
}
|
||||
|
||||
});
|
||||
// Bill Request
|
||||
$('#request_bills').click(function () {
|
||||
var order_id = $('#save_order_id').val();
|
||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
// data: 'order_id='+ order_id,
|
||||
success: function (result) {
|
||||
if (!result.status) {
|
||||
swal("Information!", result.error_message);
|
||||
}
|
||||
else {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -277,19 +277,19 @@
|
||||
sub_total = sub_total + (order_item.price * order_item.qty)
|
||||
|
||||
# unless order_item.price == 0 %>
|
||||
<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>
|
||||
<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
|
||||
@@ -345,20 +345,19 @@
|
||||
@order_items.each do |order_item |
|
||||
count += 1
|
||||
%>
|
||||
|
||||
<tr>
|
||||
<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>
|
||||
<tr class="edit_order" data-id='<%= 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
|
||||
@@ -397,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> -->
|
||||
@@ -420,6 +422,7 @@
|
||||
<% if @status_sale == 'sale' %>
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled>Add Order</button> -->
|
||||
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||
@@ -427,6 +430,13 @@
|
||||
|
||||
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||
<% end %>
|
||||
<% if !@split_bill.nil? %>
|
||||
<% if @split_bill == '1' %>
|
||||
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<!-- first bill not used in cloud -->
|
||||
<% if ENV["SERVER_MODE"] == "cloud" %>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
@@ -437,14 +447,11 @@
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<%end%>
|
||||
<%end%>
|
||||
<% if !@split_bill.nil? %>
|
||||
<% if @split_bill == '1' %>
|
||||
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<% end %>
|
||||
<!-- <button type="button" id="void" class="btn bg-blue btn-block" > Void </button> -->
|
||||
<% end %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||
@@ -475,9 +482,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Cashier Buttons -->
|
||||
|
||||
<% end %>
|
||||
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block" >Re.Print</button> -->
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -901,4 +909,13 @@ $('#add_invoice').on('click',function(){
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/*edit order in oqs*/
|
||||
$('.edit_order').on('click',function(){
|
||||
var assigned_order_item_id = $(this).attr('data-id');
|
||||
var dining_id = "<%= @room.id %>";
|
||||
if((assigned_order_item_id!=undefined) && (assigned_order_item_id!='')){
|
||||
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||
@@ -57,23 +57,26 @@
|
||||
<td class="p-2" width="20%">
|
||||
<%= sale_item.product_name %>
|
||||
</td>
|
||||
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' && sale_item.remark != 'foc' %>
|
||||
<% if sale_item.status != 'void' && sale_item.status != 'edit' && sale_item.status != 'foc' %>
|
||||
<td class="p-1" width="5%">
|
||||
<input id="<%= sale_item.id %>_qty" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control "/>
|
||||
<input id="<%= sale_item.id %>_qty" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control " onkeyup="checkQuantity(this.value,'<%= sale_item.id %>');" onkeypress="return isNumberKey(event);" />
|
||||
<span id="<%= sale_item.id %>_qtyErr" style="color:red;"></span>
|
||||
</td>
|
||||
<td class="p-1" width="10%">
|
||||
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control"/>
|
||||
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" onkeypress="return isNumberKey(event);"/>
|
||||
<span id="<%= sale_item.id %>_priceErr" style="color:red;"></span>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input id="<%= sale_item.id %>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
|
||||
</td> -->
|
||||
<td class="p-1" width="25%">
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-lg bg-blue waves-effect update'>Update</button>
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-lg bg-danger waves-effect void'>Void</button>
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-lg bg-red waves-effect foc'>FOC</button>
|
||||
<button data-id="<%= sale_item.id %>" data-type="void" class='editModal btn btn-lg bg-danger waves-effect' data-toggle="modal" data-target="#editModal">Void</button>
|
||||
|
||||
<button data-id="<%= sale_item.id %>" data-type="foc" class='editModal btn btn-lg bg-danger waves-effect' data-toggle="modal" data-target="#editModal">FOC</button>
|
||||
</td>
|
||||
|
||||
<% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
|
||||
<% elsif sale_item.qty.to_i < 0 || sale_item.status == 'edit' %>
|
||||
<td class="p-1" width="5%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
@@ -148,48 +151,114 @@
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-block btn-lg bg-default waves-effect" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<button type="button" class="btn btn-danger btn- action-btn" id='cancel_all_void'>Cancel All Void</button>
|
||||
<button type="button" class="btn btn-block btn-lg bg-blue waves-effect" id='apply'>Apply</button>
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-block btn-lg bg-default waves-effect" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<button type="button" class="btn btn-danger btn- action-btn" id='cancel_all_void'>Cancel All Void</button>
|
||||
<button type="button" class="btn btn-block btn-lg bg-blue waves-effect" id='apply'>Apply</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="editModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="editModalLabel">Please Enter Remark</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect" id="action">VOID</button>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
// Bill Request
|
||||
$(document).ready(function () {
|
||||
$('.editModal').on('click', function () {
|
||||
$("#action").attr('data-type', $(this).attr('data-type'));
|
||||
$("#action").attr('data-id', $(this).attr('data-id'));
|
||||
$("#action").text($(this).attr('data-type'))
|
||||
})
|
||||
|
||||
$(".update").on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var qty = $('#' + sale_item_id + "_qty").val();
|
||||
var price = $('#' + sale_item_id + "_price").val();
|
||||
console.log(qty + "|" + price)
|
||||
var ajax_url = "/origami/item_edit";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
|
||||
success: function (result) {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Qty and Price was successfully Updated",
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
console.log(qty + "|" + price);
|
||||
var qty_status = true;
|
||||
var price_status = true;
|
||||
if((qty > 0) && (price > 0)){
|
||||
qty_status = true;
|
||||
price_status = true;
|
||||
$('#' + sale_item_id + "_qtyErr").html("");
|
||||
$('#' + sale_item_id + "_priceErr").html("");
|
||||
}else if((qty > 0) && (price <= 0 || price == '')){
|
||||
price_status = false;
|
||||
$('#' + sale_item_id + "_qtyErr").html("");
|
||||
if(price == ''){
|
||||
$('#' + sale_item_id + "_priceErr").html("can't be blank");
|
||||
}else{
|
||||
$('#' + sale_item_id + "_price").val("");
|
||||
$('#' + sale_item_id + "_priceErr").html("Price must be greater than 0");
|
||||
}
|
||||
}else if((qty <= 0 || qty == '') && (price > 0)){
|
||||
qty_status = false;
|
||||
if(qty == ''){
|
||||
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
|
||||
}else{
|
||||
$('#' + sale_item_id + "_qty").val("");
|
||||
$('#' + sale_item_id + "_qtyErr").html("Quantity must be greater than 0");
|
||||
}
|
||||
|
||||
$('#' + sale_item_id + "_priceErr").html("");
|
||||
}else{
|
||||
qty_status = false;
|
||||
price_status = false;
|
||||
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
|
||||
$('#' + sale_item_id + "_priceErr").html("can't be blank");
|
||||
}
|
||||
|
||||
if(qty_status && price_status){
|
||||
var ajax_url = "/origami/item_edit";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
|
||||
success: function (result) {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Qty and Price was successfully Updated",
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.void').on('click', function () {
|
||||
/*$('.void').on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var remark = $("#remark").val();
|
||||
var ajax_url = "/origami/item_void";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id,
|
||||
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
@@ -202,7 +271,27 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id,
|
||||
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})*/
|
||||
|
||||
$('#action').on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var type = $(this).attr('data-type');
|
||||
var remark = $("#remark").val();
|
||||
if (type=='foc') {
|
||||
var ajax_url = "/origami/item_foc";
|
||||
}else{
|
||||
var ajax_url = "/origami/item_void";
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
@@ -225,6 +314,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('#back').on('click', function () {
|
||||
var table_id = '<%= @table_id %>'
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
@@ -311,4 +401,24 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//check for isNumber
|
||||
function isNumberKey(evt) {
|
||||
var charCode = (evt.which) ? evt.which : event.keyCode;
|
||||
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function checkQuantity(obj_value,sale_item_id) {
|
||||
if(obj_value == '0'){
|
||||
$("#"+sale_item_id+"_qty").val('1');
|
||||
}
|
||||
}
|
||||
|
||||
function checkPrice(obj_value,sale_item_id) {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -65,6 +65,8 @@
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-order-id" class="hidden"><%=odr_item['order_id'] %></span>
|
||||
<span id="item-account-type" class="hidden"><%=odr_item['account_id'] %></span>
|
||||
<span id="item-code" class="hidden"><%=odr_item['item_code'] %></span>
|
||||
<span id="item-instance-code" class="hidden"><%=odr_item['item_instance_code'] %></span>
|
||||
<span id="item-name-price">
|
||||
<%=odr_item['item_name'] %>
|
||||
<% if !odr_item['set_menu_items'].nil?
|
||||
@@ -132,6 +134,8 @@
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-order-id" class="hidden"><%=order_item[order.order_id.to_s]['order_id'] %></span>
|
||||
<span id="item-account-type" class="hidden"><%=order_item[order.order_id.to_s]['account_id'] %></span>
|
||||
<span id="item-code" class="hidden"><%=order_item[order.order_id.to_s]['item_code'] %></span>
|
||||
<span id="item-instance-code" class="hidden"><%=order_item[order.order_id.to_s]['item-instance-code'] %></span>
|
||||
<span id="item-name-price">
|
||||
<%=order_item[order.order_id.to_s]['item_name'] %>
|
||||
<% if !order_item[order.order_id.to_s]['set_menu_items'].nil?
|
||||
@@ -194,7 +198,9 @@
|
||||
<th>#</th>
|
||||
<th>Receipt No.</th>
|
||||
<th>Total</th>
|
||||
<% if !@current_user.nil? && @current_user.role != 'waiter' %>
|
||||
<th>Action</th>
|
||||
<% end %>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @sale_data.each_with_index do |sale_data, sale_index| %>
|
||||
@@ -207,9 +213,12 @@
|
||||
<td><input type="radio" name="rdn_receipt" id="rdn_receipt" value="<%= sale_data.sale_id %>" <%= checked %>></td>
|
||||
<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 != 'waiter' %>
|
||||
<td>
|
||||
<button type="button" class="btn btn-block waves-effect btn-primary btn_pay" id=<%= sale_data.sale_id %> >Pay</button>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -228,9 +237,15 @@
|
||||
<!-- Action Panel -->
|
||||
<div>
|
||||
<button type="button" class="btn bg-default btn-block waves-effect" id="back" ><i class="material-icons">reply</i> Back </button>
|
||||
<button id="equal_split" class="btn btn-block waves-effect bg-blue">= Split</button>
|
||||
<button id="order_split" class="btn btn-block waves-effect bg-blue">By Order</button>
|
||||
<button id="order_item_split" class="btn btn-block waves-effect bg-blue">By Order Item</button>
|
||||
<% if !@current_user.nil? && @current_user.role != 'waiter' %>
|
||||
<% 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>
|
||||
<button id="order_item_split" class="btn btn-block waves-effect bg-blue">By Order Item</button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
@@ -249,7 +264,7 @@
|
||||
<div class="modal-body">
|
||||
<div class="form-horizontal">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<input type="text" id="per_person" name="per_person" class="form-control" onkeypress="return isNumberKey(event);"/><br>
|
||||
<span id="per_personErr" style="color:red;"></span>
|
||||
</div>
|
||||
@@ -316,9 +331,7 @@
|
||||
<script type="text/javascript">
|
||||
var split_sale_id = "";
|
||||
var split_receipt_no = "";
|
||||
var split_total_amount = 0;
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#back').on('click',function(){
|
||||
backToOrigami();
|
||||
})
|
||||
@@ -395,7 +408,7 @@
|
||||
// orderItemSplitBillProcess(cnt_items);
|
||||
// }
|
||||
}else{
|
||||
swal("Opps","Please select at least one item!","warning");
|
||||
swal("Oops","Please select at least one item!","warning");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -459,7 +472,7 @@
|
||||
// orderSplitBillProcess(cnt_odrs);
|
||||
// }
|
||||
}else{
|
||||
swal("Opps","Please select at least one order!","warning");
|
||||
swal("Oops","Please select at least one order!","warning");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -472,14 +485,15 @@
|
||||
|
||||
//equal split process
|
||||
$('#equal_split').on('click', function(){
|
||||
var dining_id = $("#table_id").text();
|
||||
split_sale_id = $("input[type='radio'][name='rdn_receipt']:checked").val();
|
||||
split_receipt_no = $("input[type='radio'][name='rdn_receipt']:checked").parent().parent().attr('id');
|
||||
split_total_amount = $("input[type='radio'][name='rdn_receipt']:checked").parent().parent().attr('data');
|
||||
|
||||
if(split_sale_id != undefined && split_sale_id != ""){
|
||||
$('#equal_split_modal').modal({backdrop: 'static', keyboard: true, show: true});
|
||||
}
|
||||
else{
|
||||
swal("Opps","Please select one receipt!","warning");
|
||||
swal("Oops","Please select one receipt!","warning");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -490,15 +504,15 @@
|
||||
$("#per_personErr").html('');
|
||||
$('#equal_split_modal').modal('hide');
|
||||
if(person > 1){
|
||||
var ajax_url = "/origami/split_bills/surveys";
|
||||
var dining_id = $("#table_id").text();
|
||||
var ajax_url = "/origami/split_bills/equal_person";
|
||||
var dining_id = $("#table_id").text();
|
||||
var type = $("#table_type").text();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
dataType: 'JSON',
|
||||
data: {'dining_id':dining_id, 'sale_id':split_sale_id, 'receipt_no':split_receipt_no, 'total_customer': person, 'total_amount':split_total_amount },
|
||||
data: { 'sale_id':split_sale_id, 'total_customer': person },
|
||||
success: function (result) {
|
||||
console.log(result);
|
||||
if(result.status){
|
||||
@@ -688,6 +702,8 @@ function get_selected_order_items(){
|
||||
var order_item = {};
|
||||
order_item.id = $(this).attr('id').substr(0,16);
|
||||
order_item.order_id = $(this).find('#item-order-id').text().trim();
|
||||
order_item.item_code = $(this).find('#item-code').text().trim();
|
||||
order_item.item_instance_code = $(this).find('#item-instance-code').text().trim();
|
||||
order_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
||||
order_item.account_id = $(this).find('#item-account-type').text();
|
||||
order_item.qty = $(this).find('#item-qty').text();
|
||||
|
||||
@@ -1,11 +1,26 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<% if !@print_settings.nil? %>
|
||||
<% 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
|
||||
%>
|
||||
<% end %>
|
||||
|
||||
<div class="col-lg-4 col-md-6 col-sm-6">
|
||||
<!-- <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> -->
|
||||
<% @sale_array.each do |sale| %>
|
||||
<div class="card tables" data-id="<%= sale.id %>">
|
||||
<div class="card tables receipt_block" data-id="<%= sale.id %>">
|
||||
<% if sale.id == @sale.id %>
|
||||
<div class="card-block" style="background-color:#6080f0;">
|
||||
<div class="card-block selected-item">
|
||||
<%= sale.receipt_no %>
|
||||
</div>
|
||||
<% else %>
|
||||
@@ -15,7 +30,7 @@
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-7 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
@@ -74,7 +89,7 @@
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
<td class='item-attr'><%= number_with_precision(sale_item.price, precision: precision.to_i ) %></td>
|
||||
</tr>
|
||||
<%
|
||||
# end
|
||||
@@ -93,7 +108,7 @@
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
<td class='item-attr'><%= number_with_precision(order_item.qty*order_item.price, precision: precision.to_i ) %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
@@ -109,7 +124,7 @@
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><span id="sub_total"><%= number_with_precision(sub_total, precision: precision.to_i ) %></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
@@ -117,19 +132,19 @@
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= number_with_precision(@sale.total_discount, precision: precision.to_i ) rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= number_with_precision(@sale.total_tax, precision: precision.to_i ) rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= number_with_precision(@sale.rounding_adjustment, precision: precision.to_i ) rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><span id="grand_total"><%= number_with_precision(@sale.grand_total, precision: precision.to_i ) rescue 0%></span></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
@@ -142,7 +157,8 @@
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<button type="button" id="void" class="btn bg-danger btn-block" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true" > Void </button>
|
||||
<button type="button" class="btn bg-deep-purple btn-block" id="foc" active="<%= can? :foc, :payment %>"> FOC </button>
|
||||
<button type="button" id="void" class="btn bg-danger btn-block" active="<%= can? :overall_void, :void %>" > Void </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -200,13 +216,45 @@ $('#void').on('click',function () {
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
success: function () {
|
||||
window.location.href = '/origami/';
|
||||
window.location.href = '/origami';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
swal("Opps","You are not authorized for void","warning");
|
||||
}
|
||||
});
|
||||
|
||||
$('#foc').click(function() {
|
||||
var cash = $('#grand_total').text();
|
||||
var sub_total = $('#sub_total').text();
|
||||
var sale_id = '';
|
||||
if($('.receipt_block > div').hasClass('selected-item')){
|
||||
sale_id = $('.receipt_block > div.selected-item').parent().attr('data-id');
|
||||
}
|
||||
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total };
|
||||
// console.log(sale_id);
|
||||
if(sale_id != ''){
|
||||
if ($(this).attr('active')=== "true") {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%= origami_payment_foc_path %>",
|
||||
data: params,
|
||||
success:function(result){
|
||||
if (cash >= 0) {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Thank You !',
|
||||
}, function () {
|
||||
window.location.href = '/origami';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal("Oops","You are not authorized for foc","warning")
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -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"> </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"> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
113
app/views/reports/product_sale/index.html.erb
Normal file
113
app/views/reports/product_sale/index.html.erb
Normal 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> </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| %>
|
||||
<% grand_total += sale.grand_total %>
|
||||
<% if sale.status_type != "Discount" && sale.status_type != "foc"
|
||||
total_qty += sale.total_item
|
||||
end %>
|
||||
<% if sale.status_type == "foc" && sale.price > 0
|
||||
total_qty += sale.total_item
|
||||
end %>
|
||||
|
||||
<tr>
|
||||
<td> </td>
|
||||
<% if !cate_arr.include?(sale.menu_category_id) %>
|
||||
<td><%= sale.menu_category_name %></td>
|
||||
<% cate_arr.push(sale.menu_category_id) %>
|
||||
<% else %>
|
||||
<% cate_arr = Array.new %>
|
||||
<td> </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>
|
||||
59
app/views/reports/product_sale/index.xls.erb
Executable file
59
app/views/reports/product_sale/index.xls.erb
Executable file
@@ -0,0 +1,59 @@
|
||||
<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> </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> </td>
|
||||
<td><%= sale.menu_category_name %></td>
|
||||
<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>
|
||||
@@ -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"> </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"> </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"> </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"> </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"> </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"> </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"> </td>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user