<#-- This is the meta-template used to generate the actual invoice template. --> [=invoiceTitle] ${invoice.number} <#if showPageBackground> <#if useCharacterEncoding>

[=invoiceTitle]

[=invoiceHeader]
<@showLine td="th" columnDateValue="

[=columnDate]

" columnNameValue="

[=columnName]

" columnCatalogItemValue="

[=columnCatalogItem]

" columnTimeValue="

[=columnTime]

" columnQuantityValue="

[=columnQuantity]

" columnMeasureValue="

[=columnMeasure]

" columnPriceValue="

[=columnPrice]

" columnTaxValue="

[=showItemTaxRate?then('${tax.name} ${tax.defaultRate}', '${tax.name}')]

" columnNonTaxableValue="

[=columnNonTaxable]

" columnTotalValue="

[=columnTotal]

" /> <@showInvoiceItemsByProject/> <#if showSubtotalInvoice> <@showLine class="table-total" colspanName=true columnNameValue="

[=subtotalInvoiceName]

" columnTimeValue="[=useDecimalTimeFormat?then('

[#if invoice.timeEntries?size != 0]${invoice.billableTimeAsDecimal}[/#if]

', '

[#if invoice.timeEntries?size != 0]${invoice.billableTimeAsHour}[/#if]

')]" columnTaxValue="

${invoice.getTaxTotal(tax)}

" columnTotalValue="

${invoice.total}

[#if invoice.totalDiscounted]

${invoice.regularTotal}

[/#if]

" /> <#if showSubtotalTax> <@showLine class="table-total" colspanName=true columnNameValue="[=showInvoiceTaxRate?then('

${tax.name} ${tax.defaultRate}

', '

${tax.name}

')]" columnTotalValue="

${invoice.getTaxTotal(tax)}

" /> <#if showSubtotalTaxes> <@showLine class="table-total" colspanName=true columnNameValue="

[=subtotalTaxesName]

" columnTotalValue="

${invoice.taxesTotal}

" /> <#if showTotalInvoice> <@showLine class="table-total" colspanName=true columnNameValue="

[=totalInvoiceName]

" columnTotalValue="

${invoice.grandTotal}

" /> <#if showSubtotalPayments> <@showLine class="table-total" colspanName=true columnNameValue="

[=subtotalPaymentsName]

" columnTotalValue="

${invoice.paymentsTotal}

" /> <#if showSubtotalPayment> <@showLine class="table-total" columnDateValue="

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

" columnTotalValue="

${payment.amount}

" /> <#if showInvoiceBalance> <@showLine class="table-total" colspanName=true columnNameValue="

[=invoiceBalanceName]

" columnTotalValue="

${invoice.balance}

" /> <#if showOtherInvoicesBalance> <@showLine class="table-total" colspanName=true columnNameValue="

[=otherInvoicesBalanceName]

" columnTotalValue="

${client.otherInvoicesBalance}

" /> <#if showClientBalance> <@showLine class="table-total" colspanName=true columnNameValue="

[=clientBalanceName]

" columnTotalValue="

${client.balance}

" /> <#if showDepositsBalance> <@showLine class="table-total" colspanName=true columnNameValue="

[=depositsBalanceName]

" columnTotalValue="

${client.depositsBalance}

" />
[#if invoice.taxable]
[#list invoice.taxes?sort_by("name") as tax]
[/#list]
[/#if]
[#list invoice.payments?sort_by("date") as payment]
[/#list]
<#if showPaidStamp>

[#if invoice.paid]

[/#if]

<#if showClientStatement> <@showClientStatementMacro/>
<#if showQRbill>
<#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 showLine class="" td="td" colspanName=false columnDateValue="" columnNameValue="" columnCatalogItemValue="" columnTimeValue="" columnQuantityValue="" columnMeasureValue="" columnPriceValue="" columnTaxValue="" columnNonTaxableValue="" columnTotalValue=""> class="[=class]"> <#if colspanName && showColumnDate> <[=td] class="table-column table-column-name" colspan="2">[=columnNameValue] <#else> <#if showColumnDate> <[=td] class="table-column table-column-date">[=columnDateValue] <[=td] class="table-column table-column-name">[=columnNameValue] <#if showColumnCatalogItem> <[=td] class="table-column table-column-catalogItem">[=columnCatalogItemValue] <#if showColumnTime> <[=td] class="table-column table-column-time">[=columnTimeValue] <#if showColumnQuantity> <[=td] class="table-column table-column-quantity">[=columnQuantityValue] <#if showColumnMeasure> <[=td] class="table-column table-column-measure">[=columnMeasureValue] <#if showColumnPrice> <[=td] class="table-column table-column-price">[=columnPriceValue] <#if showColumnTax> <[=td]>[#list invoice.taxes?sort_by("name") as tax] <[=td] class="table-column table-column-tax">[=columnTaxValue] <[=td]>[/#list] <#if showColumnNonTaxable> <[=td]>[#if invoice.taxes?size == 0] <#if showNonTaxable> <[=td] class="table-column table-column-tax">[=columnNonTaxableValue] <#else> <[=td] class="table-column table-column-tax"/> <[=td]>[/#if] <#if showColumnTotal> <[=td] class="table-column table-column-total">[=columnTotalValue] <#macro showRegularItems items> <#if showRegularItemsHeader>

[=regularItemsHeaderName]

[#list [=items]?sort_by("date") as item] <@showLine class="table-row-item table-row-item-regular" columnDateValue="

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

" columnNameValue="[=showItemDescription?then('

${item.name}

${item.description}

', '

${item.name}

')]" columnCatalogItemValue="

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

" columnQuantityValue="

${item.quantity}

[#if item.quantityDiscounted]

${item.regularQuantity}

[/#if]

" columnPriceValue="

${item.price}

[#if item.priceDiscounted]

${item.regularPrice}

[/#if]

" columnMeasureValue="

${item.unitOfMeasure}

" columnTaxValue="[=showNonTaxable?then('

[#if !item.taxable]

[=nonTaxable]

[#else]

${item.calculateTaxTotal(tax)}

[/#if]

', '

${item.calculateTaxTotal(tax)}

')]" columnNonTaxableValue="

[=nonTaxable]

" columnTotalValue="

${item.total}

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

[=productsHeaderName]

[#list [=items]?sort_by("date") as item] <@showLine class="table-row-item table-row-item-product" columnDateValue="

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

" columnNameValue="[=showItemDescription?then('

${item.name}

${item.description}

', '

${item.name}

')]" columnCatalogItemValue="

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

" columnQuantityValue="

${item.quantity}

[#if item.quantityDiscounted]

${item.regularQuantity}

[/#if]

" columnPriceValue="

${item.price}

[#if item.priceDiscounted]

${item.regularPrice}

[/#if]

" columnMeasureValue="

${item.unitOfMeasure}

" columnTaxValue="[=showNonTaxable?then('

[#if !item.taxable]

[=nonTaxable]

[#else]

${item.calculateTaxTotal(tax)}

[/#if]

', '

${item.calculateTaxTotal(tax)}

')]" columnNonTaxableValue="

[=nonTaxable]

" columnTotalValue="

${item.total}

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

[=expensesHeaderName]

[#list [=items]?sort_by("date") as item] <@showLine class="table-row-item table-row-item-expense" columnDateValue="

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

" columnNameValue="[=showItemDescription?then('

${item.name}

${item.description}

', '

${item.name}

')]" columnCatalogItemValue="

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

" columnQuantityValue="

${item.quantity}

" columnPriceValue="

${item.price}

" columnMeasureValue="

${item.unitOfMeasure}

" columnTaxValue="[=showNonTaxable?then('

[#if !item.taxable]

[=nonTaxable]

[#else]

${item.calculateTaxTotal(tax)}

[/#if]

', '

${item.calculateTaxTotal(tax)}

')]" columnNonTaxableValue="

[=nonTaxable]

" columnTotalValue="

${item.total}

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

[=mileageHeaderName]

[#list [=items]?sort_by("name") as item] <@showLine class="table-row-item table-row-item-mileage" columnNameValue="[=showItemDescription?then('

${item.name}

${item.description}

', '

${item.name}

')]" columnCatalogItemValue="

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

" columnQuantityValue="

${item.quantity}

" columnPriceValue="

${item.price}

" columnMeasureValue="

${item.unitOfMeasure}

" columnTaxValue="[=showNonTaxable?then('

[#if !item.taxable]

[=nonTaxable]

[#else]

${item.calculateTaxTotal(tax)}

[/#if]

', '

${item.calculateTaxTotal(tax)}

')]" columnNonTaxableValue="

[=nonTaxable]

" columnTotalValue="

${item.total}

" /> <#if showMileageTrips && showColumnQuantity> [#list item.trips?sort_by("startTime") as trip] <@showLine class="table-row-mileage" columnNameValue="

${trip.description}

" columnQuantityValue="

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

" /> [/#list] [/#list] <#macro showServiceItems items> <#if showServicesHeader>

[=servicesHeaderName]

[#list [=items]?sort_by("date") as item] <@showLine class="table-row-item table-row-item-service" columnDateValue="

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

" columnNameValue="[=showItemDescription?then('

${item.name}

${item.description}

', '

${item.name}

')]" columnCatalogItemValue="

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

" columnTimeValue="

[=useDecimalTimeFormat?then('${item.billableTimeAsDecimal}', '${item.billableTimeAsHour}')]

" columnQuantityValue="

${item.quantity}

[#if item.quantityDiscounted]

${item.regularQuantity}

[/#if]

" columnPriceValue="

${item.price}

[#if item.priceDiscounted]

${item.regularPrice}

[/#if]

" columnMeasureValue="

${item.unitOfMeasure}

" columnTaxValue="[=showNonTaxable?then('

[#if !item.taxable]

[=nonTaxable]

[#else]

${item.calculateTaxTotal(tax)}

[/#if]

', '

${item.calculateTaxTotal(tax)}

')]" columnNonTaxableValue="

[=nonTaxable]

" columnTotalValue="

${item.total}

" /> <#if showServiceTime && showColumnTime> <#if groupServiceTimeByDate> [#list invoice.groupDatesByDate(item.timeEntries)?sort as date][#assign dateTimeEntries = invoice.filterByDate(item.timeEntries, date.toInterval())] <@showLine class="table-row-time" columnNameValue="

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

" columnTimeValue="[=useDecimalTimeFormat?then('

${date.toDate()?string(\"MMM dd\")} - ${invoice.calculateBillableTimeAsDecimal(dateTimeEntries)}

', '

${date.toDate()?string(\"MMM dd\")} - ${invoice.calculateBillableTimeAsHour(dateTimeEntries)}

')]" /> [/#list] <#else> [#list item.timeEntries?sort_by("date") as timeEntry] <@showLine class="table-row-time" columnNameValue="

${timeEntry.description}

" columnTimeValue="

[=useDecimalTimeFormat?then('${timeEntry.date?string(\"MMM dd\")} - ${timeEntry.billableTimeAsDecimal}', '${timeEntry.date?string(\"MMM dd\")} - ${timeEntry.billableTimeAsHour}')]

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

${project.name}

[#if project.serviceItems?size != 0] <@showServiceItems items="project.serviceItems"/> <#if showSubtotalServices> <@showLine class="table-total" columnTotalValue="

${project.serviceItemsSubtotal}

" /> [/#if] [#if project.productItems?size != 0] <@showProductItems items="project.productItems"/> <#if showSubtotalProducts> <@showLine class="table-total" columnTotalValue="

${project.productItemsSubtotal}

" /> [/#if] [#if project.expenseItems?size != 0] <@showExpenseItems items="project.expenseItems"/> <#if showSubtotalExpenses> <@showLine class="table-total" columnTotalValue="

${project.expenseItemsSubtotal}

" /> [/#if] [#if project.mileageItems?size != 0] <@showMileageItems items="project.mileageItems"/> <#if showSubtotalMileage> <@showLine class="table-total" columnTotalValue="

${project.mileageItemsSubtotal}

" /> [/#if] <#if showSubtotalProject> [#if invoice.projects?size != 1] <@showLine class="table-total" columnTimeValue="[=useDecimalTimeFormat?then('

[#if invoice.timeEntries?size != 0]${project.billableTimeAsDecimal}[/#if]

', '

[#if invoice.timeEntries?size != 0]${project.billableTimeAsHour}[/#if]

')]" columnTotalValue="

${project.total}

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