order reservation receipt bill"

This commit is contained in:
phyusin
2018-12-05 16:04:01 +06:30
parent 9e82f86484
commit 9c45ee0b8b
10 changed files with 186 additions and 569 deletions

View File

@@ -199,6 +199,16 @@ $(function() {
// $('body').addClass('modal-open').removeClass('modal-open-fix, modal-open-fix-pad');
// }, 1000);
// });
//print pdf function
$("#print_receipt_pdf").on('click touchstart', function(event){
$(this).off("click touchstart touchend");
print_receipt();
});
$(".btn_pdf_close").on('click',function(){
window.location.href = '/origami/order_reservation';
});
});
function warnBeforeRedirect(linkURL) {
@@ -517,17 +527,17 @@ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reas
window.location.href = '/origami/order_reservation';
});
}else{
if(result.filename){
if(data.filepath){
//PDF lightbox data
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
$("#sale_id").val(result.sale_id);
$("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename);
$("#printer_name").val(result.printer_name);
var pdfPath = "/en/pdfjs/minimal?file=" + data.filepath.substring(6);
$("#sale_id").val(data.sale_id);
$("#sale_receipt_no").val(data.receipt_no);
$("#filename").val(data.filepath);
$("#printer_name").val(data.printer_name);
$("#receipt_pdf").attr("src", pdfPath);
$("#receiptpdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#receiptpdfModalLabel").text("Receipt: " + result.receipt_no);
$("#receiptpdfModalLabel").text("Receipt: " + data.receipt_no);
}else{
swal({
title: 'Information',
@@ -701,31 +711,26 @@ function getOnlineOrderCount(){
}
/* online order count*/
//print pdf function
$("#print_receipt_pdf").on('click touchstart', function(event){
$(this).off("click touchstart touchend");
print_receipt();
});
/* pdf print out */
function print_receipt(){
var sale_id = $('#sale_id').text();
var sale_id = $('#sale_id').val();
var filename = $("#filename").val();
var printer_name = $("#printer_name").val();
var receipt_no = $("#sale_receipt_no").val();
var params = { 'filename':filename, 'receipt_no':receipt_no, 'printer_name':printer_name };
console.log(params);
$.ajax({
type: "POST",
url: "/origami/sale/"+sale_id+"/doemal_order/payment/print",
data: params,
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);
}
}
else{
// if ($("#server_mode").val() == "cloud") {
// if(typeof code2lab != 'undefined'){
// code2lab.printFile(result.filepath.substr(6), result.printer_url);
// }
// }
// else{
swal({
title: "Print Success",
text: "Complete Order",
@@ -737,7 +742,7 @@ function print_receipt(){
}, function () {
window.location.href = '/origami/order_reservation';
});
}
// }
}
});
}