src/org/openbravo/erpCommon/ad_forms/InvoiceVendorMultiline_Lines_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 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="InvoiceVendorMultilineLinesData" package="org.openbravo.erpCommon.ad_forms">
carlos@0
    26
  <SqlClassComment></SqlClassComment>
carlos@0
    27
  <SqlMethod name="select" type="preparedStatement" return="multiple">
carlos@0
    28
    <SqlMethodComment></SqlMethodComment>
carlos@0
    29
    <Sql>
carlos@0
    30
      <![CDATA[
carlos@0
    31
      SELECT C_INVOICELINE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, C_INVOICE_ID, C_ORDERLINE_ID, M_INOUTLINE_ID, LINE, DESCRIPTION, M_PRODUCT_ID, QTYINVOICED, PRICELIST, PRICEACTUAL, PRICELIMIT, LINENETAMT, C_CHARGE_ID, CHARGEAMT, C_UOM_ID, C_TAX_ID, S_RESOURCEASSIGNMENT_ID, A_ASSET_ID, TAXAMT, M_ATTRIBUTESETINSTANCE_ID, ISDESCRIPTION, QUANTITYORDER, M_PRODUCT_UOM_ID, C_INVOICE_DISCOUNT_ID, 
carlos@0
    32
      AD_COLUMN_IDENTIFIER(TO_CHAR('M_Product'), TO_CHAR(M_PRODUCT_ID), TO_CHAR(?)) AS M_PRODUCT_ID_D, PRICESTD, M_OFFER_ID 
carlos@0
    33
      FROM C_INVOICELINE 
carlos@423
    34
      WHERE C_INVOICE_ID = TO_NUMBER(?) 
carlos@0
    35
      ORDER BY LINE
carlos@0
    36
     ]]>
carlos@0
    37
     </Sql>
carlos@0
    38
     <Parameter name="adLanguage"/>
carlos@0
    39
     <Parameter name="cInvoiceId"/>
carlos@0
    40
  </SqlMethod>
carlos@0
    41
  <SqlMethod name="set" type="constant" return="multiple">
carlos@0
    42
    <SqlMethodComment></SqlMethodComment>
carlos@0
    43
    <Sql></Sql>
carlos@0
    44
    <Parameter name="line"/>
carlos@0
    45
  </SqlMethod>
carlos@0
    46
  <SqlMethod name="selectLineNo" type="preparedStatement" return="String" default="0">
carlos@0
    47
    <SqlMethodComment></SqlMethodComment>
carlos@0
    48
    <Sql>
carlos@0
    49
      <![CDATA[
carlos@0
    50
      SELECT LINE AS TOTAL
carlos@0
    51
      FROM C_INVOICELINE 
carlos@423
    52
      WHERE C_INVOICELINE_ID = TO_NUMBER(?) 
carlos@0
    53
     ]]>
carlos@0
    54
     </Sql>
carlos@0
    55
     <Parameter name="cInvoiceId"/>
carlos@0
    56
  </SqlMethod>
carlos@0
    57
  <SqlMethod name="selectNextLine" type="preparedStatement" return="String" default="0">
carlos@0
    58
    <SqlMethodComment></SqlMethodComment>
carlos@0
    59
    <Sql>
carlos@0
    60
      <![CDATA[
carlos@0
    61
      SELECT COALESCE(MAX(LINE), 0) + 10 AS TOTAL
carlos@0
    62
      FROM C_INVOICELINE 
carlos@423
    63
      WHERE C_INVOICE_ID = TO_NUMBER(?) 
carlos@0
    64
     ]]>
carlos@0
    65
     </Sql>
carlos@0
    66
     <Parameter name="cInvoiceId"/>
carlos@0
    67
  </SqlMethod>
carlos@0
    68
  <SqlMethod name="selectUOM" type="preparedStatement" return="String" default="">
carlos@0
    69
    <SqlMethodComment></SqlMethodComment>
carlos@0
    70
    <Sql>
carlos@0
    71
      <![CDATA[
carlos@0
    72
      SELECT C_UOM_ID AS TOTAL
carlos@0
    73
      FROM M_PRODUCT 
carlos@423
    74
      WHERE M_PRODUCT_ID = TO_NUMBER(?) 
carlos@0
    75
     ]]>
carlos@0
    76
     </Sql>
carlos@0
    77
     <Parameter name="mProductId"/>
carlos@0
    78
  </SqlMethod>
carlos@0
    79
  <SqlMethod name="update" type="preparedStatement" static="false" return="rowCount">
carlos@0
    80
    <Sql><![CDATA[
carlos@0
    81
        UPDATE C_INVOICELINE SET UPDATEDBY = TO_NUMBER(?), UPDATED = now(), M_PRODUCT_ID = TO_NUMBER(?), QTYINVOICED = TO_NUMBER(?), C_TAX_ID = TO_NUMBER(?), 
carlos@0
    82
        DESCRIPTION = ?, PRICELIST = TO_NUMBER(?), PRICEACTUAL = TO_NUMBER(?), PRICELIMIT = TO_NUMBER(?), LINENETAMT = (TO_NUMBER(?)*TO_NUMBER(?)), 
carlos@0
    83
        C_CHARGE_ID = TO_NUMBER(?), CHARGEAMT = TO_NUMBER(?), C_UOM_ID = TO_NUMBER(?), S_RESOURCEASSIGNMENT_ID = TO_NUMBER(?), A_ASSET_ID = TO_NUMBER(?), TAXAMT = TO_NUMBER(?), 
carlos@0
    84
        M_ATTRIBUTESETINSTANCE_ID = TO_NUMBER(?), ISDESCRIPTION = ?, QUANTITYORDER = TO_NUMBER(?), M_PRODUCT_UOM_ID = TO_NUMBER(?), C_INVOICE_DISCOUNT_ID = TO_NUMBER(?), 
carlos@0
    85
        PRICESTD = TO_NUMBER(?)
carlos@423
    86
        WHERE C_INVOICELINE_ID = TO_NUMBER(?) 
carlos@0
    87
    ]]></Sql>
carlos@0
    88
    <Parameter name="updatedby"/>
carlos@0
    89
    <Parameter name="mProductId"/>
carlos@0
    90
    <Parameter name="qtyinvoiced"/>
carlos@0
    91
    <Parameter name="cTaxId"/>
carlos@0
    92
    <Parameter name="description"/>
carlos@0
    93
    <Parameter name="pricelist"/>
carlos@0
    94
    <Parameter name="priceactual"/>
carlos@0
    95
    <Parameter name="pricelimit"/>
carlos@0
    96
    <Parameter name="priceactual"/>
carlos@0
    97
    <Parameter name="qtyinvoiced"/>
carlos@0
    98
    <Parameter name="cChargeId"/>
carlos@0
    99
    <Parameter name="chargeamt"/>
carlos@0
   100
    <Parameter name="cUomId"/>
carlos@0
   101
    <Parameter name="sResourceassignmentId"/>
carlos@0
   102
    <Parameter name="aAssetId"/>
carlos@0
   103
    <Parameter name="taxamt"/>
carlos@0
   104
    <Parameter name="mAttributesetinstanceId"/>
carlos@0
   105
    <Parameter name="isdescription"/>
carlos@0
   106
    <Parameter name="quantityorder"/>
carlos@0
   107
    <Parameter name="mProductUomId"/>
carlos@0
   108
    <Parameter name="cInvoiceDiscountId"/>
carlos@0
   109
    <Parameter name="pricestd"/>
carlos@0
   110
    <Parameter name="cInvoicelineId"/>
carlos@0
   111
  </SqlMethod>
carlos@0
   112
  <SqlMethod name="insert" type="preparedStatement" static="false" return="rowCount">
carlos@0
   113
    <Sql><![CDATA[
carlos@0
   114
        INSERT INTO C_INVOICELINE (
carlos@0
   115
    C_INVOICELINE_ID, AD_CLIENT_ID, AD_ORG_ID, 
carlos@0
   116
    ISACTIVE, CREATED, CREATEDBY, 
carlos@0
   117
    UPDATED, UPDATEDBY, C_INVOICE_ID, 
carlos@0
   118
    C_ORDERLINE_ID, M_INOUTLINE_ID, LINE, 
carlos@0
   119
    DESCRIPTION, M_PRODUCT_ID, QTYINVOICED, 
carlos@0
   120
    PRICELIST, PRICEACTUAL, PRICELIMIT, 
carlos@0
   121
    LINENETAMT, C_CHARGE_ID, CHARGEAMT, 
carlos@0
   122
    C_UOM_ID, C_TAX_ID, S_RESOURCEASSIGNMENT_ID, 
carlos@0
   123
    A_ASSET_ID, TAXAMT, M_ATTRIBUTESETINSTANCE_ID, 
carlos@0
   124
    ISDESCRIPTION, QUANTITYORDER, M_PRODUCT_UOM_ID, 
carlos@0
   125
    C_INVOICE_DISCOUNT_ID, PRICESTD) 
carlos@0
   126
    VALUES ( TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 
carlos@0
   127
    'Y', now(), TO_NUMBER(?), 
carlos@0
   128
    now(), TO_NUMBER(?), TO_NUMBER(?), 
carlos@423
   129
    TO_NUMBER(?), TO_NUMBER(?), (SELECT COALESCE(MAX(LINE), 0) +10 FROM C_INVOICELINE WHERE C_INVOICE_ID = TO_NUMBER(?)), 
carlos@0
   130
    ?, TO_NUMBER(?), TO_NUMBER(?), 
carlos@0
   131
    TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 
carlos@0
   132
    (TO_NUMBER(?)*TO_NUMBER(?)), TO_NUMBER(?), TO_NUMBER(?), 
carlos@0
   133
    TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 
carlos@0
   134
    TO_NUMBER(?), TO_NUMBER(?), TO_NUMBER(?), 
carlos@0
   135
    ?, TO_NUMBER(?), TO_NUMBER(?), 
carlos@0
   136
    TO_NUMBER(?), TO_NUMBER(?))
carlos@0
   137
    ]]></Sql>
carlos@0
   138
    <Parameter name="cInvoicelineId"/>
carlos@0
   139
    <Parameter name="adClientId"/>
carlos@0
   140
    <Parameter name="adOrgId"/>
carlos@0
   141
    <Parameter name="createdby"/>
carlos@0
   142
    <Parameter name="updatedby"/>
carlos@0
   143
    <Parameter name="cInvoiceId"/>
carlos@0
   144
    <Parameter name="cOrderlineId"/>
carlos@0
   145
    <Parameter name="mInoutlineId"/>
carlos@0
   146
    <Parameter name="cInvoiceId"/>
carlos@0
   147
    <Parameter name="description"/>
carlos@0
   148
    <Parameter name="mProductId"/>
carlos@0
   149
    <Parameter name="qtyinvoiced"/>
carlos@0
   150
    <Parameter name="pricelist"/>
carlos@0
   151
    <Parameter name="priceactual"/>
carlos@0
   152
    <Parameter name="pricelimit"/>
carlos@0
   153
    <Parameter name="priceactual"/>
carlos@0
   154
    <Parameter name="qtyinvoiced"/>
carlos@0
   155
    <Parameter name="cChargeId"/>
carlos@0
   156
    <Parameter name="chargeamt"/>
carlos@0
   157
    <Parameter name="cUomId"/>
carlos@0
   158
    <Parameter name="cTaxId"/>
carlos@0
   159
    <Parameter name="sResourceassignmentId"/>
carlos@0
   160
    <Parameter name="aAssetId"/>
carlos@0
   161
    <Parameter name="taxamt"/>
carlos@0
   162
    <Parameter name="mAttributesetinstanceId"/>
carlos@0
   163
    <Parameter name="isdescription"/>
carlos@0
   164
    <Parameter name="quantityorder"/>
carlos@0
   165
    <Parameter name="mProductUomId"/>
carlos@0
   166
    <Parameter name="cInvoiceDiscountId"/>
carlos@0
   167
    <Parameter name="pricestd"/>
carlos@0
   168
  </SqlMethod>
carlos@0
   169
  <SqlMethod name="delete" type="preparedStatement" connection="true" static="false" return="rowCount">
carlos@0
   170
    <Sql><![CDATA[
carlos@0
   171
        DELETE FROM C_INVOICELINE 
carlos@423
   172
        WHERE C_INVOICELINE_ID = TO_NUMBER(?) 
carlos@0
   173
    ]]></Sql>
carlos@0
   174
    <Parameter name="cInvoicelineId"/>
carlos@0
   175
  </SqlMethod>
carlos@0
   176
</SqlClass>