#--
This is the meta-template used to generate the actual invoice template.
-->
[=invoiceTitle] ${invoice.number}
<#if showPageBackground>
#if>
<#if useCharacterEncoding>
#if>
[=invoiceTitle]
<@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>
[#if invoice.taxable] |
<#if showSubtotalTax>
[#list invoice.taxes?sort_by("name") as tax] |
<@showLine class="table-total" colspanName=true columnNameValue="[=showInvoiceTaxRate?then('${tax.name} ${tax.defaultRate}
', '${tax.name}
')]" columnTotalValue="${invoice.getTaxTotal(tax)}
" />
[/#list] |
#if>
<#if showSubtotalTaxes>
<@showLine class="table-total" colspanName=true columnNameValue="[=subtotalTaxesName]
" columnTotalValue="${invoice.taxesTotal}
" />
#if>
<#if showTotalInvoice>
<@showLine class="table-total" colspanName=true columnNameValue="[=totalInvoiceName]
" columnTotalValue="${invoice.grandTotal}
" />
#if>
[/#if] |
<#if showSubtotalPayments>
<@showLine class="table-total" colspanName=true columnNameValue="[=subtotalPaymentsName]
" columnTotalValue="${invoice.paymentsTotal}
" />
#if>
<#if showSubtotalPayment>
[#list invoice.payments?sort_by("date") as payment] |
<@showLine class="table-total" columnDateValue="${payment.date?date?string.short}
" columnTotalValue="${payment.amount}
" />
[/#list] |
#if>
<#if showInvoiceBalance>
<@showLine class="table-total" colspanName=true columnNameValue="[=invoiceBalanceName]
" columnTotalValue="${invoice.balance}
" />
#if>
<#if showOtherInvoicesBalance>
<@showLine class="table-total" colspanName=true columnNameValue="[=otherInvoicesBalanceName]
" columnTotalValue="${client.otherInvoicesBalance}
" />
#if>
<#if showClientBalance>
<@showLine class="table-total" colspanName=true columnNameValue="[=clientBalanceName]
" columnTotalValue="${client.balance}
" />
#if>
<#if showDepositsBalance>
<@showLine class="table-total" colspanName=true columnNameValue="[=depositsBalanceName]
" columnTotalValue="${client.depositsBalance}
" />
#if>
<#if showPaidStamp>
[#if invoice.paid]
[/#if]
#if>
<#if showClientStatement>
<@showClientStatementMacro/>
#if>
<#if showQRbill>
#if>
<#macro showClientStatementMacro>
[#if client.openInvoices?size != 0]
[=clientStatementHeader]
<#if showClientStatementColumnNumber>
[=clientStatementColumnNumber] |
#if>
<#if showClientStatementColumnDate>
[=clientStatementColumnDate] |
#if>
<#if showClientStatementColumnDueDate>
[=clientStatementColumnDueDate] |
#if>
<#if showClientStatementColumnAge>
[=clientStatementColumnAge] |
#if>
<#if showClientStatementColumnGrandTotal>
[=clientStatementColumnGrandTotal] |
#if>
<#if showClientStatementColumnPayments>
[=clientStatementColumnPayments] |
#if>
<#if showClientStatementColumnBalance>
[=clientStatementColumnBalance] |
#if>
[#list client.openInvoices?sort_by("ageInDays") as invoice] |
<#if showClientStatementColumnNumber>
${invoice.number} |
#if>
<#if showClientStatementColumnDate>
${invoice.date?date?string.short} |
#if>
<#if showClientStatementColumnDueDate>
${invoice.dueDate?date?string.short} |
#if>
<#if showClientStatementColumnAge>
${invoice.ageInDays?string("#0")} |
#if>
<#if showClientStatementColumnGrandTotal>
${invoice.grandTotal} |
#if>
<#if showClientStatementColumnPayments>
${invoice.paymentsTotal} |
#if>
<#if showClientStatementColumnBalance>
${invoice.balance} |
#if>
[/#list] |
<#if showClientStatementColumnNumber>
|
#if>
<#if showClientStatementColumnDate>
|
#if>
<#if showClientStatementColumnDueDate>
|
#if>
<#if showClientStatementColumnAge>
|
#if>
<#if showClientStatementColumnGrandTotal>
|
#if>
<#if showClientStatementColumnPayments>
|
#if>
<#if showClientStatementColumnBalance>
${client.balance} |
#if>
[=clientStatementFooter]
[/#if]
#macro>
<#macro showLine class="" td="td" colspanName=false columnDateValue="" columnNameValue="" columnCatalogItemValue="" columnTimeValue="" columnQuantityValue="" columnMeasureValue="" columnPriceValue="" columnTaxValue="" columnNonTaxableValue="" columnTotalValue="">
class="[=class]"#if>>
<#if colspanName && showColumnDate>
<[=td] class="table-column table-column-name" colspan="2">[=columnNameValue][=td]>
<#else>
<#if showColumnDate>
<[=td] class="table-column table-column-date">[=columnDateValue][=td]>
#if>
<[=td] class="table-column table-column-name">[=columnNameValue][=td]>
#if>
<#if showColumnCatalogItem>
<[=td] class="table-column table-column-catalogItem">[=columnCatalogItemValue][=td]>
#if>
<#if showColumnTime>
<[=td] class="table-column table-column-time">[=columnTimeValue][=td]>
#if>
<#if showColumnQuantity>
<[=td] class="table-column table-column-quantity">[=columnQuantityValue][=td]>
#if>
<#if showColumnMeasure>
<[=td] class="table-column table-column-measure">[=columnMeasureValue][=td]>
#if>
<#if showColumnPrice>
<[=td] class="table-column table-column-price">[=columnPriceValue][=td]>
#if>
<#if showColumnTax>
<[=td]>[#list invoice.taxes?sort_by("name") as tax][=td]>
<[=td] class="table-column table-column-tax">[=columnTaxValue][=td]>
<[=td]>[/#list][=td]>
#if>
<#if showColumnNonTaxable>
<[=td]>[#if invoice.taxes?size == 0][=td]>
<#if showNonTaxable>
<[=td] class="table-column table-column-tax">[=columnNonTaxableValue][=td]>
<#else>
<[=td] class="table-column table-column-tax"/>
#if>
<[=td]>[/#if][=td]>
#if>
<#if showColumnTotal>
<[=td] class="table-column table-column-total">[=columnTotalValue][=td]>
#if>
#macro>
<#macro showRegularItems items>
<#if showRegularItemsHeader>
[=regularItemsHeaderName] |
#if>
[#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>
<#macro showProductItems items>
<#if showProductsHeader>
[=productsHeaderName] |
#if>
[#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>
<#macro showExpenseItems items>
<#if showExpensesHeader>
[=expensesHeaderName] |
#if>
[#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>
<#macro showMileageItems items>
<#if showMileageHeader>
[=mileageHeaderName] |
#if>
[#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] |
#if>
[/#list] |
#macro>
<#macro showServiceItems items>
<#if showServicesHeader>
[=servicesHeaderName] |
#if>
[#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] |
#if>
#if>
[/#list] |
#macro>
<#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] |
[#if project.productItems?size != 0] |
<@showProductItems items="project.productItems"/>
<#if showSubtotalProducts>
<@showLine class="table-total" columnTotalValue="${project.productItemsSubtotal}
" />
#if>
[/#if] |
[#if project.expenseItems?size != 0] |
<@showExpenseItems items="project.expenseItems"/>
<#if showSubtotalExpenses>
<@showLine class="table-total" columnTotalValue="${project.expenseItemsSubtotal}
" />
#if>
[/#if] |
[#if project.mileageItems?size != 0] |
<@showMileageItems items="project.mileageItems"/>
<#if showSubtotalMileage>
<@showLine class="table-total" columnTotalValue="${project.mileageItemsSubtotal}
"
/>
#if>
[/#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] |
#if>
[/#list] |
[#if invoice.regularItems?size != 0] |
<@showRegularItems items="invoice.regularItems"/>
[/#if] |
#macro>