Avenças por Cliente
[% IF settlements_by_customer.customers.size > 0 -%]
----------------------------------------
           [% i18n("AVENÇAS POR CLIENTE") %]
----------------------------------------
  CLIENTE                         VALOR
----------------------------------------
[% FOREACH customer IN settlements_by_customer.customers -%]
[% customer.name.chars(30) %] [% customer.nif.chars(9) %]
[% IF customer.settlements.size > 0 -%]
  [% i18n("Avenças") %]
[% FOREACH set IN customer.settlements -%]
    [% IF set.aux %][% set.aux | format("%28s") %] [% set.settlement | format("%.2f") | format("%7s") %][% ELSE %][% set.settlement | format("%.2f") | format("%36s") %][% END %]
[% END -%]
[% END -%]
[% IF customer.invoices.size > 0 -%]
  [% i18n("Faturas") %]
[% FOREACH inv IN customer.invoices -%]
    [% inv.value | format("%.2f") | format("%7s") %] | [% inv.business_date %] | [% inv.fo_doc_number %]
[% END -%]
    ----------
    [% customer.invoices_total | format("%.2f") | format("%7s") %]
[% END -%]

[% END -%]
                               ---------
                                 [% settlements_by_customer.total | format("%.2f") | format("%7s")  %]
[% END -%]
