receipt bill sale payments action cable

This commit is contained in:
Thein Lin Kyaw
2020-08-24 11:42:44 +06:30
parent b3ab999962
commit c8b0471794
2 changed files with 40 additions and 36 deletions

View File

@@ -126,6 +126,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
Rails.logger.debug "############## filename::" + filename
else
if !Lookup.where(lookup_type: "ReceiptPdfView").pluck(:value).include?('1')
sale_payments = SalePayment
.select(:payment_method, 'SUM(`sale_payments`.`payment_amount`) AS `payment_amount`')
.where(sale_id: sale_data.sale_id).group(:payment_method)
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
queue: cashier_terminal.printer_name,
unique_code: print_settings.unique_code,
@@ -148,7 +152,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
card_balance_amount: card_balance_amount,
discount_price_by_accounts: discount_price_by_accounts,
item_price_by_accounts: item_price_by_accounts,
sale_payments: sale_data.sale_payments
sale_payments: sale_payments.as_json
},
footer: {
printed_status: printed_status, footer_text: "Thank You! See you Again"