Jump to content
We've recently updated our Privacy Statement, available here ×

5 SubReports on single Master


CaptnTony

Recommended Posts

I have an invoice Report that contains 5 different subreports. Each of the subreports prints fine on it's own (3 of them use a different datasource than the master).

 

The problem I am now running into is that (in iReport 1.2.2) I layout the report like this:

 

(all in the detail band)

subReport1 (Executive Summary)

subReport2 (Local Service Charges)

subReport3 (Long Distance Details - Format 1)

subReport4 (Long Distance Details - Format 2)

subreport5 (Toll Free Call Details)

 

 

But when I populate the report for various customers (both as a PDF file and through previewing with the viewer), the sections *after* the Executive Summary appear on the page 'randomly'. The Executive Summary is 'locked' to the top of the section, while the other 4 subreports are set to 'float'.

 

I've noticed that I can 'predict' how the various sections will be ordered based on what sort of information will appear on the invoice (not all have all the types of services/call details so those sections are set to not print when there is no data).

 

What I'm wondering is if the 'float' setting is causing this to happen. I really need the sections to be printed in the order they appear in the design so invoices won't look different month to month and/or between different customers.

 

 

 

< ------ current version of Invoice jrxml ------ >

 

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport

name="Invoice_Std_01"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="555"

columnSpacing="0"

leftMargin="20"

rightMargin="20"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<property name="ireport.scriptlethandling" value="0" />

<property name="ireport.encoding" value="UTF-8" />

<import value="java.util.*" />

<import value="net.sf.jasperreports.engine.*" />

<import value="net.sf.jasperreports.engine.data.*" />

 

<parameter name="pInvoiceID" isForPrompting="true" class="java.lang.Long">

<defaultValueExpression ><![CDATA[new Long(1)]]></defaultValueExpression>

</parameter>

<parameter name="SUBREPORT_DIR" isForPrompting="true" class="java.lang.String">

<defaultValueExpression ><![CDATA["F:\Shared\Shared Java Components\JasperReports\CIMS\"]]></defaultValueExpression>

</parameter>

<parameter name="conCDRInfo" isForPrompting="true" class="java.sql.Connection">

<parameterDescription><![CDATA[Database Connection to Call Records Database]]></parameterDescription>

</parameter>

<queryString><![CDATA[sELECT BillCycle_InvoiceGroup.Description AS AccountName, Invoice.InvoiceDate, Invoice.DueDate, Invoice.TermsID, Invoice.InvoiceID

FROM Invoice LEFT JOIN BillCycle_InvoiceGroup ON Invoice.InvoiceGroupID = BillCycle_InvoiceGroup.BillCycleInvoiceGroupID

WHERE Invoice.InvoiceID = $P!{pInvoiceID};]]></queryString>

 

<field name="AccountName" class="java.lang.String"/>

<field name="InvoiceDate" class="java.util.Date"/>

<field name="DueDate" class="java.sql.Timestamp"/>

<field name="TermsID" class="java.math.BigDecimal"/>

<field name="InvoiceID" class="java.lang.Long"/>

 

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="104" isSplitAllowed="true" >

<staticText>

<reportElement

x="209"

y="11"

width="339"

height="24"

forecolor="#CC0000"

key="staticText-1"

positionType="Float"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement verticalAlignment="Top">

<font pdfFontName="Helvetica-Bold" size="18" isBold="true"/>

</textElement>

<text><![CDATA[invoice and Account Statement]]></text>

</staticText>

<image isUsingCache="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="4"

y="10"

width="198"

height="89"

key="image-1"

positionType="Float"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<graphicElement stretchType="NoStretch"/>

<imageExpression class="java.lang.String"><![CDATA["F:\Shared\CIMS\images\dti_logo.gif"]]></imageExpression>

</image>

<staticText>

<reportElement

x="210"

y="32"

width="336"

height="16"

forecolor="#999999"

key="staticText-2"

positionType="Float"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement>

<font size="12" isBold="true"/>

</textElement>

<text><![CDATA[24 Hour Customer Care: 1-877-pickdti (1-877-742-5384)]]></text>

</staticText>

<staticText>

<reportElement

x="207"

y="50"

width="52"

height="14"

key="staticText-3"

positionType="Float"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement rotation="None">

<font fontName="Arial" size="12" isBold="true"/>

</textElement>

<text><![CDATA[Account:]]></text>

</staticText>

<staticText>

<reportElement

x="207"

y="65"

width="82"

height="14"

key="staticText-4"

positionType="Float"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement verticalAlignment="Middle">

<font fontName="Arial" size="12" isBold="true"/>

</textElement>

<text><![CDATA[invoice Date:]]></text>

</staticText>

<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="266"

y="50"

width="286"

height="14"

key="textField"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement>

<font fontName="Arial" size="12" isBold="false"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{AccountName}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="MMMMM dd, yyyy" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="294"

y="65"

width="258"

height="14"

key="textField"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement>

<font fontName="Arial" size="12"/>

</textElement>

<textFieldExpression class="java.util.Date"><![CDATA[$F{InvoiceDate}]]></textFieldExpression>

</textField>

<staticText>

<reportElement

x="207"

y="83"

width="102"

height="14"

key="staticText-5"

positionType="Float"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement verticalAlignment="Middle">

<font fontName="Arial" size="12" isBold="true"/>

</textElement>

<text><![CDATA[invoice Number:]]></text>

</staticText>

<textField isStretchWithOverflow="false" pattern="###0;-###0" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="306"

y="83"

width="242"

height="14"

key="textField-1"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement>

<font fontName="Arial" size="12"/>

</textElement>

<textFieldExpression class="java.lang.Long"><![CDATA[$P{pInvoiceID}]]></textFieldExpression>

</textField>

</band>

</title>

<pageHeader>

<band height="0" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="0" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="138" isSplitAllowed="true" >

<subreport isUsingCache="true">

<reportElement

x="3"

y="2"

width="550"

height="24"

key="subExecutiveSummary"

isRemoveLineWhenBlank="true"/>

<subreportParameter name="pInvoiceID">

<subreportParameterExpression><![CDATA[$P{pInvoiceID}]]></subreportParameterExpression>

</subreportParameter>

<subreportParameter name="SUBREPORT_DIR">

<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>

</subreportParameter>

<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>

<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "Invoice_Std_01_ExecSummary.jasper"]]></subreportExpression>

</subreport>

<subreport isUsingCache="true">

<reportElement

mode="Transparent"

x="3"

y="30"

width="550"

height="24"

key="subLocalService"

positionType="Float"/>

<subreportParameter name="SUBREPORT_DIR">

<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>

</subreportParameter>

<subreportParameter name="pInvoiceID">

<subreportParameterExpression><![CDATA[$P{pInvoiceID}]]></subreportParameterExpression>

</subreportParameter>

<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>

<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "Invoice_Std_01_LocalService.jasper"]]></subreportExpression>

</subreport>

<subreport isUsingCache="true">

<reportElement

x="3"

y="58"

width="550"

height="24"

key="subLongDistance-NoAcctCodes"

positionType="Float"/>

<subreportParameter name="pInvoiceID">

<subreportParameterExpression><![CDATA[$P{pInvoiceID}]]></subreportParameterExpression>

</subreportParameter>

<subreportParameter name="conCDRInfo">

<subreportParameterExpression><![CDATA[$P{conCDRInfo}]]></subreportParameterExpression>

</subreportParameter>

<connectionExpression><![CDATA[$P{conCDRInfo}]]></connectionExpression>

<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "Invoice_Std_01_LongDistanceService_NoAcctCodes.jasper"]]></subreportExpression>

</subreport>

<subreport isUsingCache="true">

<reportElement

mode="Transparent"

x="3"

y="86"

width="550"

height="24"

key="subLongDistance-AcctCodes"

positionType="Float"/>

<subreportParameter name="pInvoiceID">

<subreportParameterExpression><![CDATA[$P{pInvoiceID}]]></subreportParameterExpression>

</subreportParameter>

<subreportParameter name="conCDRInfo">

<subreportParameterExpression><![CDATA[$P{conCDRInfo}]]></subreportParameterExpression>

</subreportParameter>

<connectionExpression><![CDATA[$P{conCDRInfo}]]></connectionExpression>

<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "Invoice_Std_01_LongDistanceService_AcctCodes.jasper"]]></subreportExpression>

</subreport>

<subreport isUsingCache="true">

<reportElement

x="3"

y="114"

width="550"

height="24"

key="subTollFree_CallDetail"

positionType="Float"/>

<subreportParameter name="pInvoiceID">

<subreportParameterExpression><![CDATA[$P{pInvoiceID}]]></subreportParameterExpression>

</subreportParameter>

<subreportParameter name="conCDRInfo">

<subreportParameterExpression><![CDATA[$P{conCDRInfo}]]></subreportParameterExpression>

</subreportParameter>

<connectionExpression><![CDATA[$P{conCDRInfo}]]></connectionExpression>

<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "Invoice_Std_01_TollFreeService_CallDetail.jasper"]]></subreportExpression>

</subreport>

</band>

</detail>

<columnFooter>

<band height="0" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="0" isSplitAllowed="true" >

</band>

</pageFooter>

<summary>

<band height="0" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 2 years later...

CaptnTony
Wrote:

That looks like it did the trick! Went to 1.2.5 of JR and iReports 1.2.5 as well.

Thank you much.

Could someone tell me where can I get a method for SQL documentation, I'm looking for a way to document every query I create in I-report with coments and descriptions about sentences, fields, alias, tables, subqueries and stuff aliked.

Thanks,

Carlos S.

Link to comment
Share on other sites

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...