<#-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <#-- Generates PDF of multiple checks in two styles: one check per page, multiple checks per page Note that this must be customized to fit specific check layouts. The layout here is copied by hand from a real template using a ruler. --> <#escape x as x?xml> <#-- define the margins of the check layout here --> <#if !security.hasEntityPermission("ACCOUNTING", "_PRINT_CHECKS", session)> ${uiLabelMap.AccountingPrintChecksPermissionError} <#else> <#if payments.size() == 0> ${uiLabelMap.AccountingPaymentCheckMessage1} <#list payments as payment> <#assign paymentApplications = payment.getRelated("PaymentApplication", null, null, false)> <#-- this produces a page break if this block cannot fit on the current page --> <#-- the check: note that the format is fairly precise --> <#-- this seems to be the only way to force a fixed height in fop --> ${payment.effectiveDate?date?string.short} <#assign toPartyNameResult = dispatcher.runSync("getPartyNameForDate", Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("partyId", payment.partyIdTo, "compareDate", payment.effectiveDate, "userLogin", userLogin))/> ${toPartyNameResult.fullName?default("Name Not Found")} **${payment.getBigDecimal("amount").setScale(decimals, rounding).toString()} <#assign amount = Static["org.apache.ofbiz.base.util.UtilNumber"].formatRuleBasedAmount(payment.getDouble("amount"), "%dollars-and-hundredths", locale).toUpperCase()> ${amount}<#list 1..(100-amount.length()) as x>* <#-- payment applications (twice: both blocks are exactly the same) --> <#-- this seems to be the only way to force a fixed height in fop --> <#assign toPartyNameResult = dispatcher.runSync("getPartyNameForDate", Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("partyId", payment.partyIdTo, "compareDate", payment.effectiveDate, "userLogin", userLogin))/> ${toPartyNameResult.fullName?default("Name Not Found")} ${payment.effectiveDate?date?string.short} ${uiLabelMap.CommonDate} ${uiLabelMap.CommonType} ${uiLabelMap.AccountingReferenceNumber} ${uiLabelMap.AccountingPaymentOriginalAmount} ${uiLabelMap.AccountingBalanceDue} ${uiLabelMap.AccountingPayment} <#list paymentApplications as paymentApplication> <#assign invoice = paymentApplication.getRelatedOne("Invoice", false)!> ${payment.effectiveDate?date?string.short} <#if invoice??>${uiLabelMap.AccountingInvoice} : ${invoice.invoiceId} <#if invoice??>${invoice.referenceNumber!} ${paymentApplication.taxAuthGeoId!} ${paymentApplication.getBigDecimal("amountApplied").setScale(decimals, rounding).toString()} <#if invoice.invoiceTypeId! == "PAYROL_INVOICE"> <#assign InvoiceItems = invoice.getRelated("InvoiceItem", null, null, false)!> <#assign PayrolGroups = PayrolGroup!> <#list PayrolGroups as payrolGroup> <#assign fontSize = "75%"> <#assign lineStyle = "dashed"> <#assign sumQuantity = 0> <#assign sumAmount = 0> <#assign sumSubTotal = 0> <#list InvoiceItems as invoiceItem> <#assign invoiceItemType = invoiceItem.getRelatedOne("InvoiceItemType", false)!> <#assign quantity = 0> <#assign amount = 0> <#assign subTotal = 0> <#if invoiceItemType.parentTypeId == payrolGroup.invoiceItemTypeId> <#if invoiceItem.quantity?has_content><#assign quantity = invoiceItem.quantity!><#else><#assign quantity = 0> <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0> <#if amount != 0 && quantity == 0 ><#assign quantity = 1> <#assign subTotal = quantity * amount> <#assign sumQuantity = sumQuantity + quantity> <#assign sumAmount = sumAmount + amount> <#assign sumSubTotal = sumSubTotal + subTotal> <#if sumSubTotal != 0> ${payrolGroup.description!} Quantity Amount Sum <#assign sumQuantity = 0> <#assign sumAmount = 0> <#assign sumSubTotal = 0> <#list InvoiceItems as invoiceItem> <#assign invoiceItemType = invoiceItem.getRelatedOne("InvoiceItemType", false)!> <#assign subTotal = 0> <#if invoiceItemType.parentTypeId == payrolGroup.invoiceItemTypeId> <#if invoiceItem.quantity?has_content><#assign quantity = invoiceItem.quantity!><#else><#assign quantity = 0> <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0> <#if amount != 0 && quantity == 0 ><#assign quantity = 1> <#assign subTotal = quantity * amount> <#assign sumQuantity = sumQuantity + quantity> <#assign sumAmount = sumAmount + amount> <#assign sumSubTotal = sumSubTotal + subTotal> ${invoiceItemType.description!} ${quantity!} ${amount!} ${subTotal!} <#assign sumQuantity = 0> <#assign sumAmount = 0> <#assign sumSubTotal = 0> <#list InvoiceItems as invoiceItem> <#assign invoiceItemType = invoiceItem.getRelatedOne("InvoiceItemType", false)!> <#assign subTotal = 0> <#if invoiceItemType.parentTypeId == payrolGroup.invoiceItemTypeId> <#if invoiceItem.quantity?has_content><#assign quantity = invoiceItem.quantity!><#else><#assign quantity = 0> <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0> <#if amount != 0 && quantity == 0><#assign quantity = 1> <#assign subTotal = quantity * amount> <#assign sumQuantity = sumQuantity + quantity> <#assign sumAmount = sumAmount + amount> <#assign sumSubTotal = sumSubTotal + subTotal> <#if sumSubTotal != 0> ${sumQuantity!} ${sumAmount!} ${sumSubTotal!} ${uiLabelMap.AccountingCheckAmount} ${payment.getBigDecimal("amount").setScale(decimals, rounding).toString()} <#-- copy of above --> <#-- this seems to be the only way to force a fixed height in fop --> ${Static["org.apache.ofbiz.party.party.PartyHelper"].getPartyName(delegator, payment.partyIdTo, false)} ${payment.effectiveDate?date?string.short} ${uiLabelMap.CommonDate} ${uiLabelMap.CommonType} ${uiLabelMap.AccountingReferenceNumber} ${uiLabelMap.AccountingPaymentOriginalAmount} ${uiLabelMap.AccountingBalanceDue} ${uiLabelMap.AccountingPayment} <#list paymentApplications as paymentApplication> <#assign invoice = paymentApplication.getRelatedOne("Invoice", false)!> ${payment.effectiveDate?date?string.short} <#if invoice??>${uiLabelMap.AccountingInvoice} : ${invoice.invoiceId} <#if invoice??>${invoice.referenceNumber!} ${paymentApplication.taxAuthGeoId!} ${paymentApplication.getBigDecimal("amountApplied").setScale(decimals, rounding).toString()} <#if invoice.invoiceTypeId! == "PAYROL_INVOICE"> <#assign InvoiceItems = invoice.getRelated("InvoiceItem", null, null, false)!> <#assign PayrolGroups = PayrolGroup!> <#list PayrolGroups as payrolGroup> <#assign fontSize = "75%"> <#assign lineStyle = "dashed"> <#assign sumQuantity = 0> <#assign sumAmount = 0> <#assign sumSubTotal = 0> <#list InvoiceItems as invoiceItem> <#assign invoiceItemType = invoiceItem.getRelatedOne("InvoiceItemType", false)!> <#assign quantity = 0> <#assign amount = 0> <#assign subTotal = 0> <#if invoiceItemType.parentTypeId == payrolGroup.invoiceItemTypeId> <#if invoiceItem.quantity?has_content><#assign quantity = invoiceItem.quantity!><#else><#assign quantity = 0> <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0> <#if amount != 0 && quantity == 0 ><#assign quantity = 1> <#assign subTotal = quantity * amount> <#assign sumQuantity = sumQuantity + quantity> <#assign sumAmount = sumAmount + amount> <#assign sumSubTotal = sumSubTotal + subTotal> <#if sumSubTotal != 0> ${payrolGroup.description!} Quantity Amount Sum <#assign sumQuantity = 0> <#assign sumAmount = 0> <#assign sumSubTotal = 0> <#list InvoiceItems as invoiceItem> <#assign invoiceItemType = invoiceItem.getRelatedOne("InvoiceItemType", false)!> <#assign subTotal = 0> <#if invoiceItemType.parentTypeId == payrolGroup.invoiceItemTypeId> <#if invoiceItem.quantity?has_content><#assign quantity = invoiceItem.quantity!><#else><#assign quantity = 0> <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0> <#if amount != 0 && quantity == 0 ><#assign quantity = 1> <#assign subTotal = quantity * amount> <#assign sumQuantity = sumQuantity + quantity> <#assign sumAmount = sumAmount + amount> <#assign sumSubTotal = sumSubTotal + subTotal> ${invoiceItemType.description!} ${quantity!} ${amount!} ${subTotal!} <#assign sumQuantity = 0> <#assign sumAmount = 0> <#assign sumSubTotal = 0> <#list InvoiceItems as invoiceItem> <#assign invoiceItemType = invoiceItem.getRelatedOne("InvoiceItemType", false)!> <#assign subTotal = 0> <#if invoiceItemType.parentTypeId == payrolGroup.invoiceItemTypeId> <#if invoiceItem.quantity?has_content><#assign quantity = invoiceItem.quantity!><#else><#assign quantity = 0> <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0> <#if amount != 0 && quantity == 0><#assign quantity = 1> <#assign subTotal = quantity * amount> <#assign sumQuantity = sumQuantity + quantity> <#assign sumAmount = sumAmount + amount> <#assign sumSubTotal = sumSubTotal + subTotal> <#if sumSubTotal != 0> ${sumQuantity!} ${sumAmount!} ${sumSubTotal!} ${uiLabelMap.AccountingCheckAmount} ${payment.getBigDecimal("amount").setScale(decimals, rounding).toString()} <#-- security if -->