order reservation receipt bill"
This commit is contained in:
@@ -184,6 +184,7 @@ class OrderReservation < ApplicationRecord
|
||||
shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
shop_detail = Shop.first
|
||||
order_reservation = OrderReservation.get_order_reservation_info(saleObj.sale_id)
|
||||
if !cashier_terminal.nil?
|
||||
# Calculate Food and Beverage Total
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||
@@ -191,13 +192,14 @@ class OrderReservation < ApplicationRecord
|
||||
other_amount = SaleItem.calculate_other_charges(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,saleObj.customer.name, item_price_by_accounts, discount_price_by_accounts, nil,nil,shop_detail, "Paid",nil,nil,other_amount,nil,nil)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,saleObj.customer.name, item_price_by_accounts, discount_price_by_accounts, nil,nil,shop_detail, "Paid",nil,nil,other_amount,nil,nil, order_reservation)
|
||||
#receipt bill pdf setting
|
||||
|
||||
result = {:status=> true,
|
||||
:filepath => filename,
|
||||
:sale_id => saleObj.sale_id,
|
||||
:receipt_no => sale_receipt_no,
|
||||
:printer_name => printer_name,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings ,
|
||||
:message => DELIVERED }
|
||||
@@ -494,6 +496,14 @@ class OrderReservation < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
#Create get_data for order_reservation
|
||||
def self.get_order_reservation_info(sale_id)
|
||||
query=OrderReservation.select("order_reservations.* ,deliveries.delivery_type,deliveries.delivery_fee")
|
||||
.joins("join deliveries on deliveries.order_reservation_id = order_reservations.order_reservation_id")
|
||||
.where("order_reservations.sale_id = '#{sale_id}'").first()
|
||||
return query
|
||||
end
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS")
|
||||
|
||||
Reference in New Issue
Block a user