Northridge Pharmaceuticals
Customer Sales Summary — Top customers by sales
Report generated: ${now?string("yyyy-MM-dd HH:mm:ss")}
<#-- compute totals first (numeric summation) --> <#assign total_sales = 0.0> <#assign total_rows = 0> <#if reportData?exists> <#list reportData as r> <#assign total_sales = total_sales + (r.TotalSales?number?default(0)) /> <#assign total_rows = total_rows + 1 />

Customer ID | Company Name | Orders | Total Sales (USD) | Avg Order Value (USD)
--- | --- | --- | --- | ---
<#if reportData?exists && reportData?size == 0>
No data available for the selected period.
<#elseif reportData?exists> <#list reportData as row>
${row.CustomerID?html} | ${row.CompanyName?html} | ${(row.OrdersCount?number?default(0))?string["0"]} | ${(row.TotalSales?number?default(0))?string["#,##0.00"]} | ${(row.AvgOrderValue?number?default(0))?string["#,##0.00"]}
<#else>
No data available (reportData missing).
Top customers shown: ${ total_rows?string["0"] } |  | ${ (total_sales)?string["#,##0.00"] } |

Notes:

- Numbers are formatted with pattern "#,##0.00" and emitted as text cells so the exporter will display them exactly.
- If you want true numeric Excel cells, remove data-text-cell="true" and emit raw numbers (e.g. row.TotalSales?number) while keeping data-numeric-cell-format for display.