order receipt bill pdf
This commit is contained in:
@@ -271,6 +271,7 @@ For Food Court Settings On/Off
|
|||||||
|
|
||||||
For Online Order Receip Setting
|
For Online Order Receip Setting
|
||||||
1) settings/lookups => { type:order_reservation, name:ReceiptBill, value: {0 or 1} }
|
1) settings/lookups => { type:order_reservation, name:ReceiptBill, value: {0 or 1} }
|
||||||
|
2) settings/print_settings => {name: ReceiptBillOrder, unique_code: ReceiptBillOrderPdf, ....}
|
||||||
|
|
||||||
* ToDo list
|
* ToDo list
|
||||||
|
|
||||||
|
|||||||
@@ -517,12 +517,17 @@ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reas
|
|||||||
window.location.href = '/origami/order_reservation';
|
window.location.href = '/origami/order_reservation';
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
//PDF lightbox data
|
//PDF lightbox data
|
||||||
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
|
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
|
||||||
|
$("#sale_id").val(result.sale_id);
|
||||||
$("#sale_receipt_no").val(result.receipt_no);
|
$("#sale_receipt_no").val(result.receipt_no);
|
||||||
$("#filename").val(result.filename);
|
$("#filename").val(result.filename);
|
||||||
$("#printer_name").val(result.printer_name);
|
$("#printer_name").val(result.printer_name);
|
||||||
$("#receipt_pdf").attr("src", pdfPath);
|
$("#receipt_pdf").attr("src", pdfPath);
|
||||||
|
|
||||||
|
$("#receciptpdfModal").modal({show : true, backdrop : false, keyboard : false});
|
||||||
|
$("#receiptpdfModalLabel").text("Receipt: " + result.receipt_no);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
swal({
|
swal({
|
||||||
@@ -683,8 +688,34 @@ function getOnlineOrderCount(){
|
|||||||
}
|
}
|
||||||
/* online order count*/
|
/* online order count*/
|
||||||
|
|
||||||
|
//print pdf function
|
||||||
|
$("#print_receipt_pdf").on('click touchstart', function(event){
|
||||||
|
$(this).off("click touchstart touchend");
|
||||||
|
print_receipt();
|
||||||
|
});
|
||||||
|
|
||||||
/* pdf print out */
|
/* pdf print out */
|
||||||
function print_receipt(){
|
function print_receipt(){
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
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 };
|
||||||
|
$.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{
|
||||||
|
payment_success_alert();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
/* pdf print out */
|
/* pdf print out */
|
||||||
@@ -679,16 +679,21 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
filename = params[:filename]
|
filename = params[:filename]
|
||||||
receipt_no = params[:receipt_no]
|
receipt_no = params[:receipt_no]
|
||||||
printer_name = params[:printer_name]
|
printer_name = params[:printer_name]
|
||||||
|
cashier_type = params[:type]
|
||||||
|
|
||||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
if cashier_type == "doemal_order"
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillOrderPdf"
|
||||||
if !receipt_bill_a5_pdf.empty?
|
else
|
||||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
unique_code = "ReceiptBillPdf"
|
||||||
if receipt_bilA5[1] == '1'
|
if !receipt_bill_a5_pdf.empty?
|
||||||
unique_code = "ReceiptBillA5Pdf"
|
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||||
else
|
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||||
unique_code = "ReceiptBillPdf"
|
if receipt_bilA5[1] == '1'
|
||||||
|
unique_code = "ReceiptBillA5Pdf"
|
||||||
|
else
|
||||||
|
unique_code = "ReceiptBillPdf"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ class OrderReservation < ApplicationRecord
|
|||||||
|
|
||||||
result = {:status=> true,
|
result = {:status=> true,
|
||||||
:filepath => filename,
|
:filepath => filename,
|
||||||
|
:sale_id => saleObj.sale_id,
|
||||||
:receipt_no => sale_receipt_no,
|
:receipt_no => sale_receipt_no,
|
||||||
:printer_model => print_settings.brand_name,
|
:printer_model => print_settings.brand_name,
|
||||||
:printer_url => print_settings.api_settings ,
|
:printer_url => print_settings.api_settings ,
|
||||||
|
|||||||
@@ -193,17 +193,22 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
|||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
|
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
|
||||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
if printer_settings.name.strip.downcase != "receiptbillorder"
|
||||||
if !receipt_bill_a5_pdf.empty?
|
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
if !receipt_bill_a5_pdf.empty?
|
||||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||||
if receipt_bilA5[1] == '1'
|
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||||
pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
|
if receipt_bilA5[1] == '1'
|
||||||
else
|
pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
|
||||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
|
else
|
||||||
|
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
#doemal online order pdf template
|
||||||
|
pdf = ReceiptBillOrderPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount)
|
||||||
end
|
end
|
||||||
# print as print copies in printer setting
|
# print as print copies in printer setting
|
||||||
count = printer_settings.print_copies
|
count = printer_settings.print_copies
|
||||||
|
|||||||
@@ -659,10 +659,10 @@
|
|||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h6 class="modal-title">
|
<h6 class="modal-title">
|
||||||
<span id="receiptpdfModalLabel"></span>
|
<span id="receiptpdfModalLabel"></span>
|
||||||
<span id="changed_amount" class="p-l-120"></span>
|
|
||||||
</h6>
|
</h6>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body" style="height: 400px;">
|
<div class="modal-body" style="height: 400px;">
|
||||||
|
<input type="hidden" name="sale_id" id="sale_id">
|
||||||
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
|
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
|
||||||
<input type="hidden" name="filename" id="filename">
|
<input type="hidden" name="filename" id="filename">
|
||||||
<input type="hidden" name="printer_name" id="printer_name">
|
<input type="hidden" name="printer_name" id="printer_name">
|
||||||
@@ -671,7 +671,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="mr-2 m-t-5 btn-lg btn-block bg-red waves-effect print_receipt" id="print_receipt"> Print
|
<button type="button" class="mr-2 m-t-5 btn-lg btn-block bg-red waves-effect print_receipt_pdf" id="print_receipt_pdf"> Print
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
|
<button type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
|
||||||
CLOSE
|
CLOSE
|
||||||
|
|||||||
Reference in New Issue
Block a user