update jade print in pay,void and foc

This commit is contained in:
Aung Myo
2018-03-21 15:37:45 +06:30
parent a30abfb30c
commit 80853fb666
4 changed files with 58 additions and 17 deletions

View File

@@ -464,7 +464,7 @@ class Origami::PaymentsController < BaseOrigamiController
# Re-call Sale Data
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"
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)
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"
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)
end
end
end
# end
end
end
@@ -538,6 +548,15 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings)
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

View File

@@ -87,8 +87,6 @@ class Origami::VoidController < BaseOrigamiController
if bookings[0].dining_facility_id.to_i>0
table = DiningFacility.find(bookings[0].dining_facility_id)
end
end
if bookings[0].dining_facility_id.to_i > 0
@@ -100,7 +98,7 @@ class Origami::VoidController < BaseOrigamiController
end
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
unique_code = "ReceiptBillPdf"
customer= Customer.find(sale.customer_id)
@@ -120,9 +118,17 @@ class Origami::VoidController < BaseOrigamiController
item_price_by_accounts = SaleItem.calculate_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.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
printer = Printer::ReceiptPrinter.new(print_settings)
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)
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

View File

@@ -726,9 +726,9 @@
createReceiptNoInFirstBillData(receipt_no,"");
// For Server Print - from jade
// if ($("#server_mode").val() == "cloud") {
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath, result.printer_url);
// }
}
// console.log(result);
// code2lab.printBill(result.filepath, result.printer_model, result.printer_url);
@@ -920,8 +920,12 @@
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
success: function () {
window.location.href = '/origami/';
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath, result.printer_url);
}
window.location.href = '/origami/';
}
});
}

View File

@@ -420,11 +420,11 @@
</div>
<div class="modal-footer ">
<div class="row m-b-10 m-r-30">
<% if ENV["SERVER_MODE"] != 'cloud' %>
<div class="col-md-5 m-r-20">
<button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
</div>
<% end %>
<div class="col-md-5">
<button type="button" class="btn btn-link bg-blue waves-effect btn_pdf_close" data-dismiss="modal">CLOSE</button>
</div>
@@ -710,8 +710,12 @@ var customer_name = "<%= @customer.name %>";
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
success: function () {
success: function (result) {result
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") {
window.location.href = '/origami';
}else{
@@ -922,6 +926,10 @@ var customer_name = "<%= @customer.name %>";
title: "Information!",
text: 'Thank You !',
}, function () {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath, result.printer_url);
}
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
@@ -997,6 +1005,10 @@ var customer_name = "<%= @customer.name %>";
data: params,
success:function(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") {
window.location.href = '/origami';
}else{