我正在尝试创建一个用于支票打印的报告。它的布局是存根,存根,然后检查。我认为最好的方法是将存根的详细信息作为子报告(在报告中插入两次)和检查信息的报告的正常详细信息。第 3 方设备将根据我在该详细信息带中的报告中传递的信息处理“支票”(打印支票的 micr 部分的帐户信息,添加签名和一些防盗“东西”)。
问题是我不知道如何限制子报表上的记录数。我已经尝试在主报表中为乐队设置高度,在主报表中为子报表属性设置高度,在子报表中为报表的高度设置。似乎没有任何效果。我也尝试做类似的事情。
($V{REPORT_COUNT} %15) == 0
现在我不是 Java 人。我们使用 jasper 报表在基于 Python 的 ERP 系统中生成表单。
关于我应该如何设计这份报告的任何建议?还要注意报告的“检查”部分需要在除一页之外的所有页面上都有无效的详细信息。
编辑
例如,假设我们向供应商 FOO 支付 35 张发票。布局将是存根、存根、检查(每个都是页面大小的 1/3)。存根 1 和存根 2 是彼此相同的副本。因此,第一页将在第一存根中显示 15 张发票,然后在下一个存根中显示相同的 15 张发票,然后它将在页面底部 3 打印物理检查详细信息。第 2 页将显示接下来的 15 张发票(与上述相同的布局),但支票详细信息已作废。最后一页将显示剩余的 5 张发票。
页面是穿孔的。我们保留 1 个存根,然后将检查存根发送给供应商。
主报告的jrxml
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ap_checks" language="groovy" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="3fb75d91-5293-4c89-8450-938a5ac37235">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["/Users/pkraus/iReport/"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select
appay.id, appay.batch_id, appay.date, appay.payment_type_id, appay.vendor_id,appay.total,
appay.check_number,
vendors.code as vendor_code,vendors.name as vendor_name,
locations.name,locations.address_one,locations.address_two,locations.city,
states.code as state_code,locations.zip_code
from
ap_payments as appay,
ap_payment_types,
vendors,
locations,
states
where
appay.payment_type_id = ap_payment_types.id and
ap_payment_types.print_check = 't' and
vendors.id = appay.vendor_id and
locations.id = vendors.remit_to_id and
states.id = locations.state_id]]>
</queryString>
<field name="id" class="java.lang.Integer"/>
<field name="batch_id" class="java.lang.Integer"/>
<field name="date" class="java.sql.Date"/>
<field name="payment_type_id" class="java.lang.Integer"/>
<field name="vendor_id" class="java.lang.Integer"/>
<field name="total" class="java.math.BigDecimal"/>
<field name="check_number" class="java.lang.String"/>
<field name="vendor_code" class="java.lang.String"/>
<field name="vendor_name" class="java.lang.String"/>
<field name="name" class="java.lang.String"/>
<field name="address_one" class="java.lang.String"/>
<field name="address_two" class="java.lang.String"/>
<field name="city" class="java.lang.String"/>
<field name="state_code" class="java.lang.String"/>
<field name="zip_code" class="java.lang.String"/>
<detail>
<band height="200" splitType="Stretch">
<subreport isUsingCache="true" runToBottom="false">
<reportElement uuid="71baa8ec-c623-4032-a2b0-381776857ee6" x="0" y="0" width="572" height="152"/>
<subreportParameter name="check_id">
<subreportParameterExpression><![CDATA[$F{id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "ap_checks_stub.jasper"]]></subreportExpression>
</subreport>
</band>
<band height="178"/>
<band height="163">
<textField>
<reportElement uuid="00182356-2626-4e23-90bf-c8ab35d9bd11" x="380" y="54" width="56" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{date}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="042dac2b-6fb5-401d-ab90-11c60cecfa98" x="17" y="114" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{address_one}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="ec25e5af-5b4d-4f5a-8197-62a84e0b5773" x="17" y="125" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{address_two}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="37d3f097-e308-4601-9e1e-e21be81ad57a" x="17" y="134" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{city}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="9df87896-ea75-4411-aeb6-db0b1484d219" x="178" y="134" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{zip_code}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="d99d514e-893b-4b45-ae2b-b8677cee6ed9" x="98" y="134" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{state_code}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="926d835e-adc4-4f4b-a29f-5fa18d45090c" x="17" y="74" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{vendor_code}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="6a8349b5-c86a-4ffc-87b7-84000ebef6af" x="17" y="105" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{vendor_name}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="ed874ea2-a95d-47cd-bf8e-b2b559a5dbbf" x="472" y="54" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{check_number}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
子报表的jrxml
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ap_checks_stub" language="groovy" pageWidth="572" pageHeight="100" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="31589b1a-6d6a-40ff-870b-e84e52104956">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="check_id" class="java.lang.Number"/>
<queryString>
<![CDATA[select
pi.id as payment_id, pi.payment,
vi.number,vi.date,
ap_payments.check_number, vendors.code
from
payment_invoices as pi,
vendor_invoices as vi,
ap_payments,
vendors
where
vi.id = pi.invoice_id and
ap_payments.id = pi.check_id and
ap_payments.vendor_id = vendors.id and
pi.check_id = 1]]>
</queryString>
<field name="payment_id" class="java.lang.Integer"/>
<field name="payment" class="java.math.BigDecimal"/>
<field name="number" class="java.lang.String"/>
<field name="date" class="java.sql.Date"/>
<field name="check_number" class="java.lang.String"/>
<field name="code" class="java.lang.String"/>
<columnHeader>
<band height="24" splitType="Stretch">
<staticText>
<reportElement uuid="424923c4-ac9f-4763-919e-afe81870fb6f" x="0" y="0" width="100" height="20"/>
<textElement/>
<text><![CDATA[number]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="28" splitType="Stretch">
<textField>
<reportElement uuid="4b06f8cf-15d3-44a3-9edf-31e5f760fac6" x="0" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{number}]]></textFieldExpression>
</textField>
<break>
<reportElement uuid="278dc135-0e6b-4d47-84bc-b3bf79c90edf" x="0" y="20" width="100" height="1">
<printWhenExpression><![CDATA[$V{REPORT_COUNT} <= 15]]></printWhenExpression>
</reportElement>
</break>
<textField>
<reportElement uuid="80635d70-845f-4893-9f42-f13a064a255d" x="298" y="8" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="24" splitType="Stretch">
<textField>
<reportElement uuid="bc3035b9-7989-46a4-abf6-ff10ec486a60" x="0" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{code}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<lastPageFooter>
<band height="24">
<textField>
<reportElement uuid="3d6e71b0-7fb7-40ec-9e04-529f39003e71" x="0" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{code}]]></textFieldExpression>
</textField>
</band>
</lastPageFooter>
</jasperReport>