<#-- This is a meta-template that is used to generate invoice templates. --> ${invoiceTitle} ${'$'}{invoice.number} <#if showPageBackground>

${invoiceTitle}

${invoiceHeader}
<@showInvoiceHeader/> <@showInvoiceItemsByProject/> <#if showSubtotalInvoice> <@showInvoiceSubtotal/> <#if showSubtotalTax> <@showInvoiceTaxes/> <#if showSubtotalTaxes> <@showInvoiceTaxesSubtotal/> <#if showTotalInvoice> <@showInvoiceTotal/> <#if showSubtotalPayments> <@showSubtotalPaymentsMacro/> <#if showSubtotalPayment> <@showSubtotalPaymentMacro/> <#if showInvoiceBalance> <@showInvoiceBalanceMacro/>
[#if invoice.taxable]
[/#if]
<#if showPaidStamp>

[#if invoice.paid]

[/#if]

<#if showClientStatement> <@showClientStatementMacro/>
<#macro showClientStatementMacro>

[#if client.openInvoices?size != 0]

${clientStatementHeader} <#if showClientStatementColumnNumber> <#if showClientStatementColumnDate> <#if showClientStatementColumnDueDate> <#if showClientStatementColumnAge> <#if showClientStatementColumnGrandTotal> <#if showClientStatementColumnPayments> <#if showClientStatementColumnBalance> <#if showClientStatementColumnNumber> <#if showClientStatementColumnDate> <#if showClientStatementColumnDueDate> <#if showClientStatementColumnAge> <#if showClientStatementColumnGrandTotal> <#if showClientStatementColumnPayments> <#if showClientStatementColumnBalance> <#if showClientStatementColumnNumber>
${clientStatementColumnNumber} ${clientStatementColumnDate} ${clientStatementColumnDueDate} ${clientStatementColumnAge} ${clientStatementColumnGrandTotal} ${clientStatementColumnPayments} ${clientStatementColumnBalance}
[#list client.openInvoices?sort_by("ageInDays") as invoice]
${'$'}{invoice.number} ${'$'}{invoice.date?date?string.short} ${'$'}{invoice.dueDate?date?string.short} ${'$'}{invoice.ageInDays?string("#0")} ${'$'}{invoice.grandTotal} ${'$'}{invoice.paymentsTotal} ${'$'}{invoice.balance}
[/#list]
<#if showClientStatementColumnDate> <#if showClientStatementColumnDueDate> <#if showClientStatementColumnAge> <#if showClientStatementColumnGrandTotal> <#if showClientStatementColumnPayments> <#if showClientStatementColumnBalance> ${'$'}{client.balance}
${clientStatementFooter}

[/#if]

<#macro showSubtotalPaymentMacro> [#list invoice.payments?sort_by("date") as payment] <#if showColumnDate>

${'$'}{payment.date?date?string.short}

<#if showColumnCatalogItem> <#if showColumnTime> <#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax] [/#list] <#if showColumnTotal>

${'$'}{payment.amount}

[/#list] <#macro showSubtotalPaymentsMacro>

${subtotalPaymentsName}

<#if showColumnCatalogItem> <#if showColumnTime> <#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax] [/#list] <#if showColumnTotal>

${'$'}{invoice.paymentsTotal}

<#macro showInvoiceBalanceMacro>

${invoiceBalanceName}

<#if showColumnCatalogItem> <#if showColumnTime> <#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax] [/#list] <#if showColumnTotal>

${'$'}{invoice.balance}

<#macro showInvoiceTaxesSubtotal>

${subtotalTaxesName}

<#if showColumnCatalogItem> <#if showColumnTime> <#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax] [/#list] <#if showColumnTotal>

${'$'}{invoice.taxesTotal}

<#macro showInvoiceTaxes> [#list invoice.taxes?sort_by("name") as tax]

${'$'}{tax.name} <#if showInvoiceTaxRate>${'$'}{tax.defaultRate}

<#if showColumnCatalogItem> <#if showColumnTime> <#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax] [/#list] <#if showColumnTotal>

${'$'}{invoice.taxTotal(tax)}

[/#list] <#macro showInvoiceTotal>

${totalInvoiceName}

<#if showColumnCatalogItem> <#if showColumnTime> <#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax] [/#list] <#if showColumnTotal>

${'$'}{invoice.grandTotal}

<#macro showInvoiceHeader> <#if showColumnDate>

${columnDate}

${columnName}

<#if showColumnCatalogItem>

${columnCatalogItem}

<#if showColumnTime>

${columnTime}

<#if showColumnQuantity>

${columnQuantity}

<#if showColumnMeasure>

${columnMeasure}

<#if showColumnPrice>

${columnPrice}

<#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax]

${'$'}{tax.name} <#if showItemTaxRate>${'$'}{tax.defaultRate}

[/#list] <#if showColumnTotal>

${columnTotal}

<#macro showProducts products> <#if showProductsHeader>

${productsHeaderName}

[#list ${products}?sort_by("date") as product] <#if showColumnDate>

${'$'}{product.date?date?string.short}

${'$'}{product.name}

<#if showItemDescription>

${'$'}{product.description}

<#if showColumnCatalogItem>

${'$'}{product.catalogItem!"-"}

<#if showColumnTime>

-

<#if showColumnQuantity>

${'$'}{product.quantity}

[#if product.quantityDiscounted]

${'$'}{product.regularQuantity}

[/#if]

<#if showColumnMeasure>

${'$'}{product.unitOfMeasure}

<#if showColumnPrice>

${'$'}{product.price}

[#if product.priceDiscounted]

${'$'}{product.regularPrice}

[/#if]

<#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax]

${'$'}{invoice.taxTotal(tax, product)}

[/#list] <#if showColumnTotal>

${'$'}{product.total}

[/#list] <#macro showExpenses expenses> <#if showExpensesHeader>

${expensesHeaderName}

[#list ${expenses}?sort_by("date") as expense] <#if showColumnDate>

${'$'}{expense.date?date?string.short}

${'$'}{expense.name}

<#if showItemDescription>

${'$'}{expense.description}

<#if showColumnCatalogItem>

${'$'}{expense.catalogItem!"-"}

<#if showColumnTime>

-

<#if showColumnQuantity>

${'$'}{expense.quantity}

<#if showColumnMeasure>

${'$'}{expense.unitOfMeasure}

<#if showColumnPrice>

${'$'}{expense.price}

<#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax]

${'$'}{invoice.taxTotal(tax, expense)}

[/#list] <#if showColumnTotal>

${'$'}{expense.total}

[/#list] <#macro showServices services> <#if showServicesHeader>

${servicesHeaderName}

[#list ${services}?sort_by("date") as service] <#if showColumnDate>

${'$'}{service.date?date?string.short}

${'$'}{service.name}

<#if showItemDescription>

${'$'}{service.description}

<#if showColumnCatalogItem>

${'$'}{service.catalogItem!"-"}

<#if showColumnTime>

<#if useDecimalTimeFormat>${'$'}{service.billableTimeAsDecimal}<#else>${'$'}{service.billableTimeAsHour}

<#if showColumnQuantity>

${'$'}{service.quantity}

[#if service.quantityDiscounted]

${'$'}{service.regularQuantity}

[/#if]

<#if showColumnMeasure>

${'$'}{service.unitOfMeasure}

<#if showColumnPrice>

${'$'}{service.price}

[#if service.priceDiscounted]

${'$'}{service.regularPrice}

[/#if]

<#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax]

${'$'}{invoice.taxTotal(tax, service)}

[/#list] <#if showColumnTotal>

${'$'}{service.total}

<#if showServiceTime && showColumnTime> <#if groupServiceTimeByDate> <@showServiceTimeByDate service="service"/> <#else> <@showServiceTimeMacro service="service"/> [/#list] <#macro showServiceTimeMacro service> [#list ${service}.timeEntries?sort_by("date") as timeEntry] <#if showColumnDate>

${'$'}{timeEntry.description}

<#if showColumnCatalogItem> <#if showColumnTime>

${'$'}{timeEntry.date?string("MMM dd")} - <#if useDecimalTimeFormat>${'$'}{timeEntry.elapsedTimeAsDecimal}<#else>${'$'}{timeEntry.elapsedTimeAsHour}

<#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes as tax] [/#list] <#if showColumnTotal> [/#list] <#macro showServiceTimeByDate service> [#list ${service}.timeEntriesByDate?sort_by("date") as timeEntry] <#if showColumnDate> <#if showColumnCatalogItem> <#if showColumnTime>

${'$'}{timeEntry.date?string("MMM dd")} - <#if useDecimalTimeFormat>${'$'}{timeEntry.elapsedTimeAsDecimal}<#else>${'$'}{timeEntry.elapsedTimeAsHour}

<#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes as tax] [/#list] <#if showColumnTotal> [/#list] <#macro showInvoiceSubtotal>

${subtotalInvoiceName}

<#if showColumnCatalogItem> <#if showColumnTime>

<#if useDecimalTimeFormat>${'$'}{invoice.billableTimeAsDecimal}<#else>${'$'}{invoice.billableTimeAsHour}

<#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax]

${'$'}{invoice.taxTotal(tax)}

[/#list] <#if showColumnTotal>

${'$'}{invoice.total}

[#if invoice.totalDiscounted]

${'$'}{invoice.regularTotal}

[/#if]

<#macro showInvoiceItemsByProject> [#list invoice.projects?sort_by("name") as project]

${'$'}{project.name}

[#if project.services?size != 0] <@showServices services="project.services"/> <#if showSubtotalServices> <#if showColumnDate> <#if showColumnCatalogItem> <#if showColumnTime> <#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax] [/#list] <#if showColumnTotal>

${'$'}{project.servicesSubtotal}

[/#if] [#if project.products?size != 0] <@showProducts products="project.products"/> <#if showSubtotalProducts> <#if showColumnDate> <#if showColumnCatalogItem> <#if showColumnTime> <#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax] [/#list] <#if showColumnTotal>

${'$'}{project.productsSubtotal}

[/#if] [#if project.expenses?size != 0] <@showExpenses expenses="project.expenses"/> <#if showSubtotalExpenses> <#if showColumnDate> <#if showColumnCatalogItem> <#if showColumnTime> <#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes?sort_by("name") as tax] [/#list] <#if showColumnTotal>

${'$'}{project.expensesSubtotal}

[/#if] <#if showSubtotalProject> [#if invoice.projects?size != 1] <#if showColumnDate> <#if showColumnCatalogItem> <#if showColumnTime>

<#if useDecimalTimeFormat>${'$'}{project.billableTimeAsDecimal}<#else>${'$'}{project.billableTimeAsHour}

<#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes as tax] [/#list] <#if showColumnTotal>

${'$'}{project.total}

[/#if] [/#list]