Report in PDF of iReport does not display the fields in the Summary band

0

In the management system I'm working on, I generate a non-fiscal thermal printer voucher in PDF made in iReport using the PHPJasperXML library. In this voucher, when I have only one product (one row) in the Detail band, the Summary band fields are blank. When I have two or more products (two rows or more) in the Detail band, the fields are filled normally. In the iReport preview it works perfectly, with one, two or more products.

You can see below the jrxml code (only the detail and summary band):

<detail>
    <band height="25" splitType="Stretch">
        <textField isStretchWithOverflow="true">
            <reportElement x="0" y="0" width="186" height="12"
                           uuid="e06c4bc6-e0f7-4e0e-8a7b-ab5ce1fd5e62"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement verticalAlignment="Middle">
                <font size="7" isBold="false"/>
                <paragraph leftIndent="5"/>
            </textElement>
            <textFieldExpression>
                <![CDATA[$F{descricao}]]>
            </textFieldExpression>
        </textField>
        <textField pattern="#,##0.00;-#,##0.00">
            <reportElement x="52" y="12" width="67" height="12"
                           uuid="1d928a34-4972-4204-9612-9f0e8a6749d3"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement textAlignment="Center"
                         verticalAlignment="Middle">
                <font size="7"/>
                <paragraph rightIndent="5"/>
            </textElement>
            <textFieldExpression>
                <![CDATA[$F{valor}]]>
            </textFieldExpression>
        </textField>
        <textField pattern="#,##0.00;-#,##0.00">
            <reportElement x="0" y="12" width="52" height="12"
                           uuid="f6d30d04-d0fe-4dd3-a675-377ff6d2b473"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement textAlignment="Center"
                         verticalAlignment="Middle">
                <font size="7"/>
                <paragraph rightIndent="5"/>
            </textElement>
            <textFieldExpression>
                <![CDATA[$F{quantidade}]]>
            </textFieldExpression>
        </textField>
        <textField pattern="#,##0.00;-#,##0.00">
            <reportElement x="119" y="12" width="67" height="12"
                           uuid="0603e3b7-801d-49af-9a06-5d33023c5277"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement textAlignment="Center"
                         verticalAlignment="Middle">
                <font size="7"/>
                <paragraph rightIndent="5"/>
            </textElement>
            <textFieldExpression>
                <![CDATA[$F{subtotal}]]>
            </textFieldExpression>
        </textField>
    </band>
</detail>
<summary>
    <band height="203">
        <staticText>
            <reportElement mode="Opaque" x="0" y="82"
                           width="85" height="16"
                           backcolor="#CCCCCC"
                           uuid="6b173bab-525a-4da5-a564-723a8cbb1fbc"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement verticalAlignment="Middle">
                <font size="7" isBold="true"/>
                <paragraph leftIndent="5"/>
            </textElement>
            <text><![CDATA[R$ TROCO:]]></text>
        </staticText>
        <staticText>
            <reportElement x="0" y="3" width="53" height="12"
                           uuid="c99a6844-ca28-47c7-a022-80d2717bf547"/>
            <textElement textAlignment="Center"
                         verticalAlignment="Bottom">
                <font size="7"/>
                <paragraph leftIndent="5"/>
            </textElement>
            <text><![CDATA[Emissão:]]></text>
        </staticText>
        <staticText>
            <reportElement mode="Opaque" x="0" y="66"
                           width="85" height="16"
                           backcolor="#CCCCCC"
                           uuid="d0b8947e-8183-4a55-8b6d-f238bdac0404"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement verticalAlignment="Middle">
                <font size="7" isBold="true"/>
                <paragraph leftIndent="5"/>
            </textElement>
            <text><![CDATA[R$ TOTAL REC.:]]></text>
        </staticText>
        <textField pattern="#,##0.00;-#,##0.00">
            <reportElement isPrintRepeatedValues="false"
                           x="85" y="82"
                           width="101" height="16"
                           uuid="a15e9cba-0f96-42be-8071-dbd7afecf73a"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement textAlignment="Right"
                         verticalAlignment="Middle">
                <font size="7"/>
                <paragraph rightIndent="5"/>
            </textElement>
            <textFieldExpression>
                <![CDATA[$F{troco}]]>
            </textFieldExpression>
        </textField>
        <textField pattern="#,##0.00;-#,##0.00">
            <reportElement isPrintRepeatedValues="false"
                           x="85" y="34"
                           width="101" height="16"
                           uuid="47411e66-b385-427c-825c-3be4e4abe45e"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement textAlignment="Right"
                         verticalAlignment="Middle">
                <font size="7"/>
                <paragraph rightIndent="5"/>
            </textElement>
            <textFieldExpression>
                <![CDATA[$F{desconto}]]>
            </textFieldExpression>
        </textField>
        <staticText>
            <reportElement mode="Opaque" x="0" y="34"
                           width="85" height="16"
                           backcolor="#CCCCCC"
                           uuid="05f791f7-9e38-4ee2-b7db-8e1ec1d6275f"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement verticalAlignment="Middle">
                <font size="7" isBold="true"/>
                <paragraph leftIndent="5"/>
            </textElement>
            <text><![CDATA[R$ DESCONTO:]]></text>
        </staticText>
        <staticText>
            <reportElement mode="Opaque" x="0" y="18"
                           width="85" height="16"
                           backcolor="#CCCCCC"
                           uuid="3c260ede-9083-41f2-aa35-b2e044fc645a"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement verticalAlignment="Middle">
                <font size="7" isBold="true"/>
                <paragraph leftIndent="5"/>
            </textElement>
            <text><![CDATA[R$ SUBTOTAL:]]></text>
        </staticText>
        <textField>
            <reportElement x="52" y="3" width="134" height="12"
                           uuid="47291c92-c9d1-40ac-a8d8-82247f26f98b"/>
            <textElement verticalAlignment="Top">
                <font size="7"/>
                <paragraph leftIndent="5"/>
            </textElement>
            <textFieldExpression>
                <![CDATA[$F{hoje}]]>
            </textFieldExpression>
        </textField>
        <textField pattern="#,##0.00;-#,##0.00">
            <reportElement isPrintRepeatedValues="false"
                           x="85" y="66"
                           width="101" height="16"
                           uuid="798cef8b-50c8-437b-af79-95526dbcd315"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement textAlignment="Right"
                         verticalAlignment="Middle">
                <font size="7"/>
                <paragraph rightIndent="5"/>
            </textElement>
            <textFieldExpression>
                <![CDATA[$F{total_rec}]]>
            </textFieldExpression>
        </textField>
        <textField pattern="#,##0.00;-#,##0.00">
            <reportElement isPrintRepeatedValues="false"
                           mode="Transparent" x="85" y="18"
                           width="101" height="16"
                           uuid="ac0e949b-93f4-4ded-a654-97230a33cb20"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement textAlignment="Right"
                         verticalAlignment="Middle">
                <font size="7" isBold="false" isItalic="false"
                      isUnderline="false"
                      isStrikeThrough="false"/>
                <paragraph rightIndent="5"/>
            </textElement>
            <textFieldExpression>
                <![CDATA[$F{total_prod}]]>
            </textFieldExpression>
        </textField>
        <textField pattern="#,##0.00;-#,##0.00">
            <reportElement isPrintRepeatedValues="false"
                           x="85" y="50"
                           width="101" height="16"
                           uuid="98a37383-f178-4e9b-817a-66c3ebe183a5"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement textAlignment="Right"
                         verticalAlignment="Middle">
                <font size="7"/>
                <paragraph rightIndent="5"/>
            </textElement>
            <textFieldExpression>
                <![CDATA[$F{total_venda}]]>
            </textFieldExpression>
        </textField>
        <textField isStretchWithOverflow="true">
            <reportElement positionType="Float"
                           stretchType="RelativeToBandHeight"
                           x="0" y="102"
                           width="186" height="98"
                           isPrintWhenDetailOverflows="true"
                           uuid="85f18504-1690-48ae-a11a-02a6b0ef4489"/>
            <box>
                <pen       lineColor="#999999"/>
                <topPen    lineColor="#999999"/>
                <leftPen   lineColor="#999999"/>
                <bottomPen lineColor="#999999"/>
                <rightPen  lineColor="#999999"/>
            </box>
            <textElement markup="none">
                <font size="7" isPdfEmbedded="false"/>
            </textElement>
            <textFieldExpression>
                <![CDATA[$F{pagamentos_venda}]]>
            </textFieldExpression>
        </textField>
        <staticText>
            <reportElement mode="Opaque"
                           x="0" y="50"
                           width="85" height="16"
                           backcolor="#CCCCCC"
                           uuid="1fc6ac4f-3090-4de5-8fd6-7562b4058ecf"/>
            <box>
                <pen       lineWidth="0.25" lineColor="#999999"/>
                <topPen    lineWidth="0.25" lineColor="#999999"/>
                <leftPen   lineWidth="0.25" lineColor="#999999"/>
                <bottomPen lineWidth="0.25" lineColor="#999999"/>
                <rightPen  lineWidth="0.25" lineColor="#999999"/>
            </box>
            <textElement verticalAlignment="Middle">
                <font size="7" isBold="true"/>
                <paragraph leftIndent="5"/>
            </textElement>
            <text><![CDATA[R$ TOTAL:]]></text>
        </staticText>
        <line>
            <reportElement x="0" y="0"
                           width="186" height="1"
                           uuid="e3ab1d85-d813-4fe6-ba0d-70c9bf390b79"/>
        </line>
    </band>
</summary>

The results in PDF:

1 - With one product (one row in the detail band):

2 - With two products (two rows in the detail band):

The values are already ready from the MySQL database, nothing is changed or incremented within the Summary. I already tried with parameter and variable but it did not work.

Does anyone have any ideas? Would it be a problem in the report or some server configuration?

Thanks in advance!

guiih_nastrini's picture
Joined: Aug 16 2018 - 6:23am
Last seen: 4 months 4 days ago

0 Answers:

No answers yet
Feedback