Skip to content

Instantly share code, notes, and snippets.

@8vius
Created September 28, 2018 16:52
Show Gist options
  • Save 8vius/494bdf27613ad6ea043fbb0a21c27246 to your computer and use it in GitHub Desktop.
Save 8vius/494bdf27613ad6ea043fbb0a21c27246 to your computer and use it in GitHub Desktop.
%h5 INVOICE REGISTER
%table.report.unlined(style="font-size: 7pt; margin-bottom: 0")
%thead
%tr.bb-1(style="page-break-inside: avoid;")
%th.text-center(style="width:2% !important") No.
%th.text-center(style="width:18% !important") Vendor
%th.text-center(style="width:15% !important") Invoice Number
%th.text-center(style="width:13% !important") Invoice Date
%th.text-center(style="width:12% !important") Payment Status
%th.text-center(style="width:25% !important") Account Code
%th.text-center(style="width:15% !important") Amount
- report.rows.group_by(&:row_number).each do |row_number, codes|
%tbody
%tr(style="height: 10px; border-bottom: 2px solid silver; page-break-inside: avoid;")
%tr(style="page-break-inside: avoid;")
%td(style="width:6% !important") #{row_number}
%td(style="width:16% !important") #{codes.first.vendor}
%td(style="width:10% !important") #{codes.first.invoice_number}
%td(style="width:10% !important") #{codes.first.invoice_date}
%td(style="width:10% !important") #{codes.first.payment_status}
%td
%td.bb-1.money(style="width:8% !important")= number_to_currency(Money.new(codes.sum(&:amount_cents)))
- codes.each do |code|
%tr(style="page-break-inside: avoid;")
%td(colspan=5)
%td.left.lightshade(style="width:24% !important")
#{code.code} - #{code.label}
%td.money.lightshade(style="width:10% !important")
= number_to_currency(Money.new(code.amount_cents))
%tbody.project-total
%tr.double-top(style="page-break-inside: avoid;")
%th(colspan=5)
%th(style="width: 24%") TOTAL Draw #{report.rows.first.draw_number} Amount
%th.money(style="width:10% !important")= number_to_currency(Money.new(report.rows.sum(&:amount_cents)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment