Mapa de IVA
[% IF sales_vat.vats.keys.size > 0 -%]
----------------------------------------
             [% i18n("MAPA DE IVA") %]
----------------------------------------
[% IF sales_vat.received.vats.keys.size > 0 -%]
[% i18n("RECEBIDO") %]
========
[% i18n("TAXA") %]         [% i18n("BASE") %]        [% i18n("IVA") %]       [% i18n("TOTAL") %]
[% FOREACH vat IN sales_vat.received.vats.keys.nsort -%]
[% vat | format("%.2f") | format("%6s") %]    [% sales_vat.received.vats.$vat.total_wo_vat | format("%.2f") | format("%8s") %]  [% sales_vat.received.vats.$vat.total_vat | format("%.2f") | format("%8s") %]   [% sales_vat.received.vats.$vat.total | format("%.2f") | format("%9s") %]
[% END -%]
[% IF sales_vat.received.vats.keys.size > 1 -%]

[% i18n("TOTAL") %]     [% sales_vat.received.total_wo_vat | format("%.2f") | format("%8s") %]  [% sales_vat.received.total_vat | format("%.2f") | format("%8s") %]   [% sales_vat.received.total | format("%.2f") | format("%9s") %]
[% END -%]
[% END -%]
[% IF sales_vat.payed.vats.keys.size > 0 -%]

[% i18n("PAGO") %]
====
[% i18n("TAXA") %]         [% i18n("BASE") %]        [% i18n("IVA") %]       [% i18n("TOTAL") %]
[% FOREACH vat IN sales_vat.payed.vats.keys.nsort -%]
[% vat | format("%.2f") | format("%6s") %]    [% sales_vat.payed.vats.$vat.total_wo_vat | format("%.2f") | format("%8s") %]  [% sales_vat.payed.vats.$vat.total_vat | format("%.2f") | format("%8s") %]   [% sales_vat.payed.vats.$vat.total | format("%.2f") | format("%9s") %]
[% END -%]
[% IF sales_vat.payed.vats.keys.size > 1 -%]

[% i18n("TOTAL") %]     [% sales_vat.payed.total_wo_vat | format("%.2f") | format("%8s") %]  [% sales_vat.payed.total_vat | format("%.2f") | format("%8s") %]   [% sales_vat.payed.total | format("%.2f") | format("%9s") %]
[% END -%]
[% END -%]

[% i18n("IVA A ENTREGAR") %][% sales_vat.received.total_vat - sales_vat.payed.total_vat | format("%.2f") | format("%14s") %]
[% END -%]
[% IF manual_docs.keys.size > 0 -%]

----------------------------------------
          [% i18n("DOCUMENTOS MANUAIS") %]
----------------------------------------
[% doc_totals = 0 -%]
[% doc_vats = 0 -%]
[% FOREACH date IN manual_docs.dates.keys.sort -%]
[% i18n("LANÇADOS EM") %]: [% date %]

[% i18n("DATA") | format("%-10s") %]|[% i18n("C/ IVA") | format("%-7s") %]|[% i18n("IVA") | format("%-7s") %]| [% i18n("DOCUMENTO") %]
----------'-------'-------'-------------
[% FOREACH doc IN manual_docs.dates.$date.docs.keys.sort -%]
[% doc_total = 0 -%]
[% doc_total_wo_vat = 0 -%]
[% vat_total = 0 -%]
[% IF manual_docs.dates.$date.docs.$doc.manualdoc_type == 'recover' -%]
[% doc_total = manual_docs.dates.$date.docs.$doc.total -%]
[% vat_total = manual_docs.dates.$date.docs.$doc.total - manual_docs.dates.$date.docs.$doc.total_wo_vat -%]
[% ELSE -%]
[% doc_total = manual_docs.dates.$date.docs.$doc.manualdoc_total_w_vat -%]
[% vat_total = manual_docs.dates.$date.docs.$doc.manualdoc_total_vat -%]
[% END -%]
[% doc_totals = doc_totals + doc_total -%]
[% doc_vats = doc_vats + vat_total -%]
[% doc_total_wo_vat = doc_total_wo_vat + (doc_totals - doc_vats) -%]
[% manual_docs.dates.$date.docs.$doc.manualdoc_date %]|[% doc_total | format("%.2f") | format("%7s") %]|[% vat_total | format("%.2f") | format("%7s") %]| [% manual_docs.dates.$date.docs.$doc.manualdoc_serie %]/[% manual_docs.dates.$date.docs.$doc.manualdoc_docnum %]
[% END -%]

[% END -%]
          |[% i18n("C/ IVA") | format("%-7s") %]|[% i18n("IVA") | format("%-7s") %]| [% i18n("S/ IVA") | format("%-7s") %]
----------'-------'-------'-------------
TOTAL     '[% doc_totals | format("%.2f") | format("%7s") %]'[% doc_vats | format("%.2f") | format("%7s") %]'[% doc_total_wo_vat | format("%.2f") | format("%7s") %]
[% END -%]
