iReport中子报表的执行顺序问题

时间:2018-09-24 13:53:20

标签: jasper-reports

我的报告有问题:我在详细信息区域内有两个子报表,我想在此详细信息区域中显示此子报表的信息。当我的报告开始工作时,iReport会向我显示正确的信息,但是会跳出一个详细信息带。

我的报告是基于员工的,关于第一位员工的信息将跳到第二个详细信息(循环),而关于第二个员工的信息将跳到第三个详细信息(循环)。

我该如何解决?我认为答案与报表和子报表之间的执行顺序有关。

<?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="relFuncionario" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="9bf51761-6084-4072-af51-591f2f4a1524">
    <property name="ireport.zoom" value="1.5"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <parameter name="nomeEmpresa" class="java.lang.String"/>
    <parameter name="arquivoLogo" class="java.lang.String"/>
    <parameter name="nomeLogo" class="java.lang.String"/>
    <parameter name="parametroRelatorio" class="java.lang.Object"/>
    <parameter name="parametroBusca" class="java.lang.Object"/>
    <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
        <defaultValueExpression><![CDATA["/home/dev05/eclipse-workspace/hrrh/src/main/java/br/com/publico/relatorios/"]]></defaultValueExpression>
    </parameter>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <field name="nome" class="java.lang.String"/>
    <field name="nomeFilialRegistro" class="java.lang.String"/>
    <field name="nomeFilialLotado" class="java.lang.String"/>
    <field name="filialMatricula" class="java.lang.String"/>
    <field name="descricaoCargo" class="java.lang.String"/>
    <field name="listaVoVerbaCalculadas" class="java.lang.Object"/>
    <field name="salarioBase" class="java.lang.String"/>
    <field name="nomeCentroCusto" class="java.lang.String"/>
    <field name="setor" class="java.lang.String"/>
    <field name="matricula" class="java.lang.String"/>
    <field name="idFilialRegistro" class="java.lang.String"/>
    <field name="admissao" class="java.lang.String"/>
    <field name="cnpjFilial" class="java.lang.String"/>
    <variable name="cabecalhoRelatorio" class="java.lang.String">
        <initialValueExpression><![CDATA[$P{parametroRelatorio}.getCabecalhoRelatorio()]]></initialValueExpression>
    </variable>
    <variable name="nome" class="java.lang.String">
        <initialValueExpression><![CDATA[$P{parametroRelatorio}.getNome()]]></initialValueExpression>
    </variable>
    <variable name="situacoes" class="java.lang.String">
        <initialValueExpression><![CDATA[$P{parametroRelatorio}.getSituacao()]]></initialValueExpression>
    </variable>
    <variable name="filial" class="java.lang.String">
        <initialValueExpression><![CDATA[$P{parametroRelatorio}.getTbFilial().getNome()]]></initialValueExpression>
    </variable>
    <variable name="totalProventos" class="java.lang.Double" calculation="Sum">
        <initialValueExpression><![CDATA[0.0]]></initialValueExpression>
    </variable>
    <variable name="totalDescontos" class="java.lang.Double" calculation="Sum">
        <initialValueExpression><![CDATA[0.0]]></initialValueExpression>
    </variable>
    <group name="filialGroup" isStartNewPage="true">
        <groupExpression><![CDATA[$F{idFilialRegistro}]]></groupExpression>
        <groupHeader>
            <band height="26">
                <frame>
                    <reportElement x="0" y="1" width="555" height="25" uuid="b7df75a4-0889-451c-b5d4-48ff06c26112"/>
                    <box>
                        <topPen lineWidth="1.0"/>
                        <leftPen lineWidth="1.0"/>
                        <bottomPen lineWidth="1.0"/>
                        <rightPen lineWidth="1.0"/>
                    </box>
                </frame>
                <staticText>
                    <reportElement x="1" y="1" width="150" height="10" uuid="9f9792da-8072-4faf-8105-bf61978df070"/>
                    <textElement markup="none">
                        <font size="7" isBold="false"/>
                    </textElement>
                    <text><![CDATA[Filial/Centro de Custo/Setor:]]></text>
                </staticText>
                <textField pattern="000">
                    <reportElement x="1" y="11" width="10" height="10" uuid="998a0bdc-c8c4-4c55-b4f1-7c15da957dd2"/>
                    <textElement>
                        <font size="7" isBold="false"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{idFilialRegistro}]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement x="16" y="11" width="30" height="10" uuid="39fcd3ff-f501-4055-87db-9801c94fc41f"/>
                    <textElement>
                        <font size="7" isBold="false"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{nomeFilialRegistro}]]></textFieldExpression>
                </textField>
                <line>
                    <reportElement x="11" y="15" width="4" height="1" uuid="6ecd0ac8-99f9-4ce7-8a83-81a5fb58c674"/>
                </line>
                <line>
                    <reportElement x="46" y="12" width="3" height="8" uuid="708bd6c0-be12-4db4-98ec-870c77b15f7f"/>
                </line>
                <textField>
                    <reportElement x="51" y="11" width="30" height="10" uuid="91ebd0dd-fd77-46d2-aeff-f9748d77fd01"/>
                    <textElement>
                        <font size="7" isBold="false"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{nomeCentroCusto}]]></textFieldExpression>
                </textField>
                <line>
                    <reportElement x="101" y="12" width="3" height="8" uuid="35fcf67c-02e6-41ae-baff-fa08baad598e"/>
                </line>
                <textField>
                    <reportElement x="106" y="11" width="30" height="10" uuid="8986626c-a443-449f-b4ea-95de81c1cd5a"/>
                    <textElement>
                        <font size="7" isBold="false"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{setor}]]></textFieldExpression>
                </textField>
                <staticText>
                    <reportElement x="405" y="1" width="40" height="10" uuid="5b75f0ac-5146-4593-b872-4e8a5d04b8cf"/>
                    <textElement markup="none">
                        <font size="7" isBold="false"/>
                    </textElement>
                    <text><![CDATA[CNPJ(MF):]]></text>
                </staticText>
                <textField>
                    <reportElement x="445" y="1" width="110" height="10" uuid="70c24770-ddab-468c-a636-95348359e93f"/>
                    <textElement>
                        <font size="7" isBold="false"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{cnpjFilial}]]></textFieldExpression>
                </textField>
            </band>
        </groupHeader>
    </group>
    <background>
        <band splitType="Stretch"/>
    </background>
    <pageHeader>
        <band height="64" splitType="Stretch">
            <frame>
                <reportElement x="0" y="36" width="280" height="25" uuid="196dcfb4-a08d-4cd2-acc0-b379076dc7f9">
                    <printWhenExpression><![CDATA[$P{arquivoLogo}.isEmpty()]]></printWhenExpression>
                </reportElement>
                <textField>
                    <reportElement x="0" y="0" width="252" height="25" uuid="b9b66888-6cbc-4ed7-a614-1a919b795f2a"/>
                    <textElement>
                        <font size="16" isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$P{nomeEmpresa}]]></textFieldExpression>
                </textField>
            </frame>
            <frame>
                <reportElement x="0" y="36" width="280" height="25" uuid="15227bca-1431-46f0-9a57-a803a8f41c8b">
                    <printWhenExpression><![CDATA[!($P{arquivoLogo}.isEmpty())]]></printWhenExpression>
                </reportElement>
                <image>
                    <reportElement x="0" y="0" width="33" height="25" uuid="0b33b737-397d-4757-841c-c2a4b881eda6">
                        <printWhenExpression><![CDATA[!($P{arquivoLogo}.isEmpty())]]></printWhenExpression>
                    </reportElement>
                    <imageExpression><![CDATA[$P{arquivoLogo}]]></imageExpression>
                </image>
            </frame>
            <textField pattern="dd/MM/yyyy">
                <reportElement x="415" y="38" width="80" height="13" uuid="c22f18dd-abde-473f-bd83-dde46ed1ea06"/>
                <textElement textAlignment="Right">
                    <font isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
            </textField>
            <textField pattern="hh:mm:ss">
                <reportElement x="495" y="38" width="60" height="13" uuid="201a77f3-4bac-455d-8c71-1f81fe42ac88"/>
                <textElement textAlignment="Right">
                    <font isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
            </textField>
            <textField pattern="000">
                <reportElement x="540" y="0" width="15" height="10" uuid="39bf2cc2-bcc7-4dc5-b08f-49f058c76892"/>
                <textElement textAlignment="Right">
                    <font size="7"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="513" y="0" width="27" height="10" uuid="b348eb6d-0d64-4ffd-9f38-0e9810c0c5f7"/>
                <textElement textAlignment="Right">
                    <font size="7"/>
                </textElement>
                <text><![CDATA[Folha]]></text>
            </staticText>
            <textField>
                <reportElement x="455" y="10" width="100" height="14" uuid="1aa89c90-bea8-449f-b4b1-8f4119f453c6"/>
                <textElement textAlignment="Right">
                    <font size="10" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{nomeEmpresa}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="385" y="24" width="170" height="14" uuid="5f3b54a7-f51d-4eb9-ba35-8f4b47dd8165"/>
                <textElement textAlignment="Right">
                    <font size="10" isBold="false"/>
                </textElement>
                <text><![CDATA[Folha de Pagamento Analítica]]></text>
            </staticText>
            <staticText>
                <reportElement x="502" y="51" width="53" height="10" uuid="16a65837-7203-4127-9bc1-0652b9878c1e"/>
                <textElement textAlignment="Right">
                    <font size="7" isBold="false"/>
                </textElement>
                <text><![CDATA[Pessoal v7.0]]></text>
            </staticText>
            <textField>
                <reportElement x="22" y="-48" width="128" height="16" uuid="e52bfeb0-afac-48f8-95e7-dde2bcaf5e1f"/>
                <textElement>
                    <font size="12" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{nomeLogo}]]></textFieldExpression>
            </textField>
        </band>
    </pageHeader>
    <detail>
        <band height="118">
            <frame>
                <reportElement x="305" y="29" width="250" height="10" uuid="72003493-6c88-40f5-9955-9cbcd9ee04e2"/>
                <box>
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                    <rightPen lineWidth="1.0"/>
                </box>
            </frame>
            <staticText>
                <reportElement x="435" y="30" width="50" height="10" uuid="7fdb4c14-81eb-4519-8e0d-612064451ae4"/>
                <textElement textAlignment="Right">
                    <font size="7"/>
                </textElement>
                <text><![CDATA[base]]></text>
            </staticText>
            <textField>
                <reportElement x="40" y="10" width="100" height="10" uuid="9506da18-1fb8-4eff-9cf8-e7552f9d84b4"/>
                <textElement>
                    <font size="7"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{descricaoCargo}]]></textFieldExpression>
            </textField>
            <frame>
                <reportElement x="0" y="29" width="250" height="10" uuid="40d54c35-e7fb-487f-8f0c-55ccf59e34b4"/>
                <box>
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                    <rightPen lineWidth="1.0"/>
                </box>
            </frame>
            <frame>
                <reportElement x="395" y="93" width="40" height="10" uuid="b65905ad-a125-4497-a0d6-536e5d27f173"/>
                <box>
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                    <rightPen lineWidth="1.0"/>
                </box>
            </frame>
            <staticText>
                <reportElement x="0" y="30" width="50" height="10" uuid="583e3146-c6c9-4552-a524-13495eed9f8f"/>
                <textElement>
                    <font size="7"/>
                </textElement>
                <text><![CDATA[Proventos]]></text>
            </staticText>
            <textField pattern="#,##0.00" isBlankWhenNull="true">
                <reportElement x="304" y="93" width="50" height="10" uuid="f33bfe13-138a-40ad-90f3-bbbdf56857cc"/>
                <textElement>
                    <font size="7"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{totalDescontos}]]></textFieldExpression>
            </textField>
            <line>
                <reportElement x="444" y="103" width="100" height="1" uuid="b21b9aa4-5c65-42bc-9810-aad0a09788d1"/>
            </line>
            <textField pattern="#,##0.00" isBlankWhenNull="true">
                <reportElement isPrintRepeatedValues="false" x="195" y="75" width="50" height="10" uuid="ba99655d-66da-4d50-9480-16ab1ec2bbad"/>
                <textElement textAlignment="Right">
                    <font size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{totalProventos}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="305" y="0" width="50" height="10" uuid="34053421-e6b9-4683-9f2b-9e0bcedf143a"/>
                <textElement markup="none">
                    <font size="7" isBold="false"/>
                </textElement>
                <text><![CDATA[Salário/Mês]]></text>
            </staticText>
            <staticText>
                <reportElement x="395" y="103" width="40" height="10" uuid="2eb9016d-8f89-4ea4-938d-5ea956275cdc"/>
                <textElement textAlignment="Center">
                    <font size="7" isBold="true"/>
                </textElement>
                <text><![CDATA[Líquido]]></text>
            </staticText>
            <staticText>
                <reportElement x="305" y="30" width="50" height="10" uuid="aafa4ff2-1c9a-485f-a8cd-abf8e8faa0fb"/>
                <textElement>
                    <font size="7"/>
                </textElement>
                <text><![CDATA[Descontos]]></text>
            </staticText>
            <line>
                <reportElement x="270" y="98" width="10" height="1" uuid="8a5d1ae2-3c99-4e95-bedf-185441530737"/>
            </line>
            <staticText>
                <reportElement x="366" y="93" width="21" height="10" uuid="5d5c7952-9063-4247-a059-4dfd0549161c"/>
                <textElement textAlignment="Center">
                    <font size="7" isBold="true"/>
                </textElement>
                <text><![CDATA[=]]></text>
            </staticText>
            <staticText>
                <reportElement x="305" y="75" width="60" height="10" uuid="f2a13d55-8b3f-4310-b853-7137a7b696e6"/>
                <textElement>
                    <font size="7"/>
                </textElement>
                <text><![CDATA[Total:]]></text>
            </staticText>
            <staticText>
                <reportElement x="195" y="30" width="50" height="10" uuid="26f73d6f-30bd-4e03-809b-432269faf46f"/>
                <textElement textAlignment="Right">
                    <font size="7"/>
                </textElement>
                <text><![CDATA[valor]]></text>
            </staticText>
            <staticText>
                <reportElement x="130" y="30" width="50" height="10" uuid="3e5b0b57-7203-4d90-8ee5-6c17a348a972"/>
                <textElement textAlignment="Right">
                    <font size="7"/>
                </textElement>
                <text><![CDATA[base]]></text>
            </staticText>
            <textField isBlankWhenNull="true">
                <reportElement x="0" y="0" width="40" height="10" uuid="18456f83-bf96-4a2c-a8da-3b1d915c50da"/>
                <textElement>
                    <font size="7"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{filialMatricula}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="500" y="30" width="50" height="10" uuid="59715b84-15ba-4249-88ba-dd51dfcb408d"/>
                <textElement textAlignment="Right">
                    <font size="7"/>
                </textElement>
                <text><![CDATA[valor]]></text>
            </staticText>
            <textField pattern="dd/MM/yyyy">
                <reportElement x="200" y="0" width="60" height="10" uuid="395d9e66-e9cf-4c70-898c-e3c159494c11"/>
                <textElement>
                    <font size="7"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{admissao}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="150" y="0" width="50" height="10" uuid="18540b7e-20c3-4e22-b4f0-90218fdb461f"/>
                <textElement markup="none">
                    <font size="7" isBold="false"/>
                </textElement>
                <text><![CDATA[Admissão:]]></text>
            </staticText>
            <textField pattern="#,##0.00" isBlankWhenNull="true">
                <reportElement x="375" y="10" width="50" height="10" uuid="8a615aff-9a1e-484b-b937-ec0ed25b83c7"/>
                <textElement>
                    <font size="7"/>
                </textElement>
                <textFieldExpression><![CDATA[]]></textFieldExpression>
            </textField>
            <textField pattern="#,##0.00" isBlankWhenNull="true">
                <reportElement x="195" y="93" width="50" height="10" uuid="ae702588-8a8f-4b33-9b64-bd42b2abfa05"/>
                <textElement textAlignment="Right">
                    <font size="7"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{totalProventos}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="375" y="0" width="50" height="10" uuid="c1db1487-eec6-4f04-ad34-df2741af10d5"/>
                <textElement markup="none">
                    <font size="7" isBold="false"/>
                </textElement>
                <text><![CDATA[Salário/DIa]]></text>
            </staticText>
            <textField pattern="dd/MM/yyyy">
                <reportElement x="305" y="10" width="50" height="10" uuid="d7357e03-2dcc-4e9b-9cd0-7fa1b16448d3"/>
                <textElement>
                    <font size="7"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{salarioBase}]]></textFieldExpression>
            </textField>
            <subreport>
                <reportElement x="305" y="41" width="250" height="30" isRemoveLineWhenBlank="true" uuid="838d1250-57c4-4aa0-875e-8d657f2b44a8"/>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{listaVoVerbaCalculadas})]]></dataSourceExpression>
                <returnValue subreportVariable="totalDescontos" toVariable="totalDescontos"/>
                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "relFolhaPagamentoDesconto.jasper"]]></subreportExpression>
            </subreport>
            <subreport>
                <reportElement x="0" y="41" width="250" height="30" isRemoveLineWhenBlank="true" uuid="dcdeb67d-bfd4-451e-b414-00b58ce93666"/>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{listaVoVerbaCalculadas})]]></dataSourceExpression>
                <returnValue subreportVariable="totalProventos" toVariable="totalProventos"/>
                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "relFolhaPagamentoProvento.jasper"]]></subreportExpression>
            </subreport>
            <staticText>
                <reportElement x="0" y="77" width="60" height="10" uuid="38f5fb20-5ffe-44d1-b09d-1846bd78686f"/>
                <textElement>
                    <font size="7"/>
                </textElement>
                <text><![CDATA[Total:]]></text>
            </staticText>
            <staticText>
                <reportElement x="304" y="104" width="65" height="10" uuid="9f1aeb0e-84df-4bc4-a8f6-90e74a44fd28"/>
                <textElement>
                    <font size="7"/>
                </textElement>
                <text><![CDATA[D e s c o n t o s]]></text>
            </staticText>
            <textField pattern="#,##0.00" isBlankWhenNull="true">
                <reportElement x="499" y="76" width="50" height="10" uuid="67862c32-4e9d-40cb-847e-c1fbd419a0ec"/>
                <textElement textAlignment="Right">
                    <font size="7" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{totalDescontos}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="444" y="104" width="99" height="10" uuid="152d10c6-c62c-42b2-8c9f-6b20bae9ad27"/>
                <textElement textAlignment="Center">
                    <font size="7" isBold="true"/>
                </textElement>
                <text><![CDATA[Assinatura]]></text>
            </staticText>
            <staticText>
                <reportElement x="190" y="104" width="60" height="10" uuid="52913fe0-73f3-4c04-9db1-df206b7dc0da"/>
                <textElement textAlignment="Right">
                    <font size="7"/>
                </textElement>
                <text><![CDATA[P r o v e n t o s]]></text>
            </staticText>
            <textField>
                <reportElement x="40" y="0" width="110" height="10" uuid="525e0746-dfde-44fa-951d-825256c79472"/>
                <textElement>
                    <font size="7" isBold="true" isUnderline="false"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{nome}]]></textFieldExpression>
            </textField>
            <textField pattern="#,##0.00" isBlankWhenNull="true">
                <reportElement x="395" y="94" width="40" height="10" uuid="ccbf3a51-9a1b-4c17-821a-17233acd05b7"/>
                <textElement textAlignment="Center">
                    <font size="7" isBold="true" isItalic="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{totalProventos}-$V{totalDescontos}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <pageFooter>
        <band height="14" splitType="Stretch">
            <textField>
                <reportElement mode="Opaque" x="0" y="0" width="515" height="13" backcolor="#E6E6E6" uuid="4a117b25-fba2-440d-8ded-37b006a5837b"/>
                <textElement textAlignment="Right"/>
                <textFieldExpression><![CDATA["Página "+$V{PAGE_NUMBER}+" de"]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report">
                <reportElement mode="Opaque" x="515" y="0" width="40" height="13" backcolor="#E6E6E6" uuid="c6ce9691-c432-4563-8fd1-78d6a0f165bc"/>
                <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement positionType="FixRelativeToBottom" x="220" y="0" width="80" height="13" uuid="24a71db2-5375-4397-a91e-cfecbace18f2"/>
                <textElement>
                    <font size="7"/>
                </textElement>
                <text><![CDATA[relFolhaPagamento]]></text>
            </staticText>
            <textField pattern="ddMMyyyy">
                <reportElement x="0" y="1" width="125" height="13" uuid="11e4c252-beaf-40e9-9972-0cc43e09d451"/>
                <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
            </textField>
        </band>
    </pageFooter>
</jasperReport>

0 个答案:

没有答案