src/org/openbravo/erpCommon/ad_reports/ReportPricelist_data.xsql
author David Baz Fayos <david.baz@openbravo.com>
Tue, 27 May 2008 15:26:10 +0000
changeset 1044 8691bbc94032
parent 423 ecf368072c48
child 1142 24823db6e4e4
permissions -rw-r--r--
Removed old frame parameter of windowTableId
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *************************************************************************
 * The contents of this file are subject to the Openbravo  Public  License
 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
 * Version 1.1  with a permitted attribution clause; you may not  use this
 * file except in compliance with the License. You  may  obtain  a copy of
 * the License at http://www.openbravo.com/legal/license.html 
 * Software distributed under the License  is  distributed  on  an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific  language  governing  rights  and  limitations
 * under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SL 
 * All portions are Copyright (C) 2001-2006 Openbravo SL 
 * All Rights Reserved. 
 * Contributor(s):  ______________________________________.
 ************************************************************************
-->





<SqlClass name="ReportPricelistData" package="org.openbravo.erpCommon.ad_reports">
  <SqlClassComment></SqlClassComment>
  <SqlMethod name="select" type="preparedStatement" return="multiple">
    <SqlMethodComment></SqlMethodComment>
    <Sql>
    <![CDATA[
      SELECT M_PRICELIST_VERSION.M_PRICELIST_VERSION_ID, M_PRICELIST_VERSION.NAME||'   '||'valid from:  '|| M_PRICELIST_VERSION.VALIDFROM AS VERSION_NAME,
      M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID, M_PRODUCT_CATEGORY.NAME AS CATEGORY_NAME,
      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
      FROM M_PRICELIST_VERSION, M_PRODUCTPRICE, M_PRODUCT, M_PRODUCT_CATEGORY
      WHERE M_PRICELIST_VERSION.M_PRICELIST_VERSION_ID = M_PRODUCTPRICE.M_PRICELIST_VERSION_ID
      AND M_PRODUCTPRICE.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
      AND M_PRODUCT.M_PRODUCT_CATEGORY_ID = M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID
      AND M_PRICELIST_VERSION.AD_CLIENT_ID IN ('1')
      AND M_PRICELIST_VERSION.AD_ORG_ID IN ('1')
      AND 1=1
      ORDER BY VERSION_NAME, CATEGORY_NAME, M_PRODUCT.NAME
     ]]></Sql>
    <Field name="rownum" value="count"/>
    <Parameter name="adUserClient" type="replace" optional="true" after="AND M_PRICELIST_VERSION.AD_CLIENT_ID IN (" text="'1'"/>
    <Parameter name="adOrgClient" type="replace" optional="true" after="AND M_PRICELIST_VERSION.AD_ORG_ID IN (" text="'1'"/>
    <Parameter name="mPricelistVersionId" optional="true" after="AND 1=1"><![CDATA[ AND M_PRICELIST_VERSION.M_PRICELIST_VERSION_ID = TO_NUMBER(?)]]></Parameter>
    <Parameter name="mProductCategoryId" optional="true" after="AND 1=1"><![CDATA[AND M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID = TO_NUMBER(?)]]></Parameter>
    <Parameter name="mProduct" optional="true" type="argument" after="AND 1=1"><![CDATA[ AND M_PRODUCT.M_PRODUCT_ID IN]]></Parameter>
  </SqlMethod>
  <SqlMethod name="set" type="constant" return="multiple">
      <SqlMethodComment></SqlMethodComment>
      <Sql></Sql>
  </SqlMethod>
  <SqlMethod name="selectPDF" type="preparedStatement" return="multiple">
    <SqlMethodComment></SqlMethodComment>
    <Sql>
    <![CDATA[
      SELECT M_PRICELIST.NAME AS VERSION_NAME, M_PRODUCT_CATEGORY.NAME AS CATEGORY_NAME,
      (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 '(Valid from : '||M_PRICELIST_VERSION.VALIDFROM||')' END) AS VALID
      FROM M_PRODUCT left join C_UOM on M_PRODUCT.C_UOM_ID = C_UOM.C_UOM_ID,
      M_PRICELIST, M_PRICELIST_VERSION, M_PRODUCTPRICE, M_PRODUCT_CATEGORY
      WHERE M_PRICELIST.M_PRICELIST_ID = M_PRICELIST_VERSION.M_PRICELIST_ID
      AND M_PRICELIST_VERSION.M_PRICELIST_VERSION_ID = M_PRODUCTPRICE.M_PRICELIST_VERSION_ID
      AND M_PRODUCTPRICE.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
      AND M_PRODUCT.M_PRODUCT_CATEGORY_ID = M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID
      AND M_PRICELIST_VERSION.AD_CLIENT_ID IN ('1')
      AND M_PRICELIST_VERSION.AD_ORG_ID IN ('1')
      AND 1=1
      ORDER BY VERSION_NAME, CATEGORY_NAME, M_PRODUCT.NAME
     ]]></Sql>
    <Parameter name="adUserClient" type="replace" optional="true" after="AND M_PRICELIST_VERSION.AD_CLIENT_ID IN (" text="'1'"/>
    <Parameter name="adOrgClient" type="replace" optional="true" after="AND M_PRICELIST_VERSION.AD_ORG_ID IN (" text="'1'"/>
    <Parameter name="mPricelistVersionId" optional="true" after="AND 1=1"><![CDATA[ AND M_PRICELIST_VERSION.M_PRICELIST_VERSION_ID = TO_NUMBER(?)]]></Parameter>
    <Parameter name="mProductCategoryId" optional="true" after="AND 1=1"><![CDATA[AND M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID = TO_NUMBER(?)]]></Parameter>
    <Parameter name="mProduct" optional="true" type="argument" after="AND 1=1"><![CDATA[ AND M_PRODUCT.M_PRODUCT_ID IN]]></Parameter>
  </SqlMethod>
  <SqlMethod name="selectMproduct" type="preparedStatement" return="multiple">
    <SqlMethodComment></SqlMethodComment>
    <Sql>
    <![CDATA[
      SELECT M_PRODUCT.M_PRODUCT_ID AS ID,M_PRODUCT.NAME
      FROM M_PRODUCT
      WHERE AD_ORG_ID IN ('1') 
      AND AD_CLIENT_ID IN ('1') 
      AND (1=2 )
     ]]></Sql>
     <Parameter name="adOrgClient" type="replace" optional="true" after="AD_ORG_ID IN (" text="'1'"/>
     <Parameter name="adUserClient" type="replace" optional="true" after="AND AD_CLIENT_ID IN (" text="'1'"/>
     <Parameter name="mProductId" optional="true" type="argument" after="(1=2" text=" OR M_PRODUCT_ID IN"/>
  </SqlMethod>
</SqlClass>