Fixes issue 27034
authorEduardo Argal Guibert <eduardo.argal@openbravo.com>
Wed, 25 Feb 2015 14:55:59 +0100
changeset 26075 0b5b6b950341
parent 26074 92405876894e
child 26076 05e90afd7678
child 26081 96ba7b028cb7
Fixes issue 27034
Add From/To Account filters to Journal Entries Report
src-db/database/sourcedata/AD_TEXTINTERFACES.xml
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.java
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.xml
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal_data.xsql
--- a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Wed Feb 25 09:53:23 2015 +0100
+++ b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Wed Feb 25 14:55:59 2015 +0100
@@ -13564,6 +13564,17 @@
 <!--23D9E05B782A4D3ABADEFF565FBD5CE4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--23D9E05B782A4D3ABADEFF565FBD5CE4--></AD_TEXTINTERFACES>
 
+<!--24EA40A4D79F416B9CDE6199F9DF5944--><AD_TEXTINTERFACES>
+<!--24EA40A4D79F416B9CDE6199F9DF5944-->  <AD_TEXTINTERFACES_ID><![CDATA[24EA40A4D79F416B9CDE6199F9DF5944]]></AD_TEXTINTERFACES_ID>
+<!--24EA40A4D79F416B9CDE6199F9DF5944-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--24EA40A4D79F416B9CDE6199F9DF5944-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--24EA40A4D79F416B9CDE6199F9DF5944-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--24EA40A4D79F416B9CDE6199F9DF5944-->  <TEXT><![CDATA[From Account]]></TEXT>
+<!--24EA40A4D79F416B9CDE6199F9DF5944-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--24EA40A4D79F416B9CDE6199F9DF5944-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--24EA40A4D79F416B9CDE6199F9DF5944-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--24EA40A4D79F416B9CDE6199F9DF5944--></AD_TEXTINTERFACES>
+
 <!--25584757FAAF48399C3A676DF6C51970--><AD_TEXTINTERFACES>
 <!--25584757FAAF48399C3A676DF6C51970-->  <AD_TEXTINTERFACES_ID><![CDATA[25584757FAAF48399C3A676DF6C51970]]></AD_TEXTINTERFACES_ID>
 <!--25584757FAAF48399C3A676DF6C51970-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -13596,6 +13607,17 @@
 <!--26461A71B3E141A09F3CAE6A29D38875-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--26461A71B3E141A09F3CAE6A29D38875--></AD_TEXTINTERFACES>
 
+<!--26B67B8378AC40A48A2F817925D81096--><AD_TEXTINTERFACES>
+<!--26B67B8378AC40A48A2F817925D81096-->  <AD_TEXTINTERFACES_ID><![CDATA[26B67B8378AC40A48A2F817925D81096]]></AD_TEXTINTERFACES_ID>
+<!--26B67B8378AC40A48A2F817925D81096-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--26B67B8378AC40A48A2F817925D81096-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--26B67B8378AC40A48A2F817925D81096-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--26B67B8378AC40A48A2F817925D81096-->  <TEXT><![CDATA[To Account]]></TEXT>
+<!--26B67B8378AC40A48A2F817925D81096-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--26B67B8378AC40A48A2F817925D81096-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--26B67B8378AC40A48A2F817925D81096-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--26B67B8378AC40A48A2F817925D81096--></AD_TEXTINTERFACES>
+
 <!--26C4AF54C40D42D492048F1882C1FCEB--><AD_TEXTINTERFACES>
 <!--26C4AF54C40D42D492048F1882C1FCEB-->  <AD_TEXTINTERFACES_ID><![CDATA[26C4AF54C40D42D492048F1882C1FCEB]]></AD_TEXTINTERFACES_ID>
 <!--26C4AF54C40D42D492048F1882C1FCEB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html	Wed Feb 25 09:53:23 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html	Wed Feb 25 14:55:59 2015 +0100
@@ -13,7 +13,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2001-2014 Openbravo SLU
+ * All portions are Copyright (C) 2001-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -90,10 +90,30 @@
 }
 
 function onloadFunctions() {
+  keyArray[keyArray.length] = new keyArrayItem("ENTER", "openSearch(null, null, '../info/AccountElementValue.html', 'SELECTOR_ACCOUNTELEMENTVALUE', false, 'frmMain', 'inpcElementValueIdFrom', 'inpElementValueIdFrom_DES', document.frmMain.inpElementValueIdFrom_DES.value, 'inpcAcctSchemaId', document.frmMain.inpcAcctSchemaId.value, 'Command', 'KEY');", "inpElementValueIdFrom_DES", "null");
+  keyArray[keyArray.length] = new keyArrayItem("ENTER", "openSearch(null, null, '../info/AccountElementValue.html', 'SELECTOR_ACCOUNTELEMENTVALUE', false, 'frmMain', 'inpcElementValueIdTo', 'inpElementValueIdTo_DES', document.frmMain.inpElementValueIdTo_DES.value, 'inpcAcctSchemaId', document.frmMain.inpcAcctSchemaId.value, 'Command', 'KEY');", "inpElementValueIdTo_DES", "null");
+}
+
+function validate() {
+  var frm = document.frmMain;
+  var evFrom = frm.inpcElementValueIdFrom.value;
+  var evTo = frm.inpcElementValueIdTo.value;
+
+if (frm.inpcAcctSchemaId.value == null || frm.inpcAcctSchemaId.value == ""){
+    setWindowElementFocus(frm.inpcAcctSchemaId);
+    showJSMessage(7);
+    return false;
+    } else if ((evFrom != null && evFrom != "" && (evTo == null || evTo == ""))
+           ||  (evTo != null && evTo != "" && (evFrom == null || evFrom == ""))) {
+      showJSMessage(27);
+      return false;
+  }
+  return true;
 }
 
 function displayAdvancedFilters(){
     if (advancedFiltersrow1.style.display == 'none') {
+        displayLogicElement('advancedFiltersrow0', true);
         displayLogicElement('advancedFiltersrow1', true);
         displayLogicElement('advancedFiltersrow2', true);
         displayLogicElement('advancedFiltersrow3', true);
@@ -101,6 +121,7 @@
         displayLogicElement('advancedFiltersrow5', true);
     }
     else{
+        displayLogicElement('advancedFiltersrow0', false);
         displayLogicElement('advancedFiltersrow1', false);
         displayLogicElement('advancedFiltersrow2', false);
         displayLogicElement('advancedFiltersrow3', false);
@@ -225,7 +246,9 @@
         setTabTableParentElement();
         enableShortcuts('edition');
         setBrowserAutoComplete(false);
-        
+        try {
+            onloadFunctions();
+          } catch (e) {}        
         resizeArea();
         updateMenuIcon('buttonMenu');
 
@@ -462,6 +485,7 @@
                  <div id="reportC_ACCTSCHEMA_ID"></div> 
                 </select></td>
             </tr>
+            
             <tr>
               <td colspan="6">
                 <table class="FieldGroup" cellspacing="0" cellpadding="0" border="0">
@@ -478,6 +502,52 @@
                 </table>
               </td>
             </tr>
+            <tr id=advancedFiltersrow0>
+              <td class="TitleCell"><span class="LabelText">From Account</span></td>
+              <td class="TextBox_btn_ContentCell" colspan="2">
+                <table border="0" cellspacing="0" cellpadding="0" summary=""  style="padding-top: 0px;">
+                  <tr>
+                    <td class="TextBox_ContentCell">
+                      <input type="hidden" name="inpcElementValueIdFrom" id="paramElementvalueIdFrom" value=""></input>
+                      <input class="dojoValidateValid TextBox_btn_TwoCells_width" type="text"  name="inpElementValueIdFrom_DES" id="inpElementValueIdFrom_DES" maxlength="20" value=""></input>
+                    </td>
+                    <td class="FieldButton_ContentCell">
+                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Account'; return true;" onblur="window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;" onclick="openSearch(null, null, '../info/AccountElementValue.html', 'SELECTOR_ACCOUNTELEMENTVALUE', false, 'frmMain', 'inpcElementValueIdFrom', 'inpElementValueIdFrom_DES', document.frmMain.inpElementValueIdFrom_DES.value, 'inpcAcctSchemaId', document.frmMain.inpcAcctSchemaId.value);return false;">
+                      <table class="FieldButton"  onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='Search';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;">
+                        <tr>
+                          <td class="FieldButton_bg">
+                            <img alt="Account" class="FieldButton_Icon FieldButton_Icon_Account" title="Account" src="../../../../../web/images/blank.gif" border="0"></img>
+                          </td>
+                        </tr>
+                      </table>
+                      </a>
+                    </td>
+                  </tr>
+                </table>
+              </td>
+              <td class="TitleCell"><span class="LabelText">To Account</span></td>
+              <td class="TextBox_btn_ContentCell" colspan="2">
+                <table border="0" cellspacing="0" cellpadding="0" summary=""  style="padding-top: 0px;">
+                  <tr>
+                    <td class="TextBox_ContentCell">
+                      <input type="hidden" name="inpcElementValueIdTo" id="paramElementvalueIdTo" value=""></input>
+                      <input class="dojoValidateValid TextBox_btn_TwoCells_width" type="text"  name="inpElementValueIdTo_DES" id="inpElementValueIdTo_DES" maxlength="20" value=""></input>
+                    </td>
+                    <td class="FieldButton_ContentCell">
+                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Account'; return true;" onblur="window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;" onclick="openSearch(null, null, '../info/AccountElementValue.html', 'SELECTOR_ACCOUNTELEMENTVALUE', false, 'frmMain', 'inpcElementValueIdTo', 'inpElementValueIdTo_DES', document.frmMain.inpElementValueIdTo_DES.value, 'inpcAcctSchemaId', document.frmMain.inpcAcctSchemaId.value);return false;">
+                      <table class="FieldButton"  onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='Search';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;">
+                        <tr>
+                          <td class="FieldButton_bg">
+                            <img alt="Account" class="FieldButton_Icon FieldButton_Icon_Account" title="Account" src="../../../../../web/images/blank.gif" border="0"></img>
+                          </td>
+                        </tr>
+                      </table>
+                      </a>
+                    </td>
+                  </tr>
+                </table>
+              </td>
+            </tr>
             <tr id=advancedFiltersrow1>
              <td class="TitleCell"><span class="LabelText">Document</span></td>
               <td class="Combo_ContentCell" colspan="2"> <select  name="inpDocument" id="inpDocument" class="Combo Combo_TwoCells_width">
@@ -542,7 +612,7 @@
                   <button type="button" 
                     id="buttonHTML" 
                     class="ButtonLink" 
-                    onclick="submitCommandForm('FIND', false, frmMain, 'ReportGeneralLedgerJournal.html', '_self');return false;" 
+                    onclick="submitCommandForm('FIND', true, frmMain, 'ReportGeneralLedgerJournal.html', '_self');return false;" 
                     onfocus="buttonEvent('onfocus', this); window.status='View Results in a New Window'; return true;" 
                     onblur="buttonEvent('onblur', this);" 
                     onkeyup="buttonEvent('onkeyup', this);" 
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.java	Wed Feb 25 09:53:23 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.java	Wed Feb 25 14:55:59 2015 +0100
@@ -127,9 +127,26 @@
           "ReportGeneralLedgerJournal|EntryNo", "1");
       String strShowDescription = vars.getGlobalVariable("inpShowDescription",
           "ReportGeneralLedgerJournal|ShowDescription", "");
+      String strcelementvaluefrom = vars.getGlobalVariable("inpcElementValueIdFrom",
+          "ReportGeneralLedgerJournal|C_ElementValue_IDFROM", "");
+      String strcelementvalueto = vars.getGlobalVariable("inpcElementValueIdTo",
+          "ReportGeneralLedgerJournal|C_ElementValue_IDTO", "");
+      String strcelementvaluefromdes = "", strcelementvaluetodes = "";
+      if (!strcelementvaluefrom.equals(""))
+        strcelementvaluefromdes = ReportGeneralLedgerData.selectSubaccountDescription(this,
+            strcelementvaluefrom);
+      if (!strcelementvalueto.equals(""))
+        strcelementvaluetodes = ReportGeneralLedgerData.selectSubaccountDescription(this,
+            strcelementvalueto);
+      strcelementvaluefromdes = (strcelementvaluefromdes.equals("null")) ? ""
+          : strcelementvaluefromdes;
+      strcelementvaluetodes = (strcelementvaluetodes.equals("null")) ? "" : strcelementvaluetodes;
+      vars.setSessionValue("inpElementValueIdFrom_DES", strcelementvaluefromdes);
+      vars.setSessionValue("inpElementValueIdTo_DES", strcelementvaluetodes);
       printPageDataSheet(response, vars, strDateFrom, strDateTo, strDocument, strOrg, strTable,
           strRecord, "", strcAcctSchemaId, strShowClosing, strShowReg, strShowOpening, strPageNo,
-          strEntryNo, strShowDescription, strShowRegular, strShowDivideUp, "", "");
+          strEntryNo, strShowDescription, strShowRegular, strShowDivideUp, "", "",
+          strcelementvaluefrom, strcelementvalueto, strcelementvaluefromdes, strcelementvaluetodes);
     } else if (vars.commandIn("DIRECT")) {
       String strTable = vars.getGlobalVariable("inpTable", "ReportGeneralLedgerJournal|Table");
       String strRecord = vars.getGlobalVariable("inpRecord", "ReportGeneralLedgerJournal|Record");
@@ -156,14 +173,14 @@
       setHistoryCommand(request, "DIRECT");
       vars.setSessionValue("ReportGeneralLedgerJournal.initRecordNumber", "0");
       printPageDataSheet(response, vars, "", "", "", "", strTable, strRecord, "", strcAcctSchemaId,
-          "", "", "", "1", "1", "", "Y", "", schemas, strPosted);
+          "", "", "", "1", "1", "", "Y", "", schemas, strPosted, "", "", "", "");
     } else if (vars.commandIn("DIRECT2")) {
       String strFactAcctGroupId = vars.getGlobalVariable("inpFactAcctGroupId",
           "ReportGeneralLedgerJournal|FactAcctGroupId");
       setHistoryCommand(request, "DIRECT2");
       vars.setSessionValue("ReportGeneralLedgerJournal.initRecordNumber", "0");
       printPageDataSheet(response, vars, "", "", "", "", "", "", strFactAcctGroupId, "", "", "",
-          "", "1", "1", "", "Y", "", "", "");
+          "", "1", "1", "", "Y", "", "", "", "", "", "", "");
     } else if (vars.commandIn("FIND")) {
       String strcAcctSchemaId = vars.getRequestGlobalVariable("inpcAcctSchemaId",
           "ReportGeneralLedger|cAcctSchemaId");
@@ -224,9 +241,23 @@
           "ReportGeneralLedgerJournal|ShowDescription");
       if (strShowDescription == null || "".equals(strShowDescription))
         vars.setSessionValue("ReportGeneralLedgerJournal|ShowDescription", "N");
+      String strcelementvaluefrom = vars.getRequestGlobalVariable("inpcElementValueIdFrom",
+          "ReportGeneralLedgerJournal|C_ElementValue_IDFROM");
+      String strcelementvalueto = vars.getRequestGlobalVariable("inpcElementValueIdTo",
+          "ReportGeneralLedgerJournal|C_ElementValue_IDTO");
+      String strcelementvaluefromdes = "", strcelementvaluetodes = "";
+      if (!strcelementvaluefrom.equals(""))
+        strcelementvaluefromdes = ReportGeneralLedgerData.selectSubaccountDescription(this,
+            strcelementvaluefrom);
+      if (!strcelementvalueto.equals(""))
+        strcelementvaluetodes = ReportGeneralLedgerData.selectSubaccountDescription(this,
+            strcelementvalueto);
+      vars.setSessionValue("inpElementValueIdFrom_DES", strcelementvaluefromdes);
+      vars.setSessionValue("inpElementValueIdTo_DES", strcelementvaluetodes);
       printPageDataSheet(response, vars, strDateFrom, strDateTo, strDocument, strOrg, "", "", "",
           strcAcctSchemaId, strShowClosing, strShowReg, strShowOpening, strPageNo, strEntryNo,
-          strShowDescription, strShowRegular, strShowDivideUp, "", "");
+          strShowDescription, strShowRegular, strShowDivideUp, "", "", strcelementvaluefrom,
+          strcelementvalueto, strcelementvaluefromdes, strcelementvaluetodes);
     } else if (vars.commandIn("PDF", "XLS")) {
       if (log4j.isDebugEnabled())
         log4j.debug("PDF");
@@ -306,10 +337,14 @@
       }
       // vars.setSessionValue("ReportGeneralLedgerJournal.initRecordNumber", "0");
       setHistoryCommand(request, "DEFAULT");
+      String strcelementvaluefrom = vars.getRequestGlobalVariable("inpcElementValueIdFrom",
+          "ReportGeneralLedgerJournal|C_ElementValue_IDFROM");
+      String strcelementvalueto = vars.getRequestGlobalVariable("inpcElementValueIdTo",
+          "ReportGeneralLedgerJournal|C_ElementValue_IDTO");
       printPagePDF(request, response, vars, strDateFrom, strDateTo, strDocument, strOrg, strTable,
           strRecord, strFactAcctGroupId, strcAcctSchemaId, strShowClosing, strShowReg,
           strShowOpening, strPageNo, strEntryNo, "Y".equals(strShowDescription) ? "Y" : "",
-          strShowRegular, strShowDivideUp);
+          strShowRegular, strShowDivideUp, strcelementvaluefrom, strcelementvalueto);
     } else if (vars.commandIn("PREVIOUS_RELATION")) {
       String strInitRecord = vars.getSessionValue("ReportGeneralLedgerJournal.initRecordNumber");
       String strPreviousRecordRange = vars.getSessionValue(PREVIOUS_RANGE);
@@ -373,7 +408,12 @@
       String strRecord, String strFactAcctGroupId, String strcAcctSchemaId, String strShowClosing,
       String strShowReg, String strShowOpening, String strPageNo, String strEntryNo,
       String strShowDescription, String strShowRegular, String strShowDivideUp, String accShemas,
-      String strPosted) throws IOException, ServletException {
+      String strPosted, String strcelementvaluefrom, String strcelementvalueto,
+      String strcelementvaluefromdes, String strcelementvaluetodes) throws IOException,
+      ServletException {
+    String strAllaccounts = "Y";
+    if (strcelementvaluefrom != null && !strcelementvaluefrom.equals(""))
+      strAllaccounts = "N";
     String strRecordRange = Utility.getContext(this, vars, "#RecordRange",
         "ReportGeneralLedgerJournal");
     int intRecordRangePredefined = (strRecordRange.equals("") ? 0 : Integer
@@ -407,7 +447,8 @@
             Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"),
             Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportGeneralLedger"),
             strDateFrom, DateTimeData.nDaysAfter(this, strDateTo, "1"), strDocument,
-            strcAcctSchemaId, strOrgFamily, strCheck);
+            strcAcctSchemaId, strOrgFamily, strCheck, strAllaccounts, strcelementvaluefrom,
+            strcelementvalueto);
         String strInitAcctEntries = vars.getSessionValue(PREVIOUS_ACCTENTRIES);
         int acctEntries = (strInitAcctEntries.equals("") ? 0 : Integer.parseInt(strInitAcctEntries
             .split(",")[0]));
@@ -462,14 +503,15 @@
             Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"),
             Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportGeneralLedger"),
             strDateFrom, DateTimeData.nDaysAfter(this, strDateTo, "1"), strDocument,
-            strcAcctSchemaId, strOrgFamily, strCheck, vars.getLanguage(), initRecordNumber,
-            intRecordRangeUsed);
+            strcAcctSchemaId, strOrgFamily, strCheck, strAllaccounts, strcelementvaluefrom,
+            strcelementvalueto, vars.getLanguage(), initRecordNumber, intRecordRangeUsed);
         if (data != null && data.length > 0)
           strPosition = ReportGeneralLedgerJournalData.selectCount(this,
               Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"),
               Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportGeneralLedger"),
               strDateFrom, DateTimeData.nDaysAfter(this, strDateTo, "1"), strDocument,
-              strcAcctSchemaId, strOrgFamily, strCheck, data[0].dateacct, data[0].identifier);
+              strcAcctSchemaId, strOrgFamily, strCheck, strAllaccounts, strcelementvaluefrom,
+              strcelementvalueto, data[0].dateacct, data[0].identifier);
       } else {
         data = ReportGeneralLedgerJournalData.selectDirect(this,
             "Y".equals(strShowDescription) ? "'Y'" : "'N'",
@@ -621,6 +663,10 @@
     xmlDocument.setParameter("showDivideUp", ("".equals(strShowDivideUp)) ? "N" : strShowDivideUp);
     xmlDocument.setParameter("showDescription", ("".equals(strShowDescription)) ? "N"
         : strShowDescription);
+    xmlDocument.setParameter("paramElementvalueIdTo", strcelementvalueto);
+    xmlDocument.setParameter("paramElementvalueIdFrom", strcelementvaluefrom);
+    xmlDocument.setParameter("inpElementValueIdTo_DES", strcelementvaluetodes);
+    xmlDocument.setParameter("inpElementValueIdFrom_DES", strcelementvaluefromdes);
 
     xmlDocument.setData("structure1", data);
     out.println(xmlDocument.print());
@@ -643,10 +689,14 @@
       String strOrg, String strTable, String strRecord, String strFactAcctGroupId,
       String strcAcctSchemaId, String strShowClosing, String strShowReg, String strShowOpening,
       String strPageNo, String strEntryNo, String strShowDescription, String strShowRegular,
-      String strShowDivideUp) throws IOException, ServletException {
+      String strShowDivideUp, String strcelementvaluefrom, String strcelementvalueto) 
+      throws IOException, ServletException {
 
     ReportGeneralLedgerJournalData[] data = null;
 
+    String strAllaccounts = "Y";
+    if (strcelementvaluefrom != null && !strcelementvaluefrom.equals(""))
+      strAllaccounts = "N";
     String strTreeOrg = TreeData.getTreeOrg(this, vars.getClient());
     String strOrgFamily = getFamily(strTreeOrg, strOrg);
     if (!strFactAcctGroupId.equals("")) {
@@ -662,7 +712,8 @@
           : "'N'", Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), Utility
           .getContext(this, vars, "#AccessibleOrgTree", "ReportGeneralLedger"), strDateFrom,
           DateTimeData.nDaysAfter(this, strDateTo, "1"), strDocument, strcAcctSchemaId,
-          strOrgFamily, strCheck, vars.getLanguage());
+          strOrgFamily, strCheck, strAllaccounts, strcelementvaluefrom, strcelementvalueto, vars
+              .getLanguage());
     } else
       data = ReportGeneralLedgerJournalData.selectDirect(this,
           "Y".equals(strShowDescription) ? "'Y'" : "'N'",
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.xml	Wed Feb 25 09:53:23 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.xml	Wed Feb 25 14:55:59 2015 +0100
@@ -56,6 +56,10 @@
   <PARAMETER id="paramShowDivideUp" name="showDivideUp" boolean="checked" withId="fieldCheck"/>
   <PARAMETER id="paramShowDescription" name="showDescription" boolean="checked" withId="fieldCheck"/>
   <PARAMETER id="paramDocument" name="document"/>
+  <PARAMETER id="paramElementvalueIdTo" name="paramElementvalueIdTo" attribute="value"/>
+  <PARAMETER id="paramElementvalueIdFrom" name="paramElementvalueIdFrom" attribute="value"/>
+  <PARAMETER id="inpElementValueIdTo_DES" name="inpElementValueIdTo_DES" attribute="value"/>
+  <PARAMETER id="inpElementValueIdFrom_DES" name="inpElementValueIdFrom_DES" attribute="value"/>
  
   <PARAMETER id="jsDisablePreviousNext" name="jsDisablePreviousNext" default=""/>
 
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal_data.xsql	Wed Feb 25 09:53:23 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal_data.xsql	Wed Feb 25 14:55:59 2015 +0100
@@ -43,6 +43,19 @@
       AND f.AD_ORG_ID IN('2')
       AND F.FactAcctType IN ('C','N','O','R','D')
       AND f.C_ACCTSCHEMA_ID = SC.C_ACCTSCHEMA_ID
+      AND (?='Y' OR F.FACT_ACCT_GROUP_ID IN (
+                SELECT FACT_ACCT_GROUP_ID FROM FACT_ACCT WHERE ACCOUNT_ID IN (
+                  SELECT c_elementvalue_id as name
+                  FROM C_ELEMENTVALUE
+                  WHERE value >= (  select value from c_elementvalue where c_elementvalue_id = ?)
+                    and value <= (  select value from c_elementvalue where c_elementvalue_id = ?)
+                    and c_elementvalue.ELEMENTLEVEL = 'S')
+                  AND AD_CLIENT_ID IN ('3')
+                  AND AD_ORG_ID IN ('3')
+                  AND 3=3
+                  AND AD_ORG_ID IN('4')
+                  AND FactAcctType IN ('C','N','O','R','D')
+                ))
       GROUP BY f.C_ACCTSCHEMA_ID, SC.NAME, F.AD_TABLE_ID, F.DATEACCT, F.ACCTDESCRIPTION, CASE WHEN 'Y' = 'Y' THEN TO_CHAR(F.DESCRIPTION) ELSE TO_CHAR('') END, F.ACCTVALUE, F.DOCBASETYPE, F.RECORD_ID, 
       F.FACT_ACCT_GROUP_ID, F.ACCOUNT_ID,F.FACTACCTTYPE,
       (CASE F.AMTACCTDR WHEN 0 THEN (CASE SIGN(F.AMTACCTCR) WHEN -1 THEN 1 ELSE 2 END) ELSE (CASE SIGN(F.AMTACCTDR) WHEN -1 THEN 3 ELSE 4 END) END), F.AD_CLIENT_ID
@@ -60,6 +73,17 @@
     <Parameter name="acctschema" optional="true" after="AND 1=1"><![CDATA[ AND f.C_ACCTSCHEMA_ID = ?]]></Parameter>
     <Parameter name="orgFamily" type="replace" optional="true" after="AND f.AD_ORG_ID IN(" text="'2'"/>
     <Parameter name="checks" type="replace" optional="true" after="AND F.FactAcctType IN (" text="'C','N','O','R','D'"/>    
+    <Parameter name="allaccounts"/>
+    <Parameter name="accountFrom"/>
+    <Parameter name="accountTo"/>  
+    <Parameter name="adUserClient" type="replace" optional="true" after="AND AD_CLIENT_ID IN (" text="'3'"/>
+    <Parameter name="adUserOrg" type="replace" optional="true" after="AND AD_ORG_ID IN (" text="'3'"/>
+    <Parameter name="parDateFrom" optional="true" after="AND 3=3"><![CDATA[ AND dateacct >= TO_DATE(?)]]></Parameter>
+    <Parameter name="parDateTo" optional="true" after="AND 3=3"><![CDATA[ AND dateacct < TO_DATE(?)]]></Parameter>
+    <Parameter name="docbasetype" optional="true" after="AND 3=3"><![CDATA[ AND DOCBASETYPE = ?]]></Parameter>
+    <Parameter name="acctschema" optional="true" after="AND 3=3"><![CDATA[ AND C_ACCTSCHEMA_ID = ?]]></Parameter>
+    <Parameter name="orgFamily" type="replace" optional="true" after="AND AD_ORG_ID IN(" text="'4'"/>
+    <Parameter name="checks" type="replace" optional="true" after="AND FactAcctType IN (" text="'C','N','O','R','D'"/>
     <Parameter name="descriptionGrouping" type="replace" optional="true" after="F.ACCTDESCRIPTION, CASE WHEN " text="'Y'"/>
     <Parameter name="paramLanguage"></Parameter>
     <!--Parameter name="closing" optional="true" type="none" after="2=2" text=" AND F.FactAcctType = 'C'"/>
@@ -86,6 +110,19 @@
         AND f.AD_ORG_ID IN('2')
         AND F.FactAcctType IN ('C','N','O','R','D')
         AND f.C_ACCTSCHEMA_ID = SC.C_ACCTSCHEMA_ID
+        AND (?='Y' OR F.FACT_ACCT_GROUP_ID IN (
+                SELECT FACT_ACCT_GROUP_ID FROM FACT_ACCT WHERE ACCOUNT_ID IN (
+                  SELECT c_elementvalue_id as name
+                  FROM C_ELEMENTVALUE
+                  WHERE value >= (  select value from c_elementvalue where c_elementvalue_id = ?)
+                    and value <= (  select value from c_elementvalue where c_elementvalue_id = ?)
+                    and c_elementvalue.ELEMENTLEVEL = 'S')
+                  AND AD_CLIENT_ID IN ('3')
+                  AND AD_ORG_ID IN ('3')
+                  AND 3=3
+                  AND AD_ORG_ID IN('4')
+                  AND FactAcctType IN ('C','N','O','R','D')
+                ))
         GROUP BY f.C_ACCTSCHEMA_ID, SC.NAME, F.AD_TABLE_ID, F.DATEACCT, F.ACCTDESCRIPTION, F.ACCTVALUE, F.DOCBASETYPE, F.RECORD_ID, 
         F.FACT_ACCT_GROUP_ID, F.ACCOUNT_ID,
         (CASE F.AMTACCTDR WHEN 0 THEN (CASE SIGN(F.AMTACCTCR) WHEN -1 THEN 1 ELSE 2 END) ELSE (CASE SIGN(F.AMTACCTDR) WHEN -1 THEN 3 ELSE 4 END) END)) AA
@@ -103,9 +140,17 @@
     <Parameter name="acctschema" optional="true" after="AND 1=1"><![CDATA[ AND f.C_ACCTSCHEMA_ID = ?]]></Parameter>
     <Parameter name="orgFamily" type="replace" optional="true" after="AND f.AD_ORG_ID IN(" text="'2'"/>
     <Parameter name="checks" type="replace" optional="true" after="AND F.FactAcctType IN (" text="'C','N','O','R','D'"/>
-    <!--Parameter name="closing" optional="true" type="none" after="2=2" text=" AND F.FactAcctType = 'C'"/>
-    <Parameter name="regularization" optional="true" type="none" after="2=2" text=" AND F.FactAcctType = 'R'"/>
-    <Parameter name="opening" optional="true" type="none" after="2=2" text=" AND F.FactAcctType = 'O'"/-->
+    <Parameter name="allaccounts"/>
+    <Parameter name="accountFrom"/>
+    <Parameter name="accountTo"/>
+    <Parameter name="adUserClient" type="replace" optional="true" after="AND AD_CLIENT_ID IN (" text="'3'"/>
+    <Parameter name="adUserOrg" type="replace" optional="true" after="AND AD_ORG_ID IN (" text="'3'"/>
+    <Parameter name="parDateFrom" optional="true" after="AND 3=3"><![CDATA[ AND dateacct >= TO_DATE(?)]]></Parameter>
+    <Parameter name="parDateTo" optional="true" after="AND 3=3"><![CDATA[ AND dateacct < TO_DATE(?)]]></Parameter>
+    <Parameter name="docbasetype" optional="true" after="AND 3=3"><![CDATA[ AND DOCBASETYPE = ?]]></Parameter>
+    <Parameter name="acctschema" optional="true" after="AND 3=3"><![CDATA[ AND C_ACCTSCHEMA_ID = ?]]></Parameter>
+    <Parameter name="orgFamily" type="replace" optional="true" after="AND AD_ORG_ID IN(" text="'4'"/>
+    <Parameter name="checks" type="replace" optional="true" after="AND FactAcctType IN (" text="'C','N','O','R','D'"/>
   </SqlMethod>
   <SqlMethod name="selectCount" type="preparedStatement" return="string" default="0">
     <SqlMethodComment></SqlMethodComment>
@@ -127,6 +172,19 @@
         AND (CASE (SELECT MAX(ISSOTRX) FROM C_DOCTYPE D 
                     WHERE D.DOCBASETYPE = F.DOCBASETYPE) WHEN 'N' THEN COALESCE(T.PO_WINDOW_ID, T.AD_WINDOW_ID) ELSE T.AD_WINDOW_ID END) = (CASE TO_CHAR(F.DOCBASETYPE) 
                     WHEN 'FAT' THEN '94EAA455D2644E04AB25D93BE5157B6D' ELSE W.AD_WINDOW_ID END)
+        AND (?='Y' OR F.FACT_ACCT_GROUP_ID IN (
+                SELECT FACT_ACCT_GROUP_ID FROM FACT_ACCT WHERE ACCOUNT_ID IN (
+                  SELECT c_elementvalue_id as name
+                  FROM C_ELEMENTVALUE
+                  WHERE value >= (  select value from c_elementvalue where c_elementvalue_id = ?)
+                    and value <= (  select value from c_elementvalue where c_elementvalue_id = ?)
+                    and c_elementvalue.ELEMENTLEVEL = 'S')
+                  AND AD_CLIENT_ID IN ('3')
+                  AND AD_ORG_ID IN ('3')
+                  AND 3=3
+                  AND AD_ORG_ID IN('4')
+                  AND FactAcctType IN ('C','N','O','R','D')
+                ))
         GROUP BY F.DATEACCT, F.FACT_ACCT_GROUP_ID) AA
         WHERE (DATEACCT< TO_DATE(?) OR (DATEACCT=TO_DATE(?) AND FACT_ACCT_GROUP_ID < ?))
       ]]></Sql>
@@ -138,8 +196,19 @@
     <Parameter name="acctschema" optional="true" after="AND 1=1"><![CDATA[ AND f.C_ACCTSCHEMA_ID = ?]]></Parameter>
     <Parameter name="orgFamily" type="replace" optional="true" after="AND f.AD_ORG_ID IN(" text="'2'"/>
     <Parameter name="checks" type="replace" optional="true" after="AND F.FactAcctType IN (" text="'C','N','O','R','D'"/>
+    <Parameter name="allaccounts"/>
+    <Parameter name="accountFrom"/>
+    <Parameter name="accountTo"/>
+    <Parameter name="adUserClient" type="replace" optional="true" after="AND AD_CLIENT_ID IN (" text="'3'"/>
+    <Parameter name="adUserOrg" type="replace" optional="true" after="AND AD_ORG_ID IN (" text="'3'"/>
+    <Parameter name="parDateFrom" optional="true" after="AND 3=3"><![CDATA[ AND dateacct >= TO_DATE(?)]]></Parameter>
+    <Parameter name="parDateTo" optional="true" after="AND 3=3"><![CDATA[ AND dateacct < TO_DATE(?)]]></Parameter>
+    <Parameter name="docbasetype" optional="true" after="AND 3=3"><![CDATA[ AND DOCBASETYPE = ?]]></Parameter>
+    <Parameter name="acctschema" optional="true" after="AND 3=3"><![CDATA[ AND C_ACCTSCHEMA_ID = ?]]></Parameter>
+    <Parameter name="orgFamily" type="replace" optional="true" after="AND AD_ORG_ID IN(" text="'4'"/>
+    <Parameter name="checks" type="replace" optional="true" after="AND FactAcctType IN (" text="'C','N','O','R','D'"/>   
     <Parameter name="dateAcct"/>
-    <Parameter name="dateAcct"/>    
+    <Parameter name="dateAcct"/>
     <Parameter name="factAcctGroupId"/>
     <!--Parameter name="closing" optional="true" type="none" after="2=2" text=" AND F.FactAcctType = 'C'"/>
     <Parameter name="regularization" optional="true" type="none" after="2=2" text=" AND F.FactAcctType = 'R'"/>