details:   https://code.openbravo.com/erp/devel/pi/rev/064818230f9a
changeset: 13280:064818230f9a
user:      Jon Alegría <jon.alegria <at> openbravo.com>
date:      Tue Jul 26 17:31:20 2011 +0200
summary:   Fixes issue 0017864: The General Ledger Report does not show 
properly data
depending of the organization
Added a new method to obtain the tree org. This method obtains the tree
depending on ad_isorgincluded method. These organizations are used to obtain
the beginning of the period.

diffstat:

 src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java      |  29 
++++++++-
 src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger_data.xsql |  13 ++++
 2 files changed, 39 insertions(+), 3 deletions(-)

diffs (87 lines):

diff -r d171beefe83c -r 064818230f9a 
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java   Tue Jul 
26 16:57:09 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java   Tue Jul 
26 17:31:20 2011 +0200
@@ -243,9 +243,10 @@
     String strTreeOrg = TreeData.getTreeOrg(this, vars.getClient());
     // String strTreeAccount = ReportTrialBalanceData.treeAccount(this, 
vars.getClient());
     String strOrgFamily = getFamily(strTreeOrg, strOrg);
+    String strFinancialOrgFamily = getFinancialFamily(strTreeOrg, strOrg, 
vars.getClient());
     String strYearInitialDate = ReportGeneralLedgerData.yearInitialDate(this,
         vars.getSessionValue("#AD_SqlDateFormat"), strDateFrom,
-        Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), 
strOrgFamily);
+        Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), 
strFinancialOrgFamily);
     if (strYearInitialDate.equals(""))
       strYearInitialDate = strDateFrom;
     String toDatePlusOne = DateTimeData.nDaysAfter(this, strDateTo, "1");
@@ -514,9 +515,10 @@
     String strTreeOrg = TreeData.getTreeOrg(this, vars.getClient());
     String strOrgFamily = "";
     strOrgFamily = getFamily(strTreeOrg, strOrg);
+    String strFinancialOrgFamily = getFinancialFamily(strTreeOrg, strOrg, 
vars.getClient());
     String strYearInitialDate = ReportGeneralLedgerData.yearInitialDate(this,
         vars.getSessionValue("#AD_SqlDateFormat"), strDateFrom,
-        Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), 
strOrgFamily);
+        Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), 
strFinancialOrgFamily);
     if (strYearInitialDate.equals(""))
       strYearInitialDate = strDateFrom;
     String toDatePlusOne = DateTimeData.nDaysAfter(this, strDateTo, "1");
@@ -616,9 +618,10 @@
     String strTreeOrg = TreeData.getTreeOrg(this, vars.getClient());
     String strOrgFamily = "";
     strOrgFamily = getFamily(strTreeOrg, strOrg);
+    String strFinancialOrgFamily = getFinancialFamily(strTreeOrg, strOrg, 
vars.getClient());
     String strYearInitialDate = ReportGeneralLedgerData.yearInitialDate(this,
         vars.getSessionValue("#AD_SqlDateFormat"), strDateFrom,
-        Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), 
strOrgFamily);
+        Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), 
strFinancialOrgFamily);
     if (strYearInitialDate.equals(""))
       strYearInitialDate = strDateFrom;
     String toDatePlusOne = DateTimeData.nDaysAfter(this, strDateTo, "1");
@@ -670,6 +673,26 @@
     return Tree.getMembers(this, strTree, strChild);
   }
 
+  private String getFinancialFamily(String strTree, String strChild, String 
strClientId)
+      throws IOException, ServletException {
+    log4j.debug("Tree.getFinancialMembers");
+    ReportGeneralLedgerData[] data = ReportGeneralLedgerData
+        .getFinancialOrgs(this, strTree, strChild, strClientId);
+
+    boolean bolFirstLine = true;
+    String strText = "";
+    for (int i = 0; i < data.length; i++) {
+      data[i].id = "'" + data[i].id + "'";
+      if (bolFirstLine) {
+        bolFirstLine = false;
+        strText = data[i].id;
+      } else {
+        strText = data[i].id + "," + strText;
+      }
+    }
+    return strText;
+  }
+
   @Override
   public String getServletInfo() {
     return "Servlet ReportGeneralLedger. This Servlet was made by Pablo 
Sarobe";
diff -r d171beefe83c -r 064818230f9a 
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger_data.xsql
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger_data.xsql      
Tue Jul 26 16:57:09 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger_data.xsql      
Tue Jul 26 17:31:20 2011 +0200
@@ -286,4 +286,17 @@
     ]]></Sql>
     <Parameter name="elementValueId"/>
   </SqlMethod>
+  <SqlMethod name="getFinancialOrgs" type="preparedStatement" 
return="multiple">
+     <SqlMethodComment></SqlMethodComment>
+     <Sql><![CDATA[
+       SELECT NODE_ID AS ID
+       FROM AD_TREENODE
+       WHERE AD_TREE_ID = ?
+       AND AD_ISORGINCLUDED(?, NODE_ID, ?) <> -1
+     ]]></Sql>
+     <Parameter name="adTreeId"/>
+     <Parameter name="adOrgId"/>
+     <Parameter name="adClientId"/>
+  </SqlMethod>
+
 </SqlClass>

------------------------------------------------------------------------------
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to