src/org/openbravo/erpCommon/ad_forms/DocPayment_data.xsql
author Asier Lostalé <asier.lostale@openbravo.com>
Mon, 05 May 2008 06:59:24 +0000
changeset 799 fef2c5e2feb7
parent 423 ecf368072c48
child 1527 b4bcbf4bd120
permissions -rw-r--r--
Merged cleanup branch (r3931) with trunk
carlos@0
     1
<?xml version="1.0" encoding="UTF-8" ?>
carlos@0
     2
<!--
asier@799
     3
 *************************************************************************
asier@799
     4
 * The contents of this file are subject to the Openbravo  Public  License
asier@799
     5
 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
asier@799
     6
 * Version 1.1  with a permitted attribution clause; you may not  use this
asier@799
     7
 * file except in compliance with the License. You  may  obtain  a copy of
asier@799
     8
 * the License at http://www.openbravo.com/legal/license.html 
asier@799
     9
 * Software distributed under the License  is  distributed  on  an "AS IS"
asier@799
    10
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
asier@799
    11
 * License for the specific  language  governing  rights  and  limitations
asier@799
    12
 * under the License. 
asier@799
    13
 * The Original Code is Openbravo ERP. 
asier@799
    14
 * The Initial Developer of the Original Code is Openbravo SL 
asier@799
    15
 * All portions are Copyright (C) 2001-2008 Openbravo SL 
asier@799
    16
 * All Rights Reserved. 
asier@799
    17
 * Contributor(s):  ______________________________________.
asier@799
    18
 ************************************************************************
carlos@0
    19
-->
carlos@0
    20
<SqlClass name="DocPaymentData" package="org.openbravo.erpCommon.ad_forms">
carlos@0
    21
  <SqlClassComment></SqlClassComment>
carlos@0
    22
  <SqlMethod name="select" type="preparedStatement" return="multiple">
carlos@0
    23
    <SqlMethodComment></SqlMethodComment>
carlos@0
    24
    <Sql>
carlos@0
    25
      <![CDATA[
carlos@0
    26
        SELECT now() AS SYSDATE1, '' AS account_ID, '' AS C_SETTLEMENT_ID, '' AS AD_CLIENT_ID, '' AS AD_ORG_ID, '' AS ISACTIVE,
carlos@0
    27
        '' AS CREATED, '' AS CREATEDBY, '' AS UPDATED, '' AS UPDATEDBY, '' AS DOCUMENTNO, '' AS DATETRX, '' AS C_DOCTYPE_ID,
carlos@0
    28
        '' AS PROCESSING, '' AS PROCESSED, '' AS POSTED, '' AS C_PROJECT_ID, '' AS C_CAMPAIGN_ID, '' AS C_ACTIVITY_ID,
carlos@0
    29
        '' AS USER1_ID, '' AS USER2_ID, '' AS CREATEFROM, '' AS C_CURRENCY_ID, '' AS CANCELEDNOTCHARGEAMT, '' AS GENERATEDAMT,
carlos@0
    30
        '' AS CHARGEDAMT, '' AS DESCRIPTION, '' AS CREATEFILE, '' AS DATEACCT, '' AS SETTLEMENTTYPE, '' AS CREDIT_ACCT, '' AS DEBIT_ACCT,
carlos@0
    31
        '' AS AMOUNTDEBIT, '' AS AMOUNTCREDIT, '' AS AMOUNT
carlos@0
    32
        FROM DUAL
carlos@0
    33
     ]]>
carlos@0
    34
     </Sql>
carlos@0
    35
   </SqlMethod>
carlos@0
    36
  <SqlMethod name="selectRegistro" type="preparedStatement" return="multiple">
carlos@0
    37
    <SqlMethodComment></SqlMethodComment>
carlos@0
    38
    <Sql>
carlos@0
    39
      <![CDATA[
carlos@0
    40
        SELECT S.AD_CLIENT_ID, S.AD_ORG_ID, S.C_PROJECT_ID, S.C_CAMPAIGN_ID, S.C_ACTIVITY_ID,
carlos@0
    41
        S.USER1_ID, S.USER2_ID, S.DOCUMENTNO, S.DATEACCT, S.C_CURRENCY_ID, S.C_DOCTYPE_ID,
carlos@0
    42
        S.CHARGEDAMT, S.POSTED, S.DATETRX, S.SETTLEMENTTYPE
carlos@0
    43
        FROM C_SETTLEMENT S
carlos@423
    44
        WHERE AD_Client_ID = TO_NUMBER(?) 
carlos@423
    45
        AND C_SETTLEMENT_ID = TO_NUMBER(?)
carlos@0
    46
     ]]>
carlos@0
    47
     </Sql>
carlos@0
    48
     <Parameter name="client"/>
carlos@0
    49
     <Parameter name="id"/>
carlos@0
    50
   </SqlMethod>
carlos@0
    51
  <SqlMethod name="selectBPartnerCustomerAcct" type="preparedStatement" return="multiple">
carlos@0
    52
    <SqlMethodComment></SqlMethodComment>
carlos@0
    53
    <Sql>
carlos@0
    54
      <![CDATA[
carlos@0
    55
        SELECT COALESCE(
carlos@0
    56
          (SELECT C_RECEIVABLE_ACCT 
carlos@0
    57
          FROM C_BP_CUSTOMER_ACCT
carlos@423
    58
          WHERE C_BPARTNER_ID = TO_NUMBER(?)
carlos@423
    59
          AND C_ACCTSCHEMA_ID = TO_NUMBER(?)
carlos@0
    60
          AND STATUS = ?),
carlos@0
    61
          (SELECT C_RECEIVABLE_ACCT 
carlos@0
    62
          FROM C_BP_CUSTOMER_ACCT
carlos@423
    63
          WHERE C_BPARTNER_ID = TO_NUMBER(?)
carlos@423
    64
          AND C_ACCTSCHEMA_ID = TO_NUMBER(?)
carlos@0
    65
          AND STATUS IS NULL)) AS ACCOUNT_ID FROM DUAL
carlos@0
    66
carlos@0
    67
     ]]>
carlos@0
    68
     </Sql>
carlos@0
    69
     <Parameter name="C_BPARTNER_ID"/>
carlos@0
    70
     <Parameter name="C_ACCTSCHEMA_ID"/>     
carlos@0
    71
     <Parameter name="STATUS"/>
carlos@0
    72
     <Parameter name="C_BPARTNER_ID"/>
carlos@0
    73
     <Parameter name="C_ACCTSCHEMA_ID"/>
carlos@0
    74
   </SqlMethod>
carlos@0
    75
  <SqlMethod name="selectBPartnerVendorAcct" type="preparedStatement" return="multiple">
carlos@0
    76
    <SqlMethodComment></SqlMethodComment>
carlos@0
    77
    <Sql>
carlos@0
    78
      <![CDATA[
carlos@0
    79
        SELECT COALESCE(
carlos@0
    80
          (SELECT V_LIABILITY_ACCT 
carlos@0
    81
          FROM C_BP_VENDOR_ACCT
carlos@423
    82
          WHERE C_BPARTNER_ID = TO_NUMBER(?)
carlos@423
    83
          AND C_ACCTSCHEMA_ID = TO_NUMBER(?)
carlos@0
    84
          AND STATUS = ?),
carlos@0
    85
          (SELECT V_LIABILITY_ACCT
carlos@0
    86
          FROM C_BP_VENDOR_ACCT
carlos@423
    87
          WHERE C_BPARTNER_ID = TO_NUMBER(?)
carlos@423
    88
          AND C_ACCTSCHEMA_ID = TO_NUMBER(?)
carlos@0
    89
          AND STATUS IS NULL)) AS ACCOUNT_ID FROM DUAL
carlos@0
    90
     ]]>
carlos@0
    91
     </Sql>
carlos@0
    92
     <Parameter name="C_BPARTNER_ID"/>
carlos@0
    93
     <Parameter name="C_ACCTSCHEMA_ID"/>     
carlos@0
    94
     <Parameter name="STATUS"/>
carlos@0
    95
     <Parameter name="C_BPARTNER_ID"/>
carlos@0
    96
     <Parameter name="C_ACCTSCHEMA_ID"/>     
carlos@0
    97
   </SqlMethod>
carlos@0
    98
  <SqlMethod name="selectCancelManual" type="preparedStatement" return="multiple">
carlos@0
    99
    <SqlMethodComment></SqlMethodComment>
carlos@0
   100
    <Sql>
carlos@0
   101
      <![CDATA[
carlos@0
   102
        SELECT B.AMOUNTCREDIT AS AMOUNTCREDIT, B.AMOUNTDEBIT AS AMOUNTDEBIT, GA.GLITEM_CREDIT_ACCT AS CREDIT_ACCT, GA.GLITEM_DEBIT_ACCT AS DEBIT_ACCT
carlos@0
   103
        FROM C_DEBT_PAYMENT D, C_DEBT_PAYMENT_BALANCING B, C_GLITEM G, C_GLITEM_ACCT GA
carlos@0
   104
        WHERE D.C_DEBT_PAYMENT_ID = B.C_DEBT_PAYMENT_ID
carlos@0
   105
        AND B.C_GLITEM_ID = G.C_GLITEM_ID
carlos@0
   106
        AND G.C_GLITEM_ID = GA.C_GLITEM_ID
carlos@423
   107
        AND GA.C_ACCTSCHEMA_ID = TO_NUMBER(?)
carlos@423
   108
        AND B.C_DEBT_PAYMENT_ID = (SELECT C_DEBT_PAYMENT_ID FROM C_DEBT_PAYMENT WHERE C_SETTLEMENT_CANCEL_ID = TO_NUMBER(?))
carlos@0
   109
     ]]>
carlos@0
   110
     </Sql>
carlos@0
   111
     <Parameter name="C_ACCTSCHEMA_ID"/>
carlos@0
   112
     <Parameter name="C_SETTLEMENT_ID"/>
carlos@0
   113
   </SqlMethod>
carlos@0
   114
  <SqlMethod name="selectManual" type="preparedStatement" return="multiple">
carlos@0
   115
    <SqlMethodComment></SqlMethodComment>
carlos@0
   116
    <Sql>
carlos@0
   117
      <![CDATA[
carlos@0
   118
        SELECT B.AMOUNTCREDIT AS AMOUNTCREDIT, B.AMOUNTDEBIT AS AMOUNTDEBIT, GA.Glitem_Credit_Acct AS CREDIT_ACCT, GA.Glitem_Debit_Acct AS DEBIT_ACCT
carlos@0
   119
        FROM C_DEBT_PAYMENT D, C_DEBT_PAYMENT_BALANCING B, C_GLITEM G, C_Glitem_Acct GA
carlos@0
   120
        WHERE D.C_DEBT_PAYMENT_ID = B.C_DEBT_PAYMENT_ID
carlos@0
   121
        AND B.C_GLITEM_ID = G.C_GLITEM_ID
carlos@0
   122
        AND G.C_GLITEM_ID = GA.C_GLITEM_ID
carlos@423
   123
        AND GA.C_ACCTSCHEMA_ID = TO_NUMBER(?)
carlos@423
   124
        AND D.C_DEBT_PAYMENT_ID = TO_NUMBER(?)
carlos@0
   125
     ]]>
carlos@0
   126
     </Sql>
carlos@0
   127
     <Parameter name="C_ACCTSCHEMA_ID"/>
carlos@0
   128
     <Parameter name="C_DEBT_PAYMENT_ID"/>
carlos@0
   129
   </SqlMethod>
carlos@0
   130
  <SqlMethod name="selectDirectManual" type="preparedStatement" return="multiple">
carlos@0
   131
    <SqlMethodComment></SqlMethodComment>
carlos@0
   132
    <Sql>
carlos@0
   133
      <![CDATA[
carlos@0
   134
        SELECT C_GLITEM_ACCT.GLITEM_CREDIT_ACCT AS CREDIT_ACCT,
carlos@0
   135
        C_GLITEM_ACCT.GLITEM_DEBIT_ACCT AS DEBIT_ACCT, C_DEBT_PAYMENT.AMOUNT AS AMOUNT
carlos@0
   136
        FROM C_DEBT_PAYMENT, C_GLITEM_ACCT
carlos@0
   137
        WHERE C_GLITEM_ACCT.C_GLITEM_ID = C_DEBT_PAYMENT.C_GLITEM_ID
carlos@423
   138
        AND C_GLITEM_ACCT.C_ACCTSCHEMA_ID = TO_NUMBER(?)
carlos@423
   139
        AND C_DEBT_PAYMENT.C_DEBT_PAYMENT_ID = TO_NUMBER(?)
carlos@0
   140
     ]]>
carlos@0
   141
     </Sql>
carlos@0
   142
     <Parameter name="C_ACCTSCHEMA_ID"/>
carlos@0
   143
     <Parameter name="C_DEBT_PAYMENT_ID"/>
carlos@0
   144
   </SqlMethod>
carlos@0
   145
</SqlClass>