change take away customer for quick service

This commit is contained in:
phyusin
2018-03-09 14:05:18 +06:30
parent 91e76c7381
commit 9c89bce25d
4 changed files with 65 additions and 56 deletions

View File

@@ -103,10 +103,15 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
} }
# begin # begin
if params[:order_source] == "quick_service"
customer_id = "CUS-000000000002" # for no customer id from mobile
else
customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
end
@order = Order.new @order = Order.new
@order.source = params[:order_source] @order.source = params[:order_source]
@order.order_type = params[:order_type] @order.order_type = params[:order_type]
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile @order.customer_id = customer_id
@order.items = items_arr @order.items = items_arr
@order.guest = params[:guest_info] @order.guest = params[:guest_info]
@order.table_id = params[:table_id] # this is dining facilities's id @order.table_id = params[:table_id] # this is dining facilities's id

View File

@@ -204,15 +204,15 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
if count == 1 if count == 1
filename = "/receipts/receipt_bill_#{sale_data.receipt_no}.pdf" filename = "/receipts/receipt_bill_#{sale_data.receipt_no}.pdf"
pdf.render_file directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf" pdf.render_file directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf"
if printed_status != 'Paid' # if printed_status != 'Paid'
self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf", cashier_terminal.printer_name) self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf", cashier_terminal.printer_name)
end # end
else else
filename = "/receipts/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf" filename = "/receipts/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf"
pdf.render_file directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf" pdf.render_file directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf"
if printed_status != 'Paid' # if printed_status != 'Paid'
self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf", cashier_terminal.printer_name) self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf", cashier_terminal.printer_name)
end # end
end end
count -= 1 count -= 1

View File

@@ -16,7 +16,11 @@
<!-- <a href="javascript:void(0);" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"></a> --> <!-- <a href="javascript:void(0);" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"></a> -->
<%if current_login_employee.role !="waiter" %> <%if current_login_employee.role !="waiter" %>
<a href="javascript:void(0);" class="bars"></a> <a href="javascript:void(0);" class="bars"></a>
<a class="navbar-brand" href="<%=dashboard_path%>" style="margin-left: 20px;"> <% if current_login_employee.role != "cashier" %>
<a class="navbar-brand" href="<%=dashboard_path%>" style="margin-left: 20px;">
<% else %>
<a class="navbar-brand" href="<%=origami_dashboard_path%>" style="margin-left: 20px;">
<% end %>
<% else %> <% else %>
<a class="navbar-brand m-0" href="<%= origami_dashboard_path%>"> <a class="navbar-brand m-0" href="<%= origami_dashboard_path%>">
<%end%> <%end%>

View File

@@ -462,11 +462,11 @@ var customer_id = "<%= @customer.id %>";
var customer_name = "<%= @customer.name %>"; var customer_name = "<%= @customer.name %>";
$(document).ready(function(){ $(document).ready(function(){
//start customer modal popup //start customer modal popup
if((customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){ // if((customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){ // if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
$("#is_memberModal").modal({show : true, backdrop: false, keyboard : false}); // $("#is_memberModal").modal({show : true, backdrop: false, keyboard : false});
} // }
} // }
/* start check first bill or not*/ /* start check first bill or not*/
var member_id = $('#membership_id').text(); var member_id = $('#membership_id').text();
@@ -594,53 +594,53 @@ var customer_name = "<%= @customer.name %>";
$("#loading_wrapper" ).hide(); $("#loading_wrapper" ).hide();
//PDF lightbox data //PDF lightbox data
$("#sale_receipt_no").val(result.receipt_no); // $("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename); // $("#filename").val(result.filename);
$("#printer_name").val(result.printer_name); // $("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", result.filename); // $("#receipt_pdf").attr("src", result.filename);
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false}); // $("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Payment Successful!"); // $("#pdfModalLabel").text("Payment Successful!");
$("#changed_amount").text(""); // $("#changed_amount").text("");
if($('#balance').text() < 0){
<% if precision.to_i > 0 %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
<% else %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
<% end %>
}
//PDF lightbox data
// if($('#balance').text() < 0){ // if($('#balance').text() < 0){
// swal({ // <% if precision.to_i > 0 %>
// title: "Payment Successful!", // $("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
// text: 'Changed amount ' + $('#balance').text() * (-1), // <% else %>
// html: true, // $("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
// closeOnConfirm: false, // <% end %>
// 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';
// // }
// });
// } // }
//PDF lightbox data
if($('#balance').text() < 0){
swal({
title: "Payment Successful!",
text: 'Changed amount ' + $('#balance').text() * (-1),
html: true,
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';
}
});
}
} }
}); });
} }