update receipt pdf view
This commit is contained in:
@@ -185,6 +185,10 @@ For MoveTablePdf in print settings
|
|||||||
3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal }
|
3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal }
|
||||||
/* Tax Profile Group Types in lookups */
|
/* Tax Profile Group Types in lookups */
|
||||||
|
|
||||||
|
/*Receipt Pdf View in lookups */
|
||||||
|
1) settings/lookups => { type:ReceiptPdfView, name: Receipt Pdf View, value:1 or 0 }
|
||||||
|
=> 1 is active and 0 is in-active
|
||||||
|
|
||||||
Add Kitchen Role of Employee
|
Add Kitchen Role of Employee
|
||||||
=> 1) settings/lookups => { type:employee_roles, name: Kitchen, value:kitchen }
|
=> 1) settings/lookups => { type:employee_roles, name: Kitchen, value:kitchen }
|
||||||
|
|
||||||
|
|||||||
@@ -242,7 +242,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
@table_no = ''
|
@table_no = ''
|
||||||
@dining = ''
|
@dining = ''
|
||||||
@other_payment = 0.0
|
@other_payment = 0.0
|
||||||
|
@pdf_view = nil
|
||||||
|
@lookup_pdf = Lookup.find_by_lookup_type("ReceiptPdfView")
|
||||||
|
if !@lookup_pdf.nil?
|
||||||
|
@pdf_view = @lookup_pdf.value
|
||||||
|
end
|
||||||
@shop = Shop.first #show shop info
|
@shop = Shop.first #show shop info
|
||||||
|
|
||||||
@customer_lists = Customer.where("customer_id = 'CUS-000000000001' or customer_id = 'CUS-000000000002'")
|
@customer_lists = Customer.where("customer_id = 'CUS-000000000001' or customer_id = 'CUS-000000000002'")
|
||||||
|
|||||||
@@ -622,6 +622,8 @@
|
|||||||
var cashier_type = "<%= @cashier_type %>";
|
var cashier_type = "<%= @cashier_type %>";
|
||||||
var customer_id = "<%= @customer.id %>";
|
var customer_id = "<%= @customer.id %>";
|
||||||
var customer_name = "<%= @customer.name %>";
|
var customer_name = "<%= @customer.name %>";
|
||||||
|
var pdf_view = '<%=@pdf_view%>';
|
||||||
|
console.log(pdf_view)
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
setHeaderBreadCrumb(_PAYMENTS_);
|
setHeaderBreadCrumb(_PAYMENTS_);
|
||||||
//start customer modal popup
|
//start customer modal popup
|
||||||
@@ -765,8 +767,8 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
calculate_member_discount(sale_id,tax_type);
|
calculate_member_discount(sale_id,tax_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#pdfModal").on('shown.bs.modal', function () {
|
// $("#pdfModal").on('shown.bs.modal', function () {
|
||||||
$('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
|
// $('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_cash_path %>",
|
url: "<%= origami_payment_cash_path %>",
|
||||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type,
|
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type,
|
||||||
@@ -794,8 +796,6 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
$("#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);
|
||||||
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
|
|
||||||
$("#pdfModalLabel").text("Sale Completed");
|
|
||||||
$("#changed_amount").text("");
|
$("#changed_amount").text("");
|
||||||
if($('#balance').text() < 0){
|
if($('#balance').text() < 0){
|
||||||
<% if precision.to_i > 0 %>
|
<% if precision.to_i > 0 %>
|
||||||
@@ -805,39 +805,13 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
<% end %>
|
<% end %>
|
||||||
}
|
}
|
||||||
|
|
||||||
//PDF lightbox data
|
if (pdf_view == 1) {
|
||||||
// if($('#balance').text() < 0){
|
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
|
||||||
// swal({
|
$("#pdfModalLabel").text("Sale Completed");
|
||||||
// title: "Payment Successful!",
|
}else{
|
||||||
// text: 'Changed amount ' + $('#balance').text() * (-1),
|
//PDF lightbox data
|
||||||
// html: true,
|
print_receipt();
|
||||||
// closeOnConfirm: false,
|
}
|
||||||
// closeOnCancel: false,
|
|
||||||
// allowOutsideClick: false
|
|
||||||
// }, function () {
|
|
||||||
// if (cashier_type=="cashier") {
|
|
||||||
// window.location.href = '/origami';
|
|
||||||
// }else{
|
|
||||||
// window.location.href = '/origami/quick_service';
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }else{
|
|
||||||
// $('#pay').text("Pay");
|
|
||||||
// swal({
|
|
||||||
// title: "Payment Successful!",
|
|
||||||
// text: 'Thank You !',
|
|
||||||
// html: true,
|
|
||||||
// closeOnConfirm: false,
|
|
||||||
// closeOnCancel: false,
|
|
||||||
// allowOutsideClick: false
|
|
||||||
// }, function () {
|
|
||||||
// if (cashier_type=="cashier") {
|
|
||||||
// window.location.href = '/origami';
|
|
||||||
// }else{
|
|
||||||
// window.location.href = '/origami/quick_service';
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1075,22 +1049,16 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
//print pdf function
|
//print pdf function
|
||||||
// $(".print_receipt").on('click',function(){
|
// $(".print_receipt").on('click',function(){
|
||||||
$(document).on('touchstart click', '.print_receipt', function(event){
|
$(document).on('touchstart click', '.print_receipt', function(event){
|
||||||
|
print_receipt();
|
||||||
|
});
|
||||||
|
|
||||||
|
function print_receipt() {
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
var filename = $("#filename").val();
|
var filename = $("#filename").val();
|
||||||
var printer_name = $("#printer_name").val();
|
var printer_name = $("#printer_name").val();
|
||||||
var receipt_no = $("#sale_receipt_no").val();
|
var receipt_no = $("#sale_receipt_no").val();
|
||||||
var params = { 'filename':filename, 'receipt_no':receipt_no, 'printer_name':printer_name };
|
var params = { 'filename':filename, 'receipt_no':receipt_no, 'printer_name':printer_name };
|
||||||
|
|
||||||
// swal({
|
|
||||||
// title: "Alert",
|
|
||||||
// text: "Are you sure want to print?",
|
|
||||||
// type: "warning",
|
|
||||||
// showCancelButton: true,
|
|
||||||
// confirmButtonColor: "#DD6B55",
|
|
||||||
// confirmButtonText: "Print",
|
|
||||||
// closeOnConfirm: false
|
|
||||||
// }, function (isConfirm) {
|
|
||||||
// if (isConfirm) {
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/origami/sale/"+sale_id+"/"+cashier_type+"/payment/print",
|
url: "/origami/sale/"+sale_id+"/"+cashier_type+"/payment/print",
|
||||||
@@ -1100,18 +1068,43 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
if ($("#server_mode").val() == "cloud") {
|
if ($("#server_mode").val() == "cloud") {
|
||||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||||
}
|
}
|
||||||
if (cashier_type=="cashier") {
|
|
||||||
window.location.href = '/origami';
|
|
||||||
}else{
|
|
||||||
window.location.href = '/origami/quick_service';
|
if (pdf_view ==1) {
|
||||||
customer_display_view(null,"reload");
|
if (cashier_type=="cashier") {
|
||||||
}
|
window.location.href = '/origami';
|
||||||
|
}else{
|
||||||
|
window.location.href = '/origami/quick_service';
|
||||||
|
customer_display_view(null,"reload");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
var title = "Payment Successful!";
|
||||||
|
if($('#balance').text() < 0){
|
||||||
|
var text = 'Changed amount ' + $('#balance').text() * (-1);
|
||||||
|
}else{
|
||||||
|
$('#pay').text("Pay");
|
||||||
|
var text = 'Thank You !';
|
||||||
|
}
|
||||||
|
swal({
|
||||||
|
title: "Payment Successful!",
|
||||||
|
text: text,
|
||||||
|
html: true,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false
|
||||||
|
}, function () {
|
||||||
|
if (cashier_type=="cashier") {
|
||||||
|
window.location.href = '/origami';
|
||||||
|
}else{
|
||||||
|
window.location.href = '/origami/quick_service';
|
||||||
|
customer_display_view(null,"reload");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// }
|
}
|
||||||
// });
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$(".btn_pdf_close").on('click',function(){
|
$(".btn_pdf_close").on('click',function(){
|
||||||
|
|||||||
Reference in New Issue
Block a user