receipt bill order podf

This commit is contained in:
phyusin
2018-11-30 11:26:32 +06:30
parent 41657db355
commit f2b48fa02e
4 changed files with 824 additions and 38 deletions

View File

@@ -175,27 +175,35 @@ class OrderReservation < ApplicationRecord
#order reservation status updated
update_order_reservation(order.id, saleObj.sale_id, DELIVERED)
if receipt_bill == 1
#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)
if receipt_bill == 1
#receipt bill pdf setting
# get printer info
unique_code = "ReceiptBillOrderPdf"
print_settings=PrintSetting.find_by_unique_code(unique_code)
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
shift = ShiftSale.find(saleObj.shift_sale_id)
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
shop_detail = Shop.first
if !cashier_terminal.nil?
# 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(saleObj.sale_items)
result = {:status=> true,
:filepath => filename,
:sale_id => saleObj.sale_id,
:receipt_no => sale_receipt_no,
:printer_model => print_settings.brand_name,
:printer_url => print_settings.api_settings ,
:message => DELIVERED }
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)
#receipt bill pdf setting
result = {:status=> true,
:filepath => filename,
:sale_id => saleObj.sale_id,
: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
else
result = {:status=> true, :message => DELIVERED }
end