svn commit: r1730891 - in /ofbiz/branches/release14.12: ./ applications/accounting/webapp/accounting/payment/PrintChecks.fo.ftl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1730891 - in /ofbiz/branches/release14.12: ./ applications/accounting/webapp/accounting/payment/PrintChecks.fo.ftl

jleroux@apache.org
Author: jleroux
Date: Wed Feb 17 17:54:21 2016
New Revision: 1730891

URL: http://svn.apache.org/viewvc?rev=1730891&view=rev
Log:
"Applied fix from trunk for revision: 1730889  "
------------------------------------------------------------------------
r1730889 | jleroux | 2016-02-17 18:47:47 +0100 (mer. 17 févr. 2016) | 5 lignes

A patch from Pierre Smits for "printCheck action generates an error" https://issues.apache.org/jira/browse/OFBIZ-6898

When generating a check (/accounting/control/printChecks.pdf?paymentId=demo10000) following error is generated:
Unable to transform FO file: org.apache.fop.apps.FOPException: org.apache.fop.fo.ValidationException: null:32:31: "fo:table-cell" is missing child elements. Required content model: marker* (%block;)+ (See position 32:31)
     [java] javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: null:32:31: "fo:table-cell" is missing child elements. Required content model: marker* (%block;)+ (See position 32:31); Screen XSL:FO text was:
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release14.12/   (props changed)
    ofbiz/branches/release14.12/applications/accounting/webapp/accounting/payment/PrintChecks.fo.ftl

Propchange: ofbiz/branches/release14.12/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 17 17:54:21 2016
@@ -8,4 +8,4 @@
 /ofbiz/branches/json-integration-refactoring:1634077-1635900
 /ofbiz/branches/multitenant20100310:921280-927264
 /ofbiz/branches/release13.07:1547657
-/ofbiz/trunk:1649072,1649083-1649084,1649086,1649090,1649096,1649230,1649238-1649239,1649248,1649272,1649275,1649280-1649281,1649283,1649285-1649286,1649291,1649329,1649331,1649384,1649393,1649666,1649742,1650240,1650348,1650357,1650583,1650642,1650678,1650821,1650882,1650887,1650938,1651593,1652312,1652361,1652638,1652641,1652672,1652688,1652706,1652725,1652731,1652739,1652852,1653248,1653296,1653456,1653597,1653614,1654175,1654273,1654509,1654670,1654672-1654673,1654683-1654684,1654824,1655046,1655668,1655979,1656014,1656185,1656198,1656445,1656983,1657323,1657506-1657507,1657514,1657714,1657790,1657848,1658364,1658662,1658882,1659224,1659965,1660031,1660053,1660389,1660444,1660579,1661303,1661328,1661760,1661778,1661853,1661862,1661873,1661940,1661951,1661977,1662119-1662120,1662361,1662500,1662812,1662919,1663202,1663912,1663979,1664602,1664604,1664696,1665154,1665162,1665535,1666404,1666511,1666633,1666836,1666939,1666949,1666958,1667055,1667253,1667483,1667492,1667774,1668207,
 1668214,1668236,1668246,1668258,1668263,1668265,1668270,1668277,1668314,1668657,1669317,1669588,1672427,1672430,1672846,1672853,1672856,1672862,1672873,1673764,1674447,1674464,1674491,1674496,1674908,1676674,1677123,1677597,1677769-1677770,1678294,1678882,1678911,1679689,1679697,1679709,1679720,1679728,1679732,1679957,1680155,1680288,1680304,1680671,1680675,1680733,1680840,1680881,1682272,1682295,1682415,1682633,1683998,1684094,1686360,1686536,1686545,1686566,1686569,1686574,1686583,1686635,1686651,1686970,1687427,1688772,1690086,1690581,1692357,1692458,1692600,1692604,1693393,1693579,1695017,1696018,1696234,1697590,1697647,1697993,1698259,1698261,1698263,1701164,1701441,1701819,1701825,1701936,1702002,1702548,1702704,1703121,1703586,1703945,1703954,1703965,1703971,1703976-1703977,1703981,1704000,1704014,1704018,1704036,1704043,1704052,1704082,1704140,1704230,1705004,1705329,1705405,1705412,1705417,1705427,1705532,1706159,1706162,1706316,1706531,1706549,1706553,1706561,1706569,17065
 77,1706589,1706591,1706593,1706694,1707837,1707857,1708274,1708341,1708742,1708930,1709117,1710178,1710348,1711513,1712971,1714244,1714410,1714415,1714571,1714657,1715477-1715478,1715485,1715501,1716319,1717058,1717180,1717682,1717710,1717760,1718023,1718109,1719094,1719872,1720883,1721067,1721093,1721625,1722712,1723007,1723248,1724402,1724566,1724763,1724916,1724918,1724925,1724930,1724940,1724943,1724946,1724951,1724957,1724978,1725217,1725257,1725561,1725574,1726388,1726493,1726828,1728398,1729005,1729609,1729809,1730035,1730456,1730882
+/ofbiz/trunk:1649072,1649083-1649084,1649086,1649090,1649096,1649230,1649238-1649239,1649248,1649272,1649275,1649280-1649281,1649283,1649285-1649286,1649291,1649329,1649331,1649384,1649393,1649666,1649742,1650240,1650348,1650357,1650583,1650642,1650678,1650821,1650882,1650887,1650938,1651593,1652312,1652361,1652638,1652641,1652672,1652688,1652706,1652725,1652731,1652739,1652852,1653248,1653296,1653456,1653597,1653614,1654175,1654273,1654509,1654670,1654672-1654673,1654683-1654684,1654824,1655046,1655668,1655979,1656014,1656185,1656198,1656445,1656983,1657323,1657506-1657507,1657514,1657714,1657790,1657848,1658364,1658662,1658882,1659224,1659965,1660031,1660053,1660389,1660444,1660579,1661303,1661328,1661760,1661778,1661853,1661862,1661873,1661940,1661951,1661977,1662119-1662120,1662361,1662500,1662812,1662919,1663202,1663912,1663979,1664602,1664604,1664696,1665154,1665162,1665535,1666404,1666511,1666633,1666836,1666939,1666949,1666958,1667055,1667253,1667483,1667492,1667774,1668207,
 1668214,1668236,1668246,1668258,1668263,1668265,1668270,1668277,1668314,1668657,1669317,1669588,1672427,1672430,1672846,1672853,1672856,1672862,1672873,1673764,1674447,1674464,1674491,1674496,1674908,1676674,1677123,1677597,1677769-1677770,1678294,1678882,1678911,1679689,1679697,1679709,1679720,1679728,1679732,1679957,1680155,1680288,1680304,1680671,1680675,1680733,1680840,1680881,1682272,1682295,1682415,1682633,1683998,1684094,1686360,1686536,1686545,1686566,1686569,1686574,1686583,1686635,1686651,1686970,1687427,1688772,1690086,1690581,1692357,1692458,1692600,1692604,1693393,1693579,1695017,1696018,1696234,1697590,1697647,1697993,1698259,1698261,1698263,1701164,1701441,1701819,1701825,1701936,1702002,1702548,1702704,1703121,1703586,1703945,1703954,1703965,1703971,1703976-1703977,1703981,1704000,1704014,1704018,1704036,1704043,1704052,1704082,1704140,1704230,1705004,1705329,1705405,1705412,1705417,1705427,1705532,1706159,1706162,1706316,1706531,1706549,1706553,1706561,1706569,17065
 77,1706589,1706591,1706593,1706694,1707837,1707857,1708274,1708341,1708742,1708930,1709117,1710178,1710348,1711513,1712971,1714244,1714410,1714415,1714571,1714657,1715477-1715478,1715485,1715501,1716319,1717058,1717180,1717682,1717710,1717760,1718023,1718109,1719094,1719872,1720883,1721067,1721093,1721625,1722712,1723007,1723248,1724402,1724566,1724763,1724916,1724918,1724925,1724930,1724940,1724943,1724946,1724951,1724957,1724978,1725217,1725257,1725561,1725574,1726388,1726493,1726828,1728398,1729005,1729609,1729809,1730035,1730456,1730882,1730889

Modified: ofbiz/branches/release14.12/applications/accounting/webapp/accounting/payment/PrintChecks.fo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/accounting/webapp/accounting/payment/PrintChecks.fo.ftl?rev=1730891&r1=1730890&r2=1730891&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/accounting/webapp/accounting/payment/PrintChecks.fo.ftl (original)
+++ ofbiz/branches/release14.12/applications/accounting/webapp/accounting/payment/PrintChecks.fo.ftl Wed Feb 17 17:54:21 2016
@@ -25,472 +25,443 @@ by hand from a real template using a rul
 <#escape x as x?xml>
 
 <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
-
-  <fo:layout-master-set>
-
+    <fo:layout-master-set>
     <#-- define the margins of the check layout here -->
-    <fo:simple-page-master master-name="checks"
-      page-height="27.9cm" page-width="21.6cm">
-      <fo:region-body/>
-    </fo:simple-page-master>
-
-  </fo:layout-master-set>
-
-  <fo:page-sequence master-reference="checks">
-    <fo:flow flow-name="xsl-region-body">
-      <#if !security.hasEntityPermission("ACCOUNTING", "_PRINT_CHECKS", session)>
-      <fo:block padding="20pt">${uiLabelMap.AccountingPrintChecksPermissionError}</fo:block>
-      <#else>
-      <#if payments.size() == 0>
-        <fo:block padding="20pt">${uiLabelMap.AccountingPaymentCheckMessage1}</fo:block>
-      </#if>
-
-      <#list payments as payment>
-      <#assign paymentApplications = payment.getRelated("PaymentApplication", null, null, false)>
-      <fo:block font-size="10pt" break-before="page"> <#-- 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 -->
-        <fo:table table-layout="fixed" width="100%">
-          <fo:table-column column-width="100%"/>
-          <fo:table-body>
-          <fo:table-row height="8.85cm">
-          <fo:table-cell>
-
-        <fo:table table-layout="fixed" width="100%">
-          <fo:table-column column-width="17.7cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-body>
-            <fo:table-row>
-              <fo:table-cell/>
-              <fo:table-cell>
-                <fo:block padding-before="2.2cm">${payment.effectiveDate?date?string.short}</fo:block>
-              </fo:table-cell>
-            </fo:table-row>
-            <fo:table-row>
-              <fo:table-cell padding-before="0.8cm">
-                <fo:block margin-left="3.0cm">
-                  <#assign toPartyNameResult = dispatcher.runSync("getPartyNameForDate", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", payment.partyIdTo, "compareDate", payment.effectiveDate, "userLogin", userLogin))/>
-                  ${toPartyNameResult.fullName?default("Name Not Found")}
-                </fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding-before="0.8cm">
-                <fo:block>**${payment.getBigDecimal("amount").setScale(decimals, rounding).toString()}</fo:block>
-              </fo:table-cell>
-            </fo:table-row>
-            <fo:table-row>
-              <fo:table-cell number-columns-spanned="2">
-                <#assign amount = Static["org.ofbiz.base.util.UtilNumber"].formatRuleBasedAmount(payment.getDouble("amount"), "%dollars-and-hundredths", locale).toUpperCase()>
-                <fo:block padding-before="0.4cm" margin-left="1.3cm">${amount}<#list 1..(100-amount.length()) as x>*</#list></fo:block>
-              </fo:table-cell>
-            </fo:table-row>
-          </fo:table-body>
-        </fo:table>
-
-        </fo:table-cell>
-        </fo:table-row>
-        </fo:table-body>
-        </fo:table>
-
-        <#-- payment applications (twice: both blocks are exactly the same) -->
-
-        <#-- this seems to be the only way to force a fixed height in fop -->
-        <fo:table table-layout="fixed" width="100%">
-          <fo:table-column column-width="100%"/>
-          <fo:table-body>
-          <fo:table-row height="9.3cm">
-          <fo:table-cell>
-
-        <fo:table table-layout="fixed" margin-left="5pt" margin-right="5pt" width="100%">
-          <fo:table-column column-width="3cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-header>
-            <fo:table-row>
-              <fo:table-cell padding="3pt" number-columns-spanned="3" text-align="center">
-                <fo:block text-align="center">
-                  <#assign toPartyNameResult = dispatcher.runSync("getPartyNameForDate", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", payment.partyIdTo, "compareDate", payment.effectiveDate, "userLogin", userLogin))/>
-                  ${toPartyNameResult.fullName?default("Name Not Found")}
-                </fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt" number-columns-spanned="4" text-align="center">
-                <fo:block text-align="center">${payment.effectiveDate?date?string.short}</fo:block>
-              </fo:table-cell>
-            </fo:table-row>
-
-            <fo:table-row>
-              <fo:table-cell padding="3pt">
-                <fo:block font-weight="bold">${uiLabelMap.CommonDate}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block font-weight="bold">${uiLabelMap.CommonType}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block font-weight="bold">${uiLabelMap.AccountingReferenceNumber}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block font-weight="bold" text-align="right">${uiLabelMap.AccountingPaymentOriginalAmount}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block font-weight="bold" text-align="right">${uiLabelMap.AccountingBalanceDue}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block font-weight="bold" text-align="right">${uiLabelMap.AccountingPayment}</fo:block>
-              </fo:table-cell>
-            </fo:table-row>
-
-          </fo:table-header>
-          <fo:table-body>
-
-            <#list paymentApplications as paymentApplication>
-            <#assign invoice = paymentApplication.getRelatedOne("Invoice", false)!>
-            <fo:table-row>
-              <fo:table-cell padding="3pt">
-                <fo:block>${payment.effectiveDate?date?string.short}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block><#if invoice??>${uiLabelMap.AccountingInvoice} : ${invoice.invoiceId}</#if></fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block>
-                  <#if invoice??>${invoice.referenceNumber!}</#if>
-                  ${paymentApplication.taxAuthGeoId!}
-                </fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block text-align="end">${paymentApplication.getBigDecimal("amountApplied").setScale(decimals, rounding).toString()}</fo:block>
-              </fo:table-cell>
-            </fo:table-row>
-            <#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>
-                      <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0></#if>
-                      <#if amount != 0 && quantity == 0 ><#assign quantity = 1></#if>
-                          <#assign subTotal = quantity * amount>
-                          <#assign sumQuantity = sumQuantity + quantity>
-                          <#assign sumAmount = sumAmount + amount>
-                          <#assign sumSubTotal = sumSubTotal + subTotal>
-                      </#if>
-                  </#list>
-                  <#if sumSubTotal != 0>
-              <fo:table-row font-size="${fontSize}">
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt" number-columns-spanned="3" border-bottom-style="${lineStyle}">
-              <fo:block font-weight="bold">${payrolGroup.description!}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt" border-bottom-style="${lineStyle}" >
-              <fo:block font-weight="bold" text-align="center">Quantity</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt" border-bottom-style="${lineStyle}" >
-              <fo:block font-weight="bold" text-align="center">Amount</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt" border-bottom-style="${lineStyle}" >
-              <fo:block font-weight="bold" text-align="center">Sum</fo:block>
-              </fo:table-cell>
-              </fo:table-row>
-                </#if>
-
-                <#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>
-                      <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0></#if>
-                      <#if amount != 0 && quantity == 0 ><#assign quantity = 1></#if>
-                      <#assign subTotal = quantity * amount>
-                      <#assign sumQuantity = sumQuantity + quantity>
-                      <#assign sumAmount = sumAmount + amount>
-                      <#assign sumSubTotal = sumSubTotal + subTotal>
-              <fo:table-row font-size="${fontSize}">
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt" number-columns-spanned="3"><fo:block>${invoiceItemType.description!}</fo:block></fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block text-align="center">${quantity!}</fo:block></fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block text-align="center">${amount!}</fo:block></fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block text-align="center">${subTotal!}</fo:block></fo:table-cell>
-              </fo:table-row>
-                      </#if>
-                  </#list>
-
-                  <#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>
-                      <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0></#if>
-                      <#if amount != 0 && quantity == 0><#assign quantity = 1></#if>
-                          <#assign subTotal = quantity * amount>
-                          <#assign sumQuantity = sumQuantity + quantity>
-                          <#assign sumAmount = sumAmount + amount>
-                          <#assign sumSubTotal = sumSubTotal + subTotal>
-                      </#if>
-                  </#list>
-                  <#if sumSubTotal != 0>
-              <fo:table-row font-size="${fontSize}">
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt" number-columns-spanned="3" border-top-style="${lineStyle}"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt" border-top-style="${lineStyle}"><fo:block text-align="center">${sumQuantity!}</fo:block></fo:table-cell>
-              <fo:table-cell padding="3pt" border-top-style="${lineStyle}"><fo:block text-align="center">${sumAmount!}</fo:block></fo:table-cell>
-              <fo:table-cell padding="3pt" border-top-style="solid" border-bottom-style="${lineStyle}"><fo:block text-align="right">${sumSubTotal!}</fo:block></fo:table-cell>
-              </fo:table-row>
-              <fo:table-row font-size="${fontSize}">
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              </fo:table-row>
-                  </#if>
-
-              </#list>
-              <fo:table-row font-size="${fontSize}">
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt" number-columns-spanned="6" border-top-style="solid"><fo:block/></fo:table-cell>
-              </fo:table-row>
-              </#if>
-
-            </#list>
-
-            <fo:table-row>
-              <fo:table-cell padding="3pt" number-columns-spanned="6">
-                <fo:block text-align="end">${uiLabelMap.AccountingCheckAmount}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block text-align="end">${payment.getBigDecimal("amount").setScale(decimals, rounding).toString()}</fo:block>
-              </fo:table-cell>
-            </fo:table-row>
-          </fo:table-body>
-        </fo:table>
-
-        </fo:table-cell>
-        </fo:table-row>
-        </fo:table-body>
-        </fo:table>
-
-
-        <#-- copy of above -->
-
-        <#-- this seems to be the only way to force a fixed height in fop -->
-        <fo:table table-layout="fixed" width="100%">
-          <fo:table-column column-width="100%"/>
-          <fo:table-body>
-          <fo:table-row height="9.3cm">
-          <fo:table-cell>
-
-        <fo:table table-layout="fixed" margin-left="5pt" margin-right="5pt" width="100%">
-          <fo:table-column column-width="3cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-column column-width="3cm"/>
-          <fo:table-header>
-            <fo:table-row>
-              <fo:table-cell padding="3pt" number-columns-spanned="3" text-align="center">
-                <fo:block text-align="center">
-                  ${Static["org.ofbiz.party.party.PartyHelper"].getPartyName(delegator, payment.partyIdTo, false)}
-                </fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt" number-columns-spanned="4" text-align="center">
-                <fo:block text-align="center">${payment.effectiveDate?date?string.short}</fo:block>
-              </fo:table-cell>
-            </fo:table-row>
-            <fo:table-row>
-              <fo:table-cell padding="3pt">
-                <fo:block font-weight="bold">${uiLabelMap.CommonDate}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block font-weight="bold">${uiLabelMap.CommonType}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block font-weight="bold">${uiLabelMap.AccountingReferenceNumber}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block font-weight="bold" text-align="right">${uiLabelMap.AccountingPaymentOriginalAmount}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block font-weight="bold" text-align="right">${uiLabelMap.AccountingBalanceDue}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block font-weight="bold" text-align="right">${uiLabelMap.AccountingPayment}</fo:block>
-              </fo:table-cell>
-            </fo:table-row>
-          </fo:table-header>
-          <fo:table-body>
-
-            <#list paymentApplications as paymentApplication>
-            <#assign invoice = paymentApplication.getRelatedOne("Invoice", false)!>
-            <fo:table-row>
-              <fo:table-cell padding="3pt">
-                <fo:block>${payment.effectiveDate?date?string.short}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block><#if invoice??>${uiLabelMap.AccountingInvoice} : ${invoice.invoiceId}</#if></fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block>
-                  <#if invoice??>${invoice.referenceNumber!}</#if>
-                  ${paymentApplication.taxAuthGeoId!}
-                </fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block text-align="end">${paymentApplication.getBigDecimal("amountApplied").setScale(decimals, rounding).toString()}</fo:block>
-              </fo:table-cell>
-            </fo:table-row>
-            <#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>
-                      <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0></#if>
-                      <#if amount != 0 && quantity == 0 ><#assign quantity = 1></#if>
-                          <#assign subTotal = quantity * amount>
-                          <#assign sumQuantity = sumQuantity + quantity>
-                          <#assign sumAmount = sumAmount + amount>
-                          <#assign sumSubTotal = sumSubTotal + subTotal>
-                      </#if>
-                  </#list>
-                  <#if sumSubTotal != 0>
-              <fo:table-row font-size="${fontSize}">
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt" number-columns-spanned="3" border-bottom-style="${lineStyle}">
-              <fo:block font-weight="bold">${payrolGroup.description!}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt" border-bottom-style="${lineStyle}" >
-              <fo:block font-weight="bold" text-align="center">Quantity</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt" border-bottom-style="${lineStyle}" >
-              <fo:block font-weight="bold" text-align="center">Amount</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt" border-bottom-style="${lineStyle}" >
-              <fo:block font-weight="bold" text-align="center">Sum</fo:block>
-              </fo:table-cell>
-              </fo:table-row>
+        <fo:simple-page-master master-name="checks" page-height="27.9cm" page-width="21.6cm">
+            <fo:region-body/>
+        </fo:simple-page-master>
+
+    </fo:layout-master-set>
+
+    <fo:page-sequence master-reference="checks">
+        <fo:flow flow-name="xsl-region-body">
+            <#if !security.hasEntityPermission("ACCOUNTING", "_PRINT_CHECKS", session)>
+                <fo:block padding="20pt">${uiLabelMap.AccountingPrintChecksPermissionError}</fo:block>
+            <#else>
+                <#if payments.size() == 0>
+                    <fo:block padding="20pt">${uiLabelMap.AccountingPaymentCheckMessage1}</fo:block>
                 </#if>
-
-                <#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>
-                      <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0></#if>
-                      <#if amount != 0 && quantity == 0 ><#assign quantity = 1></#if>
-                      <#assign subTotal = quantity * amount>
-                      <#assign sumQuantity = sumQuantity + quantity>
-                      <#assign sumAmount = sumAmount + amount>
-                      <#assign sumSubTotal = sumSubTotal + subTotal>
-              <fo:table-row font-size="${fontSize}">
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt" number-columns-spanned="3"><fo:block>${invoiceItemType.description!}</fo:block></fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block text-align="center">${quantity!}</fo:block></fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block text-align="center">${amount!}</fo:block></fo:table-cell>
-              <fo:table-cell padding="3pt"><fo:block text-align="center">${subTotal!}</fo:block></fo:table-cell>
-              </fo:table-row>
-                      </#if>
-                  </#list>
-
-                  <#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>
-                      <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0></#if>
-                      <#if amount != 0 && quantity == 0><#assign quantity = 1></#if>
-                          <#assign subTotal = quantity * amount>
-                          <#assign sumQuantity = sumQuantity + quantity>
-                          <#assign sumAmount = sumAmount + amount>
-                          <#assign sumSubTotal = sumSubTotal + subTotal>
-                      </#if>
-                  </#list>
-                  <#if sumSubTotal != 0>
-              <fo:table-row font-size="${fontSize}">
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt" number-columns-spanned="3" border-top-style="${lineStyle}"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt" border-top-style="${lineStyle}"><fo:block text-align="center">${sumQuantity!}</fo:block></fo:table-cell>
-              <fo:table-cell padding="3pt" border-top-style="${lineStyle}"><fo:block text-align="center">${sumAmount!}</fo:block></fo:table-cell>
-              <fo:table-cell padding="3pt" border-top-style="solid" border-bottom-style="${lineStyle}"><fo:block text-align="right">${sumSubTotal!}</fo:block></fo:table-cell>
-              </fo:table-row>
-              <fo:table-row font-size="${fontSize}">
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              </fo:table-row>
-                  </#if>
-
-              </#list>
-              <fo:table-row font-size="${fontSize}">
-              <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
-              <fo:table-cell padding="3pt" number-columns-spanned="6" border-top-style="solid"><fo:block/></fo:table-cell>
-              </fo:table-row>
-              </#if>
-
-            </#list>
-
-            <fo:table-row>
-              <fo:table-cell padding="3pt" number-columns-spanned="6">
-                <fo:block text-align="end">${uiLabelMap.AccountingCheckAmount}</fo:block>
-              </fo:table-cell>
-              <fo:table-cell padding="3pt">
-                <fo:block text-align="end">${payment.getBigDecimal("amount").setScale(decimals, rounding).toString()}</fo:block>
-              </fo:table-cell>
-            </fo:table-row>
-          </fo:table-body>
-        </fo:table>
-
-        </fo:table-cell>
-        </fo:table-row>
-        </fo:table-body>
-        </fo:table>
-
-      </fo:block>
-      </#list>
-      </#if> <#-- security if -->
-    </fo:flow>
-  </fo:page-sequence>
+                <#list payments as payment>
+                    <#assign paymentApplications = payment.getRelated("PaymentApplication", null, null, false)>
+                    <fo:block font-size="10pt" break-before="page"> <#-- 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 -->
+                        <fo:table table-layout="fixed" width="100%">
+                            <fo:table-column column-width="100%"/>
+                            <fo:table-body>
+                                <fo:table-row height="8.85cm">
+                                    <fo:table-cell>
+                                        <fo:table table-layout="fixed" width="100%">
+                                            <fo:table-column column-width="17.7cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-body>
+                                                <fo:table-row>
+                                                    <fo:table-cell><fo:block/></fo:table-cell>
+                                                    <fo:table-cell>
+                                                        <fo:block padding-before="2.2cm">${payment.effectiveDate?date?string.short}</fo:block>
+                                                    </fo:table-cell>
+                                                </fo:table-row>
+                                                <fo:table-row>
+                                                    <fo:table-cell padding-before="0.8cm">
+                                                        <fo:block margin-left="3.0cm">
+                                                            <#assign toPartyNameResult = dispatcher.runSync("getPartyNameForDate", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", payment.partyIdTo, "compareDate", payment.effectiveDate, "userLogin", userLogin))/>
+                                                            ${toPartyNameResult.fullName?default("Name Not Found")}
+                                                        </fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding-before="0.8cm">
+                                                        <fo:block>**${payment.getBigDecimal("amount").setScale(decimals, rounding).toString()}</fo:block>
+                                                    </fo:table-cell>
+                                                </fo:table-row>
+                                                <fo:table-row>
+                                                    <fo:table-cell number-columns-spanned="2">
+                                                        <#assign amount = Static["org.ofbiz.base.util.UtilNumber"].formatRuleBasedAmount(payment.getDouble("amount"), "%dollars-and-hundredths", locale).toUpperCase()>
+                                                        <fo:block padding-before="0.4cm" margin-left="1.3cm">${amount}<#list 1..(100-amount.length()) as x>*</#list></fo:block>
+                                                    </fo:table-cell>
+                                                </fo:table-row>
+                                            </fo:table-body>
+                                        </fo:table>
+                                    </fo:table-cell>
+                                </fo:table-row>
+                            </fo:table-body>
+                        </fo:table>
+                        <#-- payment applications (twice: both blocks are exactly the same) -->
+                    
+                        <#-- this seems to be the only way to force a fixed height in fop -->
+                        <fo:table table-layout="fixed" width="100%">
+                            <fo:table-column column-width="100%"/>
+                            <fo:table-body>
+                                <fo:table-row height="9.3cm">
+                                    <fo:table-cell>
+                                        <fo:table table-layout="fixed" margin-left="5pt" margin-right="5pt" width="100%">
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-header>
+                                                <fo:table-row>
+                                                    <fo:table-cell padding="3pt" number-columns-spanned="3" text-align="center">
+                                                        <fo:block text-align="center">
+                                                            <#assign toPartyNameResult = dispatcher.runSync("getPartyNameForDate", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", payment.partyIdTo, "compareDate", payment.effectiveDate, "userLogin", userLogin))/>
+                                                            ${toPartyNameResult.fullName?default("Name Not Found")}
+                                                        </fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt" number-columns-spanned="4" text-align="center">
+                                                        <fo:block text-align="center">${payment.effectiveDate?date?string.short}</fo:block>
+                                                    </fo:table-cell>
+                                                </fo:table-row>
+                                                <fo:table-row>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block font-weight="bold">${uiLabelMap.CommonDate}</fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block font-weight="bold">${uiLabelMap.CommonType}</fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block font-weight="bold">${uiLabelMap.AccountingReferenceNumber}</fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block font-weight="bold" text-align="right">${uiLabelMap.AccountingPaymentOriginalAmount}</fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block font-weight="bold" text-align="right">${uiLabelMap.AccountingBalanceDue}</fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block font-weight="bold" text-align="right">${uiLabelMap.AccountingPayment}</fo:block>
+                                                    </fo:table-cell>
+                                                </fo:table-row>
+                                            </fo:table-header>
+                                            <fo:table-body>
+                                                <#list paymentApplications as paymentApplication>
+                                                    <#assign invoice = paymentApplication.getRelatedOne("Invoice", false)!>
+                                                    <fo:table-row>
+                                                        <fo:table-cell padding="3pt">
+                                                            <fo:block>${payment.effectiveDate?date?string.short}</fo:block>
+                                                        </fo:table-cell>
+                                                        <fo:table-cell padding="3pt">
+                                                            <fo:block><#if invoice??>${uiLabelMap.AccountingInvoice} : ${invoice.invoiceId}</#if></fo:block>
+                                                        </fo:table-cell>
+                                                        <fo:table-cell padding="3pt">
+                                                            <fo:block>
+                                                                <#if invoice??>${invoice.referenceNumber!}</#if>
+                                                                ${paymentApplication.taxAuthGeoId!}
+                                                            </fo:block>
+                                                        </fo:table-cell>
+                                                        <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                        <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                        <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                        <fo:table-cell padding="3pt">
+                                                            <fo:block text-align="end">${paymentApplication.getBigDecimal("amountApplied").setScale(decimals, rounding).toString()}</fo:block>
+                                                        </fo:table-cell>
+                                                    </fo:table-row>
+                                                        <#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>
+                                                                        <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0></#if>
+                                                                        <#if amount != 0 && quantity == 0 ><#assign quantity = 1></#if>
+                                                                        <#assign subTotal = quantity * amount>
+                                                                        <#assign sumQuantity = sumQuantity + quantity>
+                                                                        <#assign sumAmount = sumAmount + amount>
+                                                                        <#assign sumSubTotal = sumSubTotal + subTotal>
+                                                                    </#if>
+                                                                </#list>
+                                                                <#if sumSubTotal != 0>
+                                                                    <fo:table-row font-size="${fontSize}">
+                                                                        <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                                        <fo:table-cell padding="3pt" number-columns-spanned="3" border-bottom-style="${lineStyle}">
+                                                                            <fo:block font-weight="bold">${payrolGroup.description!}</fo:block>
+                                                                        </fo:table-cell>
+                                                                        <fo:table-cell padding="3pt" border-bottom-style="${lineStyle}" >
+                                                                            <fo:block font-weight="bold" text-align="center">Quantity</fo:block>
+                                                                        </fo:table-cell>
+                                                                        <fo:table-cell padding="3pt" border-bottom-style="${lineStyle}" >
+                                                                            <fo:block font-weight="bold" text-align="center">Amount</fo:block>
+                                                                        </fo:table-cell>
+                                                                        <fo:table-cell padding="3pt" border-bottom-style="${lineStyle}" >
+                                                                            <fo:block font-weight="bold" text-align="center">Sum</fo:block>
+                                                                        </fo:table-cell>
+                                                                    </fo:table-row>
+                                                                </#if>
+                                                                <#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>
+                                                                        <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0></#if>
+                                                                        <#if amount != 0 && quantity == 0 ><#assign quantity = 1></#if>
+                                                                        <#assign subTotal = quantity * amount>
+                                                                        <#assign sumQuantity = sumQuantity + quantity>
+                                                                        <#assign sumAmount = sumAmount + amount>
+                                                                        <#assign sumSubTotal = sumSubTotal + subTotal>
+                                                                        <fo:table-row font-size="${fontSize}">
+                                                                            <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                                            <fo:table-cell padding="3pt" number-columns-spanned="3"><fo:block>${invoiceItemType.description!}</fo:block></fo:table-cell>
+                                                                            <fo:table-cell padding="3pt"><fo:block text-align="center">${quantity!}</fo:block></fo:table-cell>
+                                                                            <fo:table-cell padding="3pt"><fo:block text-align="center">${amount!}</fo:block></fo:table-cell>
+                                                                            <fo:table-cell padding="3pt"><fo:block text-align="center">${subTotal!}</fo:block></fo:table-cell>
+                                                                        </fo:table-row>
+                                                                    </#if>
+                                                            </#list>
+                                                            <#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>
+                                                                    <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0></#if>
+                                                                    <#if amount != 0 && quantity == 0><#assign quantity = 1></#if>
+                                                                    <#assign subTotal = quantity * amount>
+                                                                    <#assign sumQuantity = sumQuantity + quantity>
+                                                                    <#assign sumAmount = sumAmount + amount>
+                                                                    <#assign sumSubTotal = sumSubTotal + subTotal>
+                                                                </#if>
+                                                            </#list>
+                                                            <#if sumSubTotal != 0>
+                                                                <fo:table-row font-size="${fontSize}">
+                                                                    <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                                    <fo:table-cell padding="3pt" number-columns-spanned="3" border-top-style="${lineStyle}"><fo:block/></fo:table-cell>
+                                                                    <fo:table-cell padding="3pt" border-top-style="${lineStyle}"><fo:block text-align="center">${sumQuantity!}</fo:block></fo:table-cell>
+                                                                    <fo:table-cell padding="3pt" border-top-style="${lineStyle}"><fo:block text-align="center">${sumAmount!}</fo:block></fo:table-cell>
+                                                                    <fo:table-cell padding="3pt" border-top-style="solid" border-bottom-style="${lineStyle}"><fo:block text-align="right">${sumSubTotal!}</fo:block></fo:table-cell>
+                                                                </fo:table-row>
+                                                                <fo:table-row font-size="${fontSize}">
+                                                                    <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                                </fo:table-row>
+                                                            </#if>
+                                                        </#list>
+                                                        <fo:table-row font-size="${fontSize}">
+                                                            <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                            <fo:table-cell padding="3pt" number-columns-spanned="6" border-top-style="solid"><fo:block/></fo:table-cell>
+                                                        </fo:table-row>
+                                                    </#if>
+                                                </#list>
+                                                <fo:table-row>
+                                                    <fo:table-cell padding="3pt" number-columns-spanned="6">
+                                                        <fo:block text-align="end">${uiLabelMap.AccountingCheckAmount}</fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block text-align="end">${payment.getBigDecimal("amount").setScale(decimals, rounding).toString()}</fo:block>
+                                                    </fo:table-cell>
+                                                </fo:table-row>
+                                            </fo:table-body>
+                                        </fo:table>
+                                    </fo:table-cell>
+                                </fo:table-row>
+                            </fo:table-body>
+                        </fo:table>
+
+                        <#-- copy of above -->
+                        <#-- this seems to be the only way to force a fixed height in fop -->
+                        <fo:table table-layout="fixed" width="100%">
+                            <fo:table-column column-width="100%"/>
+                            <fo:table-body>
+                                <fo:table-row height="9.3cm">
+                                    <fo:table-cell>
+                                        <fo:table table-layout="fixed" margin-left="5pt" margin-right="5pt" width="100%">
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-column column-width="3cm"/>
+                                            <fo:table-header>
+                                                <fo:table-row>
+                                                    <fo:table-cell padding="3pt" number-columns-spanned="3" text-align="center">
+                                                        <fo:block text-align="center">
+                                                            ${Static["org.ofbiz.party.party.PartyHelper"].getPartyName(delegator, payment.partyIdTo, false)}
+                                                        </fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt" number-columns-spanned="4" text-align="center">
+                                                        <fo:block text-align="center">${payment.effectiveDate?date?string.short}</fo:block>
+                                                    </fo:table-cell>
+                                                </fo:table-row>
+                                                <fo:table-row>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block font-weight="bold">${uiLabelMap.CommonDate}</fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block font-weight="bold">${uiLabelMap.CommonType}</fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block font-weight="bold">${uiLabelMap.AccountingReferenceNumber}</fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block font-weight="bold" text-align="right">${uiLabelMap.AccountingPaymentOriginalAmount}</fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block font-weight="bold" text-align="right">${uiLabelMap.AccountingBalanceDue}</fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block font-weight="bold" text-align="right">${uiLabelMap.AccountingPayment}</fo:block>
+                                                    </fo:table-cell>
+                                                </fo:table-row>
+                                            </fo:table-header>
+                                            <fo:table-body>
+                                                <#list paymentApplications as paymentApplication>
+                                                    <#assign invoice = paymentApplication.getRelatedOne("Invoice", false)!>
+                                                    <fo:table-row>
+                                                        <fo:table-cell padding="3pt">
+                                                            <fo:block>${payment.effectiveDate?date?string.short}</fo:block>
+                                                        </fo:table-cell>
+                                                        <fo:table-cell padding="3pt">
+                                                            <fo:block><#if invoice??>${uiLabelMap.AccountingInvoice} : ${invoice.invoiceId}</#if></fo:block>
+                                                        </fo:table-cell>
+                                                        <fo:table-cell padding="3pt">
+                                                            <fo:block>
+                                                                <#if invoice??>${invoice.referenceNumber!}</#if>
+                                                                ${paymentApplication.taxAuthGeoId!}
+                                                            </fo:block>
+                                                        </fo:table-cell>
+                                                        <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                        <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                        <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                        <fo:table-cell padding="3pt">
+                                                            <fo:block text-align="end">${paymentApplication.getBigDecimal("amountApplied").setScale(decimals, rounding).toString()}</fo:block>
+                                                        </fo:table-cell>
+                                                    </fo:table-row>
+                                                    
+                                                    <#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>
+                                                                    <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0></#if>
+                                                                    <#if amount != 0 && quantity == 0 ><#assign quantity = 1></#if>
+                                                                    <#assign subTotal = quantity * amount>
+                                                                    <#assign sumQuantity = sumQuantity + quantity>
+                                                                    <#assign sumAmount = sumAmount + amount>
+                                                                    <#assign sumSubTotal = sumSubTotal + subTotal>
+                                                                </#if>
+                                                            </#list>
+                                                            <#if sumSubTotal != 0>
+                                                                <fo:table-row font-size="${fontSize}">
+                                                                    <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                                    <fo:table-cell padding="3pt" number-columns-spanned="3" border-bottom-style="${lineStyle}">
+                                                                        <fo:block font-weight="bold">${payrolGroup.description!}</fo:block>
+                                                                    </fo:table-cell>
+                                                                    <fo:table-cell padding="3pt" border-bottom-style="${lineStyle}" >
+                                                                        <fo:block font-weight="bold" text-align="center">Quantity</fo:block>
+                                                                    </fo:table-cell>
+                                                                    <fo:table-cell padding="3pt" border-bottom-style="${lineStyle}" >
+                                                                        <fo:block font-weight="bold" text-align="center">Amount</fo:block>
+                                                                    </fo:table-cell>
+                                                                    <fo:table-cell padding="3pt" border-bottom-style="${lineStyle}" >
+                                                                        <fo:block font-weight="bold" text-align="center">Sum</fo:block>
+                                                                    </fo:table-cell>
+                                                                </fo:table-row>
+                                                            </#if>
+                                                            <#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>
+                                                                    <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0></#if>
+                                                                    <#if amount != 0 && quantity == 0 ><#assign quantity = 1></#if>
+                                                                    <#assign subTotal = quantity * amount>
+                                                                    <#assign sumQuantity = sumQuantity + quantity>
+                                                                    <#assign sumAmount = sumAmount + amount>
+                                                                    <#assign sumSubTotal = sumSubTotal + subTotal>
+                                                                    <fo:table-row font-size="${fontSize}">
+                                                                        <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                                        <fo:table-cell padding="3pt" number-columns-spanned="3"><fo:block>${invoiceItemType.description!}</fo:block></fo:table-cell>
+                                                                        <fo:table-cell padding="3pt"><fo:block text-align="center">${quantity!}</fo:block></fo:table-cell>
+                                                                        <fo:table-cell padding="3pt"><fo:block text-align="center">${amount!}</fo:block></fo:table-cell>
+                                                                        <fo:table-cell padding="3pt"><fo:block text-align="center">${subTotal!}</fo:block></fo:table-cell>
+                                                                    </fo:table-row>
+                                                                </#if>
+                                                            </#list>
+                                                            <#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>
+                                                                    <#if invoiceItem.amount?has_content><#assign amount = invoiceItem.amount!><#else><#assign amount = 0></#if>
+                                                                    <#if amount != 0 && quantity == 0><#assign quantity = 1></#if>
+                                                                    <#assign subTotal = quantity * amount>
+                                                                    <#assign sumQuantity = sumQuantity + quantity>
+                                                                    <#assign sumAmount = sumAmount + amount>
+                                                                    <#assign sumSubTotal = sumSubTotal + subTotal>
+                                                                </#if>
+                                                            </#list>
+                                                            <#if sumSubTotal != 0>
+                                                                <fo:table-row font-size="${fontSize}">
+                                                                    <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                                    <fo:table-cell padding="3pt" number-columns-spanned="3" border-top-style="${lineStyle}"><fo:block/></fo:table-cell>
+                                                                    <fo:table-cell padding="3pt" border-top-style="${lineStyle}"><fo:block text-align="center">${sumQuantity!}</fo:block></fo:table-cell>
+                                                                    <fo:table-cell padding="3pt" border-top-style="${lineStyle}"><fo:block text-align="center">${sumAmount!}</fo:block></fo:table-cell>
+                                                                    <fo:table-cell padding="3pt" border-top-style="solid" border-bottom-style="${lineStyle}"><fo:block text-align="right">${sumSubTotal!}</fo:block></fo:table-cell>
+                                                                </fo:table-row>
+                                                                <fo:table-row font-size="${fontSize}">
+                                                                    <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                                </fo:table-row>
+                                                            </#if>
+                                                        </#list>
+                                                        <fo:table-row font-size="${fontSize}">
+                                                            <fo:table-cell padding="3pt"><fo:block/></fo:table-cell>
+                                                            <fo:table-cell padding="3pt" number-columns-spanned="6" border-top-style="solid"><fo:block/></fo:table-cell>
+                                                        </fo:table-row>
+                                                    </#if>
+                                                </#list>
+                                                <fo:table-row>
+                                                    <fo:table-cell padding="3pt" number-columns-spanned="6">
+                                                        <fo:block text-align="end">${uiLabelMap.AccountingCheckAmount}</fo:block>
+                                                    </fo:table-cell>
+                                                    <fo:table-cell padding="3pt">
+                                                        <fo:block text-align="end">${payment.getBigDecimal("amount").setScale(decimals, rounding).toString()}</fo:block>
+                                                    </fo:table-cell>
+                                                </fo:table-row>
+                                            </fo:table-body>
+                                        </fo:table>
+                                    </fo:table-cell>
+                                </fo:table-row>
+                            </fo:table-body>
+                        </fo:table>
+                    </fo:block>
+                </#list>
+            </#if> <#-- security if -->
+        </fo:flow>
+    </fo:page-sequence>
 </fo:root>
 </#escape>