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

${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 showDepositsBalance> <@showDepositsBalanceMacro/>
[#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 showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#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 showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#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 showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#if showColumnTotal>

${'$'}{invoice.balance}

<#macro showDepositsBalanceMacro>

${depositsBalanceName}

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

${'$'}{client.depositsBalance}

<#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 showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#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 showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#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 showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#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 showColumnTaxExempt> [#if invoice.taxes?size == 0]

${columnTaxExempt}

[/#if] <#if showColumnTotal>

${columnTotal}

<#macro showRegularItems items> <#if showRegularItemsHeader>

${regularItemsHeaderName}

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

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

${'$'}{item.name}

<#if showItemDescription>

${'$'}{item.description}

<#if showColumnCatalogItem>

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

<#if showColumnTime>

-

<#if showColumnQuantity>

${'$'}{item.quantity}

[#if item.quantityDiscounted]

${'$'}{item.regularQuantity}

[/#if]

<#if showColumnMeasure>

${'$'}{item.unitOfMeasure}

<#if showColumnPrice>

${'$'}{item.price}

[#if item.priceDiscounted]

${'$'}{item.regularPrice}

[/#if]

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

[#if item.taxExempt]

<#if showTaxExempt>

${taxExempt}

<#else>

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

[#else]

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

[/#if]

[/#list] <#if showColumnTaxExempt> [#if invoice.taxes?size == 0] <#if showTaxExempt>

${taxExempt}

<#else> [/#if] <#if showColumnTotal>

${'$'}{item.total}

[/#list] <#macro showProductItems items> <#if showProductsHeader>

${productsHeaderName}

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

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

${'$'}{item.name}

<#if showItemDescription>

${'$'}{item.description}

<#if showColumnCatalogItem>

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

<#if showColumnTime>

-

<#if showColumnQuantity>

${'$'}{item.quantity}

[#if item.quantityDiscounted]

${'$'}{item.regularQuantity}

[/#if]

<#if showColumnMeasure>

${'$'}{item.unitOfMeasure}

<#if showColumnPrice>

${'$'}{item.price}

[#if item.priceDiscounted]

${'$'}{item.regularPrice}

[/#if]

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

[#if item.taxExempt]

<#if showTaxExempt>

${taxExempt}

<#else>

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

[#else]

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

[/#if]

[/#list] <#if showColumnTaxExempt> [#if invoice.taxes?size == 0] <#if showTaxExempt>

${taxExempt}

<#else> [/#if] <#if showColumnTotal>

${'$'}{item.total}

[/#list] <#macro showExpenseItems items> <#if showExpensesHeader>

${expensesHeaderName}

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

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

${'$'}{item.name}

<#if showItemDescription>

${'$'}{item.description}

<#if showColumnCatalogItem>

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

<#if showColumnTime>

-

<#if showColumnQuantity>

${'$'}{item.quantity}

<#if showColumnMeasure>

${'$'}{item.unitOfMeasure}

<#if showColumnPrice>

${'$'}{item.price}

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

[#if item.taxExempt]

<#if showTaxExempt>

${taxExempt}

<#else>

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

[#else]

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

[/#if]

[/#list] <#if showColumnTaxExempt> [#if invoice.taxes?size == 0] <#if showTaxExempt>

${taxExempt}

<#else> [/#if] <#if showColumnTotal>

${'$'}{item.total}

[/#list] <#macro showMileageItems items> <#if showMileageHeader>

${mileageHeaderName}

[#list ${items}?sort_by("name") as item] <#if showColumnDate>

${'$'}{item.name}

<#if showItemDescription>

${'$'}{item.description}

<#if showColumnCatalogItem>

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

<#if showColumnTime>

-

<#if showColumnQuantity>

${'$'}{item.quantity}

<#if showColumnMeasure>

${'$'}{item.unitOfMeasure}

<#if showColumnPrice>

${'$'}{item.price}

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

[#if item.taxExempt]

<#if showTaxExempt>

${taxExempt}

<#else>

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

[#else]

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

[/#if]

[/#list] <#if showColumnTaxExempt> [#if invoice.taxes?size == 0] <#if showTaxExempt>

${taxExempt}

<#else> [/#if] <#if showColumnTotal>

${'$'}{item.total}

<#if showMileageTrips && showColumnQuantity> <@showMileageTripsMacro item="item"/> [/#list] <#macro showMileageTripsMacro item> [#list ${item}.trips?sort_by("startTime") as trip] <#if showColumnDate>

${'$'}{trip.description}

<#if showColumnCatalogItem> <#if showColumnTime> <#if showColumnQuantity>

${'$'}{trip.startTime?string("MMM dd")} - ${'$'}{trip.distance}

<#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes as tax] [/#list] <#if showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#if showColumnTotal> [/#list] <#macro showServiceItems items> <#if showServicesHeader>

${servicesHeaderName}

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

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

${'$'}{item.name}

<#if showItemDescription>

${'$'}{item.description}

<#if showColumnCatalogItem>

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

<#if showColumnTime>

<#if useDecimalTimeFormat>${'$'}{item.billedTimeAsDecimal}<#else>${'$'}{item.billedTimeAsHour}

<#if showColumnQuantity>

${'$'}{item.quantity}

[#if item.quantityDiscounted]

${'$'}{item.regularQuantity}

[/#if]

<#if showColumnMeasure>

${'$'}{item.unitOfMeasure}

<#if showColumnPrice>

${'$'}{item.price}

[#if item.priceDiscounted]

${'$'}{item.regularPrice}

[/#if]

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

[#if item.taxExempt]

<#if showTaxExempt>

${taxExempt}

<#else>

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

[#else]

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

[/#if]

[/#list] <#if showColumnTaxExempt> [#if invoice.taxes?size == 0] <#if showTaxExempt>

${taxExempt}

<#else> [/#if] <#if showColumnTotal>

${'$'}{item.total}

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

${'$'}{timeEntry.description}

<#if showColumnCatalogItem> <#if showColumnTime>

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

<#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes as tax] [/#list] <#if showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#if showColumnTotal> [/#list] <#macro showServiceItemTimeByDate item> [#list invoice.groupDatesByDate(${item}.timeEntries)?sort as date][#assign dateTimeEntries = invoice.filterByDate(${item}.timeEntries, date.toInterval())] <#if showColumnDate>

[#list dateTimeEntries?sort as timeEntry]${'$'}{timeEntry.description} [/#list]

<#if showColumnCatalogItem> <#if showColumnTime>

${'$'}{date.toDate()?string("MMM dd")} - <#if useDecimalTimeFormat>${'$'}{invoice.calculateRoundedElapsedTimeAsDecimal(dateTimeEntries)}<#else>${'$'}{invoice.calculateRoundedElapsedTimeAsHour(dateTimeEntries)}

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

${subtotalInvoiceName}

<#if showColumnCatalogItem> <#if showColumnTime>

<#if useDecimalTimeFormat>${'$'}{invoice.billedTimeAsDecimal}<#else>${'$'}{invoice.billedTimeAsHour}

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

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

[/#list] <#if showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#if showColumnTotal>

${'$'}{invoice.total}

[#if invoice.totalDiscounted]

${'$'}{invoice.regularTotal}

[/#if]

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

${'$'}{project.name}

[#if project.serviceItems?size != 0] <@showServiceItems items="project.serviceItems"/> <#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 showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#if showColumnTotal>

${'$'}{project.serviceItemsSubtotal}

[/#if] [#if project.productItems?size != 0] <@showProductItems items="project.productItems"/> <#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 showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#if showColumnTotal>

${'$'}{project.productItemsSubtotal}

[/#if] [#if project.expenseItems?size != 0] <@showExpenseItems items="project.expenseItems"/> <#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 showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#if showColumnTotal>

${'$'}{project.expenseItemsSubtotal}

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

${'$'}{project.mileageItemsSubtotal}

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

<#if useDecimalTimeFormat>${'$'}{project.billedTimeAsDecimal}<#else>${'$'}{project.billedTimeAsHour}

<#if showColumnQuantity> <#if showColumnMeasure> <#if showColumnPrice> <#if showColumnTax> [#list invoice.taxes as tax] [/#list] <#if showColumnTaxExempt> [#if invoice.taxes?size == 0] [/#if] <#if showColumnTotal>

${'$'}{project.total}

[/#if] [/#list] [#if invoice.regularItems?size != 0] <@showRegularItems items="invoice.regularItems"/> [/#if]