order reservation pdf setting
This commit is contained in:
@@ -504,17 +504,26 @@ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reas
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data.status) {
|
if (data.status) {
|
||||||
swal({
|
if(status != "completed"){
|
||||||
title: 'Information',
|
swal({
|
||||||
text: "Order has been "+data.message,
|
title: 'Information',
|
||||||
type: 'success',
|
text: "Order has been "+data.message,
|
||||||
html: true,
|
type: 'success',
|
||||||
closeOnConfirm: false,
|
html: true,
|
||||||
closeOnCancel: false,
|
closeOnConfirm: false,
|
||||||
allowOutsideClick: false
|
closeOnCancel: false,
|
||||||
}, function () {
|
allowOutsideClick: false
|
||||||
window.location.href = '/origami/order_reservation';
|
}, function () {
|
||||||
});
|
window.location.href = '/origami/order_reservation';
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
//PDF lightbox data
|
||||||
|
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
|
||||||
|
$("#sale_receipt_no").val(result.receipt_no);
|
||||||
|
$("#filename").val(result.filename);
|
||||||
|
$("#printer_name").val(result.printer_name);
|
||||||
|
$("#receipt_pdf").attr("src", pdfPath);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
swal({
|
swal({
|
||||||
title: 'Oops',
|
title: 'Oops',
|
||||||
@@ -673,3 +682,9 @@ function getOnlineOrderCount(){
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
/* online order count*/
|
/* online order count*/
|
||||||
|
|
||||||
|
/* pdf print out */
|
||||||
|
function print_receipt(){
|
||||||
|
|
||||||
|
}
|
||||||
|
/* pdf print out */
|
||||||
@@ -11,7 +11,7 @@ class Api::CheckInProcessController < Api::ApiController
|
|||||||
booking = nil
|
booking = nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
booking = dining_facility.get_current_checkout_booking
|
booking = dining_facility.get_current_booking
|
||||||
end
|
end
|
||||||
if !booking.nil?
|
if !booking.nil?
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,7 @@ class Origami::OrderReservationController < BaseOrigamiController
|
|||||||
@count_on_order = OrderReservation.get_count_on_order
|
@count_on_order = OrderReservation.get_count_on_order
|
||||||
@count_on_completed = OrderReservation.get_count_on_completed
|
@count_on_completed = OrderReservation.get_count_on_completed
|
||||||
@shop = Shop.find_by_id(1)
|
@shop = Shop.find_by_id(1)
|
||||||
receipt_bill = Lookup.collection_of("order_reservation")
|
@receipt_bill = check_receipt_bill
|
||||||
@receipt_bill = 0
|
|
||||||
if !receipt_bill[0].nil?
|
|
||||||
@receipt_bill = receipt_bill[0][1]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@@ -23,6 +19,7 @@ class Origami::OrderReservationController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
remark = params[:remark]
|
remark = params[:remark]
|
||||||
access_code = params[:access_code]
|
access_code = params[:access_code]
|
||||||
|
receipt_bill = check_receipt_bill
|
||||||
|
|
||||||
order_reserve = OrderReservation.find_by_transaction_ref(params[:ref_no])
|
order_reserve = OrderReservation.find_by_transaction_ref(params[:ref_no])
|
||||||
if !order_reserve.nil?
|
if !order_reserve.nil?
|
||||||
@@ -45,7 +42,7 @@ class Origami::OrderReservationController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
elsif @status == "completed"
|
elsif @status == "completed"
|
||||||
if order_reserve.status == "ready_to_delivery"
|
if order_reserve.status == "ready_to_delivery"
|
||||||
result = OrderReservation.update_doemal_payment(order_reserve,current_user)
|
result = OrderReservation.update_doemal_payment(order_reserve,current_user,receipt_bill)
|
||||||
else
|
else
|
||||||
Rails.logger.debug "Order reservation :: " + order_reserve.to_json + " :: send status ::" + @status
|
Rails.logger.debug "Order reservation :: " + order_reserve.to_json + " :: send status ::" + @status
|
||||||
result = {status: false, message: 'Could not deliver order!'}
|
result = {status: false, message: 'Could not deliver order!'}
|
||||||
@@ -106,4 +103,19 @@ class Origami::OrderReservationController < BaseOrigamiController
|
|||||||
render :json => order_reservation
|
render :json => order_reservation
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_receipt_bill
|
||||||
|
receipt_bill = Lookup.collection_of("order_reservation")
|
||||||
|
|
||||||
|
status = 0
|
||||||
|
if !receipt_bill.nil?
|
||||||
|
receipt_bill.each do |receipt|
|
||||||
|
if receipt[0].strip.downcase == "receiptbill"
|
||||||
|
status = receipt[1].to_i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return status
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ class OrderReservation < ApplicationRecord
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.update_doemal_payment(order,current_user)
|
def self.update_doemal_payment(order,current_user,receipt_bill)
|
||||||
if(Sale.exists?(order.sale_id))
|
if(Sale.exists?(order.sale_id))
|
||||||
saleObj = Sale.find(order.sale_id)
|
saleObj = Sale.find(order.sale_id)
|
||||||
shop_details = Shop.first
|
shop_details = Shop.first
|
||||||
@@ -175,8 +175,30 @@ class OrderReservation < ApplicationRecord
|
|||||||
#order reservation status updated
|
#order reservation status updated
|
||||||
update_order_reservation(order.id, saleObj.sale_id, DELIVERED)
|
update_order_reservation(order.id, saleObj.sale_id, DELIVERED)
|
||||||
|
|
||||||
result = {:status=> true, :message => DELIVERED }
|
if receipt_bill == 1
|
||||||
return result
|
#receipt bill pdf setting
|
||||||
|
# get printer info
|
||||||
|
unique_code = "ReceiptBillOrderPdf"
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
# Calculate Food and Beverage Total
|
||||||
|
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||||
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
other_amount = SaleItem.calculate_other_charges(sale_items)
|
||||||
|
|
||||||
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data,other_amount,latest_order_no,card_balance_amount)
|
||||||
|
#receipt bill pdf setting
|
||||||
|
|
||||||
|
result = {:status=> true,
|
||||||
|
:filepath => filename,
|
||||||
|
:receipt_no => sale_receipt_no,
|
||||||
|
:printer_model => print_settings.brand_name,
|
||||||
|
:printer_url => print_settings.api_settings ,
|
||||||
|
:message => DELIVERED }
|
||||||
|
else
|
||||||
|
result = {:status=> true, :message => DELIVERED }
|
||||||
|
end
|
||||||
|
return result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -651,3 +651,32 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- pdf light box -->
|
||||||
|
<div class="modal fade" id="receciptpdfModal" tabindex="-1" role="dialog" >
|
||||||
|
<div class="modal-dialog modal-md " role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h6 class="modal-title">
|
||||||
|
<span id="receiptpdfModalLabel"></span>
|
||||||
|
<span id="changed_amount" class="p-l-120"></span>
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" style="height: 400px;">
|
||||||
|
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
|
||||||
|
<input type="hidden" name="filename" id="filename">
|
||||||
|
<input type="hidden" name="printer_name" id="printer_name">
|
||||||
|
<div class="text-center">
|
||||||
|
<iframe id="receipt_pdf" src="" class="pdf-iframe" scrolling="no"></iframe>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="mr-2 m-t-5 btn-lg btn-block bg-red waves-effect print_receipt" id="print_receipt"> Print
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
|
||||||
|
CLOSE
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user