merge with master
This commit is contained in:
@@ -60,16 +60,16 @@ if (@booking)
|
||||
end
|
||||
|
||||
# For YGN BBQ
|
||||
if adult_count > 0
|
||||
json.per_adult_spent (adult_spent/adult_count) * 0.05
|
||||
else
|
||||
# if adult_count > 0
|
||||
# json.per_adult_spent (adult_spent/adult_count) * 0.05
|
||||
# else
|
||||
json.per_adult_spent 0
|
||||
end
|
||||
if child_count > 0
|
||||
json.per_child_spent (child_spent/child_count) * 0.05
|
||||
else
|
||||
# end
|
||||
# if child_count > 0
|
||||
# json.per_child_spent (child_spent/child_count) * 0.05
|
||||
# else
|
||||
json.per_child_spent 0
|
||||
end
|
||||
# end
|
||||
# End YGN BBQ
|
||||
|
||||
json.sub_total @total_amount
|
||||
|
||||
@@ -7,8 +7,11 @@ json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
||||
if (menu.menu_categories)
|
||||
json.categories menu.menu_categories do |category|
|
||||
json.id category.id
|
||||
json.code category.code
|
||||
json.order_by category.order_by
|
||||
json.name category.name
|
||||
json.alt_name category.alt_name
|
||||
json.order_by category.order_by
|
||||
json.parent_id category.menu_category_id
|
||||
json.is_available category.is_available
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
<th><%= t("views.right_panel.detail.sr_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.card_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.membership_type") %></th>
|
||||
<th style="width:20%"><%= t("views.right_panel.detail.contact_no") %></th>
|
||||
<th style="width:20%"><%= t("views.right_panel.detail.email") %></th>
|
||||
<th><%= t("views.right_panel.detail.action") %></th>
|
||||
@@ -75,6 +76,15 @@
|
||||
</td>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.card_no rescue '-' %></td>
|
||||
<td>
|
||||
<% if !@membership_types.nil? %>
|
||||
<% @membership_types.each do |member_type| %>
|
||||
<% if member_type[1] == crm_customer.membership_type %>
|
||||
<%= member_type[0] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td style="width:20px%;word-break: break-all;"><%= crm_customer.contact_no %></td>
|
||||
<td style="width:20px%;word-break: break-all;"><%= crm_customer.email %></td>
|
||||
<td><%= link_to t("views.btn.show"), crm_customer_path(crm_customer) %></td>
|
||||
|
||||
@@ -14,11 +14,16 @@
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<!-- <a href="javascript:void(0);" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"></a> -->
|
||||
<a href="javascript:void(0);" class="bars"></a>
|
||||
<a class="navbar-brand" href="<%=dashboard_path%>">
|
||||
<%if current_login_employee.role !="waiter" %>
|
||||
<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%>">
|
||||
<%end%>
|
||||
<img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
|
||||
<span class="navbar-brand-txt">SX Restaurant</span>
|
||||
</a>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<!-- Start Delete confirrm text !-->
|
||||
<div class="navbar-right">
|
||||
@@ -29,16 +34,16 @@
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<%if current_login_employee.role !="waiter" %>
|
||||
<p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
|
||||
<i class="material-icons font-10 logout_icon">exit_to_app</i>
|
||||
<span class="font-18">Logout</span>
|
||||
</p>
|
||||
<span class="hidden" id="delete_text">
|
||||
<h6>Are you sure you want to Logout ?</h6>
|
||||
<!-- <h6>This action can't be undo. </h6> -->
|
||||
</span>
|
||||
<%end%>
|
||||
<!-- <%if current_login_employee.role !="waiter" %> -->
|
||||
<!-- <%end%> -->
|
||||
<p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
|
||||
<i class="material-icons font-10 logout_icon">exit_to_app</i>
|
||||
<span class="font-18">Logout</span>
|
||||
</p>
|
||||
<span class="hidden" id="delete_text">
|
||||
<h6>Are you sure you want to Logout ?</h6>
|
||||
<!-- <h6>This action can't be undo. </h6> -->
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- NO Need for color Change
|
||||
|
||||
@@ -145,6 +145,31 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-1 col-black">
|
||||
<span>Waiter</span>
|
||||
</div>
|
||||
<div class="col-11">
|
||||
<hr />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m-b-15">
|
||||
<% @employees.each do |employee| %>
|
||||
<%if employee.role == "waiter" %>
|
||||
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 empBtn" data-formid="#form_<%= employee.emp_id %>" >
|
||||
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
|
||||
</form>
|
||||
<div class="card emp-body">
|
||||
<div class="body bg-teal">
|
||||
<%= employee.name%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-xs-12 col-sm-12 col-md-2 col-lg-2"> </div> -->
|
||||
</div>
|
||||
|
||||
@@ -84,8 +84,8 @@
|
||||
<%= qid.qty %>
|
||||
</span> ]
|
||||
</p>
|
||||
|
||||
<p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
||||
|
||||
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
|
||||
|
||||
<span class="card-text">
|
||||
<span class="text-muted">Order at -
|
||||
|
||||
@@ -7,17 +7,28 @@
|
||||
<div class="row m-t--20">
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<ul class="nav nav-tabs flex-column" role="tablist" >
|
||||
<% @menu.each do |menu| %>
|
||||
<% if menu.menu_category_id.nil?%>
|
||||
<li class="nav-item menu_category sub_click" 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>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<% @menu.each do |menu| %>
|
||||
<% if menu.menu_category_id.nil? %>
|
||||
<% if @table.get_current_checkout_booking.nil? %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<li class="nav-item menu_category sub_click" 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>
|
||||
</a>
|
||||
</li>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<li class="nav-item menu_category sub_click" 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>
|
||||
</a>
|
||||
</li>
|
||||
<% end%>
|
||||
<% end%>
|
||||
<%end %>
|
||||
<!-- <li class="nav-item menu_category">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Menu 1 <b class="caret"></b></a>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
|
||||
|
||||
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-12">
|
||||
<input type="hidden" name="type" id="type" value="<%= @dining_facility.type %>">
|
||||
<!-- <input type="hidden" name="type" id="type" value="<%= @dining_facility.type %>"> -->
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
|
||||
@@ -54,6 +54,7 @@
|
||||
<th><%= t("views.right_panel.detail.sr_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.card_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.membership_type") %></th>
|
||||
<th style="width:20%"><%= t("views.right_panel.detail.contact_no") %></th>
|
||||
<th style="width:20%"><%= t("views.right_panel.detail.email") %></th>
|
||||
<!-- <th>Paypar No</th> -->
|
||||
@@ -76,7 +77,16 @@
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.company rescue '-' %></td>
|
||||
<td><%= crm_customer.card_no rescue '-' %></td>
|
||||
<td>
|
||||
<% if !@membership_types.nil? %>
|
||||
<% @membership_types.each do |member_type| %>
|
||||
<% if member_type[1] == crm_customer.membership_type %>
|
||||
<%= member_type[0] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td style="width:20%;word-break: break-all;"><%= crm_customer.contact_no %></td>
|
||||
<td style="width:20%;word-break: break-all;"><%= crm_customer.email %></td>
|
||||
<!-- <td><%= crm_customer.paypar_account_no %></td> -->
|
||||
@@ -423,13 +433,13 @@
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
var id = $("#table_id").val()
|
||||
var type = $("#type").val()
|
||||
var id = $("#table_id").val();
|
||||
var type = $("#type").val();
|
||||
if (type=="Table") {
|
||||
window.location.href = '/origami/table/'+id
|
||||
}else{
|
||||
window.location.href = '/origami/room/'+id
|
||||
}
|
||||
window.location.href = '/origami/room/'+id
|
||||
}
|
||||
}else{
|
||||
swal("Alert!", "Record not found!", "error");
|
||||
location.reload();
|
||||
|
||||
@@ -118,12 +118,13 @@
|
||||
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
|
||||
</button>
|
||||
<%end%>
|
||||
<%if current_login_employee.role != "waiter" %>
|
||||
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
|
||||
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button>
|
||||
<!-- Temporary Disabled -->
|
||||
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||
|
||||
<%end%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<div class="container-fluid">
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<div class="row clearfix">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
@@ -140,7 +143,11 @@
|
||||
</div>
|
||||
<% elsif @status_sale == 'sale' %>
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% if !@booking.reserved_by.nil? && %>
|
||||
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% else %>
|
||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
@@ -153,8 +160,7 @@
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No: <span id="receipt_no">
|
||||
<% if @status_sale == 'sale' %>
|
||||
<%= @sale_array[0].receipt_no rescue '' %>
|
||||
|
||||
<%= @sale_array[0].receipt_no rescue '' %>
|
||||
<% end %>
|
||||
</span>
|
||||
<br>
|
||||
@@ -264,7 +270,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="sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<% if @obj_sale != nil && @obj_sale.discount_type == 'member_discount' %>
|
||||
@@ -291,7 +297,8 @@
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr">
|
||||
<strong id="order-round-adj"><%= @obj_sale.rounding_adjustment rescue 0 %></strong></td>
|
||||
<strong id="order-round-adj"><%= @obj_sale.rounding_adjustment
|
||||
%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
@@ -366,6 +373,7 @@
|
||||
<%= 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" %>
|
||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||
<% if @dining.status != "available" %>
|
||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||
@@ -389,6 +397,7 @@
|
||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||
|
||||
<!-- <button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button> -->
|
||||
|
||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
|
||||
<% end %>
|
||||
@@ -398,11 +407,52 @@
|
||||
<% else %>
|
||||
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
|
||||
<% end %>
|
||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<select class="form-control show-tick payment_method" id="payment_method" >
|
||||
<option value="Cash">Cash</option>
|
||||
<option value="Credit">Credit</option>
|
||||
<% @payment_methods.each do |pay| %>
|
||||
<option value="<%= pay.payment_method %>">
|
||||
<%= pay.payment_method %>
|
||||
</option>
|
||||
<%end %>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
/* start check first bill or not*/
|
||||
var receipt_no = "";
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
// console.log(checkReceiptNoInFirstBillData(receipt_no));
|
||||
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||
$("#pay").show();
|
||||
}else{
|
||||
$("#pay").hide();
|
||||
}
|
||||
/* end check first bill or not*/
|
||||
|
||||
$('.invoicedetails').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
@@ -491,7 +541,7 @@
|
||||
window.location.href = '/origami/' + sale_id + '/other_charges'
|
||||
}
|
||||
else {
|
||||
alert("Please select an table!");
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -510,13 +560,12 @@
|
||||
window.location.href = '/origami/' + sale_id + '/discount'
|
||||
}
|
||||
else {
|
||||
alert("Please select an table!");
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
// Print for first bill
|
||||
// $("#first_bill").on('click', function () {
|
||||
// var sale_id = $('#sale_id').val();
|
||||
@@ -556,18 +605,19 @@
|
||||
url: ajax_url,
|
||||
// data: 'order_id='+ order_id,
|
||||
success: function (result) {
|
||||
|
||||
if (!result.status) {
|
||||
swal("Information!", result.error_message);
|
||||
}
|
||||
else {
|
||||
location.reload();
|
||||
else {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#move').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>"
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
window.location.href = '/origami/table/' + dining_id + "/movetable";
|
||||
})
|
||||
|
||||
@@ -584,8 +634,16 @@
|
||||
url: ajax_url,
|
||||
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id,
|
||||
success: function (result) {
|
||||
alert("Invoice updated")
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Invoice updated",
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
@@ -685,7 +743,7 @@
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
data: {dining_id : dining_id},
|
||||
data: {'dining_id' : dining_id},
|
||||
datatype: 'JSON',
|
||||
url: '/origami/check_in',
|
||||
success: function(data) {
|
||||
|
||||
@@ -162,19 +162,19 @@ $('#jcb_pay').on('click',function(){
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
var sub_total = $('#sub-total').text();
|
||||
var member_id = $('#membership_id').text();
|
||||
var member_discount = $('#member_discount').text();
|
||||
if (member_id && member_discount) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + sale_id + "/member_discount",
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// success:function(result){
|
||||
// }
|
||||
});
|
||||
}
|
||||
//start member discount 5% by pay card
|
||||
// var sub_total = $('#sub-total').text();
|
||||
// var member_id = $('#membership_id').text();
|
||||
// var member_discount = $('#member_discount').text();
|
||||
// if (member_id && member_discount) {
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: "/origami/" + sale_id + "/member_discount",
|
||||
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// success:function(result){
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//end member discount
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_jcb_path %>",
|
||||
|
||||
@@ -160,18 +160,18 @@
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
var sub_total = $('#sub-total').text();
|
||||
var member_id = $('#membership_id').text();
|
||||
var member_discount = $('#member_discount').text();
|
||||
if (member_id && member_discount) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + sale_id + "/member_discount",
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// success:function(result){
|
||||
// }
|
||||
});
|
||||
}
|
||||
// var sub_total = $('#sub-total').text();
|
||||
// var member_id = $('#membership_id').text();
|
||||
// var member_discount = $('#member_discount').text();
|
||||
// if (member_id && member_discount) {
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: "/origami/" + sale_id + "/member_discount",
|
||||
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// // success:function(result){
|
||||
// // }
|
||||
// });
|
||||
// }
|
||||
//end member discount
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_master_path %>",
|
||||
|
||||
@@ -163,18 +163,18 @@
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
var sub_total = $('#sub-total').text();
|
||||
var member_id = $('#membership_id').text();
|
||||
var member_discount = $('#member_discount').text();
|
||||
if (member_id && member_discount) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + sale_id + "/member_discount",
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// success:function(result){
|
||||
// }
|
||||
});
|
||||
}
|
||||
// var sub_total = $('#sub-total').text();
|
||||
// var member_id = $('#membership_id').text();
|
||||
// var member_discount = $('#member_discount').text();
|
||||
// if (member_id && member_discount) {
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: "/origami/" + sale_id + "/member_discount",
|
||||
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// success:function(result){
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//end member discount
|
||||
//Mpu Payment
|
||||
$.ajax({type: "POST",
|
||||
|
||||
@@ -96,7 +96,8 @@
|
||||
<div class="form-horizontal">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||
<div class="bottom-5">
|
||||
<input type="text" id="other-charges-amount" name="other-charges-amount" class="form-control" placeholder="Amount" />
|
||||
<input type="text" id="other-charges-amount" name="other-charges-amount" class="form-control" placeholder="Amount" onkeypress="return isNumberKey(event);" />
|
||||
<br><span id="other-charges-amountErr" style="color:red;"></span>
|
||||
</div>
|
||||
<div class="bottom-5">
|
||||
<textarea id="reasons" name="reasons" rows="2" class="form-control" placeholder="Reasons"></textarea>
|
||||
@@ -278,12 +279,19 @@
|
||||
if ($("#is_taxable:checked").length > 0) {
|
||||
is_taxable = 1
|
||||
}
|
||||
$("#other-charges-amountErr").html("");
|
||||
if(charge_amount != ""){
|
||||
$("#other-charges-amount").val("");
|
||||
$("#reasons").val("");
|
||||
// Update sub total
|
||||
$('#order-sub-total').text(parseFloat(sub_total) + parseFloat(charge_amount));
|
||||
|
||||
// Update sub total
|
||||
$('#order-sub-total').text(parseFloat(sub_total) + parseFloat(charge_amount));
|
||||
|
||||
var item_row = item_row_template(sale_id, charge_amount, reasons, is_taxable);
|
||||
$("#order-items-table tbody").append(item_row);
|
||||
var item_row = item_row_template(sale_id, charge_amount, reasons, is_taxable);
|
||||
$("#order-items-table tbody").append(item_row);
|
||||
}
|
||||
else{
|
||||
$("#other-charges-amountErr").html("can't be blank");
|
||||
}
|
||||
});
|
||||
|
||||
// Calculate Other Charges for Payment
|
||||
@@ -361,4 +369,13 @@
|
||||
return item_row;
|
||||
}
|
||||
|
||||
function isNumberKey(evt) {
|
||||
var charCode = (evt.which) ? evt.which : event.keyCode;
|
||||
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
<div class="col-lg-11col-md-11 col-sm-11">
|
||||
<div >
|
||||
<div >
|
||||
<span id="receipt_no" class="hidden"><%=@sale_data.receipt_no rescue ' '%></span>
|
||||
<% @payment_method_setting.where("is_active = true").each do |payment_method|%>
|
||||
<div class="purple others-payment bottom left m-l-30" data-type="<%= payment_method.payment_method %>" id="<%= payment_method.payment_method %>" data-url="<%=payment_method.gateway_url%>" data-sale-id="<%= @sale_id%>"><%= payment_method.payment_method %></div>
|
||||
<div class="purple others-payment bottom left m-l-30 <%= payment_method.payment_method %>" data-type="<%= payment_method.payment_method %>" id="<%= payment_method.payment_method %>" data-url="<%=payment_method.gateway_url%>" data-sale-id="<%= @sale_id%>"><%= payment_method.payment_method %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -26,6 +27,19 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* start check first bill or not*/
|
||||
var receipt_no = "";
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||
if(payment_type) {
|
||||
$(".others-payment").hide();
|
||||
$("."+payment_type).show();
|
||||
}
|
||||
|
||||
/* end check first bill or not*/
|
||||
|
||||
$('.others-payment').on('click',function(){
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
@@ -94,11 +94,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong><span id="rounding_adj"><%=@rounding_adj rescue 0%></span></strong></td>
|
||||
<td class="item-attr"><strong><%= @sale_data.rounding_adjustment rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total</strong></td>
|
||||
<td class="item-attr"><strong><span><%=@sale_data.grand_total+ @rounding_adj rescue 0%></span></strong></td>
|
||||
<td class="item-attr"><strong><span><%=@sale_data.grand_total rescue 0%></span></strong></td>
|
||||
</tr>
|
||||
<%if @balance > 0%>
|
||||
<tr>
|
||||
@@ -124,7 +124,7 @@
|
||||
<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 + @rounding_adj rescue 0%></span></strong>
|
||||
<span id="amount_due"><%= @sale_data.grand_total rescue 0%></span></strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
<!-- <br> -->
|
||||
<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+ @rounding_adj rescue 0 %></span></strong></div>
|
||||
<div class="col-md-4"><strong><span id='balance'><%= @sale_data.grand_total rescue 0 %></span></strong></div>
|
||||
</div>
|
||||
<!-- <br> -->
|
||||
</div>
|
||||
@@ -290,6 +290,24 @@
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
/* start check first bill or not*/
|
||||
var receipt_no = "";
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
||||
if(payment_type=="Cash"){
|
||||
$("#card_payment").hide();
|
||||
$("#credit_payment").hide();
|
||||
}else if(payment_type=="Credit"){
|
||||
$("#card_payment").hide();
|
||||
$("#others_payment").hide();
|
||||
}else if(payment_type=="MPU"||payment_type=="VISA"||payment_type=="JCB"||payment_type=="Master"){
|
||||
$("#credit_payment").hide();
|
||||
}
|
||||
/* end check first bill or not*/
|
||||
|
||||
var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>";
|
||||
|
||||
$("#back").on('click', function() {
|
||||
@@ -351,7 +369,7 @@
|
||||
var master1 = $('#mastercount').text();
|
||||
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1);
|
||||
var total = $('#amount_due').text();
|
||||
var amt = parseFloat(total) - othertotal;
|
||||
var amt = parseFloat(total) - parseFloat(othertotal);
|
||||
$('#cash').text(amt);
|
||||
update_balance();
|
||||
break;
|
||||
@@ -380,68 +398,91 @@
|
||||
});
|
||||
|
||||
$('#pay').click(function() {
|
||||
// $('#pay').text("Processing, Please wait!")
|
||||
$( "#loading_wrapper").show();
|
||||
|
||||
if($('#balance').text() > 0){
|
||||
swal ( "Oops" , "Insufficient Amount!" , "error" );
|
||||
$( "#loading_wrapper").hide();
|
||||
sub_total = $('#sub-total').text();
|
||||
if (payment_type == 'MPU' && $('.mpu').text() == 0 && sub_total != 0.0) {
|
||||
swal("Opps","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");
|
||||
}else if(payment_type == "VISA" && $('#visacount').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","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");
|
||||
}
|
||||
else if(payment_type == "Master" && $('#mastercount').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with Master Payment","warning");
|
||||
}
|
||||
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with Credit Payment","warning");
|
||||
}else{
|
||||
$(this).off("click");
|
||||
var sale_id = $('#sale_id').text();
|
||||
var item_row = $('.is_card');
|
||||
|
||||
if (item_row.length < 1) {
|
||||
calculate_member_discount(sale_id);
|
||||
}
|
||||
|
||||
$( "#loading_wrapper").show();
|
||||
if($('#balance').text() > 0){
|
||||
swal ( "Oops", "Insufficient Amount!" , "error" );
|
||||
$("#loading_wrapper").hide();
|
||||
}else{
|
||||
$(this).off("click");
|
||||
var sale_id = $('#sale_id').text();
|
||||
// var item_row = $('.is_card');
|
||||
|
||||
// payment
|
||||
var cash = $('#cash').text();
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#card').text();
|
||||
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_cash_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||
async: false,
|
||||
success:function(result){
|
||||
var cash = $('#cash').text();
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#card').text();
|
||||
|
||||
localStorage.removeItem("cash");
|
||||
if (result.status) {
|
||||
var msg = result.message;
|
||||
}
|
||||
else{
|
||||
var msg = '';
|
||||
}
|
||||
$( "#loading_wrapper" ).hide();
|
||||
if($('#balance').text() < 0){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Changed amount ' + $('#balance').text() * (-1),
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
if (credit <= 0) {
|
||||
calculate_member_discount(sale_id);
|
||||
}
|
||||
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_cash_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||
async: false,
|
||||
success:function(result){
|
||||
/* start delete receipt no in first bill*/
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
var receipt_no = ($("#receipt_no").html()).trim();
|
||||
deleteReceiptNoInFirstBillData(receipt_no);
|
||||
}
|
||||
/* end delete receipt no in first bill*/
|
||||
|
||||
localStorage.removeItem("cash");
|
||||
if (result.status) {
|
||||
var msg = result.message;
|
||||
}
|
||||
else{
|
||||
var msg = '';
|
||||
}
|
||||
$( "#loading_wrapper" ).hide();
|
||||
if($('#balance').text() < 0){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Changed amount ' + $('#balance').text() * (-1),
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami';
|
||||
});
|
||||
}else{
|
||||
$('#pay').text("Pay");
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Thank You !',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami';
|
||||
});
|
||||
}else{
|
||||
$('#pay').text("Pay");
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Thank You !',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami';
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#void').on('click',function () {
|
||||
if ($(this).attr('active') === "true") {
|
||||
@@ -476,7 +517,7 @@
|
||||
var master = $('#mastercount').text();
|
||||
var amount_due = $('#amount_due').text();
|
||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master)
|
||||
var result = amount_due - total;
|
||||
var result = parseFloat(amount_due) - parseFloat(total);
|
||||
$('#balance').text(result.toFixed(2));
|
||||
}
|
||||
|
||||
@@ -497,7 +538,7 @@
|
||||
|
||||
//$( "#loading_wrapper" ).hide();
|
||||
|
||||
if (cash > 0) {
|
||||
if (cash >= 0) {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Thank You !',
|
||||
@@ -517,15 +558,20 @@
|
||||
var sub_total = $('#sub-total').text();
|
||||
var member_id = $('#membership_id').text();
|
||||
var member_discount = $('#member_discount').text();
|
||||
var item_row = $('.is_card');
|
||||
|
||||
if (member_id && member_discount) {
|
||||
if (item_row.length < 1) {
|
||||
is_card = false
|
||||
}else{
|
||||
is_card = true
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + sale_id + "/member_discount",
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':false },
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
|
||||
async: false,
|
||||
success:function(result){
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<div class="container-fluid">
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
@@ -183,7 +186,7 @@
|
||||
<div class="card-title row customer_detail p-l-5 p-r-5" >
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<% if @status_sale == 'sale' %>
|
||||
<p class="hidden customer-id"><%= @obj_sale_sale.customer_id rescue '' %></p>
|
||||
<p class="hidden customer-id"><%= @obj_sale.customer_id rescue '' %></p>
|
||||
Customer : <%= @obj_sale.customer.name rescue '-' %>
|
||||
<%else%>
|
||||
<p class="hidden customer-id"><%= @obj_order.customer_id rescue "-" %></p>
|
||||
@@ -260,7 +263,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="sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @obj_sale != nil && @obj_sale.discount_type == 'member_discount'%>
|
||||
@@ -353,12 +356,14 @@
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled >Edit</button> -->
|
||||
<!-- <button type="button" id="discount" class="btn bg-blue btn-block" disabled >Discount</button> -->
|
||||
<!-- <button type="button" id="other-charges" class="btn bg-blue btn-block" disabled>Charges</button> -->
|
||||
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
||||
<button type="button" class="btn bg-blue btn-block" id='move'>Move</button>
|
||||
<button type="button" id="request_bills" class="btn bg-blue btn-block">Req.Bill</button>
|
||||
<!-- <button type="button" id="first_bill" class="btn bg-blue btn-block" disabled>First Bill</button> -->
|
||||
<!-- <button type="button" id="pay" class="btn bg-blue btn-block" disabled>Pay</button> -->
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled=""> Void </button> -->
|
||||
<% else %>
|
||||
<% end %>
|
||||
<% 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>
|
||||
<button type="button" class="btn bg-blue btn-block" id='edit'>Edit</button>
|
||||
@@ -369,10 +374,40 @@
|
||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" id='move' disabled="">Move</button> -->
|
||||
<!-- <button type="button" id="request_bills" class="btn bg-blue btn-block" disabled> Req.Bill</button> -->
|
||||
|
||||
<!-- <button type="button" id="first_bill" class="btn bg-blue btn-block">First Bill</button> -->
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<button type="button" id="void" class="btn bg-blue btn-block" > Void </button>
|
||||
<% end %>
|
||||
|
||||
|
||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<select class="form-control show-tick payment_method" id="payment_method" >
|
||||
<option value="Cash">Cash</option>
|
||||
<% @payment_methods.each do |pay| %>
|
||||
<option value="<%= pay.payment_method %>">
|
||||
<%= pay.payment_method %>
|
||||
</option>
|
||||
<%end %>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Cashier Buttons -->
|
||||
|
||||
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block" >Re.Print</button> -->
|
||||
@@ -411,6 +446,19 @@ $(document).ready(function(){
|
||||
// window.location.href = '/origami/order/' + order_id;
|
||||
// })
|
||||
|
||||
/* start check first bill or not*/
|
||||
var receipt_no = "";
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
// console.log(checkReceiptNoInFirstBillData(receipt_no));
|
||||
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||
$("#pay").show();
|
||||
}else{
|
||||
$("#pay").hide();
|
||||
}
|
||||
/* end check first bill or not*/
|
||||
|
||||
$('.invoicedetails').on('click',function(){
|
||||
var dining_id = "<%= @room.id %>";
|
||||
var sale_id = this.id;
|
||||
@@ -498,7 +546,7 @@ $(document).ready(function(){
|
||||
window.location.href = '/origami/' + sale_id + '/discount'
|
||||
}
|
||||
else {
|
||||
alert("Please select an table!");
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -517,7 +565,7 @@ $(document).ready(function(){
|
||||
window.location.href = '/origami/' + sale_id + '/other_charges'
|
||||
}
|
||||
else {
|
||||
alert("Please select an table!");
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -533,11 +581,54 @@ $("#first_bill").on('click', function(){
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success:function(result){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,"");
|
||||
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".choose_payment").on('click', function () {
|
||||
$( "#loading_wrapper").show();
|
||||
var sale_id = $('#sale_id').val();
|
||||
type = $('.payment_method').val();
|
||||
|
||||
calculate_member_discount(sale_id,type);
|
||||
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
$( "#loading_wrapper" ).hide();
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,type);
|
||||
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
function calculate_member_discount(sale_id,type) {
|
||||
var sub_total = $('#sub-total').text();
|
||||
if (type == "Cash") {
|
||||
is_card = false
|
||||
}else{
|
||||
is_card = true
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + sale_id + "/member_discount",
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
|
||||
async: false,
|
||||
success:function(result){
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$('#pay').on('click',function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
|
||||
@@ -600,8 +691,16 @@ $('#add_invoice').on('click',function(){
|
||||
url: ajax_url,
|
||||
data: 'dining_id='+ dining_id + "&sale_id=" + sale_id,
|
||||
success:function(result){
|
||||
alert("Invoice updated")
|
||||
window.location.reload();
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Invoice updated",
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -162,18 +162,18 @@
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
var sub_total = $('#sub-total').text();
|
||||
var member_id = $('#membership_id').text();
|
||||
var member_discount = $('#member_discount').text();
|
||||
if (member_id && member_discount) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + sale_id + "/member_discount",
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// success:function(result){
|
||||
// }
|
||||
});
|
||||
}
|
||||
// var sub_total = $('#sub-total').text();
|
||||
// var member_id = $('#membership_id').text();
|
||||
// var member_discount = $('#member_discount').text();
|
||||
// if (member_id && member_discount) {
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: "/origami/" + sale_id + "/member_discount",
|
||||
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// success:function(result){
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//end member discount
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_visa_path %>",
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
<%= f.input :api_settings %>
|
||||
<%= f.input :page_width %>
|
||||
<%= f.input :page_height %>
|
||||
<%= f.input :print_copies, input_html: { min: '1', step: '1', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this.value);" } %>
|
||||
<%= f.input :precision %>
|
||||
<%= f.input :print_copies, input_html: { min: 1, step: '1', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this.value);" } %>
|
||||
<%= f.input :precision, input_html: { min: 0, max: 2, :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanTwo(this.value);" } %>
|
||||
<%= f.input :delimiter %>
|
||||
<%= f.input :heading_space %>
|
||||
</div>
|
||||
@@ -73,4 +73,8 @@
|
||||
function greaterThanOne(val){
|
||||
if(parseInt(val)==0) $("#print_setting_print_copies").val(1);
|
||||
}
|
||||
|
||||
function greaterThanTwo(val){
|
||||
if(parseInt(val)>2) $("#print_setting_precision").val(2);
|
||||
}
|
||||
</script>
|
||||
@@ -43,6 +43,18 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% total_qty = 0 %>
|
||||
<% total_price = 0 %>
|
||||
<% total_amount = 0 %>
|
||||
@@ -53,9 +65,9 @@
|
||||
<td><%= result.sale_item_id rescue '-' %></td>
|
||||
<td><%= result.commissioner.name rescue '-' %></td>
|
||||
<td><%= result.commission.menu_item.name rescue '-' %></td>
|
||||
<td><%= sprintf "%.2f", result.qty.to_f.to_d rescue '-' %></td>
|
||||
<td><%= sprintf "%.2f", result.price.to_f.to_d rescue '-' %></td>
|
||||
<td><%= sprintf "%.2f", result.amount.to_f.to_d rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.qty.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.price.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.amount.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= result.updated_at.strftime("%e %b %Y %I:%M%p") rescue '-' %></td>
|
||||
</tr>
|
||||
<% total_qty += result.qty.to_f %>
|
||||
@@ -65,9 +77,9 @@
|
||||
|
||||
<tr style="border-top: 3px solid grey;">
|
||||
<td colspan="4"></td>
|
||||
<td><b><%= sprintf("%.2f", total_qty) rescue '-' %></b></td>
|
||||
<td><b><%= sprintf("%.2f", total_price) rescue '-' %></b></td>
|
||||
<td><b><%= sprintf("%.2f", total_amount) rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(total_qty, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
|
||||
<td><b><%= number_with_precision(total_price, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
|
||||
<td><b><%= number_with_precision(total_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -23,6 +23,18 @@
|
||||
|
||||
<div class="margin-top-20">
|
||||
<div class="card ">
|
||||
<% 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
|
||||
%>
|
||||
<% unless @sale_data.blank? %>
|
||||
|
||||
<table class="table table-striped" border="0">
|
||||
@@ -52,7 +64,7 @@
|
||||
<td><%= credit.receipt_no rescue '-' %></td>
|
||||
<td><%= credit.cashier_name rescue '-' %></td>
|
||||
<td><%= credit.sale.customer.name rescue '-' %></td>
|
||||
<td><%= credit.payment_amount rescue '-' %></td>
|
||||
<td><%= number_with_precision(credit.payment_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
@@ -123,7 +135,10 @@
|
||||
|
||||
function show_shift_name(period,period_type,from,to,shift_item){
|
||||
var shift = $('#shift_name');
|
||||
|
||||
if (from == '' && to == '') {
|
||||
from = $("#from").val();
|
||||
to = $("#to").val();
|
||||
}
|
||||
shift.empty();
|
||||
|
||||
var str = '';
|
||||
|
||||
@@ -44,6 +44,18 @@
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<% 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
|
||||
%>
|
||||
<% unless @sale_data.empty? %>
|
||||
|
||||
<tbody>
|
||||
@@ -79,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_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') 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='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>
|
||||
</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_delimiter(sprintf("%.2f",mpu), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></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(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(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>
|
||||
</tr>
|
||||
|
||||
<% total_tax = 0 %>
|
||||
@@ -118,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_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
|
||||
@@ -126,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_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(net, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -50,18 +50,30 @@
|
||||
<th><%= t("views.right_panel.detail.foc_sales") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<% 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
|
||||
%>
|
||||
<% unless @sale_data.empty? %>
|
||||
<tbody>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<tr>
|
||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td><%= number_with_precision(sale[:mpu_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:master_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:visa_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:jcb_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:paypar_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:credit_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(sale[:foc_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -108,11 +120,11 @@
|
||||
<!--<td><%= payment.sale.customer.name rescue '-' %></td>-->
|
||||
<td><%= payment.payment_method rescue '-' %></td>
|
||||
<% if payment.payment_method === 'cash' %>
|
||||
<td><%= payment.payment_amount - payment.change_amount%> </td>
|
||||
<td><%= number_with_precision(payment.payment_amount - payment.change_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
|
||||
<%else%>
|
||||
<td><%= payment.payment_amount%> </td>
|
||||
<td><%= number_with_precision(payment.payment_amount , precision: precision.to_i ,delimiter: delimiter) rescue '-' %> </td>
|
||||
<%end%>
|
||||
<td><%= payment.sale.grand_total rescue '-' %></td>
|
||||
<td><%= number_with_precision(payment.sale.grand_total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
|
||||
</tr>
|
||||
|
||||
@@ -120,7 +132,7 @@
|
||||
<%if total>0%>
|
||||
<tr>
|
||||
<td colspan="4" style="text-align: right;"><strong >Total </strong></td>
|
||||
<td colspan="2"><strong><%=total%></strong></td>
|
||||
<td colspan="2"><strong><%=number_with_precision(total , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></strong></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</tbody>
|
||||
@@ -189,7 +201,10 @@
|
||||
var shift = $('#shift_name');
|
||||
|
||||
shift.empty();
|
||||
|
||||
if (from == '' && to == '') {
|
||||
from = $("#from").val();
|
||||
to = $("#to").val();
|
||||
}
|
||||
var str = '';
|
||||
var param_shift = '';
|
||||
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
||||
|
||||
@@ -58,6 +58,22 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
|
||||
puts precision
|
||||
puts "predelidm"
|
||||
puts delimiter %>
|
||||
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 0 %>
|
||||
<% total_tax = 0 %>
|
||||
@@ -81,31 +97,31 @@
|
||||
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= result.total_amount rescue '-' %></td>
|
||||
<td><%= result.total_discount rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td><%= number_with_precision(result.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<%if result.customer.customer_type == "Takeaway"%>
|
||||
<td>0.0</td>
|
||||
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<%end%>
|
||||
<% result.sale_taxes.each do |tax| %>
|
||||
<td><%= tax.tax_payable_amount rescue '-' %></td>
|
||||
<td><%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<%end%>
|
||||
|
||||
<td><%= result.grand_total %></td>
|
||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
|
||||
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td><%= number_with_precision(result.rounding_adjustment.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="2"> </td>
|
||||
<td><b><%= total_sum rescue '-'%></b></td>
|
||||
<td><b><%= discount_amt rescue '-'%></b></td>
|
||||
<td><b><%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
<td><b><%= tax.st_amount.round(2) %></b></td>
|
||||
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<% end %>
|
||||
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
|
||||
<td><b><%= rounding_adj rescue '-'%></b></td>
|
||||
<td><b><%= grand_total.to_f.round + rounding_adj %></b></td>
|
||||
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(rounding_adj, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
@@ -196,7 +212,10 @@
|
||||
var str = '';
|
||||
var param_shift = '';
|
||||
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
||||
|
||||
if (from == '' && to == '') {
|
||||
from = $("#from").val();
|
||||
to = $("#to").val();
|
||||
}
|
||||
url = '<%= reports_get_shift_by_date_path %>';
|
||||
|
||||
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
||||
|
||||
@@ -45,10 +45,23 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% unless @sale_data.blank? %>
|
||||
<% acc_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
|
||||
<% sub_qty = 0 %>
|
||||
<% sub_total = 0 %>
|
||||
<% other_sub_total = 0 %>
|
||||
<% count = 0 %>
|
||||
@@ -70,12 +83,12 @@
|
||||
end %>
|
||||
|
||||
<% if sale.status_type == "foc" && sale.grand_total < 0
|
||||
total_item_foc += sale.grand_total*(-1)
|
||||
end %>
|
||||
total_item_foc += sale.grand_total*(-1)
|
||||
end %>
|
||||
|
||||
<% if sale.status_type == "Discount" && sale.grand_total < 0
|
||||
total_item_dis += sale.grand_total*(-1)
|
||||
end %>
|
||||
<% if sale.status_type == "Discount" && sale.grand_total < 0
|
||||
total_item_dis += sale.grand_total*(-1)
|
||||
end %>
|
||||
|
||||
<% if !acc_arr.include?(sale.account_id) %>
|
||||
<tr>
|
||||
@@ -85,7 +98,7 @@
|
||||
<td>
|
||||
<% @totalByAccount.each do |account, total| %>
|
||||
<% if sale.account_id == account %>
|
||||
<b><%= total %></b>
|
||||
<b><%= number_with_precision(total, precision:precision,delimiter:delimiter) %></b>
|
||||
<% grand_total += total %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -104,30 +117,37 @@
|
||||
<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>
|
||||
<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>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
<% @menu_cate_count.each do |key,value| %>
|
||||
<% if sale.menu_category_id == key %>
|
||||
|
||||
<% @menu_cate_count.each do |key,value| %>
|
||||
<% if sale.account_id == key %>
|
||||
<% count = count + 1 %>
|
||||
<% sub_total += sale.grand_total %>
|
||||
<% #sub_qty += sale.total_item %>
|
||||
<% if sale.status_type != "Discount" && sale.status_type != "foc"
|
||||
sub_qty += sale.total_item
|
||||
end %>
|
||||
<% if count == value %>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td colspan="3"> </td>
|
||||
<td><b>Total <%= sale.account_name %> Qty </b> </td>
|
||||
<td><b><%= sub_qty %></b></td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span class="underline"><%= sub_total %></span></td>
|
||||
<td ><span class="underline"><%= number_with_precision(sub_total , precision:precision,delimiter:delimiter)%> </span></td>
|
||||
</tr>
|
||||
<% sub_total = 0.0%>
|
||||
<% sub_qty = 0 %>
|
||||
<% count = 0%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- end sub total -->
|
||||
<% end %>
|
||||
<!-- end sub total -->
|
||||
<% end %>
|
||||
<!--Other Charges -->
|
||||
|
||||
<% if @other_charges.present? %>
|
||||
<tr>
|
||||
<td><b>Other Charges</b></td>
|
||||
<td colspan="4"> </td>
|
||||
@@ -144,8 +164,8 @@
|
||||
<td><%= other.item_code rescue '-' %></td>
|
||||
<td><%= other.product_name rescue '-' %></td>
|
||||
<td><%= other.total_item rescue '-' %></td>
|
||||
<td><%= other.unit_price rescue '-' %></td>
|
||||
<td><%= other.grand_total 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>
|
||||
</tr>
|
||||
<!-- sub total -->
|
||||
|
||||
@@ -155,38 +175,38 @@
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span><%= other_sub_total %></span></td>
|
||||
<td ><span><%= number_with_precision(other_sub_total , precision:precision,delimiter:delimiter)%></span></td>
|
||||
</tr>
|
||||
|
||||
<%end%>
|
||||
<!-- End Other Charges -->
|
||||
<tr style="border-top:2px solid grey;">
|
||||
<td colspan="3"> </td>
|
||||
<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><%= grand_total%></span></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision,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><%= total_item_foc %></span></td>
|
||||
<td><span><%= number_with_precision(total_item_foc , precision:precision,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><%= total_item_dis %></span></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(total_item_dis , precision:precision,delimiter:delimiter) %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.foc_sales") %></td>
|
||||
<td><span><%= @foc_data %></span></td>
|
||||
<td><span><%= number_with_precision(@foc_data , precision:precision,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><%= @discount_data %></span></td>
|
||||
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(@discount_data , precision:precision,delimiter:delimiter) %></span></td>
|
||||
</tr>
|
||||
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
@@ -202,7 +222,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;"><%= grand_total.to_f - @discount_data.to_f%></td>
|
||||
<td style="border-top:2px solid grey;"><%= number_with_precision(grand_total.to_f - @discount_data.to_f , precision:precision,delimiter:delimiter)%></td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
<td colspan="5"> </td>
|
||||
@@ -291,12 +311,15 @@
|
||||
|
||||
function show_shift_name(period,period_type,from,to,shift_item){
|
||||
var shift = $('#shift_name');
|
||||
|
||||
if (from == '' && to == '') {
|
||||
from = $("#from").val();
|
||||
to = $("#to").val();
|
||||
}
|
||||
shift.empty();
|
||||
var selected = '';
|
||||
var str = '';
|
||||
var param_shift = '<%= params[:shift_name]%>';
|
||||
|
||||
|
||||
url = '<%= reports_get_shift_by_date_path %>';
|
||||
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
||||
console.log(data)
|
||||
|
||||
@@ -63,6 +63,18 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% void = 0%>
|
||||
<% cash = 0%>
|
||||
<% credit = 0%>
|
||||
@@ -86,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><%= sprintf "%.2f",result[:cash_sales].to_f.to_d rescue '-'%></td>
|
||||
<td><%= sprintf "%.2f",result[:credit_sales].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><%= 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><%= sprintf "%.2f",result[:other_sales].to_f.to_d rescue '-'%></td>
|
||||
<td><%= number_with_precision(result[:other_sales].to_f, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||
<td>
|
||||
<%= sprintf "%.2f",result[:foc_sales].to_f.to_d rescue '-'%>
|
||||
<%= number_with_precision(result[:foc_sales].to_f, precision:precision,delimiter:delimiter) rescue '-'%>
|
||||
</td>
|
||||
<td><%= sprintf "%.2f",result[:grand_total].to_f.to_d rescue '-'%></td>
|
||||
<td><%= number_with_precision(result[:grand_total].to_f, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
<!-- <td><%= sprintf "%.2f",result[:rounding_adj].to_f.to_d rescue '-'%></td> -->
|
||||
<% grand_total = result[:grand_total].to_f %>
|
||||
@@ -114,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><%= sprintf("%.2f",cash) rescue '-'%></b></td>
|
||||
<td><b><%= sprintf("%.2f",credit) 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><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
|
||||
<td><b><%= sprintf("%.2f",card) 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><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
||||
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
||||
<td><b><%= number_with_precision(g_total, precision:precision,delimiter:delimiter) rescue '-'%></b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -191,7 +203,10 @@
|
||||
|
||||
function show_shift_name(period,period_type,from,to,shift_item){
|
||||
var shift = $('#shift_name');
|
||||
|
||||
if (from == '' && to == '') {
|
||||
from = $("#from").val();
|
||||
to = $("#to").val();
|
||||
}
|
||||
shift.empty();
|
||||
|
||||
var str = '';
|
||||
|
||||
@@ -52,6 +52,18 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% total_amount = 0.0 %>
|
||||
<% grand_total = 0.0 %>
|
||||
<% rounding_adjustment = 0.0 %>
|
||||
@@ -61,10 +73,10 @@
|
||||
<tr>
|
||||
<td><%= item.receipt_no rescue '-' %> </td>
|
||||
<td><%= item.receipt_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-' %></td>
|
||||
<td><%= item.total_amount.to_f rescue '-'%> </td>
|
||||
<td><%= item.grand_total.to_f rescue '-'%> </td>
|
||||
<td><%= item.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%> </td>
|
||||
<td><%= number_with_precision(item.total_amount.to_f, precision: precision.to_i ,delimiter: delimiter) %> </td>
|
||||
<td><%= number_with_precision(item.grand_total.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> </td>
|
||||
<td><%= number_with_precision(item.rounding_adjustment.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(item.grand_total.to_f + item.rounding_adjustment.to_f , precision: precision.to_i ,delimiter: delimiter) rescue '-'%> </td>
|
||||
<!-- <td><%= result.sales_status rescue '-' %> </td> -->
|
||||
<!-- <td><%= item.remarks rescue '-' %> </td> -->
|
||||
</tr>
|
||||
@@ -76,10 +88,10 @@
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;font-weight:600;">
|
||||
<td colspan="2" style="text-align:center;">Total Void Amount :</td>
|
||||
<td><%= total_amount rescue '-' %></td>
|
||||
<td><%= grand_total rescue '-' %></td>
|
||||
<td><%= rounding_adjustment rescue '-'%></td>
|
||||
<td colspan="3"><%= grand_rounding_adjustment rescue '-'%></td>
|
||||
<td><%= number_with_precision(total_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(grand_total, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(rounding_adjustment, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></td>
|
||||
<td colspan="3"><%= number_with_precision(grand_rounding_adjustment, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -144,7 +156,10 @@
|
||||
|
||||
function show_shift_name(period,period_type,from,to,shift_item){
|
||||
var shift = $('#shift_name');
|
||||
|
||||
if (from == '' && to == '') {
|
||||
from = $("#from").val();
|
||||
to = $("#to").val();
|
||||
}
|
||||
shift.empty();
|
||||
|
||||
var str = '';
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<th><%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.alt_name") %></th>
|
||||
<th><%= t("views.right_panel.detail.is_available") %></th>
|
||||
<th><%= t("views.right_panel.detail.order_by") %></th>
|
||||
<!-- <th><%= t("views.right_panel.detail.order_by") %></th> -->
|
||||
<th><%= t("views.right_panel.detail.parent") %></th>
|
||||
<th><%= t("views.right_panel.detail.actions") %></th>
|
||||
</tr>
|
||||
@@ -43,7 +43,7 @@
|
||||
<td><%= link_to settings_menu_category.name, settings_menu_category_path(settings_menu_category) %></td>
|
||||
<td><%= settings_menu_category.alt_name rescue ''%></td>
|
||||
<td><%= settings_menu_category.is_available rescue false%></td>
|
||||
<td><%= settings_menu_category.order_by rescue ''%></td>
|
||||
<!-- <td><%= settings_menu_category.order_by rescue ''%></td> -->
|
||||
<td><%= settings_menu_category.parent.name rescue ''%></td>
|
||||
<td><%= link_to t("views.btn.edit"), edit_settings_menu_category_path(settings_menu_category),:class => 'btn btn-info btn-sm waves-effect' %>
|
||||
</td></td>
|
||||
@@ -51,8 +51,8 @@
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= paginate @settings_menu_categories, param_name: :page, :outer_window => 3 %>
|
||||
</div>
|
||||
<%= paginate @settings_menu_categories, param_name: :page, :outer_window => 3 %>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
|
||||
<div class="card">
|
||||
|
||||
1
app/views/sym_control/run.html.erb
Executable file
1
app/views/sym_control/run.html.erb
Executable file
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user