src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReportsPDF.jrxml
author Víctor Martínez Romanos <victor.martinez@openbravo.com>
Tue, 09 Aug 2016 09:50:55 +0200
changeset 30081 72acd4fea07e
parent 30080 87c9f038283f
child 30082 036a261e3b6f
permissions -rw-r--r--
Fixed issue 33460: code review improvements

Avoid NullPointerException in non-compartive mode
In JasperReport:
* Band height for details restored to 15, so we have the same number of lines as before the change
* Period N-1 label only shown in comparative mode
<?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="GeneralAccountingReportsPDF" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20">
	<property name="ireport.scriptlethandling" value="0"/>
	<property name="ireport.encoding" value="UTF-8"/>
	<property name="ireport.zoom" value="1.6500000000000001"/>
	<property name="ireport.x" value="277"/>
	<property name="ireport.y" value="0"/>
	<import value="net.sf.jasperreports.engine.*"/>
	<import value="java.util.*"/>
	<import value="net.sf.jasperreports.engine.data.*"/>
	<style name="CustSatIndexMarkup" forecolor="#000000" pattern="###0.00;-###0.00" isBlankWhenNull="false" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false">
		<conditionalStyle>
			<conditionExpression><![CDATA[new Boolean($F{elementLevel} == 1)]]></conditionExpression>
			<style fontSize="12" isBold="true"/>
		</conditionalStyle>
		<conditionalStyle>
			<conditionExpression><![CDATA[new Boolean($F{elementLevel} == 2)]]></conditionExpression>
			<style fontSize="11" isBold="false"/>
		</conditionalStyle>
		<conditionalStyle>
			<conditionExpression><![CDATA[new Boolean($F{elementLevel} == 3)]]></conditionExpression>
			<style fontSize="10" isBold="false"/>
		</conditionalStyle>
		<conditionalStyle>
			<conditionExpression><![CDATA[new Boolean($F{elementLevel} >= 4)]]></conditionExpression>
			<style fontSize="9" isBold="false"/>
		</conditionalStyle>
	</style>
	<parameter name="REPORT_SUBTITLE" class="java.lang.String" isForPrompting="false"/>
	<parameter name="TOTAL" class="java.lang.String" isForPrompting="false"/>
	<parameter name="NUMBERFORMAT" class="java.text.DecimalFormat" isForPrompting="false"/>
	<parameter name="companyName" class="java.lang.String"/>
	<parameter name="agno" class="java.lang.String"/>
	<parameter name="agno2" class="java.lang.String"/>
	<parameter name="column" class="java.lang.String"/>
	<parameter name="columnRef" class="java.lang.String"/>
	<parameter name="org" class="java.lang.String"/>
	<parameter name="column1" class="java.lang.String"/>
	<parameter name="columnRef1" class="java.lang.String"/>
	<parameter name="date" class="java.lang.String"/>
	<parameter name="startingDate" class="java.lang.String"/>
	<parameter name="endingDate" class="java.lang.String"/>
	<parameter name="period" class="java.lang.String"/>
	<parameter name="periodRef" class="java.lang.String"/>
	<parameter name="agnoInitial" class="java.lang.String"/>
	<parameter name="agnoRef" class="java.lang.String"/>
	<parameter name="principalTitle" class="java.lang.String"/>
	<parameter name="pageNo" class="java.lang.String"/>
	<parameter name="compareTo" class="java.lang.String">
		<defaultValueExpression><![CDATA[]]></defaultValueExpression>
	</parameter>
	<queryString>
		<![CDATA[]]>
	</queryString>
	<field name="name" class="java.lang.String"/>
	<field name="qty" class="java.math.BigDecimal"/>
	<field name="qtyRef" class="java.math.BigDecimal"/>
	<field name="elementLevel" class="java.lang.Integer"/>
	<field name="groupname" class="java.lang.String"/>
	<field name="pagebreak" class="java.lang.String"/>
	<group name="group" isStartNewPage="true">
		<groupExpression><![CDATA[$F{groupname}]]></groupExpression>
		<groupHeader>
			<band/>
		</groupHeader>
		<groupFooter>
			<band/>
		</groupFooter>
	</group>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band splitType="Stretch"/>
	</title>
	<pageHeader>
		<band height="121" splitType="Stretch">
			<textField>
				<reportElement key="staticText-15" x="0" y="0" width="535" height="18"/>
				<textElement textAlignment="Center" markup="none">
					<font fontName="DejaVu Sans" size="12" isBold="true" pdfFontName="Helvetica-Bold"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{principalTitle}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement key="line-1" x="0" y="71" width="535" height="1" forecolor="#555555"/>
			</line>
			<staticText>
				<reportElement key="staticText-7" x="0" y="23" width="37" height="14"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement>
					<font fontName="DejaVu Sans" size="9" isBold="true"/>
				</textElement>
				<text><![CDATA[Client:]]></text>
			</staticText>
			<textField>
				<reportElement key="staticText-7" x="37" y="23" width="192" height="14"/>
				<textElement markup="none">
					<font fontName="DejaVu Sans" size="9" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{companyName}+ " "+ $P{agnoInitial}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement key="staticText-7" x="464" y="23" width="71" height="14"/>
				<textElement markup="none">
					<font fontName="DejaVu Sans" size="9" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{date}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement key="staticText-7" x="436" y="23" width="28" height="14"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement>
					<font fontName="DejaVu Sans" size="9" isBold="true"/>
				</textElement>
				<text><![CDATA[Date:]]></text>
			</staticText>
			<textField>
				<reportElement key="staticText-7" x="298" y="23" width="138" height="14"/>
				<textElement markup="none">
					<font fontName="DejaVu Sans" size="9" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{org}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement key="staticText-7" x="229" y="23" width="69" height="14"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement>
					<font fontName="DejaVu Sans" size="9" isBold="true"/>
				</textElement>
				<text><![CDATA[Organization:]]></text>
			</staticText>
			<textField>
				<reportElement key="staticText-7" x="62" y="39" width="473" height="14"/>
				<textElement markup="none">
					<font fontName="DejaVu Sans" size="9" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Period:" + $P{period} + (($P{compareTo}.equals("Y")) ? "   Period N-1: "+ $P{periodRef}:"")]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement key="staticText-7" x="0" y="39" width="62" height="14"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement>
					<font fontName="DejaVu Sans" size="9" isBold="true"/>
				</textElement>
				<text><![CDATA[Conditions:]]></text>
			</staticText>
			<line>
				<reportElement key="line-1" x="0" y="19" width="535" height="1"/>
			</line>
			<textField>
				<reportElement key="staticText-7" x="63" y="55" width="472" height="14"/>
				<textElement markup="none">
					<font fontName="DejaVu Sans" size="9" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA["Client N-1: "+ $P{companyName}+ " " +$P{agnoRef}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement key="staticText-7" x="211" y="84" width="112" height="11"/>
				<textElement markup="none">
					<font fontName="DejaVu Sans" size="9" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{agno}]]></textFieldExpression>
			</textField>
			<staticText>
				<reportElement key="staticText-7" mode="Transparent" x="0" y="94" width="112" height="10" forecolor="#000000" backcolor="#FFFFFF"/>
				<textElement textAlignment="Left" rotation="None" markup="none">
					<font fontName="DejaVu Sans" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Element]]></text>
			</staticText>
			<textField>
				<reportElement key="staticText-7" x="376" y="94" width="80" height="10">
					<printWhenExpression><![CDATA[$P{compareTo}.equals("Y")]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right" markup="none">
					<font fontName="DejaVu Sans" size="8" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{column}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement key="staticText-7" x="455" y="94" width="80" height="10">
					<printWhenExpression><![CDATA[$P{compareTo}.equals("Y")]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right" markup="none">
					<font fontName="DejaVu Sans" size="8" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{columnRef}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement key="staticText-7" x="0" y="74" width="229" height="12"/>
				<textElement markup="none">
					<font fontName="DejaVu Sans" size="9" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{groupname}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement key="staticText-7" x="376" y="95" width="157" height="10">
					<printWhenExpression><![CDATA[$P{compareTo}.equals("N")]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right" markup="none">
					<font fontName="DejaVu Sans" size="8" isBold="true"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{column}]]></textFieldExpression>
			</textField>
		</band>
	</pageHeader>
	<columnHeader>
		<band splitType="Stretch"/>
	</columnHeader>
	<detail>
		<band height="15" splitType="Stretch">
			<textField>
				<reportElement key="staticText-7" style="CustSatIndexMarkup" x="0" y="0" width="376" height="14"/>
				<textElement markup="none">
					<font fontName="DejaVu Sans"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{elementLevel}>=4 ? "      " + $F{name}: $F{elementLevel}==3 ? "     " + $F{name}: $F{elementLevel}==2 ? "  " + $F{name}:$F{name}]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement key="staticText-7" x="376" y="0" width="80" height="14">
					<printWhenExpression><![CDATA[$P{compareTo}.equals("Y")]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right" markup="none">
					<font fontName="DejaVu Sans" size="9" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[($F{qty}!=null) ? $P{NUMBERFORMAT}.format($F{qty}).toString() : new String(" ")]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement key="staticText-7" x="455" y="0" width="80" height="14">
					<printWhenExpression><![CDATA[$P{compareTo}.equals("Y")]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right" markup="none">
					<font fontName="DejaVu Sans" size="9" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[($F{qtyRef}!=null) ? $P{NUMBERFORMAT}.format($F{qtyRef}).toString() : new String(" ")]]></textFieldExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement key="staticText-7" x="374" y="0" width="159" height="14">
					<printWhenExpression><![CDATA[$P{compareTo}.equals("N")]]></printWhenExpression>
				</reportElement>
				<textElement textAlignment="Right" markup="none">
					<font fontName="DejaVu Sans" size="9" isBold="false"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[($F{qty}!=null) ? $P{NUMBERFORMAT}.format($F{qty}).toString() : new String(" ")]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band height="40" splitType="Stretch"/>
	</pageFooter>
	<summary>
		<band splitType="Stretch"/>
	</summary>
</jasperReport>