details:   /erp/stable/2.50/rev/5875ad06ca5c
changeset: 9330:5875ad06ca5c
user:      Egoitz Castillo <egoitz.castillo <at> openbravo.com>
date:      Fri Apr 01 17:19:27 2011 +0200
summary:   Fixes issue 0015901: The field initial balance should not appear 
when printing
Added a new checkbox to add the initial balance to the credit or the debit.

diffstat:

 src-db/database/sourcedata/AD_TEXTINTERFACES.xml                    |  11 +
 src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.html      |   8 +-
 src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java      |  73 
++++++---
 src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.xml       |   2 +
 src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance_data.xsql |  20 +-
 5 files changed, 76 insertions(+), 38 deletions(-)

diffs (truncated from 404 to 300 lines):

diff -r 85bec21fccba -r 5875ad06ca5c 
src-db/database/sourcedata/AD_TEXTINTERFACES.xml
--- a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml  Fri Apr 01 13:51:44 
2011 +0200
+++ b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml  Fri Apr 01 17:19:27 
2011 +0200
@@ -22002,6 +22002,17 @@
 <!--A5908A8E2A10405F9F89E8EFE1B530F6-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--A5908A8E2A10405F9F89E8EFE1B530F6--></AD_TEXTINTERFACES>
 
+<!--A5BF85B630DC49E59C93045CC8E994C5--><AD_TEXTINTERFACES>
+<!--A5BF85B630DC49E59C93045CC8E994C5-->  
<AD_TEXTINTERFACES_ID><![CDATA[A5BF85B630DC49E59C93045CC8E994C5]]></AD_TEXTINTERFACES_ID>
+<!--A5BF85B630DC49E59C93045CC8E994C5-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A5BF85B630DC49E59C93045CC8E994C5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A5BF85B630DC49E59C93045CC8E994C5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A5BF85B630DC49E59C93045CC8E994C5-->  <TEXT><![CDATA[Opening Entry Amount 
to Initial Balance]]></TEXT>
+<!--A5BF85B630DC49E59C93045CC8E994C5-->  
<FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.html]]></FILENAME>
+<!--A5BF85B630DC49E59C93045CC8E994C5-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--A5BF85B630DC49E59C93045CC8E994C5-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--A5BF85B630DC49E59C93045CC8E994C5--></AD_TEXTINTERFACES>
+
 <!--A6D474BA1F7E40D1BB40DB73A393B864--><AD_TEXTINTERFACES>
 <!--A6D474BA1F7E40D1BB40DB73A393B864-->  
<AD_TEXTINTERFACES_ID><![CDATA[A6D474BA1F7E40D1BB40DB73A393B864]]></AD_TEXTINTERFACES_ID>
 <!--A6D474BA1F7E40D1BB40DB73A393B864-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 85bec21fccba -r 5875ad06ca5c 
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.html
--- a/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.html    Fri Apr 
01 13:51:44 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.html    Fri Apr 
01 17:19:27 2011 +0200
@@ -480,8 +480,12 @@
             </tr>
             <tr>
             <td class="TitleCell"><span class="LabelText">Initial page 
number</span></td>
-              <td class="TextBox_ContentCell"> <input 
dojoType="openbravo:Textbox"  class="dojoValidateValid TextBox_OneCell_width" 
type="text" name="inpPageNo" id="paramPageNo" size="10" maxlength="10" 
value=""></input><script>djConfig.searchIds.push("paramPageNo");</script>
-              </td>              
+              <td class="TextBox_ContentCell" colspan="2"> <input 
dojoType="openbravo:Textbox"  class="dojoValidateValid TextBox_OneCell_width" 
type="text" name="inpPageNo" id="paramPageNo" size="10" maxlength="10" 
value=""></input><script>djConfig.searchIds.push("paramPageNo");</script>
+              </td>
+            </tr>
+           <tr>
+              <td class="TitleCell"><span class="LabelText">Opening Entry 
Amount to Initial Balance</span></td>
+              <td class="Radio_Check_ContentCell"><input 
name="inpNotInitialBalance" type="checkbox" id="fieldNotInitialBalance" 
value="Y"></input></td>
             </tr>
             <tr id="AcctFromTo">
               <td class="TitleCell"><span class="LabelText">From 
Account</span></td>
diff -r 85bec21fccba -r 5875ad06ca5c 
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java
--- a/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java    Fri Apr 
01 13:51:44 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java    Fri Apr 
01 17:19:27 2011 +0200
@@ -80,6 +80,10 @@
           "ReportTrialBalance|C_ElementValue_IDTO", 
ReportTrialBalanceData.selectLastAccount(this,
               Utility.getContext(this, vars, "#AccessibleOrgTree", "Account"), 
Utility.getContext(
                   this, vars, "#User_Client", "Account")));
+      String strNotInitialBalance = 
vars.getGlobalVariable("inpNotInitialBalance",
+          "ReportTrialBalance|notInitialBalance", "Y");
+      String strNotInitialBalance = 
vars.getRequestGlobalVariable("inpNotInitialBalance",
+          "ReportTrialBalance|notInitialBalance");
       String strcElementValueFromDes = "", strcElementValueToDes = "";
       if (!strcElementValueFrom.equals(""))
         strcElementValueFromDes = 
ReportTrialBalanceData.selectSubaccountDescription(this,
@@ -94,7 +98,7 @@
 
       printPageDataSheet(response, vars, strDateFrom, strDateTo, strPageNo, 
strOrg, strLevel,
           strcElementValueFrom, strcElementValueTo, strcElementValueFromDes, 
strcElementValueToDes,
-          strcBpartnerId, strmProductId, strcProjectId, strcAcctSchemaId, 
strGroupBy);
+          strcBpartnerId, strmProductId, strcProjectId, strcAcctSchemaId, 
strNotInitialBalance, strGroupBy);
 
     } else if (vars.commandIn("FIND")) {
       String strcAcctSchemaId = 
vars.getRequestGlobalVariable("inpcAcctSchemaId",
@@ -128,7 +132,7 @@
 
       printPageDataSheet(response, vars, strDateFrom, strDateTo, strPageNo, 
strOrg, strLevel,
           strcElementValueFrom, strcElementValueTo, strcElementValueFromDes, 
strcElementValueToDes,
-          strcBpartnerId, strmProductId, strcProjectId, strcAcctSchemaId, 
strGroupBy);
+          strcBpartnerId, strmProductId, strcProjectId, strcAcctSchemaId, 
strNotInitialBalance, strGroupBy);
 
     } else if (vars.commandIn("PDF", "XLS")) {
       String strcAcctSchemaId = 
vars.getRequestGlobalVariable("inpcAcctSchemaId",
@@ -159,15 +163,17 @@
           "ReportTrialBalance|cProjectId", "", IsIDFilter.instance);
       String strGroupBy = vars.getRequestGlobalVariable("inpGroupBy", 
"ReportTrialBalance|GroupBy");
       String strPageNo = vars.getRequestGlobalVariable("inpPageNo", 
"ReportTrialBalance|PageNo");
+      String strNotInitialBalance = 
vars.getRequestGlobalVariable("inpNotInitialBalance",
+          "ReportTrialBalance|notInitialBalance");
       if (vars.commandIn("PDF"))
         printPageDataPDF(request, response, vars, strDateFrom, strDateTo, 
strOrg, strLevel,
             strcElementValueFrom, strcElementValueFromDes, strcElementValueTo,
-            strcElementValueToDes, strcBpartnerId, strmProductId, 
strcProjectId, strcAcctSchemaId,
+            strcElementValueToDes, strcBpartnerId, strmProductId, 
strcProjectId, strcAcctSchemaId, strNotInitialBalance,
             strGroupBy, strPageNo);
       else
         printPageDataXLS(request, response, vars, strDateFrom, strDateTo, 
strOrg, strLevel,
             strcElementValueFrom, strcElementValueTo, strcBpartnerId, 
strmProductId, strcProjectId,
-            strcAcctSchemaId, strGroupBy);
+            strcAcctSchemaId, strNotInitialBalance, strGroupBy);
 
     } else if (vars.commandIn("OPEN")) {
       String strAccountId = vars.getRequiredStringParameter("inpcAccountId");
@@ -185,9 +191,11 @@
       String strcProjectId = vars.getInGlobalVariable("inpcProjectId_IN",
           "ReportTrialBalance|cProjectId", "", IsIDFilter.instance);
       String strGroupBy = vars.getRequestGlobalVariable("inpGroupBy", 
"ReportTrialBalance|GroupBy");
+      String strNotInitialBalance = 
vars.getRequestGlobalVariable("inpNotInitialBalance",
+          "ReportTrialBalance|notInitialBalance");
 
       printPageOpen(response, vars, strDateFrom, strDateTo, strOrg, strLevel, 
strcBpartnerId,
-          strmProductId, strcProjectId, strcAcctSchemaId, strGroupBy, 
strAccountId);
+          strmProductId, strcProjectId, strcAcctSchemaId, strGroupBy, 
strAccountId, strNotInitialBalance);
 
     } else {
       pageError(response);
@@ -197,7 +205,7 @@
   private void printPageOpen(HttpServletResponse response, VariablesSecureApp 
vars,
       String strDateFrom, String strDateTo, String strOrg, String strLevel, 
String strcBpartnerId,
       String strmProductId, String strcProjectId, String strcAcctSchemaId, 
String strGroupBy,
-      String strAccountId) throws IOException, ServletException {
+      String strAccountId, String strNotInitialBalance) throws IOException, 
ServletException {
 
     ReportTrialBalanceData[] data = null;
     String strTreeOrg = TreeData.getTreeOrg(this, vars.getClient());
@@ -209,8 +217,8 @@
         strLevel, strOrgFamily, Utility
             .getContext(this, vars, "#User_Client", "ReportTrialBalance"), 
Utility.getContext(this,
             vars, "#AccessibleOrgTree", "ReportTrialBalance"), null, null, 
strDateFrom,
-        strAccountId, strcBpartnerId, strmProductId, strcProjectId, 
strcAcctSchemaId, DateTimeData
-            .nDaysAfter(this, strDateTo, "1"));
+        strAccountId, strcBpartnerId, strmProductId, strcProjectId, 
strcAcctSchemaId, (strNotInitialBalance.equals("Y")?"O":"P"), 
+        DateTimeData.nDaysAfter(this, strDateTo, "1"));
 
     if (data == null) {
       data = ReportTrialBalanceData.set();
@@ -262,7 +270,7 @@
       String strDateFrom, String strDateTo, String strPageNo, String strOrg, 
String strLevel,
       String strcElementValueFrom, String strcElementValueTo, String 
strcElementValueFromDes,
       String strcElementValueToDes, String strcBpartnerId, String 
strmProductId,
-      String strcProjectId, String strcAcctSchemaId, String strGroupBy) throws 
IOException,
+      String strcProjectId, String strcAcctSchemaId, String 
strNotInitialBalance, String strGroupBy) throws IOException,
       ServletException {
 
     String strMessage = "";
@@ -311,15 +319,15 @@
             strOrgFamily, Utility.getContext(this, vars, "#User_Client", 
"ReportTrialBalance"),
             Utility.getContext(this, vars, "#AccessibleOrgTree", 
"ReportTrialBalance"),
             strAccountFromValue, strAccountToValue, strDateFrom, null, 
strcBpartnerId,
-            strmProductId, strcProjectId, strcAcctSchemaId, 
DateTimeData.nDaysAfter(this,
-                strDateTo, "1"));
+            strmProductId, strcProjectId, strcAcctSchemaId, 
(strNotInitialBalance.equals("Y")?"O":"P"), 
+            DateTimeData.nDaysAfter(this, strDateTo, "1"));
         if (strGroupBy.equals(""))
           discard[2] = "showExpand";
 
       } else {
         discard[2] = "showExpand";
         data = getDataWhenNotSubAccount(vars, strDateFrom, strDateTo, strOrg, 
strOrgFamily,
-            strcAcctSchemaId, strLevel, strTreeAccount);
+            strcAcctSchemaId, strLevel, strTreeAccount, strNotInitialBalance);
       }
 
       if (data != null && data.length > 0)
@@ -410,6 +418,7 @@
     xmlDocument.setParameter("paramMessage", (strMessage.equals("") ? "" : 
"alert('" + strMessage
         + "');"));
     xmlDocument.setParameter("groupbyselected", strGroupBy);
+    xmlDocument.setParameter("notInitialBalance", strNotInitialBalance);
 
     xmlDocument.setData("reportCBPartnerId_IN", "liststructure", 
SelectorUtilityData
         .selectBpartner(this, Utility.getContext(this, vars, 
"#AccessibleOrgTree", ""), Utility
@@ -421,7 +430,7 @@
 
     xmlDocument.setData("reportCProjectId_IN", "liststructure", 
SelectorUtilityData.selectProject(
         this, Utility.getContext(this, vars, "#AccessibleOrgTree", ""), 
Utility.getContext(this,
-            vars, "#User_Client", ""), strcProjectIdAux));
+            vars, "#User_Client", ""), strcProjectIdAux)); 
 
     if (data != null && data.length > 0) {
       xmlDocument.setData("structure1", data);
@@ -444,7 +453,7 @@
       VariablesSecureApp vars, String strDateFrom, String strDateTo, String 
strOrg,
       String strLevel, String strcElementValueFrom, String strcElementValueTo,
       String strcBpartnerId, String strmProductId, String strcProjectId, 
String strcAcctSchemaId,
-      String strGroupBy) throws IOException, ServletException {
+      String strNotInitialBalance, String strGroupBy) throws IOException, 
ServletException {
 
     response.setContentType("text/html; charset=UTF-8");
     ReportTrialBalanceData[] data = null;
@@ -471,11 +480,12 @@
             Utility.getContext(this, vars, "#User_Client", 
"ReportTrialBalance"), Utility
                 .getContext(this, vars, "#AccessibleOrgTree", 
"ReportTrialBalance"),
             strAccountFromValue, strAccountToValue, strDateFrom, 
strcBpartnerId, strmProductId,
-            strcProjectId, strcAcctSchemaId, DateTimeData.nDaysAfter(this, 
strDateTo, "1"));
+            strcProjectId, strcAcctSchemaId, 
(strNotInitialBalance.equals("Y")?"O":"P"), 
+            DateTimeData.nDaysAfter(this, strDateTo, "1"));
         showDimensions = true;
       } else {
         data = getDataWhenNotSubAccount(vars, strDateFrom, strDateTo, strOrg, 
strOrgFamily,
-            strcAcctSchemaId, strLevel, strTreeAccount);
+            strcAcctSchemaId, strLevel, strTreeAccount, strNotInitialBalance);
       }
 
       if (data == null || data.length == 0) {
@@ -511,8 +521,8 @@
       VariablesSecureApp vars, String strDateFrom, String strDateTo, String 
strOrg,
       String strLevel, String strcElementValueFrom, String 
strcElementValueFromDes,
       String strcElementValueTo, String strcElementValueToDes, String 
strcBpartnerId,
-      String strmProductId, String strcProjectId, String strcAcctSchemaId, 
String strGroupBy,
-      String strPageNo) throws IOException, ServletException {
+      String strmProductId, String strcProjectId, String strcAcctSchemaId, 
String strNotInitialBalance, 
+      String strGroupBy, String strPageNo) throws IOException, 
ServletException {
 
     response.setContentType("text/html; charset=UTF-8");
     ReportTrialBalanceData[] data = null;
@@ -539,14 +549,14 @@
             strLevel, strOrgFamily, Utility.getContext(this, vars, 
"#User_Client",
                 "ReportTrialBalance"), Utility.getContext(this, vars, 
"#AccessibleOrgTree",
                 "ReportTrialBalance"), strAccountFromValue, strAccountToValue, 
strDateFrom, null,
-            strcBpartnerId, strmProductId, strcProjectId, strcAcctSchemaId, 
DateTimeData
-                .nDaysAfter(this, strDateTo, "1"));
+            strcBpartnerId, strmProductId, strcProjectId, strcAcctSchemaId, 
(strNotInitialBalance.equals("Y")?"O":"P"), 
+            DateTimeData.nDaysAfter(this, strDateTo, "1"));
         if (!strGroupBy.equals(""))
           strIsSubAccount = true;
 
       } else {
         data = getDataWhenNotSubAccount(vars, strDateFrom, strDateTo, strOrg, 
strOrgFamily,
-            strcAcctSchemaId, strLevel, strTreeAccount);
+            strcAcctSchemaId, strLevel, strTreeAccount, strNotInitialBalance);
       }
 
       if (data == null || data.length == 0) {
@@ -583,12 +593,12 @@
 
   private ReportTrialBalanceData[] getDataWhenNotSubAccount(VariablesSecureApp 
vars,
       String strDateFrom, String strDateTo, String strOrg, String strOrgFamily,
-      String strcAcctSchemaId, String strLevel, String strTreeAccount) throws 
IOException,
+      String strcAcctSchemaId, String strLevel, String strTreeAccount, String 
strNotInitialBalance) throws IOException,
       ServletException {
     ReportTrialBalanceData[] data = null;
     ReportTrialBalanceData[] dataAux = null;
     dataAux = ReportTrialBalanceData.select(this, strDateFrom, strDateTo, 
strOrg, strTreeAccount,
-        strcAcctSchemaId, strOrgFamily, Utility.getContext(this, vars, 
"#User_Client",
+        strcAcctSchemaId, strNotInitialBalance.equals("Y")?"O":"P", 
strOrgFamily, Utility.getContext(this, vars, "#User_Client",
             "ReportTrialBalance"), Utility.getContext(this, vars, 
"#AccessibleOrgTree",
             "ReportTrialBalance"), strDateFrom, DateTimeData.nDaysAfter(this, 
strDateTo, "1"), "",
         "");
@@ -597,9 +607,10 @@
             "#User_Client", "ReportTrialBalance"));
 
     log4j.debug("Calculating tree...");
-    dataAux = calculateTree(dataAux, null, new Vector<Object>(), 
dataInitialBalance);
+    dataAux = calculateTree(dataAux, null, new Vector<Object>(), 
dataInitialBalance, strNotInitialBalance);
     dataAux = levelFilter(dataAux, null, false, strLevel);
     dataAux = dataFilter(dataAux);
+
     log4j.debug("Tree calculated");
 
     if (dataAux != null && dataAux.length > 0) {
@@ -611,7 +622,6 @@
     } else {
       data = dataAux;
     }
-
     return data;
 
   }
@@ -628,7 +638,7 @@
   }
 
   private ReportTrialBalanceData[] calculateTree(ReportTrialBalanceData[] 
data, String indice,
-      Vector<Object> vecTotal, ReportTrialBalanceData[] dataIB) {
+      Vector<Object> vecTotal, ReportTrialBalanceData[] dataIB, String 
strNotInitialBalance) {
     if (data == null || data.length == 0)
       return data;
     if (indice == null)
@@ -659,7 +669,7 @@
         vecParcial.addElement("0");
         vecParcial.addElement("0");
         vecParcial.addElement("0");
-        ReportTrialBalanceData[] dataChilds = calculateTree(data, data[i].id, 
vecParcial, dataIB);
+        ReportTrialBalanceData[] dataChilds = calculateTree(data, data[i].id, 
vecParcial, dataIB, strNotInitialBalance);
         BigDecimal parcialDR = new BigDecimal((String) 
vecParcial.elementAt(0));
         BigDecimal parcialCR = new BigDecimal((String) 
vecParcial.elementAt(1));
         BigDecimal parcialInicial = new BigDecimal((String) 
vecParcial.elementAt(2));
@@ -675,8 +685,15 @@
         // Set calculated Initial Balances
         for (int k = 0; k < dataIB.length; k++) {
           if (dataIB[k].accountId.equals(data[i].id)) {
-            data[i].saldoInicial = (new 
BigDecimal(dataIB[k].saldoInicial).add(parcialInicial))
+            if (strNotInitialBalance.equals("Y")) {
+              data[i].saldoInicial = (new 
BigDecimal(dataIB[k].saldoInicial).add(parcialInicial))
                 .toPlainString();
+            } else {
+              data[i].amtacctdr = (new 
BigDecimal(dataIB[k].amtacctdr).add(parcialDR))
+                .toPlainString();
+              data[i].amtacctcr = (new 
BigDecimal(dataIB[k].amtacctcr).add(parcialCR))
+                .toPlainString();
+            }
             data[i].saldoFinal = (new 
BigDecimal(dataIB[k].saldoInicial).add(parcialDR)
                 .subtract(parcialCR)).toPlainString();
           }
diff -r 85bec21fccba -r 5875ad06ca5c 
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.xml
--- a/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.xml     Fri Apr 
01 13:51:44 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.xml     Fri Apr 
01 17:19:27 2011 +0200
@@ -48,6 +48,8 @@
   <PARAMETER id="messageBoxIDMessage" name="messageMessage" default=""/>
   <PARAMETER id="paramSelectedGroupBy" name="groupbyselected" 
attribute="value" default=""/>
   <PARAMETER id="paramPageNo" name="PageNo" attribute="value"/>
+  <PARAMETER id="fieldCheck" name="check" default="Y"/>

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to