Fixes issue 33460 : New field for comparing ref year in Balance sheet & PL rep.
authorSanjota <sanjota.nelagi@promantia.com>
Mon, 11 Jul 2016 22:13:15 +0200
changeset 30080 87c9f038283f
parent 30079 6e46a5541bbd
child 30081 72acd4fea07e
Fixes issue 33460 : New field for comparing ref year in Balance sheet & PL rep.

New field "Compare To" created to have reference year as optional
Code reference from org.openbravo.report.improved.balancesheet module.
src-db/database/sourcedata/AD_TEXTINTERFACES.xml
src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.html
src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java
src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.xml
src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReportsPDF.jrxml
src/org/openbravo/erpCommon/businessUtility/AccountTree_data.xsql
--- a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Wed Aug 03 09:52:57 2016 -0400
+++ b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Mon Jul 11 22:13:15 2016 +0200
@@ -14414,6 +14414,17 @@
 <!--4D6F7EFED00711DDBE8C001D09C4A2FE-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--4D6F7EFED00711DDBE8C001D09C4A2FE--></AD_TEXTINTERFACES>
 
+<!--4DE64DE174C34EA2AC63A7522575A600--><AD_TEXTINTERFACES>
+<!--4DE64DE174C34EA2AC63A7522575A600-->  <AD_TEXTINTERFACES_ID><![CDATA[4DE64DE174C34EA2AC63A7522575A600]]></AD_TEXTINTERFACES_ID>
+<!--4DE64DE174C34EA2AC63A7522575A600-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--4DE64DE174C34EA2AC63A7522575A600-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--4DE64DE174C34EA2AC63A7522575A600-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--4DE64DE174C34EA2AC63A7522575A600-->  <TEXT><![CDATA[Compare To]]></TEXT>
+<!--4DE64DE174C34EA2AC63A7522575A600-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.html]]></FILENAME>
+<!--4DE64DE174C34EA2AC63A7522575A600-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--4DE64DE174C34EA2AC63A7522575A600-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--4DE64DE174C34EA2AC63A7522575A600--></AD_TEXTINTERFACES>
+
 <!--4E80DAAC37BB49D09A8EF2737160FEF5--><AD_TEXTINTERFACES>
 <!--4E80DAAC37BB49D09A8EF2737160FEF5-->  <AD_TEXTINTERFACES_ID><![CDATA[4E80DAAC37BB49D09A8EF2737160FEF5]]></AD_TEXTINTERFACES_ID>
 <!--4E80DAAC37BB49D09A8EF2737160FEF5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.html	Wed Aug 03 09:52:57 2016 -0400
+++ b/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.html	Mon Jul 11 22:13:15 2016 +0200
@@ -85,7 +85,7 @@
 		setWindowElementFocus(frm.inpAgno);
 		showJSMessage(7);
 		return false;
-	} else if (frm.inpAgnoRef.value == null || frm.inpAgnoRef.value == "") {
+	} else if (frm.inpCompareTo.checked && (frm.inpAgnoRef.value == null || frm.inpAgnoRef.value == "")) {
 		setWindowElementFocus(frm.inpAgnoRef);
 		showJSMessage(7);
 		return false;
@@ -171,6 +171,13 @@
     }
 }
 
+function onClickCompare() {
+	if(document.frmMain.inpCompareTo.checked)
+		displayLogicElement('trReferenceDetails', true);
+	else
+		displayLogicElement('trReferenceDetails', false);
+}
+
 function onloadFunctions() {
 }
 </script>
@@ -490,8 +497,15 @@
                     </TABLE>
                   </TD>
                 </tr>
+                
+                <!-- Improved Balance Sheet -->
+                <tr>
+                  <td class="TitleCell"><span class="LabelText">Compare To</span></td>
+                  <td class="Radio_Check_ContentCell"><input name="inpCompareTo" type="checkbox" id="fieldCompareTo" value="Y" onclick="onClickCompare();"></input></td>
+                </tr>
+                <!-- Improved Balance Sheet -->
 
-                <tr>
+                <tr id="trReferenceDetails">
                 <td class="TitleCell"><span class="LabelText">Reference Year</span></td>
                   <td class="Combo_ContentCell"> <SELECT name="inpAgnoRef" id="paramAgnoRef" class="ComboKey Combo_OneCell_width" onchange="displayLogic(); return true;">
                       <OPTION value=""></OPTION>
--- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java	Wed Aug 03 09:52:57 2016 -0400
+++ b/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java	Mon Jul 11 22:13:15 2016 +0200
@@ -94,14 +94,19 @@
           "GeneralAccountingReports|conImporte", "N");
       String strConCodigo = vars.getGlobalVariable("inpConCodigo",
           "GeneralAccountingReports|conCodigo", "N");
+      /* Improved Balance Sheet */
+      String strCompareTo = vars.getGlobalVariable("inpCompareTo",
+          "GeneralAccountingReports|compareTo", "Y");
+
       String strLevel = vars.getGlobalVariable("inpLevel", "GeneralAccountingReports|level", "");
       printPageDataSheet(response, vars, "", "", strDateFrom, strDateTo, strPageNo, strDateFromRef,
           strDateToRef, strAsDateTo, strAsDateToRef, strElementValue, strConImporte, "", strLevel,
-          strConCodigo, "");
+          strConCodigo, "", strCompareTo);
     } else if (vars.commandIn("FIND")) {
       String strcAcctSchemaId = vars.getStringParameter("inpcAcctSchemaId", "");
       String strAgno = vars.getRequiredGlobalVariable("inpAgno", "GeneralAccountingReports|agno");
-      String strAgnoRef = vars.getRequiredGlobalVariable("inpAgnoRef",
+      /* Improved Balance Sheet */
+      String strAgnoRef = vars.getRequestGlobalVariable("inpAgnoRef",
           "GeneralAccountingReports|agnoRef");
       String strDateFrom = vars.getRequestGlobalVariable("inpDateFrom",
           "GeneralAccountingReports|dateFrom");
@@ -123,12 +128,15 @@
           "GeneralAccountingReports|conImporte");
       String strConCodigo = vars.getRequestGlobalVariable("inpConCodigo",
           "GeneralAccountingReports|conCodigo");
+      /* Improved Balance Sheet */
+      String strCompareTo = vars.getRequestGlobalVariable("inpCompareTo",
+          "GeneralAccountingReports|compareTo");
       String strOrg = vars.getRequestGlobalVariable("inpOrganizacion",
           "GeneralAccountingReports|organizacion");
       String strLevel = vars.getRequestGlobalVariable("inpLevel", "GeneralAccountingReports|level");
       printPagePDF(request, response, vars, strAgno, strAgnoRef, strDateFrom, strDateTo,
           strDateFromRef, strDateToRef, strAsDateTo, strAsDateToRef, strElementValue,
-          strConImporte, strOrg, strLevel, strConCodigo, strcAcctSchemaId, strPageNo);
+          strConImporte, strOrg, strLevel, strConCodigo, strcAcctSchemaId, strPageNo, strCompareTo);
     } else if (vars.commandIn("LEDGER")) {
       String strOrg = vars.getStringParameter("inpOrganizacion");
       if (StringUtils.isEmpty(strOrg)) {
@@ -150,8 +158,8 @@
       VariablesSecureApp vars, String strYearId, String strYearRefId, String strDateFrom,
       String strDateTo, String strDateFromRef, String strDateToRef, String strAsDateTo,
       String strAsDateToRef, String strElementValue, String strConImporte, String strOrg,
-      String strLevel, String strConCodigo, String strcAcctSchemaId, String strPageNo)
-      throws IOException, ServletException {
+      String strLevel, String strConCodigo, String strcAcctSchemaId, String strPageNo,
+      String strCompareTo) throws IOException, ServletException {
     String localStrElementValue = strElementValue;
     String localStrDateToRef = strDateToRef;
     String localStrDateFrom = strDateFrom;
@@ -201,7 +209,13 @@
         Year year = OBDal.getInstance().get(Year.class, strYearId);
         Year yearRef = OBDal.getInstance().get(Year.class, strYearRefId);
         HashMap<String, Date> startingEndingDate = getStartingEndingDate(year);
-        HashMap<String, Date> startingEndingDateRef = getStartingEndingDate(yearRef);
+        /* Improved Balance Sheet */
+        String yrRef = "";
+        HashMap<String, Date> startingEndingDateRef = null;
+        if (strCompareTo.equals("Y")) {
+          yrRef = yearRef.getFiscalYear();
+          startingEndingDateRef = getStartingEndingDate(yearRef);
+        }
         // Years to be included as no closing is present
         String strYearsToClose = "";
         String strYearsToCloseRef = "";
@@ -219,13 +233,16 @@
             strCalculateOpening = "Y";
             strYearsToClose = "," + strYearsToClose;
           }
-          yearsInfo = getYearsToClose(startingEndingDateRef.get("startingDate"), strOrg,
-              yearRef.getCalendar(), strcAcctSchemaId, true);
-          strYearsToCloseRef = yearsInfo[0];
-          openingEntryOwnerRef = yearsInfo[1];
-          if (strYearsToCloseRef.length() > 0) {
-            strCalculateOpening = "Y";
-            strYearsToCloseRef = "," + strYearsToCloseRef;
+          /* Improved Balance Sheet */
+          if (strCompareTo.equals("Y")) {
+            yearsInfo = getYearsToClose(startingEndingDateRef.get("startingDate"), strOrg,
+                yearRef.getCalendar(), strcAcctSchemaId, true);
+            strYearsToCloseRef = yearsInfo[0];
+            openingEntryOwnerRef = yearsInfo[1];
+            if (strYearsToCloseRef.length() > 0) {
+              strCalculateOpening = "Y";
+              strYearsToCloseRef = "," + strYearsToCloseRef;
+            }
           }
         }
         // Income summary amount is calculated and included in the balance sheet data
@@ -246,7 +263,7 @@
               Utility.getContext(this, vars, "#User_Client", "GeneralAccountingReports"),
               localStrDateFrom, DateTimeData.nDaysAfter(this, localStrDateTo, "1"),
               strcAcctSchemaId, Tree.getMembers(this, strTreeOrg, strOrg),
-              "'" + year.getFiscalYear() + "'" + strYearsToClose, openingEntryOwner,
+              "'" + year.getFiscalYear() + "'" + strYearsToClose, openingEntryOwner, strCompareTo,
               localStrDateFromRef, DateTimeData.nDaysAfter(this, localStrDateToRef, "1"), "'"
                   + yearRef.getFiscalYear() + "'" + strYearsToCloseRef, openingEntryOwnerRef);
           {
@@ -257,12 +274,16 @@
                     + "'" + strYearsToClose, strTreeOrg, strOrg, strcAcctSchemaId);
             if (log4j.isDebugEnabled())
               log4j.debug("*********** strISyear: " + strISyear);
-            String strISyearRef = processIncomeSummary(localStrDateFromRef,
-                DateTimeData.nDaysAfter(this, localStrDateToRef, "1"),
-                "'" + yearRef.getFiscalYear() + "'" + strYearsToCloseRef, strTreeOrg, strOrg,
-                strcAcctSchemaId);
-            if (log4j.isDebugEnabled())
-              log4j.debug("*********** strISyearRef: " + strISyearRef);
+            /* Improved Balance Sheet */
+            String strISyearRef = "0";
+            if (strCompareTo.equals("Y")) {
+              strISyearRef = processIncomeSummary(localStrDateFromRef,
+                  DateTimeData.nDaysAfter(this, localStrDateToRef, "1"),
+                  "'" + yearRef.getFiscalYear() + "'" + strYearsToCloseRef, strTreeOrg, strOrg,
+                  strcAcctSchemaId);
+              if (log4j.isDebugEnabled())
+                log4j.debug("*********** strISyearRef: " + strISyearRef);
+            }
             accounts = appendRecords(accounts, strIncomeSummaryAccount, strISyear, strISyearRef);
 
           }
@@ -282,12 +303,12 @@
         parameters.put("group", strGroups);
         parameters.put("agno", year.getFiscalYear());
 
-        parameters.put("agno2", yearRef.getFiscalYear());
+        parameters.put("agno2", yrRef);
         parameters.put("column", year.getFiscalYear());
-        parameters.put("columnRef", yearRef.getFiscalYear());
+        parameters.put("columnRef", yrRef);
         parameters.put("org", OrganizationData.selectOrgName(this, strOrg));
         parameters.put("column1", year.getFiscalYear());
-        parameters.put("columnRef1", yearRef.getFiscalYear());
+        parameters.put("columnRef1", yrRef);
         parameters.put("companyName",
             GeneralAccountingReportsData.companyName(this, vars.getClient()));
         parameters.put("date", DateTimeData.today(this));
@@ -295,15 +316,18 @@
           localStrDateFrom = OBDateUtils.formatDate(startingEndingDate.get("startingDate"));
         if (localStrDateTo.equals(""))
           localStrDateTo = OBDateUtils.formatDate(startingEndingDate.get("endingDate"));
-        if (localStrDateFromRef.equals(""))
-          localStrDateFromRef = OBDateUtils.formatDate(startingEndingDateRef.get("startingDate"));
-        if (localStrDateToRef.equals(""))
-          localStrDateToRef = OBDateUtils.formatDate(startingEndingDateRef.get("endingDate"));
+        /* Improved Balance Sheet */
+        if (strCompareTo.equals("Y")) {
+          if (localStrDateFromRef.equals(""))
+            localStrDateFromRef = OBDateUtils.formatDate(startingEndingDateRef.get("startingDate"));
+          if (localStrDateToRef.equals(""))
+            localStrDateToRef = OBDateUtils.formatDate(startingEndingDateRef.get("endingDate"));
+        }
         parameters.put("period", localStrDateFrom + " - " + localStrDateTo);
         parameters.put("periodRef", localStrDateFromRef + " - " + localStrDateToRef);
         parameters.put("agnoInitial", year.getFiscalYear());
         parameters.put("agnoRef", yearRef.getFiscalYear());
-
+        parameters.put("compareTo", (strCompareTo.equals("Y") ? "Y" : "N"));
         parameters.put(
             "principalTitle",
             strCalculateOpening.equals("Y") ? GeneralAccountingReportsData.rptTitle(this,
@@ -486,7 +510,8 @@
       String strAgno, String strAgnoRef, String strDateFrom, String strDateTo, String strPageNo,
       String strDateFromRef, String strDateToRef, String strAsDateTo, String strAsDateToRef,
       String strElementValue, String strConImporte, String strOrg, String strLevel,
-      String strConCodigo, String strcAcctSchemaId) throws IOException, ServletException {
+      String strConCodigo, String strcAcctSchemaId, String strCompareTo) throws IOException,
+      ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("Output: dataSheet");
     XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
@@ -549,6 +574,8 @@
     xmlDocument.setParameter("asDateToRefsaveFormat", vars.getSessionValue("#AD_SqlDateFormat"));
     xmlDocument.setParameter("conImporte", strConImporte);
     xmlDocument.setParameter("conCodigo", strConCodigo);
+    /* Improved Balance Sheet */
+    xmlDocument.setParameter("compareTo", strCompareTo);
     xmlDocument.setParameter("C_Org_ID", strOrg);
     xmlDocument.setParameter("C_ElementValue_ID", strElementValue);
     xmlDocument.setParameter("level", strLevel);
--- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.xml	Wed Aug 03 09:52:57 2016 -0400
+++ b/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.xml	Mon Jul 11 22:13:15 2016 +0200
@@ -46,6 +46,7 @@
   <PARAMETER id="fieldCheck" name="check" default="Y"/>
   <PARAMETER id="fieldConImporte" name="conImporte" boolean="checked" withId="fieldCheck"/>
   <PARAMETER id="fieldConCodigo" name="conCodigo" boolean="checked" withId="fieldCheck"/>
+  <PARAMETER id="fieldCompareTo" name="compareTo" boolean="checked" withId="fieldCheck"/>
   <PARAMETER id="fieldC_ElementValue_ID" name="C_ElementValue_ID"/>
   <PARAMETER id="fieldC_Org_ID" name="C_Org_ID"/>
   <PARAMETER id="paramLevel" name="level"/>
--- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReportsPDF.jrxml	Wed Aug 03 09:52:57 2016 -0400
+++ b/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReportsPDF.jrxml	Mon Jul 11 22:13:15 2016 +0200
@@ -1,9 +1,9 @@
 <?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" uuid="1de34766-77d8-4a3a-9223-88d6ac76dcb9">
+<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.5"/>
-	<property name="ireport.x" value="0"/>
+	<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.*"/>
@@ -46,6 +46,9 @@
 	<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>
@@ -73,17 +76,17 @@
 	<pageHeader>
 		<band height="121" splitType="Stretch">
 			<textField>
-				<reportElement key="staticText-15" x="0" y="0" width="535" height="18" uuid="793d4469-26a6-483e-ab31-d93d39e76902"/>
+				<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><![CDATA[$P{principalTitle}]]></textFieldExpression>
+				<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" uuid="13b43add-025a-45e9-8995-1919aab54746"/>
+				<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" uuid="44053d39-9800-4d28-a4e4-44ca6bf0d50a"/>
+				<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"/>
@@ -96,21 +99,21 @@
 				<text><![CDATA[Client:]]></text>
 			</staticText>
 			<textField>
-				<reportElement key="staticText-7" x="37" y="23" width="192" height="14" uuid="15801ca4-e016-499d-9f57-831ce66fa6e5"/>
+				<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><![CDATA[$P{companyName}+ " "+ $P{agnoInitial}]]></textFieldExpression>
+				<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" uuid="fef3282d-269a-49b4-8b55-9dc10e37132b"/>
+				<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><![CDATA[$P{date}]]></textFieldExpression>
+				<textFieldExpression class="java.lang.String"><![CDATA[$P{date}]]></textFieldExpression>
 			</textField>
 			<staticText>
-				<reportElement key="staticText-7" x="436" y="23" width="28" height="14" uuid="1d78c0bb-21e3-44ad-9593-fb220dd65c7b"/>
+				<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"/>
@@ -123,14 +126,14 @@
 				<text><![CDATA[Date:]]></text>
 			</staticText>
 			<textField>
-				<reportElement key="staticText-7" x="298" y="23" width="138" height="14" uuid="7eb0f2ad-8837-4b6a-9aaf-56fb0a68066c"/>
+				<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><![CDATA[$P{org}]]></textFieldExpression>
+				<textFieldExpression class="java.lang.String"><![CDATA[$P{org}]]></textFieldExpression>
 			</textField>
 			<staticText>
-				<reportElement key="staticText-7" x="229" y="23" width="69" height="14" uuid="98412d72-0776-43cc-9d76-11ebff6928ed"/>
+				<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"/>
@@ -143,14 +146,14 @@
 				<text><![CDATA[Organization:]]></text>
 			</staticText>
 			<textField>
-				<reportElement key="staticText-7" x="62" y="39" width="473" height="14" uuid="635971d7-1490-4325-8ce9-c5d984c70edf"/>
+				<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><![CDATA["Period:" + $P{period} + "   Period N-1"+ $P{periodRef}]]></textFieldExpression>
+				<textFieldExpression class="java.lang.String"><![CDATA["Period:" + $P{period} + "   Period N-1"+ $P{periodRef}]]></textFieldExpression>
 			</textField>
 			<staticText>
-				<reportElement key="staticText-7" x="0" y="39" width="62" height="14" uuid="5d291dd0-76ee-427b-b14d-876305a70c2d"/>
+				<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"/>
@@ -163,50 +166,62 @@
 				<text><![CDATA[Conditions:]]></text>
 			</staticText>
 			<line>
-				<reportElement key="line-1" x="0" y="19" width="535" height="1" uuid="9b16adcc-98b9-48b6-be1e-aec1543c663e"/>
+				<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" uuid="c0639c17-692f-40ee-9658-e6db7759fb98"/>
+				<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><![CDATA["Client N-1: "+ $P{companyName}+ " " +$P{agnoRef}]]></textFieldExpression>
+				<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" uuid="9274a660-0e3b-4319-9335-a95c0f3b01b7"/>
+				<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><![CDATA[$P{agno}]]></textFieldExpression>
+				<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" uuid="467c5340-b7bc-4283-a149-7d8e324f5db4"/>
+				<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"/>
-					<paragraph lineSpacing="Single"/>
 				</textElement>
 				<text><![CDATA[Element]]></text>
 			</staticText>
 			<textField>
-				<reportElement key="staticText-7" x="376" y="94" width="80" height="10" uuid="199ddce2-e209-4e39-80c1-d9e08964e38c"/>
+				<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><![CDATA[$P{column}]]></textFieldExpression>
+				<textFieldExpression class="java.lang.String"><![CDATA[$P{column}]]></textFieldExpression>
 			</textField>
 			<textField>
-				<reportElement key="staticText-7" x="455" y="94" width="80" height="10" uuid="a46072dd-19c2-4305-82a2-12251937fcde"/>
+				<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><![CDATA[$P{columnRef}]]></textFieldExpression>
+				<textFieldExpression class="java.lang.String"><![CDATA[$P{columnRef}]]></textFieldExpression>
 			</textField>
 			<textField>
-				<reportElement key="staticText-7" x="0" y="74" width="229" height="12" uuid="1c526f90-e915-4987-94ef-85a93e688e29"/>
+				<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><![CDATA[$F{groupname}]]></textFieldExpression>
+				<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>
@@ -214,27 +229,40 @@
 		<band splitType="Stretch"/>
 	</columnHeader>
 	<detail>
-		<band height="15" splitType="Stretch">
+		<band height="17" splitType="Stretch">
 			<textField>
-				<reportElement key="staticText-7" style="CustSatIndexMarkup" x="0" y="0" width="376" height="14" uuid="c4215005-6242-46f7-a913-de5861f16db1"/>
+				<reportElement key="staticText-7" style="CustSatIndexMarkup" x="0" y="0" width="376" height="14"/>
 				<textElement markup="none">
 					<font fontName="DejaVu Sans"/>
 				</textElement>
-				<textFieldExpression><![CDATA[$F{elementLevel}>=4 ? "      " + $F{name}: $F{elementLevel}==3 ? "     " + $F{name}: $F{elementLevel}==2 ? "  " + $F{name}:$F{name}]]></textFieldExpression>
+				<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" uuid="58238d0b-9368-44df-a023-b80d1291b4ce"/>
+				<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><![CDATA[($F{qty}!=null) ? $P{NUMBERFORMAT}.format($F{qty}).toString() : new String(" ")]]></textFieldExpression>
+				<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" uuid="9eef38aa-b277-4b7d-9312-6788aa0678d5"/>
+				<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><![CDATA[($F{qtyRef}!=null) ? $P{NUMBERFORMAT}.format($F{qtyRef}).toString() : new String(" ")]]></textFieldExpression>
+				<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>
--- a/src/org/openbravo/erpCommon/businessUtility/AccountTree_data.xsql	Wed Aug 03 09:52:57 2016 -0400
+++ b/src/org/openbravo/erpCommon/businessUtility/AccountTree_data.xsql	Mon Jul 11 22:13:15 2016 +0200
@@ -134,7 +134,8 @@
                 (COALESCE(f.AMTACCTCR,0) - COALESCE(f.AMTACCTDR, 0)) AS qtyCredit_ref 
                 FROM C_ElementValue m, Fact_Acct f, C_Period p, C_Year y 
                 WHERE m.AD_Org_ID IN('2') 
-                AND m.AD_Client_ID IN('2') 
+                AND m.AD_Client_ID IN('2')
+                AND (1=2 )  
                 AND 2=2 
                 AND f.FACTACCTTYPE <> 'R'
                 AND f.FACTACCTTYPE <> 'C'
@@ -160,6 +161,7 @@
         <Parameter name="openingEntryOwner"/>
         <Parameter name="adOrgClient" type="replace" optional="true" after="m.AD_Org_ID IN(" text="'2'"/>
         <Parameter name="adUserClient" type="replace" optional="true" after="m.AD_Client_ID IN(" text="'2'"/>
+        <Parameter name="compareTo" optional="true" after="AND (1=2 "><![CDATA[ OR to_char('Y')=to_char(?)]]></Parameter>
         <Parameter name="dateFromRef" optional="true" after="AND 2=2 "><![CDATA[ AND f.DATEACCT >= to_date(?)]]></Parameter>
         <Parameter name="dateToRef" optional="true" after="AND 2=2 "><![CDATA[ AND f.DATEACCT < to_date(?)]]></Parameter>
         <Parameter name="acctschema" optional="true" after="AND 2=2 "><![CDATA[ AND f.C_ACCTSCHEMA_ID = ?]]></Parameter>