order receipt bill pdf
This commit is contained in:
@@ -271,6 +271,7 @@ For Food Court Settings On/Off
|
||||
|
||||
For Online Order Receip Setting
|
||||
1) settings/lookups => { type:order_reservation, name:ReceiptBill, value: {0 or 1} }
|
||||
2) settings/print_settings => {name: ReceiptBillOrder, unique_code: ReceiptBillOrderPdf, ....}
|
||||
|
||||
* 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';
|
||||
});
|
||||
}else{
|
||||
|
||||
//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);
|
||||
$("#receipt_pdf").attr("src", pdfPath);
|
||||
|
||||
$("#receciptpdfModal").modal({show : true, backdrop : false, keyboard : false});
|
||||
$("#receiptpdfModalLabel").text("Receipt: " + result.receipt_no);
|
||||
}
|
||||
}else{
|
||||
swal({
|
||||
@@ -683,8 +688,34 @@ 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 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 */
|
||||
@@ -679,16 +679,21 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
filename = params[:filename]
|
||||
receipt_no = params[:receipt_no]
|
||||
printer_name = params[:printer_name]
|
||||
cashier_type = params[:type]
|
||||
|
||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
unique_code = "ReceiptBillPdf"
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
else
|
||||
unique_code = "ReceiptBillPdf"
|
||||
if cashier_type == "doemal_order"
|
||||
unique_code = "ReceiptBillOrderPdf"
|
||||
else
|
||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
unique_code = "ReceiptBillPdf"
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
else
|
||||
unique_code = "ReceiptBillPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -191,6 +191,7 @@ class OrderReservation < ApplicationRecord
|
||||
|
||||
result = {:status=> true,
|
||||
:filepath => filename,
|
||||
:sale_id => saleObj.sale_id,
|
||||
:receipt_no => sale_receipt_no,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings ,
|
||||
|
||||
@@ -193,17 +193,22 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Generate PDF
|
||||
#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)
|
||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
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)
|
||||
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)
|
||||
if printer_settings.name.strip.downcase != "receiptbillorder"
|
||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
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)
|
||||
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
|
||||
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
|
||||
# print as print copies in printer setting
|
||||
count = printer_settings.print_copies
|
||||
|
||||
@@ -659,10 +659,10 @@
|
||||
<div class="modal-header">
|
||||
<h6 class="modal-title">
|
||||
<span id="receiptpdfModalLabel"></span>
|
||||
<span id="changed_amount" class="p-l-120"></span>
|
||||
</h6>
|
||||
</div>
|
||||
<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="filename" id="filename">
|
||||
<input type="hidden" name="printer_name" id="printer_name">
|
||||
@@ -671,7 +671,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<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 type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
|
||||
CLOSE
|
||||
|
||||
Reference in New Issue
Block a user