Fixed bug [ 1904142 ] QA-MAS Balance sheet report
authorCarlos Romero <carlos.romero@openbravo.com>
Wed, 12 Mar 2008 10:08:42 +0000
changeset 520 568823778809
parent 519 e38b8c9efdfd
child 521 a4543fd50290
Fixed bug [ 1904142 ] QA-MAS Balance sheet report
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.html
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.xml
src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance_data.xsql
--- a/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.html	Tue Mar 11 15:10:17 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.html	Wed Mar 12 10:08:42 2008 +0000
@@ -13,7 +13,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SL
- * All portions are Copyright (C) 2001-2006 Openbravo SL
+ * All portions are Copyright (C) 2001-2008 Openbravo SL
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -21,7 +21,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<TITLE>Generate Invoices manual</TITLE>
+<TITLE>Balance Sheet</TITLE>
     <link rel="SHORTCUT ICON" href="../../../../../web/images/favicon.ico" type="image/x-icon" />
     <link rel="stylesheet" type="text/css" href="../../../../../web/skins/Default/Main/Main_Manual.css" id="paramCSS" />
     <link rel="stylesheet" type="text/css" href="../../../../../web/skins/Default/Main/Client/DataGrid/DataGrid.css" id="paramCSS" />
@@ -84,6 +84,7 @@
   }
 }
 
+
 function onloadFunctions() {
   new TypeAheadCombo("inpOrg");
   new TypeAheadCombo("inpLevel");
@@ -117,7 +118,26 @@
   return true;
 }
 
+
+function refreshAccounts() {
+  var cmbAccountSchema = document.frmMain.inpcAcctSchemaId;  
+  var cmbAccountFrom = document.frmMain.inpAccountFrom;  
+  var cmbAccountTo = document.frmMain.inpAccountTo;  
+  cambiarListaCombo(cmbAccountFrom, arrAccountFrom, cmbAccountSchema.options[cmbAccountSchema.selectedIndex].value, false);
+  cambiarListaCombo(cmbAccountTo, arrAccountTo, cmbAccountSchema.options[cmbAccountSchema.selectedIndex].value, false);  
+  return true;
+}
 </SCRIPT>
+
+<script language="JavaScript" type="text/javascript" id="paramArrayAccountFrom">
+var arrAccountFrom=null;
+</script>
+
+<script language="JavaScript" type="text/javascript" id="paramArrayAccountTo">
+var arrAccountTo=null;
+</script>
+
+
 </HEAD>
     <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="resizeArea(); updateMenuIcon('buttonMenu'); setFocusFirstControl(); onloadFunctions();" onresize="resizeArea();">
 <FORM method="POST" action="ReportTrialBalance.html" name="frmMain"  target="_self">
@@ -302,7 +322,7 @@
             </TR>
             <TR>
               <TD class="TitleCell"> <SPAN class="LabelText">Accounting schema</SPAN></TD>
-              <TD class="Combo_ContentCell" colspan="2"> <SELECT name="inpcAcctSchemaId" id="inpcAcctSchemaId" class="ComboKey Combo_TwoCells_width" required="true" onchange="submitCommandForm('DEFAULT',true);">
+              <TD class="Combo_ContentCell" colspan="2"> <SELECT name="inpcAcctSchemaId" id="inpcAcctSchemaId" class="ComboKey Combo_TwoCells_width" required="true" onchange="refreshAccounts();">
                   <OPTION value=""> <DIV id="reportC_ACCTSCHEMA_ID"></DIV></OPTION>
                 </SELECT>
               </TD>
--- a/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java	Tue Mar 11 15:10:17 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java	Wed Mar 12 10:08:42 2008 +0000
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SL 
- * All portions are Copyright (C) 2001-2006 Openbravo SL 
+ * All portions are Copyright (C) 2001-2008 Openbravo SL 
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -209,6 +209,8 @@
     xmlDocument.setParameter("paramAll0", strAll.equals("")?"0":"1");
     xmlDocument.setData("reportCBPartnerId_IN", "liststructure", ReportRefundInvoiceCustomerDimensionalAnalysesData.selectBpartner(this, Utility.getContext(this, vars, "#User_Org", ""), Utility.getContext(this, vars, "#User_Client", ""), strcBpartnerIdAux));
 
+    xmlDocument.setParameter("accounFromArray", arrayDobleEntrada("arrAccountFrom", ReportTrialBalanceData.selectAccountDouble(this, Utility.getContext(this, vars, "#User_Org", "Account"), Utility.getContext(this, vars, "#User_Client", "Account"),"")));
+    xmlDocument.setParameter("accounToArray", arrayDobleEntrada("arrAccountTo", ReportTrialBalanceData.selectAccountDouble(this, Utility.getContext(this, vars, "#User_Org", "Account"), Utility.getContext(this, vars, "#User_Client", "Account"),"")));    
     if (log4j.isDebugEnabled()) log4j.debug("filling structure, data.length:"+new_data.length);
     if (discard[1].equals("sectionNoBP")) { 
       if (log4j.isDebugEnabled()) log4j.debug("without BPs");
--- a/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.xml	Tue Mar 11 15:10:17 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.xml	Wed Mar 12 10:08:42 2008 +0000
@@ -12,7 +12,7 @@
 * under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SL 
-* All portions are Copyright (C) 2001-2006 Openbravo SL 
+* All portions are Copyright (C) 2001-2008 Openbravo SL 
 * All Rights Reserved. 
 * Contributor(s):  ______________________________________.
 ************************************************************************
@@ -48,6 +48,9 @@
   <PARAMETER id="messageBoxIDTitle" name="messageTitle" default=""/>
   <PARAMETER id="messageBoxIDMessage" name="messageMessage" default=""/>
 
+  <PARAMETER id="paramArrayAccountFrom" name="accounFromArray"/>
+  <PARAMETER id="paramArrayAccountTo" name="accounToArray"/>
+    
   <PARAMETER id="parameterAll" name="all" default="1"/>
   <PARAMETER id="paramAll" name="paramAll0" boolean="checked" withId="parameterAll" default="1"/>
 
--- a/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance_data.xsql	Tue Mar 11 15:10:17 2008 +0000
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance_data.xsql	Wed Mar 12 10:08:42 2008 +0000
@@ -31,7 +31,7 @@
       SELECT SUM(PARENT_ID) AS PARENT_ID, ID, NAME, ACCOUNT_ID, ELEMENTLEVEL, SUM(AMTACCTDR) AS AMTACCTDR, 
       SUM(AMTACCTCR) AS AMTACCTCR, SUM(SALDO_INICIAL) AS SALDO_INICIAL,0 AS TOTALAMTACCTDR, 0 AS TOTALAMTACCTCR,
       SUM(SALDO_INICIAL+AMTACCTDR-AMTACCTCR) AS SALDO_FINAL, TO_DATE(?) AS DATE_FROM, TO_DATE(?) AS DATE_TO, ? AS AD_ORG_ID,
-      '' AS BP
+      '' AS BP, '' AS PADRE
       FROM
       (SELECT AD_TREENODE.PARENT_ID, C_ELEMENTVALUE.C_ELEMENTVALUE_ID AS ID, C_ELEMENTVALUE.ELEMENTLEVEL, 
       C_ELEMENTVALUE.NAME AS NAME, C_ELEMENTVALUE.VALUE AS ACCOUNT_ID, 0 AS SALDO_INICIAL, 0 AS AMTACCTDR, 
@@ -167,6 +167,25 @@
   <Parameter name="cElementvalueId"/>
   <Parameter name="schema" optional="true" after="AND 1=1"><![CDATA[ AND (select max(c_element_id) from c_acctschema_element where c_acctschema_id = ? and ELEMENTTYPE = 'AC') = C_ElementValue.c_element_id ]]></Parameter>  
   </SqlMethod>
+  <SqlMethod name="selectAccountDouble" type="preparedStatement" return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql><![CDATA[
+        SELECT c_acctschema_element.c_acctschema_id AS PADRE, C_ElementValue.value as id, 
+        ((CASE C_ElementValue.isActive WHEN 'N' THEN '**' ELSE '' END) || C_ElementValue.value || ' - ' || C_ElementValue.Name) as name 
+        FROM C_ElementValue, c_acctschema_element
+        WHERE C_ElementValue.AD_Org_ID IN('1') 
+        AND C_ElementValue.AD_Client_ID IN('1')  
+        AND C_ElementValue.IsSummary='N' 
+        AND (C_ElementValue.isActive = 'Y' OR C_ElementValue.C_ElementValue_ID = TO_NUMBER(?) ) 
+        AND 1=1
+        AND c_acctschema_element.ELEMENTTYPE = 'AC'
+        and c_acctschema_element.c_acctschema_id = C_ElementValue.c_element_id         
+        ORDER BY C_ElementValue.Value
+    ]]></Sql>
+  <Parameter name="adOrgClient" type="replace" optional="true" after="C_ElementValue.AD_Org_ID IN(" text="'1'"/>
+  <Parameter name="adUserClient" type="replace" optional="true" after="C_ElementValue.AD_Client_ID IN(" text="'1'"/>
+  <Parameter name="cElementvalueId"/>  
+  </SqlMethod>  
 
   <SqlMethod name="selectAccountingName" type="preparedStatement" return="string">
     <SqlMethodComment></SqlMethodComment>