mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
78 lines
3.1 KiB
Plaintext
78 lines
3.1 KiB
Plaintext
!!! Basic
|
|
%html
|
|
%head
|
|
<meta content="text/html;charset=ansi" http-equiv="Content-Type">
|
|
= javascript_include_tag "shared/jquery-1.8.0.js"
|
|
= javascript_include_tag "qz/qz-tray.js"
|
|
= javascript_include_tag "qz/sha-256.min.js"
|
|
= javascript_include_tag "qz/rsvp-3.1.0.min.js"
|
|
= javascript_include_tag "qz/jsrsasign-latest-all-min.js"
|
|
:javascript
|
|
var printData = [
|
|
'\x1B' + '\x40', // init
|
|
'\x1B' + '\x74' + '\x10',
|
|
'\x1B' + '\x61' + '\x31', // center align
|
|
'\x1B' + '\x21' + '\x30', // em mode on
|
|
'#{j(@order.distributor.name)}' + '\x0A',
|
|
'\x1B' + '\x21' + '\x0A' + '\x1B' + '\x45' + '\x0A', // em mode off
|
|
'\x0A',
|
|
'#{j(@order.distributor.address.address_part1)}' + '\x0A', // text and line break
|
|
'#{j(@order.distributor.address.address_part2)}' + '\x0A',
|
|
'#{j(@order.distributor.contact.email)}' + '\x0A',
|
|
'\x0A', // line break
|
|
'\x1B' + '\x61' + '\x32', // right align
|
|
'#{j(l(Time.zone.now.to_date))}' + '\x0A',
|
|
'#{j(@order.number)}' + '\x0A',
|
|
'\x1B' + '\x61' + '\x30', // left align
|
|
'\x0A',
|
|
'\x1B' + '\x4D' + '\x31', // small text
|
|
"#{'%6s %-26s%10s%10s' %
|
|
[j(t(:ticket_column_qty)),
|
|
j(t(:ticket_column_item)),
|
|
j(t(:ticket_column_unit_price)),
|
|
j(t(:ticket_column_total_price))]}",
|
|
'\x0A',
|
|
'\x1B' + '\x4D' + '\x30', // normal text
|
|
'__________________________________________' + '\x0A',
|
|
"#{@order.line_items
|
|
.sort_by{ |line_item| line_item.product.name }
|
|
.map { |line_item| '%5d %-19.19s%8.8s%8.8s' %
|
|
[line_item.quantity,
|
|
j(line_item.product.name),
|
|
j(line_item.single_display_amount_with_adjustments.format(symbol: false, with_currency: false)),
|
|
j(line_item.display_amount_with_adjustments.format(symbol: false, with_currency: false))] }
|
|
.join('" + \'\x0A\' + "')}",
|
|
'\x0A',
|
|
"#{checkout_adjustments_for(@order, exclude: [:line_item])
|
|
.reject{ |a| a.amount == 0 }
|
|
.reverse.map { |adjustment| '%5s %-27.27s%8.8s' %
|
|
["",
|
|
j(raw(adjustment.label)),
|
|
j(display_adjustment_amount(adjustment).format(symbol: false, with_currency: false))] +
|
|
'" + \'\x0A\' + "'}.join }",
|
|
'__________________________________________' + '\x0A',
|
|
'\x0A',
|
|
'\x1B' + '\x45' + '\x0D', // bold on
|
|
"#{'%31s%10s' %
|
|
[j(t(:total_incl_tax)),
|
|
j(@order.display_total.format(with_currency: false))]}",
|
|
'\x1B' + '\x45' + '\x0A', // bold off
|
|
'\x0A',
|
|
"#{display_checkout_taxes_hash(@order).map { |tax_rate, tax_value|
|
|
'%31s%10s' %
|
|
[j(t(:tax_total, rate: tax_rate)),
|
|
j(tax_value.format(with_currency: false))] +
|
|
'" + \'\x0A\' + "'}.join }",
|
|
"#{'%31s%10s' %
|
|
[j(t(:total_excl_tax)),
|
|
j(display_checkout_total_less_tax(@order).format(with_currency: false))]}",
|
|
'\x0A',
|
|
'\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A',
|
|
'\x1B' + '\x69', // cut paper
|
|
];
|
|
= javascript_include_tag "qz/ticket-popup.js"
|
|
%body
|
|
%div#printer-list
|
|
|
|
|