src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports_data.xsql
author David Baz Fayos <david.baz@openbravo.com>
Tue, 27 May 2008 15:26:10 +0000
changeset 1044 8691bbc94032
parent 1012 098eeafa58a9
child 1605 8a0fe0193bef
permissions -rw-r--r--
Removed old frame parameter of windowTableId
carlos@0
     1
<?xml version="1.0" encoding="UTF-8" ?>
carlos@0
     2
<!--
carlos@0
     3
 *************************************************************************
carlos@0
     4
 * The contents of this file are subject to the Openbravo  Public  License
carlos@0
     5
 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
carlos@0
     6
 * Version 1.1  with a permitted attribution clause; you may not  use this
carlos@0
     7
 * file except in compliance with the License. You  may  obtain  a copy of
carlos@0
     8
 * the License at http://www.openbravo.com/legal/license.html 
carlos@0
     9
 * Software distributed under the License  is  distributed  on  an "AS IS"
carlos@0
    10
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
carlos@0
    11
 * License for the specific  language  governing  rights  and  limitations
carlos@0
    12
 * under the License. 
carlos@0
    13
 * The Original Code is Openbravo ERP. 
carlos@0
    14
 * The Initial Developer of the Original Code is Openbravo SL 
carlos@0
    15
 * All portions are Copyright (C) 2001-2006 Openbravo SL 
carlos@0
    16
 * All Rights Reserved. 
carlos@0
    17
 * Contributor(s):  ______________________________________.
carlos@0
    18
 ************************************************************************
carlos@0
    19
-->
carlos@0
    20
carlos@0
    21
carlos@0
    22
carlos@0
    23
carlos@0
    24
carlos@0
    25
<SqlClass name="GeneralAccountingReportsData" package="org.openbravo.erpCommon.ad_reports">
carlos@0
    26
  <SqlMethod name="selectCombo" type="preparedStatement" return="multiple">
carlos@0
    27
      <SqlMethodComment></SqlMethodComment>
carlos@0
    28
      <Sql><![CDATA[
carlos@507
    29
        SELECT A_O.AD_ORG_ID AS ID, A_O.NAME, '' as pagebreak, '' AS PADRE 
carlos@0
    30
        FROM AD_ORG A_O, AD_ROLE_ORGACCESS A_R_O, AD_ROLE R
carlos@0
    31
        WHERE A_R_O.AD_ORG_ID = A_O.AD_ORG_ID 
carlos@0
    32
        AND A_R_O.ISACTIVE = 'Y' 
carlos@0
    33
        AND A_R_O.AD_ROLE_ID = R.AD_ROLE_ID 
carlos@0
    34
        AND R.ISACTIVE = 'Y' 
carlos@423
    35
        AND A_R_O.AD_ROLE_ID = TO_NUMBER(?) 
carlos@0
    36
        ORDER BY A_O.NAME
carlos@0
    37
      ]]></Sql>
carlos@0
    38
        <Parameter name="rol"/>
carlos@0
    39
   </SqlMethod>
carlos@0
    40
   
eduardo@445
    41
   <SqlMethod name="selectRpt" type="preparedStatement" return="multiple">
eduardo@445
    42
      <SqlMethodComment></SqlMethodComment>
eduardo@445
    43
      <Sql><![CDATA[
eduardo@445
    44
		SELECT C_ACCT_RPT_ID AS ID, NAME 
eduardo@445
    45
		FROM C_ACCT_RPT
eduardo@445
    46
		WHERE AD_ORG_ID IN ('1')
eduardo@445
    47
		AND AD_CLIENT_ID IN ('1')
eduardo@445
    48
		AND 1=1
eduardo@445
    49
		ORDER BY NAME
eduardo@445
    50
      ]]></Sql>
eduardo@445
    51
		<Parameter name="org" optional="true" type="replace" after="WHERE AD_ORG_ID IN (" text="'1'"/>      
eduardo@445
    52
		<Parameter name="client" optional="true" type="replace" after="AND AD_CLIENT_ID IN (" text="'1'"/>      
eduardo@445
    53
		<Parameter name="acctschema" optional="true" after="AND 1=1"><![CDATA[ AND C_ACCT_RPT.C_ACCTSCHEMA_ID = TO_NUMBER(?)]]></Parameter>
eduardo@445
    54
   </SqlMethod>
carlos@507
    55
   <SqlMethod name="selectRptDouble" type="preparedStatement" return="multiple">
carlos@507
    56
      <SqlMethodComment></SqlMethodComment>
carlos@507
    57
      <Sql>
carlos@507
    58
		SELECT C_ACCT_RPT.C_ACCTSCHEMA_ID AS PADRE, C_ACCT_RPT.C_ACCT_RPT_ID AS ID, C_ACCT_RPT.NAME AS NAME 
carlos@507
    59
		FROM C_ACCT_RPT
carlos@507
    60
		ORDER BY NAME
carlos@507
    61
      </Sql>
carlos@507
    62
   </SqlMethod>
carlos@507
    63
      
carlos@0
    64
    <SqlMethod name="selectGroups" type="preparedStatement" return="multiple">
carlos@0
    65
      <SqlMethodComment></SqlMethodComment>
carlos@0
    66
      <Sql><![CDATA[
carlos@0
    67
        SELECT C_ACCT_RPT_GROUP_ID AS ID, name, 'page' as pagebreak
carlos@0
    68
        FROM C_ACCT_RPT_GROUP
carlos@423
    69
        WHERE C_ACCT_RPT_ID = TO_NUMBER(?)
carlos@0
    70
        ORDER BY LINE
carlos@0
    71
      ]]></Sql>
carlos@0
    72
        <Parameter name="rpt"/>
carlos@0
    73
   </SqlMethod> 
carlos@0
    74
   
carlos@0
    75
   <SqlMethod name="selectElements" type="preparedStatement" return="multiple">
carlos@0
    76
      <SqlMethodComment></SqlMethodComment>
carlos@0
    77
      <Sql><![CDATA[
carlos@0
    78
        SELECT c_elementvalue_id AS ID
carlos@0
    79
        FROM C_ACCT_RPT_NODE
carlos@423
    80
        WHERE C_ACCT_RPT_GROUP_ID = TO_NUMBER(?)
carlos@0
    81
        ORDER BY LINE
carlos@0
    82
      ]]></Sql>
carlos@0
    83
        <Parameter name="grp"/>
carlos@0
    84
   </SqlMethod>
carlos@0
    85
   
carlos@0
    86
   <SqlMethod name="groupTitle" type="preparedStatement" return="string">
carlos@0
    87
      <SqlMethodComment></SqlMethodComment>
carlos@0
    88
      <Sql><![CDATA[
carlos@0
    89
        SELECT name
carlos@0
    90
        FROM C_ACCT_RPT_GROUP
carlos@423
    91
        WHERE C_ACCT_RPT_GROUP_ID = TO_NUMBER(?)
carlos@0
    92
      ]]></Sql>
carlos@0
    93
        <Parameter name="grp"/>
carlos@0
    94
   </SqlMethod>
carlos@0
    95
   
carlos@0
    96
   <SqlMethod name="rptTitle" type="preparedStatement" return="string">
carlos@0
    97
      <SqlMethodComment></SqlMethodComment>
carlos@0
    98
      <Sql><![CDATA[
carlos@0
    99
        SELECT name
carlos@0
   100
        FROM C_ACCT_RPT
carlos@423
   101
        WHERE C_ACCT_RPT_ID = TO_NUMBER(?)
carlos@0
   102
      ]]></Sql>
carlos@0
   103
        <Parameter name="rpt"/>
carlos@0
   104
   </SqlMethod>
carlos@0
   105
   
carlos@0
   106
   
carlos@0
   107
   
carlos@0
   108
   
carlos@0
   109
  <SqlMethod name="fieldtitle" type="preparedStatement" return="String" default="">
carlos@0
   110
    <SqlMethodComment></SqlMethodComment>
carlos@0
   111
      <Sql><![CDATA[
carlos@0
   112
        SELECT m.Name 
carlos@0
   113
        FROM C_ElementValue m
carlos@423
   114
        WHERE m.C_ElementValue_ID = TO_NUMBER(?)
carlos@0
   115
      ]]></Sql>
carlos@0
   116
        <Parameter name="cElementvalueId"/>
carlos@0
   117
  </SqlMethod>
carlos@0
   118
  <SqlMethod name="fieldtitleTrl" type="preparedStatement" return="String" default="">
carlos@0
   119
    <SqlMethodComment></SqlMethodComment>
carlos@0
   120
      <Sql><![CDATA[
carlos@0
   121
        SELECT COALESCE(mt.Name, m.Name) AS NAME 
carlos@0
   122
        FROM C_ElementValue m left join C_ElementValue_Trl mt on m.C_ElementValue_ID = mt.C_ElementValue_ID 
carlos@0
   123
                                                             AND mt.AD_Language  = ?
carlos@423
   124
        WHERE m.C_ElementValue_ID = TO_NUMBER(?) 
carlos@0
   125
      ]]></Sql>
carlos@0
   126
        <Parameter name="adLanguage"/>
carlos@0
   127
        <Parameter name="cElementvalueId"/>     
carlos@0
   128
  </SqlMethod>
carlos@0
   129
  <SqlMethod name="selectElement" type="preparedStatement" return="String" default="">
carlos@0
   130
    <SqlMethodComment></SqlMethodComment>
carlos@0
   131
      <Sql><![CDATA[
carlos@0
   132
        SELECT m.AccountType 
carlos@0
   133
        FROM C_ElementValue m
carlos@423
   134
        WHERE m.C_ElementValue_ID = TO_NUMBER(?)
carlos@0
   135
      ]]></Sql>
carlos@0
   136
        <Parameter name="cElementvalueId"/>
carlos@0
   137
  </SqlMethod>
carlos@0
   138
  <SqlMethod name="treeOrg" type="preparedStatement" return="string">
carlos@0
   139
    <SqlMethodComment></SqlMethodComment>
carlos@0
   140
    <Sql>
carlos@0
   141
        SELECT AD_TREE_ORG_ID FROM AD_CLIENTINFO
carlos@423
   142
        WHERE AD_CLIENT_ID = TO_NUMBER(?)
carlos@0
   143
    </Sql>
carlos@0
   144
    <Parameter name="client"/>
carlos@0
   145
  </SqlMethod>
carlos@0
   146
  <SqlMethod name="companyName" type="preparedStatement" return="string">
carlos@0
   147
    <SqlMethodComment></SqlMethodComment>
carlos@0
   148
    <Sql>
carlos@0
   149
        SELECT NAME FROM AD_CLIENT
carlos@423
   150
        WHERE AD_CLIENT_ID = TO_NUMBER(?)
carlos@0
   151
    </Sql>
carlos@0
   152
    <Parameter name="client"/>
carlos@0
   153
  </SqlMethod>
carlos@0
   154
carlos@0
   155
  <SqlMethod name="date" type="preparedStatement" return="string">
carlos@0
   156
    <SqlMethodComment></SqlMethodComment>
carlos@0
   157
    <Sql>
carlos@0
   158
      SELECT (CASE TO_NUMBER(TO_CHAR(now(), 'YYYY')) WHEN TO_NUMBER(?) THEN TO_CHAR(now(), to_char(?)) ELSE '31/12/'||? END) AS DATETO
carlos@0
   159
      FROM DUAL
carlos@0
   160
    </Sql>
carlos@0
   161
    <Parameter name="agno"/>
carlos@0
   162
    <Parameter name="dateFormat"/>
carlos@0
   163
    <Parameter name="agno"/>
carlos@0
   164
  </SqlMethod>
carlos@0
   165
carlos@0
   166
  <SqlMethod name="incomesummary" type="preparedStatement" return="String" default="">
carlos@0
   167
    <SqlMethodComment></SqlMethodComment>
carlos@0
   168
    <Sql>
carlos@0
   169
      <![CDATA[
carlos@0
   170
      SELECT C_VALIDCOMBINATION.ACCOUNT_ID AS ID
carlos@0
   171
      FROM C_ACCTSCHEMA_GL, C_VALIDCOMBINATION, C_ELEMENTVALUE
carlos@0
   172
      WHERE C_ACCTSCHEMA_GL.INCOMESUMMARY_ACCT = C_VALIDCOMBINATION.C_VALIDCOMBINATION_ID
carlos@0
   173
      AND C_VALIDCOMBINATION.ACCOUNT_ID = C_ELEMENTVALUE.C_ELEMENTVALUE_ID
carlos@423
   174
      AND C_ACCTSCHEMA_GL.C_ACCTSCHEMA_ID = TO_NUMBER(?)
carlos@0
   175
      ]]>
carlos@0
   176
    </Sql>
carlos@0
   177
    <Parameter name="cAcctschemaId"/>
carlos@0
   178
  </SqlMethod>
carlos@0
   179
  <SqlMethod name="selectPyG" type="preparedStatement" return="String" default="">
carlos@0
   180
      <SqlMethodComment></SqlMethodComment>
carlos@0
   181
      <Sql><![CDATA[
carlos@0
   182
      SELECT COALESCE(SUM(AMTACCTCR-AMTACCTDR), 0) AS NAME
eduardo@1002
   183
      FROM FACT_ACCT, C_PERIOD, C_YEAR, (SELECT C_ELEMENTVALUE_ID
eduardo@1002
   184
                                         FROM C_ELEMENTVALUE
eduardo@1012
   185
                                         WHERE C_ELEMENTVALUE.ACCOUNTTYPE = ?) AA
carlos@501
   186
     WHERE FACT_ACCT.C_PERIOD_ID = C_PERIOD.C_PERIOD_ID
carlos@501
   187
     AND C_PERIOD.C_YEAR_ID = C_YEAR.C_YEAR_ID
eduardo@1002
   188
     AND FACT_ACCT.ACCOUNT_ID = AA.C_ELEMENTVALUE_ID
carlos@501
   189
     AND FACT_ACCT.FACTACCTTYPE <> 'R'
carlos@501
   190
     AND 1=1
carlos@501
   191
     AND C_YEAR.YEAR = ?
carlos@501
   192
     AND FACT_ACCT.AD_ORG_ID IN ('1')
carlos@0
   193
      ]]></Sql>
carlos@0
   194
        <Parameter name="accountType"/>
carlos@0
   195
        <Parameter name="dateFrom" optional="true" after="AND 1=1"><![CDATA[ AND FACT_ACCT.DATEACCT >= TO_DATE(?)]]></Parameter>
carlos@0
   196
        <Parameter name="dateTo" optional="true" after="AND 1=1"><![CDATA[ AND FACT_ACCT.DATEACCT < TO_DATE(?)]]></Parameter>
eduardo@445
   197
        <Parameter name="acctschema" optional="true" after="AND 1=1"><![CDATA[ AND FACT_ACCT.C_ACCTSCHEMA_ID = TO_NUMBER(?)]]></Parameter>
carlos@0
   198
        <Parameter name="year"/>
carlos@0
   199
        <Parameter name="adOrgId" optional="true" type="replace" after="AND FACT_ACCT.AD_ORG_ID IN (" text="'1'"/>
carlos@0
   200
   </SqlMethod>
carlos@0
   201
</SqlClass>