Invoices summary by client and year

[#if salesreport.dateIntervalStart??] [#if salesreport.dateIntervalEnd??] ${salesreport.dateIntervalStart?date} - ${salesreport.dateIntervalEnd?date} [#else] After ${salesreport.dateIntervalStart?date} [/#if] [#else] [#if salesreport.dateIntervalEnd??] Before ${salesreport.dateIntervalEnd?date} [#else] All dates [/#if] [/#if]



[#if salesreport.invoices?size == 0]

There is no data available for the selected report settings.

[#else]

[#assign allInvoices=salesreport.invoices]

[#assign years=salesreport.groupDatesByYear(allInvoices)]

[#assign clients=salesreport.groupClients(allInvoices)]

Client

[#list years?sort as year]

${year}

[/#list]

Total

[#list clients?sort as client]

${client.name}[#assign clientInvoices=salesreport.filterByClient(allInvoices, client)]

[#list years?sort as year]

[#assign clientYearInvoices=salesreport.filterByDate(clientInvoices, year.toInterval())]${salesreport.calculateTotal(clientYearInvoices)}

[/#list]

${salesreport.calculateTotal(clientInvoices)}

[/#list]

Total

[#list years?sort as year]

[#assign yearInvoices=salesreport.filterByDate(allInvoices, year.toInterval())]${salesreport.calculateTotal(yearInvoices)}

[/#list]

${salesreport.calculateTotal(allInvoices)}

[/#if]