src/org/openbravo/erpCommon/ad_reports/ReportPricelist_data.xsql
changeset 35426 9141b6a4a4e8
parent 35410 41c88f9c32e6
parent 35425 fa495023e638
child 35427 e36d52a51aee
equal deleted inserted replaced
35410:41c88f9c32e6 35426:9141b6a4a4e8
     1 <?xml version="1.0" encoding="UTF-8" ?>
       
     2 <!--
       
     3  *************************************************************************
       
     4  * The contents of this file are subject to the Openbravo  Public  License
       
     5  * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
       
     6  * Version 1.1  with a permitted attribution clause; you may not  use this
       
     7  * file except in compliance with the License. You  may  obtain  a copy of
       
     8  * the License at http://www.openbravo.com/legal/license.html 
       
     9  * Software distributed under the License  is  distributed  on  an "AS IS"
       
    10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
       
    11  * License for the specific  language  governing  rights  and  limitations
       
    12  * under the License. 
       
    13  * The Original Code is Openbravo ERP. 
       
    14  * The Initial Developer of the Original Code is Openbravo SLU 
       
    15  * All portions are Copyright (C) 2001-2010 Openbravo SLU 
       
    16  * All Rights Reserved. 
       
    17  * Contributor(s):  ______________________________________.
       
    18  ************************************************************************
       
    19 -->
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 <SqlClass name="ReportPricelistData" package="org.openbravo.erpCommon.ad_reports">
       
    26   <SqlClassComment></SqlClassComment>
       
    27   <SqlMethod name="selectTrl" type="preparedStatement" return="multiple">
       
    28     <SqlMethodComment></SqlMethodComment>
       
    29     <Sql>
       
    30     <![CDATA[
       
    31       SELECT M_PRICELIST_VERSION.M_PRICELIST_VERSION_ID, M_PRICELIST_VERSION.NAME||'   '||?||'  '|| M_PRICELIST_VERSION.VALIDFROM AS VERSION_NAME,
       
    32       M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID, M_PRODUCT_CATEGORY.NAME AS CATEGORY_NAME,
       
    33       M_PRODUCT.M_PRODUCT_ID, (CASE WHEN M_PRODUCT.VALUE IS NULL THEN M_PRODUCT.NAME ELSE M_PRODUCT.VALUE||' - '||M_PRODUCT.NAME END) AS PRODUCT_NAME, M_PRODUCTPRICE.PRICELIMIT, M_PRODUCTPRICE.PRICELIST, M_PRODUCTPRICE.PRICESTD, '' as name, '' as id, '' AS VALID, '' AS UOMNAME
       
    34       FROM M_PRICELIST_VERSION, M_PRODUCTPRICE, M_PRODUCT, M_PRODUCT_CATEGORY
       
    35       WHERE M_PRICELIST_VERSION.M_PRICELIST_VERSION_ID = M_PRODUCTPRICE.M_PRICELIST_VERSION_ID
       
    36       AND M_PRODUCTPRICE.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
       
    37       AND M_PRODUCT.M_PRODUCT_CATEGORY_ID = M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID
       
    38       AND M_PRICELIST_VERSION.AD_CLIENT_ID IN ('1')
       
    39       AND M_PRICELIST_VERSION.AD_ORG_ID IN ('1')
       
    40       AND 1=1
       
    41       ORDER BY VERSION_NAME, CATEGORY_NAME, M_PRODUCT.NAME
       
    42      ]]></Sql>
       
    43     <Field name="rownum" value="count"/>
       
    44     <Parameter name="validFromTrl"/>
       
    45     <Parameter name="adUserClient" type="replace" optional="true" after="AND M_PRICELIST_VERSION.AD_CLIENT_ID IN (" text="'1'"/>
       
    46     <Parameter name="adOrgClient" type="replace" optional="true" after="AND M_PRICELIST_VERSION.AD_ORG_ID IN (" text="'1'"/>
       
    47     <Parameter name="mPricelistVersionId" optional="true" after="AND 1=1"><![CDATA[ AND M_PRICELIST_VERSION.M_PRICELIST_VERSION_ID = ?]]></Parameter>
       
    48     <Parameter name="mProductCategoryId" optional="true" after="AND 1=1"><![CDATA[AND M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID = ?]]></Parameter>
       
    49     <Parameter name="mProduct" optional="true" type="argument" after="AND 1=1"><![CDATA[ AND M_PRODUCT.M_PRODUCT_ID IN]]></Parameter>
       
    50   </SqlMethod>
       
    51   <SqlMethod name="set" type="constant" return="multiple">
       
    52       <SqlMethodComment></SqlMethodComment>
       
    53       <Sql></Sql>
       
    54   </SqlMethod>
       
    55   <SqlMethod name="selectPDFTrl" type="preparedStatement" return="multiple">
       
    56     <SqlMethodComment></SqlMethodComment>
       
    57     <Sql>
       
    58     <![CDATA[
       
    59       SELECT M_PRICELIST_VERSION.NAME||'   '||?||'  '|| M_PRICELIST_VERSION.VALIDFROM AS VERSION_NAME, M_PRODUCT_CATEGORY.NAME AS CATEGORY_NAME,
       
    60       (CASE WHEN M_PRODUCT.VALUE IS NULL THEN M_PRODUCT.NAME ELSE M_PRODUCT.VALUE||' - '||M_PRODUCT.NAME END) AS PRODUCT_NAME, M_PRODUCTPRICE.PRICESTD, C_UOM.NAME AS UOMNAME, (CASE WHEN M_PRICELIST_VERSION.VALIDFROM IS NOT NULL THEN '('||?||' '||M_PRICELIST_VERSION.VALIDFROM||')' END) AS VALID
       
    61       FROM M_PRODUCT left join C_UOM on M_PRODUCT.C_UOM_ID = C_UOM.C_UOM_ID,
       
    62       M_PRICELIST_VERSION inner join M_PRICELIST ON M_PRICELIST_VERSION.M_PRICELIST_ID = M_PRICELIST.M_PRICELIST_ID,
       
    63       M_PRODUCTPRICE, M_PRODUCT_CATEGORY
       
    64       WHERE M_PRICELIST_VERSION.M_PRICELIST_VERSION_ID = M_PRODUCTPRICE.M_PRICELIST_VERSION_ID
       
    65       AND M_PRODUCTPRICE.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
       
    66       AND M_PRODUCT.M_PRODUCT_CATEGORY_ID = M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID
       
    67       AND M_PRICELIST_VERSION.AD_CLIENT_ID IN ('1')
       
    68       AND M_PRICELIST_VERSION.AD_ORG_ID IN ('1')
       
    69       AND 1=1
       
    70       ORDER BY VERSION_NAME, CATEGORY_NAME, M_PRODUCT.NAME
       
    71      ]]></Sql>
       
    72     <Parameter name="validFromTrl"/>
       
    73     <Parameter name="validFromTrl"/>
       
    74     <Parameter name="adUserClient" type="replace" optional="true" after="AND M_PRICELIST_VERSION.AD_CLIENT_ID IN (" text="'1'"/>
       
    75     <Parameter name="adOrgClient" type="replace" optional="true" after="AND M_PRICELIST_VERSION.AD_ORG_ID IN (" text="'1'"/>
       
    76     <Parameter name="mPricelistVersionId" optional="true" after="AND 1=1"><![CDATA[ AND M_PRICELIST_VERSION.M_PRICELIST_VERSION_ID = ?]]></Parameter>
       
    77     <Parameter name="mProductCategoryId" optional="true" after="AND 1=1"><![CDATA[AND M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID = ?]]></Parameter>
       
    78     <Parameter name="mProduct" optional="true" type="argument" after="AND 1=1"><![CDATA[ AND M_PRODUCT.M_PRODUCT_ID IN]]></Parameter>
       
    79   </SqlMethod>
       
    80 </SqlClass>