fixed print serviceaction cable
This commit is contained in:
@@ -38,7 +38,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
||||
# self.print(filename, cashier_terminal.printer_name)
|
||||
# end
|
||||
|
||||
def print_close_cashier(printer_settings,cashier_terminal,shift_sale, sale_items, total_other_charges_info,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,payment_methods)
|
||||
def print_close_cashier(printer_settings,cashier_terminal,shift_sale, sale_items, total_other_charges_info,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile,total_credit_payments,payment_methods,other_charges)
|
||||
|
||||
if !sale_items.blank? or !sale_items.nil?
|
||||
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||
@@ -74,10 +74,32 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, cashier_terminal.printer_name)
|
||||
else
|
||||
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
|
||||
queue: "Cashier",
|
||||
unique_code: print_settings.unique_code,
|
||||
print_copies: print_settings.print_copies,
|
||||
data: {
|
||||
shop_details: shop_details.as_json,
|
||||
shift_sale: shift_sale,
|
||||
cashier_terminal: cashier_terminal,
|
||||
shift_employee: shift_sale.employee,
|
||||
sale_items: sale_items,
|
||||
sale_taxes: sale_taxes,
|
||||
other_payment: other_payment,
|
||||
total_amount_by_account: amount,
|
||||
total_discount_by_account: discount,
|
||||
total_member_discount: member_discount,
|
||||
total_waste: total_waste,
|
||||
total_spoile: total_spoile,
|
||||
other_charges: other_charges,
|
||||
total_other_charges: total_other_charges,
|
||||
total_credit_payments: total_credit_payments
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -86,7 +108,18 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
||||
|
||||
if print_settings.unique_code == "SaleItemsPdf"
|
||||
pdf = SaleItemsPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges)
|
||||
end
|
||||
|
||||
if print_settings.unique_code == "SaleItemsStarPdf"
|
||||
pdf = SaleItemsStarPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges)
|
||||
end
|
||||
|
||||
pdf.render_file filename
|
||||
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, print_settings.printer_name)
|
||||
else
|
||||
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
|
||||
queue: 'Cashier',
|
||||
unique_code: print_settings.unique_code,
|
||||
@@ -105,18 +138,6 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
||||
},
|
||||
}
|
||||
)
|
||||
puts 'Printing!!!!'
|
||||
end
|
||||
if print_settings.unique_code == "SaleItemsStarPdf"
|
||||
pdf = SaleItemsStarPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, total_other_charges)
|
||||
puts 'PrintingStar!!!!'
|
||||
end
|
||||
|
||||
pdf.render_file filename
|
||||
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, print_settings.printer_name)
|
||||
end
|
||||
end
|
||||
#sqa
|
||||
|
||||
@@ -15,18 +15,6 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
pdf = print_settings.unique_code.constantize.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||
booking_id = Booking.get_booking_id(order_id)
|
||||
# end
|
||||
puts "print_channel_#{Shop.current_shop.shop_code}"
|
||||
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
|
||||
queue: oqs.station_name,
|
||||
unique_code: print_settings.unique_code,
|
||||
print_copies: print_settings.print_copies,
|
||||
data: {
|
||||
order_item: order_item[0].as_json(methods: :type),
|
||||
print_status: print_status.gsub(/[()]/, ""),
|
||||
booking_id: booking_id,
|
||||
precision: print_settings.precision
|
||||
}
|
||||
)
|
||||
|
||||
shop = Shop.current_shop
|
||||
directory_name = 'public/orders_'+shop.shop_code
|
||||
@@ -38,6 +26,18 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
else
|
||||
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
|
||||
queue: oqs.station_name,
|
||||
unique_code: print_settings.unique_code,
|
||||
print_copies: print_settings.print_copies,
|
||||
data: {
|
||||
order_item: order_item[0].as_json(methods: :type),
|
||||
print_status: print_status.gsub(/[()]/, ""),
|
||||
booking_id: booking_id,
|
||||
precision: print_settings.precision
|
||||
}
|
||||
)
|
||||
end
|
||||
#For print copy
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
@@ -87,6 +87,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
end
|
||||
# For Print Order Summary
|
||||
else
|
||||
booking_id = Booking.get_booking_id(order_id) #order[0].order_id
|
||||
order = print_query('order_summary', order_id)
|
||||
|
||||
filename = directory_name + "/order_summary_#{order_id}.pdf"
|
||||
@@ -97,21 +98,20 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
else
|
||||
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
|
||||
queue: oqs.station_name,
|
||||
unique_code: print_settings.unique_code,
|
||||
print_copies: print_settings.print_copies,
|
||||
data: {
|
||||
order_item: order_items,
|
||||
order: order.as_json(methods: :type),
|
||||
print_status: "",
|
||||
booking_id: booking_id,
|
||||
precision: print_settings.precision}
|
||||
)
|
||||
end
|
||||
booking_id = Booking.get_booking_id(order_id) #order[0].order_id
|
||||
puts "printing>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
|
||||
puts "print_channel_#{Shop.current_shop.shop_code}"
|
||||
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
|
||||
queue: oqs.station_name,
|
||||
unique_code: print_settings.unique_code,
|
||||
print_copies: print_settings.print_copies,
|
||||
data: {
|
||||
order_item: order_items,
|
||||
order: order.as_json(methods: :type),
|
||||
print_status: "",
|
||||
booking_id: booking_id,
|
||||
precision: print_settings.precision}
|
||||
)
|
||||
|
||||
#For print copy
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
|
||||
@@ -106,6 +106,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
pdf = ReceiptBillOrderPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,other_amount,latest_order_no,card_balance_amount,order_reservation)
|
||||
end
|
||||
|
||||
if ENV["SERVER_MODE"] == "cloud"
|
||||
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
|
||||
queue: "Cashier",
|
||||
unique_code: print_settings.unique_code,
|
||||
@@ -133,6 +134,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
footer: { printed_status: printed_status, footer_text: "Thank You! See you Again" }
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
# print as print copies in printer setting
|
||||
count = printer_settings.print_copies
|
||||
@@ -199,18 +201,19 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
|
||||
pdf = MoveTablePdf.new(printer_settings,to,from,shop_detail,date,type,moved_by,order_items)
|
||||
pdf.render_file "tmp/print_move_table.pdf"
|
||||
|
||||
if oqs.print_copy
|
||||
self.print("tmp/print_move_table.pdf",oqs.printer_name)
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
if oqs.print_copy
|
||||
self.print("tmp/print_move_table.pdf",oqs.printer_name)
|
||||
else
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
#no print in cloud server
|
||||
self.print("tmp/print_move_table.pdf", oqs.printer_name)
|
||||
end
|
||||
else
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
#no print in cloud server
|
||||
self.print("tmp/print_move_table.pdf", oqs.printer_name)
|
||||
end
|
||||
ActionCable.server.broadcast("print_channel_#{Shop.current_shop.shop_code}",
|
||||
queue: oqs.station_name,
|
||||
unique_code: print_settings.unique_code,
|
||||
@@ -226,6 +229,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
},
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
#Bill Receipt Print
|
||||
|
||||
Reference in New Issue
Block a user