Merge branch 'r-1902001-01' into foodcourt
This commit is contained in:
@@ -239,7 +239,7 @@
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
Receipt No: <span id="receipt_no">
|
||||
<% if @status_sale == 'sale' %>
|
||||
<%= @sale_array[0].receipt_no rescue '' %>
|
||||
<%= @obj_sale.receipt_no rescue '' %>
|
||||
<% end %>
|
||||
</span>
|
||||
<br>
|
||||
@@ -266,8 +266,8 @@
|
||||
<div class="row 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"><%= @sale_array[0].customer_id rescue '' %></p>
|
||||
Customer : <%= @sale_array[0].customer.name rescue '' %>
|
||||
<p class="hidden customer-id"><%= @obj_sale.customer_id rescue '' %></p>
|
||||
Customer : <%= @obj_sale.customer.name rescue '' %>
|
||||
<% elsif @status_order == 'order'
|
||||
%>
|
||||
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
|
||||
@@ -291,9 +291,9 @@
|
||||
<% count = 0
|
||||
sub_total = 0
|
||||
if @status_sale == "sale"
|
||||
@sale_array[0].sale_items.each do |sale_item|
|
||||
@obj_sale.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price%>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||
<input type="hidden" id="sale_id" value="<%= @obj_sale.sale_id %>">
|
||||
<%count += 1 %>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
@@ -455,7 +455,7 @@
|
||||
<% end %>
|
||||
<% @sale_array.each do |sale|
|
||||
if @sale_array.size > 1
|
||||
unless sale.receipt_no == @sale_array[0].receipt_no
|
||||
unless sale.receipt_no == @obj_sale.receipt_no
|
||||
%>
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
@@ -529,7 +529,7 @@
|
||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||
|
||||
<% if !@split_bill.nil? %>
|
||||
<% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
|
||||
<% if @split_bill == '1' && (@orde_items.present?) %>
|
||||
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -596,6 +596,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= print_settings %>
|
||||
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
@@ -971,13 +973,15 @@
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,"");
|
||||
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
if (!$('#print_settings').data('action-cable')) {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
location.reload();
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1002,80 +1006,82 @@
|
||||
$(".choose_payment").on('click', function () {
|
||||
$( "#loading_wrapper").show();
|
||||
|
||||
var sale_id = $('#sale_id').val();
|
||||
// type = $('.payment_method').val();
|
||||
type = get_selected_attributes('selected-payment');
|
||||
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
||||
var sale_id = $('#sale_id').val();
|
||||
// type = $('.payment_method').val();
|
||||
type = get_selected_attributes('selected-payment');
|
||||
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
||||
|
||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) {
|
||||
if(!location.pathname.includes("credit_payment")){
|
||||
calculate_member_discount(sale_id,"Card",tax_type);
|
||||
}
|
||||
}else{
|
||||
if(!location.pathname.includes("credit_payment")){
|
||||
calculate_member_discount(sale_id,"Cash",tax_type);
|
||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) {
|
||||
if(!location.pathname.includes("credit_payment")){
|
||||
calculate_member_discount(sale_id,"Card",tax_type);
|
||||
}
|
||||
}else{
|
||||
if(!location.pathname.includes("credit_payment")){
|
||||
calculate_member_discount(sale_id,"Cash",tax_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);
|
||||
|
||||
if (!$('#print_settings').data('action-cable')) {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function calculate_member_discount(sale_id,type,tax_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,'cashier_type':'cashier','tax_type':tax_type },
|
||||
async: false,
|
||||
success:function(result){
|
||||
}
|
||||
});
|
||||
|
||||
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,'cashier_type':'cashier','tax_type':tax_type },
|
||||
async: false,
|
||||
success:function(result){
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#pay').on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var data_order = $(this).data("order");
|
||||
if (data_order) {
|
||||
swal({
|
||||
title: "Alert! This Receipt has another item",
|
||||
text: "Are you sure want to pay this receipt !",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, Pay it !",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
|
||||
}
|
||||
});
|
||||
}else{
|
||||
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
|
||||
}
|
||||
var sale_id = $('#sale_id').val();
|
||||
var data_order = $(this).data("order");
|
||||
if (data_order) {
|
||||
swal({
|
||||
title: "Alert! This Receipt has another item",
|
||||
text: "Are you sure want to pay this receipt !",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, Pay it !",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
|
||||
}
|
||||
});
|
||||
} else {
|
||||
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
|
||||
}
|
||||
});
|
||||
|
||||
// $('#kbz_query').on('click', function(){
|
||||
@@ -1104,33 +1110,33 @@
|
||||
var current_checkin_induties_count =localStorage.getItem("current_checkin_induties_count");
|
||||
localStorage.removeItem("current_checkin_induties_count");
|
||||
if(order_id!=undefined && order_id!=null && order_id!=""){
|
||||
if($('#request_bills').is(":visible")) {
|
||||
if ($('#request_bills').is(":visible")) {
|
||||
$('#request_bills').prop("disabled",true);
|
||||
}
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
data: {current_checkin_induties_count: current_checkin_induties_count},
|
||||
success: function (result) {
|
||||
if (!result.status) {
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: result.error_message,
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function (isConfirm) {
|
||||
if(isConfirm){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
data: {current_checkin_induties_count: current_checkin_induties_count},
|
||||
success: function (result) {
|
||||
if (!result.status) {
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: result.error_message,
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function (isConfirm) {
|
||||
if(isConfirm){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal("Opps","There is no orders!","warning");
|
||||
@@ -1166,24 +1172,24 @@
|
||||
// var tax_type = localStorage.getItem("tax_type");
|
||||
var tax_type = $("#check_tax").val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id + "&tax_type=" + tax_type,
|
||||
success: function (result) {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Invoice updated",
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
$("#first_bill").removeAttr('disabled');
|
||||
$("#pay").removeAttr('disabled');
|
||||
window.location.reload();
|
||||
});
|
||||
$("#loading_wrapper").hide();
|
||||
}
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id + "&tax_type=" + tax_type,
|
||||
success: function (result) {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Invoice updated",
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
$("#first_bill").removeAttr('disabled');
|
||||
$("#pay").removeAttr('disabled');
|
||||
window.location.reload();
|
||||
});
|
||||
$("#loading_wrapper").hide();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
@@ -1268,13 +1274,15 @@
|
||||
url: ajax_url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
|
||||
success: function (result) {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
if (!$('#print_settings').data('action-cable')) {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
window.location.href = '/origami/';
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1377,13 +1385,15 @@
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
success: function (result) {
|
||||
console.log(result)
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
if (!$('#print_settings').data('action-cable')) {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
window.location.href = '/origami/';
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user