update jade print in pay,void and foc
This commit is contained in:
@@ -464,7 +464,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
# Re-call Sale Data
|
# Re-call Sale Data
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
|
|
||||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
customer= Customer.find(saleObj.customer_id)
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|
||||||
@@ -478,7 +478,17 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
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, "FOC",nil,nil)
|
|
||||||
|
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, "FOC",nil,nil)
|
||||||
|
result = {
|
||||||
|
:status => true,
|
||||||
|
:filepath => filename,
|
||||||
|
:printer_model => print_settings.brand_name,
|
||||||
|
:printer_url => print_settings.api_settings
|
||||||
|
}
|
||||||
|
|
||||||
|
# Mobile Print
|
||||||
|
render :json => result.to_json
|
||||||
|
|
||||||
if params[:type] == "quick_service"
|
if params[:type] == "quick_service"
|
||||||
booking = Booking.find_by_sale_id(sale_id)
|
booking = Booking.find_by_sale_id(sale_id)
|
||||||
@@ -492,7 +502,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
Order.pay_process_order_queue(order.order_id,table_id)
|
Order.pay_process_order_queue(order.order_id,table_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -538,6 +548,15 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name)
|
printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name)
|
||||||
|
|
||||||
render :json => {status: true}
|
result = {
|
||||||
|
:status => true,
|
||||||
|
:filepath => filename,
|
||||||
|
:printer_model => print_settings.brand_name,
|
||||||
|
:printer_url => print_settings.api_settings
|
||||||
|
}
|
||||||
|
|
||||||
|
# Mobile Print
|
||||||
|
render :json => result.to_json
|
||||||
|
# render :json => {status: true}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -87,8 +87,6 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
if bookings[0].dining_facility_id.to_i>0
|
if bookings[0].dining_facility_id.to_i>0
|
||||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if bookings[0].dining_facility_id.to_i > 0
|
if bookings[0].dining_facility_id.to_i > 0
|
||||||
@@ -100,7 +98,7 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
customer= Customer.find(sale.customer_id)
|
customer= Customer.find(sale.customer_id)
|
||||||
|
|
||||||
@@ -121,8 +119,16 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil)
|
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil)
|
||||||
end
|
result = {
|
||||||
|
:filepath => filename,
|
||||||
|
:printer_model => print_settings.brand_name,
|
||||||
|
:printer_url => print_settings.api_settings
|
||||||
|
}
|
||||||
|
|
||||||
|
# Mobile Print
|
||||||
|
render :json => result.to_json
|
||||||
|
# end
|
||||||
|
|
||||||
#end print
|
#end print
|
||||||
|
|
||||||
|
|||||||
@@ -726,9 +726,9 @@
|
|||||||
createReceiptNoInFirstBillData(receipt_no,"");
|
createReceiptNoInFirstBillData(receipt_no,"");
|
||||||
|
|
||||||
// For Server Print - from jade
|
// For Server Print - from jade
|
||||||
// if ($("#server_mode").val() == "cloud") {
|
if ($("#server_mode").val() == "cloud") {
|
||||||
code2lab.printFile(result.filepath, result.printer_url);
|
code2lab.printFile(result.filepath, result.printer_url);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// console.log(result);
|
// console.log(result);
|
||||||
// code2lab.printBill(result.filepath, result.printer_model, result.printer_url);
|
// code2lab.printBill(result.filepath, result.printer_model, result.printer_url);
|
||||||
@@ -920,8 +920,12 @@
|
|||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||||
success: function () {
|
success: function (result) {
|
||||||
window.location.href = '/origami/';
|
// For Server Print - from jade
|
||||||
|
if ($("#server_mode").val() == "cloud") {
|
||||||
|
code2lab.printFile(result.filepath, result.printer_url);
|
||||||
|
}
|
||||||
|
window.location.href = '/origami/';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -420,11 +420,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-footer ">
|
<div class="modal-footer ">
|
||||||
<div class="row m-b-10 m-r-30">
|
<div class="row m-b-10 m-r-30">
|
||||||
<% if ENV["SERVER_MODE"] != 'cloud' %>
|
|
||||||
<div class="col-md-5 m-r-20">
|
<div class="col-md-5 m-r-20">
|
||||||
<button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
|
<button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
<button type="button" class="btn btn-link bg-blue waves-effect btn_pdf_close" data-dismiss="modal">CLOSE</button>
|
<button type="button" class="btn btn-link bg-blue waves-effect btn_pdf_close" data-dismiss="modal">CLOSE</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -710,8 +710,12 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||||
success: function () {
|
success: function (result) {result
|
||||||
customer_display_view(null,"reload");
|
customer_display_view(null,"reload");
|
||||||
|
// For Server Print - from jade
|
||||||
|
if ($("#server_mode").val() == "cloud") {
|
||||||
|
code2lab.printFile(result.filepath, result.printer_url);
|
||||||
|
}
|
||||||
if (cashier_type=="cashier") {
|
if (cashier_type=="cashier") {
|
||||||
window.location.href = '/origami';
|
window.location.href = '/origami';
|
||||||
}else{
|
}else{
|
||||||
@@ -922,6 +926,10 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
title: "Information!",
|
title: "Information!",
|
||||||
text: 'Thank You !',
|
text: 'Thank You !',
|
||||||
}, function () {
|
}, function () {
|
||||||
|
// For Server Print - from jade
|
||||||
|
if ($("#server_mode").val() == "cloud") {
|
||||||
|
code2lab.printFile(result.filepath, result.printer_url);
|
||||||
|
}
|
||||||
if (cashier_type=="cashier") {
|
if (cashier_type=="cashier") {
|
||||||
window.location.href = '/origami';
|
window.location.href = '/origami';
|
||||||
}else{
|
}else{
|
||||||
@@ -997,6 +1005,10 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
data: params,
|
data: params,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
console.log(result);
|
console.log(result);
|
||||||
|
// For Server Print - from jade
|
||||||
|
if ($("#server_mode").val() == "cloud") {
|
||||||
|
code2lab.printFile(result.filepath, result.printer_url);
|
||||||
|
}
|
||||||
if (cashier_type=="cashier") {
|
if (cashier_type=="cashier") {
|
||||||
window.location.href = '/origami';
|
window.location.href = '/origami';
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Reference in New Issue
Block a user