src/org/openbravo/erpCommon/ad_reports/ReportAgingBalance_data.xsql
author David Baz Fayos <david.baz@openbravo.com>
Tue, 27 May 2008 15:26:10 +0000
changeset 1044 8691bbc94032
parent 732 88d93ac777a9
child 1605 8a0fe0193bef
permissions -rw-r--r--
Removed old frame parameter of windowTableId
pablo@711
     1
<?xml version="1.0" encoding="UTF-8" ?>
pablo@711
     2
<!--
pablo@711
     3
 *************************************************************************
pablo@711
     4
 * The contents of this file are subject to the Openbravo  Public  License
pablo@711
     5
 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
pablo@711
     6
 * Version 1.1  with a permitted attribution clause; you may not  use this
pablo@711
     7
 * file except in compliance with the License. You  may  obtain  a copy of
pablo@711
     8
 * the License at http://www.openbravo.com/legal/license.html 
pablo@711
     9
 * Software distributed under the License  is  distributed  on  an "AS IS"
pablo@711
    10
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
pablo@711
    11
 * License for the specific  language  governing  rights  and  limitations
pablo@711
    12
 * under the License. 
pablo@711
    13
 * The Original Code is Openbravo ERP. 
pablo@711
    14
 * The Initial Developer of the Original Code is Openbravo SL 
pablo@711
    15
 * All portions are Copyright (C) 2001-2006 Openbravo SL 
pablo@711
    16
 * All Rights Reserved. 
pablo@711
    17
 * Contributor(s):  ______________________________________.
pablo@711
    18
 ************************************************************************
pablo@711
    19
-->
pablo@711
    20
<SqlClass name="ReportAgingBalanceData" package="org.openbravo.erpCommon.ad_reports">
pablo@711
    21
  <SqlClassComment>Clase ReportAgingBalanceData</SqlClassComment>
juanpablo@726
    22
  <SqlMethod name="selectInitClassHeader" type="preparedStatement" return="multiple">
juanpablo@726
    23
    <SqlMethodComment></SqlMethodComment>
juanpablo@726
    24
    <Sql>
juanpablo@726
    25
    <![CDATA[
juanpablo@726
    26
      SELECT ' ' AS AD_ORG_ID, ' ' AS BPARTNER_ID, ' ' AS BPARTNER, ' ' AS ISRECEIPT, ' ' AS ZERO, ' ' AS ONE, ' ' AS TWO, ' ' AS THREE, ' ' AS FOUR, ' ' AS FIVE, ' ' AS TOTAL, ' ' AS ID, ' ' AS NAME, ' ' AS pagebreak , ' ' AS AD_TREE_ORG_ID
juanpablo@726
    27
      FROM DUAL
juanpablo@726
    28
     ]]></Sql>
juanpablo@726
    29
  </SqlMethod>
pablo@711
    30
  <SqlMethod name="select" type="preparedStatement" return="multiple">
pablo@711
    31
    <SqlMethodComment>Select for relation</SqlMethodComment>
pablo@711
    32
    <Sql>
pablo@711
    33
    <![CDATA[
carlos@732
    34
        SELECT BPARTNER AS BPARTNER_ID, AD_COLUMN_IDENTIFIER('C_Bpartner',TO_CHAR(BPARTNER),'es_ES') AS BPARTNER, ISRECEIPT,
juanpablo@726
    35
        SUM(CASE(SCOPE) WHEN 0 THEN AMOUNT ELSE 0 END) AS ZERO,
juanpablo@726
    36
        SUM(CASE(SCOPE) WHEN 1 THEN AMOUNT ELSE 0 END) AS ONE,
juanpablo@726
    37
        SUM(CASE(SCOPE) WHEN 2 THEN AMOUNT ELSE 0 END) AS TWO,
juanpablo@726
    38
        SUM(CASE(SCOPE) WHEN 3 THEN AMOUNT ELSE 0 END) AS THREE,
juanpablo@726
    39
        SUM(CASE(SCOPE) WHEN 4 THEN AMOUNT ELSE 0 END) AS FOUR,
juanpablo@726
    40
        SUM(CASE(SCOPE) WHEN 5 THEN AMOUNT ELSE 0 END) AS FIVE,
juanpablo@726
    41
        SUM(AMOUNT) AS TOTAL, ? AS AD_ORG_ID
juanpablo@726
    42
        FROM(
juanpablo@726
    43
          SELECT C_BPARTNER_ID AS BPARTNER, AMOUNT, ISRECEIPT, DATEPLANNED,
carlos@732
    44
          AGING_GET_SCOPE(DATEPLANNED, TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?)) AS SCOPE, C_DEBT_PAYMENT_ID
juanpablo@726
    45
          FROM  C_DEBT_PAYMENT
juanpablo@726
    46
          WHERE C_DEBT_PAYMENT_STATUS(C_SETTLEMENT_CANCEL_ID, CANCEL_PROCESSED, GENERATE_PROCESSED,ISPAID,ISVALID,C_CASHLINE_ID,C_BANKSTATEMENTLINE_ID) = 'P'
juanpablo@726
    47
          AND ISRECEIPT = ?
juanpablo@726
    48
          AND 1=1
juanpablo@726
    49
          AND AD_ORG_ID IN('2')
juanpablo@726
    50
          AND AD_CLIENT_ID IN ('1')
juanpablo@726
    51
          AND AD_ORG_ID IN ('1')
carlos@732
    52
          ) AAA
juanpablo@726
    53
        GROUP BY BPARTNER, ISRECEIPT
pablo@711
    54
      ]]></Sql>
juanpablo@726
    55
    <Parameter name="orgTrx"></Parameter>
juanpablo@726
    56
    <Parameter name="one"></Parameter>
juanpablo@726
    57
    <Parameter name="two"></Parameter>
juanpablo@726
    58
    <Parameter name="three"></Parameter>
juanpablo@726
    59
    <Parameter name="four"></Parameter>
juanpablo@726
    60
    <Parameter name="isreceipt"></Parameter>
juanpablo@726
    61
    <Parameter name="cBpartnerId" optional="true" type="argument" after="AND 1=1"><![CDATA[ AND C_BPARTNER_ID IN ]]></Parameter>
juanpablo@726
    62
    <Parameter name="orgFamily" type="replace" optional="true" after="AD_ORG_ID IN(" text="'2'"/>
juanpablo@726
    63
    <Parameter name="adUserClient" type="replace" optional="true" after="AD_CLIENT_ID IN (" text="'1'"/>
juanpablo@726
    64
    <Parameter name="adUserOrg" type="replace" optional="true" after="AD_ORG_ID IN (" text="'1'"/>
pablo@711
    65
  </SqlMethod>
juanpablo@726
    66
  <SqlMethod name="treeOrg" type="preparedStatement" return="string">
juanpablo@726
    67
    <SqlMethodComment></SqlMethodComment>
juanpablo@726
    68
    <Sql>
juanpablo@726
    69
        SELECT AD_TREE_ORG_ID FROM AD_CLIENTINFO
juanpablo@726
    70
        WHERE AD_CLIENT_ID = TO_NUMBER(?)
juanpablo@726
    71
    </Sql>
juanpablo@726
    72
    <Parameter name="client"/>
juanpablo@726
    73
  </SqlMethod>
juanpablo@726
    74
  <SqlMethod name="selectCombo" type="preparedStatement" return="multiple">
juanpablo@726
    75
      <SqlMethodComment></SqlMethodComment>
juanpablo@726
    76
      <Sql><![CDATA[
juanpablo@726
    77
        SELECT A_O.AD_ORG_ID AS ID, A_O.NAME, '' as pagebreak 
juanpablo@726
    78
        FROM AD_ORG A_O, AD_ROLE_ORGACCESS A_R_O, AD_ROLE R
juanpablo@726
    79
        WHERE A_R_O.AD_ORG_ID = A_O.AD_ORG_ID 
juanpablo@726
    80
        AND A_R_O.ISACTIVE = 'Y' 
juanpablo@726
    81
        AND A_R_O.AD_ROLE_ID = R.AD_ROLE_ID 
juanpablo@726
    82
        AND R.ISACTIVE = 'Y' 
juanpablo@726
    83
        AND A_R_O.AD_ROLE_ID = TO_NUMBER(?) 
juanpablo@726
    84
        ORDER BY A_O.NAME
juanpablo@726
    85
      ]]></Sql>
juanpablo@726
    86
        <Parameter name="rol"/>
juanpablo@726
    87
   </SqlMethod>
pablo@711
    88
  <SqlMethod name="set" type="constant" return="multiple">
pablo@711
    89
      <SqlMethodComment>Create a registry</SqlMethodComment>
pablo@711
    90
      <Sql></Sql>
pablo@711
    91
  </SqlMethod>
pablo@711
    92
</SqlClass>