cadd print pdf in payment page
This commit is contained in:
@@ -28,8 +28,21 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
# Print for First Bill to Customer
|
||||
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
|
||||
|
||||
#shop detail
|
||||
shop_details = Shop::ShopDetail
|
||||
# customer= Customer.where('customer_id=' +.customer_id)
|
||||
@@ -117,7 +130,20 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
# For Print
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
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
|
||||
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
# get member information
|
||||
@@ -150,9 +176,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, print_copies, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
|
||||
|
||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :count => print_copies, :printer_name => printer_name})
|
||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
||||
|
||||
if params[:type] == "quick_service"
|
||||
booking = Booking.find_by_sale_id(sale_id)
|
||||
@@ -440,20 +466,30 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
#print function for receipt
|
||||
def print
|
||||
# byebug
|
||||
def print
|
||||
filename = params[:filename]
|
||||
receipt_no = parmas[:receipt_no]
|
||||
print_copies = params[:print_copies]
|
||||
receipt_no = params[:receipt_no]
|
||||
printer_name = params[:printer_name]
|
||||
|
||||
puts "print params"
|
||||
puts params
|
||||
|
||||
print_receipt_pdf(filename,receipt_no,print_copies,printer_name)
|
||||
|
||||
redirect_to origami_path
|
||||
# render json: JSON.generate({:status => true})
|
||||
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
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name)
|
||||
|
||||
render :json => {status: true}
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
|
||||
Reference in New Issue
Block a user