src/org/openbravo/erpCommon/ad_forms/DocLineBank_data.xsql
author Iván Perdomo <ivan.perdomo@openbravo.com>
Thu, 24 Apr 2008 17:12:02 +0000
changeset 770 8850d5956eba
parent 423 ecf368072c48
child 799 fef2c5e2feb7
permissions -rw-r--r--
Bug fix [0000111]. Modified mapping name used on manual code.
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   Compiere License  Version 1.1
carlos@0
     5
 * ("License"); You may not use this file except in compliance with the License
carlos@0
     6
 * You may obtain a copy of the License at http://www.compiere.org/license.html
carlos@0
     7
 * Software distributed under the License is distributed on an  "AS IS"  basis,
carlos@0
     8
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
carlos@0
     9
 * the specific language governing rights and limitations under the License.
carlos@0
    10
 * The Original Code is                  Compiere  ERP & CRM  Business Solution
carlos@0
    11
 * The Initial Developer of the Original Code is Jorg Janke  and ComPiere, Inc.
carlos@0
    12
 * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
carlos@0
    13
 * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
carlos@0
    14
 * Contributor(s): Openbravo SL
carlos@0
    15
 * Contributions are Copyright (C) 2001-2006 Openbravo S.L.
carlos@0
    16
 ******************************************************************************
carlos@0
    17
-->
carlos@0
    18
carlos@0
    19
carlos@0
    20
carlos@0
    21
carlos@0
    22
carlos@0
    23
<SqlClass name="DocLineBankData" package="org.openbravo.erpCommon.ad_forms">
carlos@0
    24
  <SqlClassComment></SqlClassComment>
carlos@0
    25
  <SqlMethod name="select" type="preparedStatement" return="multiple">
carlos@0
    26
    <SqlMethodComment></SqlMethodComment>
carlos@0
    27
    <Sql>
carlos@0
    28
      <![CDATA[
carlos@0
    29
      SELECT BL.AD_ORG_ID, BL.LINE, BL.DESCRIPTION, BL.C_CHARGE_ID, BL.CHARGEAMT,
carlos@0
    30
      BL.DATEACCT, BL.C_BANKSTATEMENTLINE_ID, BL.VALUTADATE, BL.C_DEBT_PAYMENT_ID, BL.ISREVERSAL,
carlos@0
    31
      BL.STMTAMT, BL.TRXAMT, DP.C_BPARTNER_ID AS C_BPARTNER_ID, DP.ISMANUAL AS ISMANUAL,  bl.CONVERTCHARGEAMT, bl.C_Currency_ID
carlos@0
    32
      FROM C_BANKSTATEMENTLINE BL left join C_DEBT_PAYMENT DP on BL.C_DEBT_PAYMENT_ID = DP.C_DEBT_PAYMENT_ID
carlos@423
    33
      WHERE C_BANKSTATEMENT_ID = TO_NUMBER(?) 
carlos@0
    34
      ORDER BY LINE
carlos@0
    35
     ]]>
carlos@0
    36
     </Sql>
carlos@0
    37
     <Parameter name="C_BANKSTATEMENT_ID"/>
carlos@0
    38
   </SqlMethod>
carlos@0
    39
  <SqlMethod name="selectChargeAccount" type="preparedStatement" return="string">
carlos@0
    40
    <SqlMethodComment></SqlMethodComment>
carlos@0
    41
    <Sql>
carlos@0
    42
      <![CDATA[
carlos@0
    43
      select b_expense_acct from c_bankaccount_acct
carlos@423
    44
      where c_bankaccount_ID = TO_NUMBER(?)
carlos@423
    45
      and c_acctschema_ID = TO_NUMBER(?)
carlos@0
    46
     ]]>
carlos@0
    47
     </Sql>
carlos@0
    48
     <Parameter name="cBankaccountId"/>
carlos@0
    49
     <Parameter name="cAcctschemaId"/>
carlos@0
    50
   </SqlMethod>
carlos@0
    51
  <SqlMethod name="selectLinesPeriodClosed" type="preparedStatement" return="string" default="0">
carlos@0
    52
    <SqlMethodComment></SqlMethodComment>
carlos@0
    53
    <Sql>
carlos@0
    54
      <![CDATA[
carlos@0
    55
      SELECT COUNT(*) AS COUNT
carlos@0
    56
      FROM C_BANKSTATEMENTLINE BL left join C_DEBT_PAYMENT DP on BL.C_DEBT_PAYMENT_ID = DP.C_DEBT_PAYMENT_ID
carlos@423
    57
      WHERE C_BANKSTATEMENT_ID = TO_NUMBER(?)
carlos@0
    58
      AND EXISTS (SELECT 1
carlos@0
    59
          FROM C_YEAR, C_PERIOD, C_PERIODCONTROL, AD_CLIENTINFO
carlos@0
    60
          WHERE C_YEAR.C_YEAR_ID = C_PERIOD.C_YEAR_ID
carlos@0
    61
         AND C_PERIOD.C_PERIOD_ID = C_PERIODCONTROL.C_PERIOD_ID
carlos@0
    62
         AND C_YEAR.C_CALENDAR_ID = AD_CLIENTINFO.C_CALENDAR_ID
carlos@0
    63
         AND AD_CLIENTINFO.AD_CLIENT_ID = BL.AD_CLIENT_ID
carlos@0
    64
         AND C_PERIODCONTROL.DOCBASETYPE = 'CMB'
carlos@0
    65
         AND C_PERIODCONTROL.PERIODSTATUS <> 'O'
carlos@0
    66
         AND BL.DATEACCT >= C_PERIOD.STARTDATE
carlos@0
    67
         AND BL.DATEACCT < C_PERIOD.ENDDATE + 1)
carlos@0
    68
      GROUP BY bl.line
carlos@0
    69
      ORDER BY LINE
carlos@0
    70
     ]]>
carlos@0
    71
     </Sql>
carlos@0
    72
     <Parameter name="cBankaccountId"/>
carlos@0
    73
   </SqlMethod>
carlos@0
    74
  </SqlClass>