src/org/openbravo/erpCommon/ad_actionButton/DropRegFactAcct_data.xsql
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Wed, 03 Sep 2008 17:55:37 +0000
changeset 1605 8a0fe0193bef
parent 423 ecf368072c48
child 1787 84217f37d788
permissions -rw-r--r--
Merge r2.5x intro trunk
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="DropRegFactAcctData" package="org.openbravo.erpCommon.ad_actionButton">
carlos@0
    26
  <SqlMethod name="select" type="preparedStatement" return="multiple">
carlos@0
    27
    <SqlMethodComment></SqlMethodComment>
carlos@0
    28
    <Sql>
carlos@0
    29
      <![CDATA[
juanpablo@1605
    30
        SELECT REG_FACT_ACCT_GROUP_ID AS ID, GETPERIODNAME(MIN(PERIODNO), ?)|| ' - ' || GETPERIODNAME(MAX(PERIODNO),?) AS NAME
carlos@0
    31
        FROM C_PERIOD 
carlos@0
    32
        WHERE REG_FACT_ACCT_GROUP_ID IS NOT NULL
juanpablo@1605
    33
        AND C_YEAR_ID = ?
juanpablo@1605
    34
        AND REG_FACT_ACCT_GROUP_ID = (select MAX(REG_FACT_ACCT_GROUP_ID) FROM C_PERIOD WHERE C_YEAR_ID = ?)
carlos@0
    35
        GROUP BY REG_FACT_ACCT_GROUP_ID
carlos@0
    36
      ]]>
carlos@0
    37
    </Sql>
carlos@0
    38
    <Parameter name="c_year_id"/>
carlos@0
    39
    <Parameter name="c_year_id"/>
carlos@0
    40
    <Parameter name="c_year_id"/>
carlos@0
    41
    <Parameter name="c_year_id"/>
carlos@0
    42
  </SqlMethod>
carlos@0
    43
  <SqlMethod name="updatePeriods" type="preparedStatement" connection="true" return="rowCount">
carlos@0
    44
    <SqlMethodComment></SqlMethodComment>
carlos@0
    45
    <Sql>
carlos@0
    46
      <![CDATA[
juanpablo@1605
    47
  UPDATE C_PERIOD SET REG_FACT_ACCT_GROUP_ID = NULL, UPDATED = now(), UPDATEDBY = ?
juanpablo@1605
    48
  WHERE REG_FACT_ACCT_GROUP_ID = ?
carlos@0
    49
      ]]>
carlos@0
    50
    </Sql>
carlos@0
    51
    <Parameter name="user"/>
carlos@0
    52
    <Parameter name="reg_fact_acct_group_id"/>
carlos@0
    53
  </SqlMethod>
carlos@0
    54
  <SqlMethod name="deleteFactAcct" type="preparedStatement" connection="true" return="rowCount">
carlos@0
    55
    <SqlMethodComment></SqlMethodComment>
carlos@0
    56
    <Sql>
carlos@0
    57
      <![CDATA[
juanpablo@1605
    58
  DELETE FROM FACT_ACCT WHERE FACT_ACCT_GROUP_ID = ?
carlos@0
    59
      ]]>
carlos@0
    60
    </Sql>
carlos@0
    61
    <Parameter name="fact_acct_group_id"/>
carlos@0
    62
  </SqlMethod>
carlos@0
    63
  <SqlMethod name="updatePeriodsOpen" type="preparedStatement" connection="true" return="rowCount">
carlos@0
    64
    <SqlMethodComment></SqlMethodComment>
carlos@0
    65
    <Sql>
carlos@0
    66
      <![CDATA[
carlos@0
    67
        UPDATE C_PeriodControl
juanpablo@1605
    68
        SET PeriodStatus = 'O', UPDATED = now(), UPDATEDBY = ?
carlos@0
    69
        WHERE PeriodStatus <> 'P'
carlos@0
    70
        AND C_PERIOD_ID IN (SELECT C_PERIOD_ID 
carlos@0
    71
                FROM C_PERIOD 
juanpablo@1605
    72
                WHERE CLOSE_FACT_ACCT_GROUP_ID = ?)
carlos@0
    73
      ]]>
carlos@0
    74
    </Sql>
carlos@0
    75
    <Parameter name="user"/>
carlos@0
    76
    <Parameter name="close_fact_acct_group_id"/>
carlos@0
    77
  </SqlMethod>
carlos@0
    78
  <SqlMethod name="selectClose" type="preparedStatement" return="String">
carlos@0
    79
    <SqlMethodComment></SqlMethodComment>
carlos@0
    80
    <Sql>
carlos@0
    81
      <![CDATA[
juanpablo@1605
    82
        SELECT DISTINCT CLOSE_FACT_ACCT_GROUP_ID AS ID FROM C_PERIOD WHERE REG_FACT_ACCT_GROUP_ID = ?
carlos@0
    83
      ]]>
carlos@0
    84
    </Sql>
carlos@0
    85
    <Parameter name="reg_fact_acct_group_id"/>
carlos@0
    86
  </SqlMethod>
carlos@0
    87
  <SqlMethod name="selectDivideUp" type="preparedStatement" return="String">
carlos@0
    88
    <SqlMethodComment></SqlMethodComment>
carlos@0
    89
    <Sql>
carlos@0
    90
      <![CDATA[
juanpablo@1605
    91
        SELECT DISTINCT DIVIDEUP_FACT_ACCT_GROUP_ID AS ID FROM C_PERIOD WHERE REG_FACT_ACCT_GROUP_ID = ?
carlos@0
    92
      ]]>
carlos@0
    93
    </Sql>
carlos@0
    94
    <Parameter name="reg_fact_acct_group_id"/>
carlos@0
    95
  </SqlMethod>
carlos@0
    96
  <SqlMethod name="updatePeriodsClose" type="preparedStatement" connection="true" return="rowCount">
carlos@0
    97
    <SqlMethodComment></SqlMethodComment>
carlos@0
    98
    <Sql>
carlos@0
    99
      <![CDATA[
juanpablo@1605
   100
  UPDATE C_PERIOD SET CLOSE_FACT_ACCT_GROUP_ID = NULL, UPDATED = now(), UPDATEDBY = ?
juanpablo@1605
   101
  WHERE CLOSE_FACT_ACCT_GROUP_ID = ?
carlos@0
   102
      ]]>
carlos@0
   103
    </Sql>
carlos@0
   104
    <Parameter name="user"/>
carlos@0
   105
    <Parameter name="close_fact_acct_group_id"/>
carlos@0
   106
  </SqlMethod>
carlos@0
   107
  <SqlMethod name="deleteFactAcctClose" type="preparedStatement" connection="true" return="rowCount">
carlos@0
   108
    <SqlMethodComment></SqlMethodComment>
carlos@0
   109
    <Sql>
carlos@0
   110
      <![CDATA[
carlos@0
   111
  DELETE FROM FACT_ACCT WHERE FACT_ACCT_GROUP_ID IN (?, ?+1, ?)
carlos@0
   112
      ]]>
carlos@0
   113
    </Sql>
carlos@0
   114
    <Parameter name="fact_acct_group_id"/>
carlos@0
   115
    <Parameter name="fact_acct_group_id"/>
carlos@0
   116
    <Parameter name="divideup_fact_acct_group_id"/>
carlos@0
   117
  </SqlMethod>
carlos@0
   118
</SqlClass>