src/org/openbravo/erpCommon/ad_reports/ReportCashflowForecast_sub.jrxml
author Jeneive MalarKodi <jeneive.malarkodi@openbravo.com>
Wed, 23 Sep 2009 11:19:02 +0530
changeset 5069 b4990292ae3e
parent 3857 6d631363ffc7
child 5089 54767c398a62
permissions -rw-r--r--
Fixes Issue 10688: CashFlow Forecast report does not work in PostgreSQL
<?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="ReportCashflowForecast_sub"
		 columnCount="1"
		 printOrder="Vertical"
		 orientation="Portrait"
		 pageWidth="594"
		 pageHeight="802"
		 columnWidth="594"
		 columnSpacing="0"
		 leftMargin="0"
		 rightMargin="0"
		 topMargin="0"
		 bottomMargin="0"
		 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.*" />

	<style 
		name="default"
		isDefault="false"
		vAlign="Middle"
		fontName="Bitstream Vera Sans"
		fontSize="11"
	/>
	<style 
		name="Report_Title"
		isDefault="false"
		leftPadding="5"
		fontName="Bitstream Vera Sans"
		fontSize="18"
	/>
	<style 
		name="Report_Subtitle"
		isDefault="false"
		forecolor="#555555"
		leftPadding="5"
		fontName="Bitstream Vera Sans"
		fontSize="14"
	/>
	<style 
		name="Total_Field"
		isDefault="false"
		mode="Opaque"
		forecolor="#000000"
		backcolor="#CCCCCC"
		vAlign="Middle"
		leftPadding="5"
		fontName="Bitstream Vera Sans"
		fontSize="11"
		isBold="true"
	/>
	<style 
		name="Detail_Header"
		isDefault="false"
		mode="Opaque"
		forecolor="#FFFFFF"
		backcolor="#5D5D5D"
		vAlign="Middle"
		leftBorder="1Point"
		leftBorderColor="#FFFFFF"
		leftPadding="5"
		rightBorder="1Point"
		rightBorderColor="#FFFFFF"
		fontName="Bitstream Vera Sans"
		fontSize="11"
		isBold="true"
	/>
	<style 
		name="GroupHeader_DarkGray"
		isDefault="false"
		mode="Opaque"
		forecolor="#FFFFFF"
		backcolor="#555555"
		vAlign="Middle"
		leftPadding="5"
		fontName="Bitstream Vera Sans"
		fontSize="18"
		isBold="true"
	/>
	<style 
		name="GroupHeader_Gray"
		isDefault="false"
		mode="Opaque"
		backcolor="#999999"
	/>
	<style 
		name="Detail_Line"
		isDefault="false"
		fontName="Bitstream Vera Sans"
		fontSize="11"
	>

		<conditionalStyle>
			<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==1)]]></conditionExpression>
			<style 
				name="Detail_Line"
				isDefault="false"
				mode="Opaque"
				backcolor="#CCCCCC"
			/>
		</conditionalStyle>
	</style>
	<style 
		name="Total_Gray"
		isDefault="false"
		mode="Opaque"
		forecolor="#000000"
		backcolor="#CCCCCC"
	/>
	<style 
		name="Report_Data_Label"
		isDefault="false"
		fontName="Bitstream Vera Sans"
		fontSize="11"
		isBold="true"
	/>
	<style 
		name="Report_Data_Field"
		isDefault="false"
		fontName="Bitstream Vera Sans"
		fontSize="11"
		isBold="false"
	/>
	<style 
		name="Report_Footer"
		isDefault="true"
		fontName="Bitstream Vera Sans"
		fontSize="11"
	/>
	<style 
		name="Group_Data_Label"
		isDefault="false"
		fontName="Bitstream Vera Sans"
		fontSize="14"
		isBold="true"
	/>
	<style 
		name="Group_Data_Field"
		isDefault="false"
		fontName="Bitstream Vera Sans"
		fontSize="14"
	/>
	<style 
		name="Detail_Data_Label"
		isDefault="false"
		mode="Opaque"
		backcolor="#CCCCCC"
		fontName="Bitstream Vera Sans"
		fontSize="11"
		isBold="true"
	/>
	<style 
		name="Detail_Data_Field"
		isDefault="false"
		mode="Opaque"
		backcolor="#CCCCCC"
		fontName="Bitstream Vera Sans"
		fontSize="11"
	/>
	<style 
		name="Group_Footer"
		isDefault="false"
		fontName="Bitstream Vera Sans"
		fontSize="11"
		isBold="true"
	/>

	<parameter name="ATTACH" isForPrompting="false" class="java.lang.String"/>
	<parameter name="BASE_WEB" isForPrompting="false" class="java.lang.String"/>
	<parameter name="BASE_DESIGN" isForPrompting="false" class="java.lang.String"/>
	<parameter name="LANGUAGE" isForPrompting="false" class="java.lang.String">
		<defaultValueExpression ><![CDATA["en_US"]]></defaultValueExpression>
	</parameter>
	<parameter name="USER_CLIENT" isForPrompting="false" class="java.lang.String"/>
	<parameter name="USER_ORG" isForPrompting="false" class="java.lang.String"/>
	<parameter name="Title" isForPrompting="false" class="java.lang.String">
		<defaultValueExpression ><![CDATA["REPORT TITLE"]]></defaultValueExpression>
	</parameter>
	<parameter name="REPORT_SUBTITLE" isForPrompting="false" class="java.lang.String"/>
	<parameter name="AcctID" isForPrompting="false" class="java.lang.String"/>
	<parameter name="DatePlanned" isForPrompting="false" class="java.util.Date"/>
	<parameter name="Partner" isForPrompting="false" class="java.lang.String"/>
	<parameter name="NUMBERFORMAT" isForPrompting="false" class="java.text.DecimalFormat"/>
	<parameter name="LOCALE" isForPrompting="false" class="java.util.Locale"/>
	<parameter name="Org" isForPrompting="false" class="java.lang.String"/>
	<queryString><![CDATA[SELECT BANKACCOUNT,              INITIALBALANCE,             TRUNC(NOW()) AS CURRENTDATE,              INCOME,              PAYMENT,              INCOME-PAYMENT AS INCPAY,   
    INITIALBALANCE+INCOME-PAYMENT AS              FINALSUMMARY, C_BANKACCOUNT_ID,                          '' AS C_DEBT_PAYMENT_ID,              '' AS DATEPLANNED,              '' AS BPARTNER, 
    '' AS DESCRIPTION,              '' AS INVOICENO,              '' AS DATEINVOICED,             '' AS AMOUNT,             '' AS ISRECEIPT,             '' AS URL,
    '' AS ISRECEIPTMESSAGE FROM (                 SELECT (B.CODEBANK || '/' || B.CODEBRANCH || B.DIGITCONTROL || BA.CODEACCOUNT || '.' || BA.DIGITCONTROL) AS BANKACCOUNT, 
    SUM(c_currency_convert(STMTAMT, BL.C_CURRENCY_ID, BA.C_CURRENCY_ID, BL.VALUTADATE, NULL, ba.ad_client_id, ba.ad_org_id)) AS INITIALBALANCE, 
    COALESCE((SELECT SUM(c_currency_convert(DP.AMOUNT, dp.C_CURRENCY_ID, ba.c_Currency_ID, dp.dateplanned,null, ba.ad_client_id, ba.ad_org_id))  
FROM C_DEBT_PAYMENT_V DP              
WHERE C_SETTLEMENT_CANCEL_ID IS NULL                
    AND DP.C_BANKACCOUNT_ID IS NOT NULL                         
    AND C_DEBT_PAYMENT_STATUS(C_SETTLEMENT_CANCEL_ID, CANCEL_PROCESSED, GENERATE_PROCESSED, DP.ISPAID, ISVALID, C_CASHLINE_ID, C_BANKSTATEMENTLINE_ID) = 'P'                
    AND ISRECEIPT = 'Y'               
    AND DP.C_BANKACCOUNT_ID = BA.C_BANKACCOUNT_ID         
    AND 1=1  AND DP.DATEPLANNED <= $P{DatePlanned}                  
    AND NOT EXISTS (SELECT 1                          
                     FROM C_REMITTANCELINE  RL,                                C_REMITTANCE      R, 
                      C_REMITTANCE_TYPE RT                         
                    WHERE R.C_REMITTANCE_ID = RL.C_REMITTANCE_ID  AND R.C_REMITTANCE_TYPE_ID = RT.C_REMITTANCE_TYPE_ID AND CONSOLIDATE = 'Y'                            
    AND (C_DEBT_PAYMENT_ID  = DP.C_DEBT_PAYMENT_ID                             OR C_DEBT_PAYMENT_CANCELLED = DP.C_DEBT_PAYMENT_ID)                          
    AND NOT EXISTS (SELECT 1                                        
                    FROM C_BANKSTATEMENTLINE BSL,                                                   C_BANKSTATEMENT B                                           
                    WHERE BSL.C_DEBT_PAYMENT_ID = RL.C_DEBT_PAYMENT_CANCELLED                                            
                    AND BSL.C_BANKSTATEMENT_ID = B.C_BANKSTATEMENT_ID                                             
                    AND B.PROCESSED='Y'))              ),0) AS INCOME,          
    -COALESCE((SELECT SUM(c_currency_convert(DP.AMOUNT, dp.C_CURRENCY_ID, ba.c_Currency_ID, dp.dateplanned,null, ba.ad_client_id, ba.ad_org_id))               
    FROM C_DEBT_PAYMENT_V DP               WHERE C_SETTLEMENT_CANCEL_ID IS NULL                 AND DP.C_BANKACCOUNT_ID IS NOT NULL                      
    AND C_DEBT_PAYMENT_STATUS(C_SETTLEMENT_CANCEL_ID, CANCEL_PROCESSED, GENERATE_PROCESSED, DP.ISPAID, ISVALID, C_CASHLINE_ID, C_BANKSTATEMENTLINE_ID) = 'P'      
    AND ISRECEIPT='N'                 AND DP.C_BANKACCOUNT_ID = BA.C_BANKACCOUNT_ID                 AND 2=2  AND DP.DATEPLANNED <= $P{DatePlanned}                  
    AND NOT EXISTS (SELECT 1                            FROM C_REMITTANCELINE  RL,                                C_REMITTANCE      R,                           
    C_REMITTANCE_TYPE RT                          WHERE R.C_REMITTANCE_ID = RL.C_REMITTANCE_ID                           
    AND R.C_REMITTANCE_TYPE_ID = RT.C_REMITTANCE_TYPE_ID                            AND CONSOLIDATE = 'Y'                            
    AND (C_DEBT_PAYMENT_ID  = DP.C_DEBT_PAYMENT_ID                             OR C_DEBT_PAYMENT_CANCELLED = DP.C_DEBT_PAYMENT_ID)                       
    AND NOT EXISTS (SELECT 1                             
    FROM C_BANKSTATEMENTLINE BSL,                                                  
    C_BANKSTATEMENT B                                           
    WHERE BSL.C_DEBT_PAYMENT_ID = RL.C_DEBT_PAYMENT_CANCELLED        
    AND BSL.C_BANKSTATEMENT_ID = B.C_BANKSTATEMENT_ID                                           
    AND B.PROCESSED='Y'))               ),0) AS PAYMENT,             BA.C_BANKACCOUNT_ID     
    FROM C_BANKSTATEMENTLINE BL,     
    C_BANKSTATEMENT     BS,           C_BANK              B,           C_BANKACCOUNT       BA     
    WHERE BS.C_BANKSTATEMENT_ID = BL.C_BANKSTATEMENT_ID        AND BA.C_BANKACCOUNT_ID = BS.C_BANKACCOUNT_ID        AND BA.C_BANK_ID = B.C_BANK_ID         AND BS.PROCESSED='Y'        
    AND BS.STATEMENTDATE <= NOW()        AND 3=3    AND B.AD_CLIENT_ID IN ($P!{USER_CLIENT})      AND B.AD_ORG_ID IN ($P!{USER_ORG})       
    GROUP BY (B.CODEBANK || '/' || B.CODEBRANCH || B.DIGITCONTROL || BA.CODEACCOUNT || '.' || BA.DIGITCONTROL), BA.C_BANKACCOUNT_ID, ba.c_Currency_ID, ba.ad_client_id, ba.ad_org_id        ) AAA        
    ORDER BY 1]]></queryString>

	<field name="BANKACCOUNT" class="java.lang.String"/>
	<field name="INITIALBALANCE" class="java.math.BigDecimal"/>
	<field name="CURRENTDATE" class="java.sql.Timestamp"/>
	<field name="INCOME" class="java.math.BigDecimal"/>
	<field name="PAYMENT" class="java.math.BigDecimal"/>
	<field name="INCPAY" class="java.math.BigDecimal"/>
	<field name="FINALSUMMARY" class="java.math.BigDecimal"/>
	<field name="C_BANKACCOUNT_ID" class="java.math.BigDecimal"/>
	<field name="C_DEBT_PAYMENT_ID" class="java.lang.String"/>
	<field name="DATEPLANNED" class="java.lang.String"/>
	<field name="BPARTNER" class="java.lang.String"/>
	<field name="DESCRIPTION" class="java.lang.String"/>
	<field name="INVOICENO" class="java.lang.String"/>
	<field name="DATEINVOICED" class="java.lang.String"/>
	<field name="AMOUNT" class="java.lang.String"/>
	<field name="ISRECEIPT" class="java.lang.String"/>
	<field name="URL" class="java.lang.String"/>
	<field name="ISRECEIPTMESSAGE" class="java.lang.String"/>

	<variable name="DetailFieldTotal" class="java.lang.String" resetType="Report" calculation="Nothing">
	</variable>
		<background>
			<band height="0"  isSplitAllowed="true" >
			</band>
		</background>
		<title>
			<band height="0"  isSplitAllowed="true" >
			</band>
		</title>
		<pageHeader>
			<band height="0"  isSplitAllowed="true" >
			</band>
		</pageHeader>
		<columnHeader>
			<band height="0"  isSplitAllowed="true" >
			</band>
		</columnHeader>
		<detail>
			<band height="16"  isSplitAllowed="true" >
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="Detail_Line"
						x="0"
						y="0"
						width="156"
						height="16"
						key="textField"/>
					<box topBorder="Thin" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000"/>
					<textElement verticalAlignment="Middle">
						<font size="6"/>
					</textElement>
				<textFieldExpression   class="java.lang.String"><![CDATA[$F{BANKACCOUNT}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="Detail_Line"
						x="156"
						y="0"
						width="89"
						height="16"
						key="textField-1"/>
					<box topBorder="Thin" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000"/>
					<textElement textAlignment="Right" verticalAlignment="Middle">
						<font size="6"/>
					</textElement>
				<textFieldExpression   class="java.math.BigDecimal"><![CDATA[$F{INITIALBALANCE}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="Detail_Line"
						x="245"
						y="0"
						width="102"
						height="16"
						key="textField-2"/>
					<box topBorder="Thin" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000"/>
					<textElement textAlignment="Right" verticalAlignment="Middle">
						<font size="6"/>
					</textElement>
				<textFieldExpression   class="java.math.BigDecimal"><![CDATA[$F{INCOME}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="Detail_Line"
						x="347"
						y="0"
						width="98"
						height="16"
						key="textField-3"/>
					<box topBorder="Thin" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000"/>
					<textElement textAlignment="Right" verticalAlignment="Middle">
						<font size="6"/>
					</textElement>
				<textFieldExpression   class="java.math.BigDecimal"><![CDATA[$F{PAYMENT}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						style="Detail_Line"
						x="445"
						y="0"
						width="89"
						height="16"
						key="textField-4"/>
					<box topBorder="Thin" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000"/>
					<textElement textAlignment="Right" verticalAlignment="Middle">
						<font size="6"/>
					</textElement>
				<textFieldExpression   class="java.math.BigDecimal"><![CDATA[$F{FINALSUMMARY}]]></textFieldExpression>
				</textField>
			</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>