Jump to content
Changes to the Jaspersoft community edition download ×

Wrong pagination and no header on second page with subreport


VORiAND

Recommended Posts

Hi All!

I have one report which includes one summary subreport on the end in the "Summary" band. My problem is, if it has many elements in the "Details" band, the subreport gets on the second page, but on the second page there is no header, the page number is also missing and the signatures are also on the first page, but they should be on the last page. .. So it seems it's a "glitch", but I don't know how can I fix this:

7cyej7z.png.674d4163e39deefb9354957944ce6201.png

iilrcc6.png.206423808064d35986403a87db91b643.png

This is my report source: https://pastebin.com/UrdsU1ni 

(sorry had to use pastebin...)

This is my subreport source:

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 6.5.1  --><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="vat_sum" pageWidth="340" pageHeight="300" orientation="Landscape" columnWidth="300" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="fd6b586b-3b38-484e-879a-f47a65d681ec">    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="MANUFACT_ADAPTER"/>    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>    <parameter name="INVOICE_ID" class="java.lang.Integer"/>    <parameter name="NET_SUM" class="java.math.BigDecimal"/>    <parameter name="VAT_SUM" class="java.math.BigDecimal"/>    <parameter name="GROSS_SUM" class="java.math.BigDecimal"/>    <parameter name="CURRENCY" class="java.lang.String"/>    <parameter name="PAYMENT_TYPE" class="java.lang.Integer">        <parameterDescription><![CDATA[]]></parameterDescription>    </parameter>    <parameter name="NET_TOTAL" class="java.lang.String"/>    <parameter name="VAT" class="java.lang.String"/>    <parameter name="VAT_TOTAL" class="java.lang.String"/>    <parameter name="GROSS_TOTAL" class="java.lang.String"/>    <parameter name="TOTAL_WITH_COLON" class="java.lang.String"/>    <parameter name="TOTAL_PRICE" class="java.lang.String"/>    <parameter name="reverse_charge" class="java.lang.Integer"/>    <parameter name="DAILY_RATE" class="java.math.BigDecimal"/>    <queryString>        <![CDATA[sELECT form_item.`VAT_RATE`,sum(form_item.NET_PRICE) AS NET_PRICE, sum(form_item.`VAT_MONEY`) AS VAT_MONEY, sum(form_item.`GROSS_MONEY`) AS GROSS_MONEYFROM form_itemWHERE form_item.`FORM_ID` = $P{INVOICE_ID} ANDform_item.`DELETED` <> 'deleted'GROUP BY form_item.`VAT_RATE`]]>    </queryString>    <field name="VAT_RATE" class="java.lang.Integer"/>    <field name="NET_PRICE" class="java.math.BigDecimal"/>    <field name="VAT_MONEY" class="java.math.BigDecimal"/>    <field name="GROSS_MONEY" class="java.math.BigDecimal"/>    <background>        <band height="3" splitType="Stretch"/>    </background>    <columnHeader>        <band height="29" splitType="Prevent">            <line>                <reportElement x="-16" y="28" width="332" height="1" uuid="07818547-1a8c-473a-a65c-f3599887fdd4"/>                <graphicElement>                    <pen lineWidth="0.5"/>                </graphicElement>            </line>            <line>                <reportElement x="-16" y="4" width="332" height="1" uuid="1c776d8e-b433-4f5c-8a9f-1640caef9736"/>                <graphicElement>                    <pen lineWidth="0.5"/>                </graphicElement>            </line>            <textField>                <reportElement mode="Opaque" x="65" y="4" width="81" height="24" backcolor="#CFCFCF" uuid="0eb994e5-84a9-4e9c-8f15-0462b2aa19fd"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="8"/>                </textElement>                <textFieldExpression><![CDATA[$P{NET_TOTAL}]]></textFieldExpression>            </textField>            <textField>                <reportElement mode="Opaque" x="146" y="4" width="80" height="24" backcolor="#CFCFCF" uuid="47f0fa71-1cbe-4731-9ae1-091d5c898246"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="8"/>                </textElement>                <textFieldExpression><![CDATA[$P{VAT_TOTAL}]]></textFieldExpression>            </textField>            <textField>                <reportElement mode="Opaque" x="226" y="4" width="90" height="24" backcolor="#CFCFCF" uuid="7558bf9f-bdbc-49d2-a744-97e213b6604a"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="8"/>                </textElement>                <textFieldExpression><![CDATA[$P{GROSS_TOTAL}]]></textFieldExpression>            </textField>            <textField>                <reportElement mode="Opaque" x="-16" y="4" width="81" height="24" backcolor="#CFCFCF" uuid="619e510c-7928-47f7-8d68-b63eb2b10bd0"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="8"/>                </textElement>                <textFieldExpression><![CDATA[$P{VAT}]]></textFieldExpression>            </textField>        </band>    </columnHeader>    <detail>        <band height="22" splitType="Prevent">            <textField pattern="#,##0.##">                <reportElement x="-16" y="0" width="81" height="22" uuid="1902154e-2578-4951-b36c-bca47359e3d4">                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>                </reportElement>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="8"/>                </textElement>                <textFieldExpression><![CDATA[($P{reverse_charge} == 1 ?  "FAD " : "") + $F{VAT_RATE} + "%"]]></textFieldExpression>            </textField>            <textField pattern="#,##0.##">                <reportElement x="65" y="0" width="81" height="22" uuid="89b79230-4abd-4fe2-98d0-850419b86d48"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="8"/>                </textElement>                <textFieldExpression><![CDATA[$F{NET_PRICE}]]></textFieldExpression>            </textField>            <textField pattern="#,##0.##">                <reportElement x="146" y="0" width="80" height="22" uuid="d793763c-7d64-4e2f-a530-a35a3adf121f"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="8"/>                </textElement>                <textFieldExpression><![CDATA[$F{VAT_MONEY}]]></textFieldExpression>            </textField>            <textField pattern="#,##0.##">                <reportElement x="226" y="0" width="90" height="22" uuid="0235855a-96cb-4b9b-8e7d-c8839c74c4fb"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="8"/>                </textElement>                <textFieldExpression><![CDATA[$F{GROSS_MONEY}]]></textFieldExpression>            </textField>        </band>    </detail>    <lastPageFooter>        <band height="70" splitType="Prevent">            <line>                <reportElement x="-16" y="0" width="332" height="1" uuid="7b7970a5-5fc2-45b6-b5f7-4673e8bc1314"/>                <graphicElement>                    <pen lineWidth="0.5"/>                </graphicElement>            </line>            <textField pattern="#,##0.##">                <reportElement x="65" y="3" width="81" height="20" uuid="5e1221ca-617a-4cc6-9df3-50b2ab29e9f8"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="8" isBold="true"/>                </textElement>                <textFieldExpression><![CDATA[$P{NET_SUM}]]></textFieldExpression>            </textField>            <textField pattern="#,##0.##">                <reportElement x="122" y="29" width="168" height="20" uuid="e6275194-7a1b-4f7c-8a8f-0e5017a0c308"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="10" isBold="true" pdfEncoding="Cp1250"/>                </textElement>                <textFieldExpression><![CDATA[$P{GROSS_SUM}]]></textFieldExpression>            </textField>            <textField pattern="#,##0.##">                <reportElement x="146" y="3" width="80" height="20" uuid="c58e6de9-f9b1-4a61-b34b-52c280390023"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="8" isBold="true"/>                </textElement>                <textFieldExpression><![CDATA[$P{VAT_SUM}]]></textFieldExpression>            </textField>            <textField pattern="#,##0.##">                <reportElement x="-16" y="3" width="81" height="20" uuid="064ec625-fefc-4b94-aadd-a1a641859def">                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>                </reportElement>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="8" isBold="true"/>                </textElement>                <textFieldExpression><![CDATA[$P{TOTAL_WITH_COLON}]]></textFieldExpression>            </textField>            <textField pattern="#,##0.##">                <reportElement x="-16" y="29" width="138" height="20" uuid="ed559e1e-f125-445f-ba37-d892fa3e3e10"/>                <textElement>                    <font fontName="DejaVu Sans" size="10" isBold="true"/>                </textElement>                <textFieldExpression><![CDATA[$P{TOTAL_PRICE}]]></textFieldExpression>            </textField>            <textField pattern="#,##0.##">                <reportElement x="226" y="3" width="90" height="20" uuid="e3ecd6a6-0d89-4186-9797-552a062fda8e"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="8" isBold="true"/>                </textElement>                <textFieldExpression><![CDATA[$P{GROSS_SUM}]]></textFieldExpression>            </textField>            <textField>                <reportElement x="-16" y="49" width="138" height="20" uuid="8d73fe0f-a403-4607-aa83-4acf512f2178"/>                <textElement>                    <font fontName="DejaVu Sans" size="10" isBold="true"/>                </textElement>                <textFieldExpression><![CDATA[!$P{CURRENCY}.equals("HUF") ? "VAT Total in HUF / Áfa érték Forintban: " : ""]]></textFieldExpression>            </textField>            <textField pattern="#,##0.##">                <reportElement x="122" y="49" width="194" height="20" uuid="abad0a43-5526-4bad-a553-6aec739559ef"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" size="10" isBold="true" pdfEncoding="Cp1250"/>                </textElement>                <textFieldExpression><![CDATA[$P{PAYMENT_TYPE}.equals(1) && !$P{CURRENCY}.equals("HUF") ?    ($P{DAILY_RATE}.multiply($P{VAT_SUM}).divide(new BigDecimal(5)).setScale(0, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(5)).intValue())  :  !$P{CURRENCY}.equals("HUF") ?  $P{DAILY_RATE}.multiply($P{VAT_SUM}).setScale(0, BigDecimal.ROUND_HALF_UP) + " Forint" : ""]]></textFieldExpression>            </textField>            <textField>                <reportElement x="291" y="29" width="25" height="20" uuid="24e5ca6d-08e8-433b-a523-b0e7f644b28e"/>                <textElement textAlignment="Right" verticalAlignment="Middle">                    <font fontName="DejaVu Sans" isBold="true"/>                </textElement>                <textFieldExpression><![CDATA[$P{CURRENCY}]]></textFieldExpression>            </textField>        </band>    </lastPageFooter></jasperReport>[/code]

Thank you very much!

7cyej7z.png.f14654dd0b09bafc0ff98d2476fc93df.png

iilrcc6.png.5e248af8c63689e58a073cd7150972f9.png

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

This is because u added subreport on summary band and make sure u have given the page header on page header band if u have given header in title it will display on first page itself. Try to create group footer and use the subreport there

Link to comment
Share on other sites

Okay, so with the "Last page footer" it seems to work, but this subreport is now on the bottom of the page, which is not very beautiful... But the bigger probem is, that I got also on the last page the column headers, which shouldn't be there, because there are not details on this page:

7q887qd.png.8abc5849c76dde38a39957141fe02aca.png

dapbp4k_0.png.59b67fe6fe3dd95b915b4973b94ae294.png

How can I remove the column headers from the last page?

7q887qd.png.3c0b5762ff6a502d6e1f28e012e1e34e.png

dapbp4k_0.png.b9cb32f15f959fd0aa71cf20e6180096.png

Link to comment
Share on other sites

Perhaps an slight idea.... at Report-Level you can adjust a property, if the Summary-Band should also have PageHeader-/Footer or if not. The default value is false. So just set it to true, to let the page-footer also appear at Summary band. 

So if the origin problem is just the missing pageheader-/footer at the summary, this could help.

hth + regards

C-Box

Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...