Invoices summary by client and month

[#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 months=salesreport.groupDatesByMonth(allInvoices)]

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

Client

[#list months?sort as month]

${month.toString("MMM yyyy")}

[/#list]

Total

[#list clients?sort as client]

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

[#list months?sort as month]

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

[/#list]

${salesreport.calculateTotal(clientInvoices)}

[/#list]

Total

[#list months?sort as month]

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

[/#list]

${salesreport.calculateTotal(allInvoices)}

[/#if]