src/org/openbravo/erpCommon/ad_reports/ReportInOut_data.xsql
author David Baz Fayos <david.baz@openbravo.com>
Tue, 27 May 2008 15:26:10 +0000
changeset 1044 8691bbc94032
parent 0 0247c26f10c6
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="ReportInOutData" package="org.openbravo.erpCommon.ad_reports">
  <SqlClassComment></SqlClassComment>
  <SqlMethod name="select" type="preparedStatement" return="multiple">
    <SqlMethodComment></SqlMethodComment>
    <Sql>
    <![CDATA[
      SELECT (CASE M_INOUT.MOVEMENTTYPE WHEN 'V+' THEN 'ENTRADAS' WHEN 'C-' THEN 'SALIDAS' ELSE '' END) AS MOVEMENTTYPE,
      (CASE M_INOUT.MOVEMENTTYPE WHEN 'V+' THEN 'MaterialReceipt' WHEN 'C-' THEN 'ShipmentCustomer' ELSE '' END) AS WINDOW, 
      (CASE M_INOUT.MOVEMENTTYPE WHEN 'V+' THEN 'ReceiptLine' WHEN 'C-' THEN 'ShipmentLine' ELSE '' END) AS TAB, 
      M_INOUT.DOCUMENTNO, M_INOUT.MOVEMENTDATE, M_PRODUCT.NAME, C_BPARTNER.NAME AS PARTNERNAME, M_LOCATOR.X, M_LOCATOR.Y, M_LOCATOR.Z, 
      AD_COLUMN_IDENTIFIER('M_WAREHOUSE', to_char(M_LOCATOR.M_WAREHOUSE_ID), ?) AS warehouse,
      M_ATTRIBUTESETINSTANCE.DESCRIPTION AS ATTRIBUTEDESCRIPTION, M_INOUTLINE.MOVEMENTQTY||' '||C1.NAME AS MOVEMENTQTY, 
      (CASE WHEN M_INOUTLINE.M_PRODUCT_UOM_ID IS NULL THEN (CASE WHEN M_PRODUCT.WEIGHT*M_INOUTLINE.MOVEMENTQTY = 0 THEN NULL WHEN M_PRODUCT.WEIGHT*M_INOUTLINE.MOVEMENTQTY IS NULL THEN NULL ELSE M_PRODUCT.WEIGHT*M_INOUTLINE.MOVEMENTQTY||' '||'Kgs' END) ELSE M_INOUTLINE.QUANTITYORDER ||' '||TO_CHAR(C2.NAME) END) AS WEIGHT,
      M_INOUTLINE.M_INOUTLINE_ID AS ID
      FROM M_INOUTLINE left join M_ATTRIBUTESETINSTANCE on M_INOUTLINE.M_ATTRIBUTESETINSTANCE_ID = M_ATTRIBUTESETINSTANCE.M_ATTRIBUTESETINSTANCE_ID
                       left join M_PRODUCT              on M_INOUTLINE.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
                       left join C_UOM C2               on M_INOUTLINE.M_PRODUCT_UOM_ID = C2.C_UOM_ID,
           M_INOUT,  C_BPARTNER, M_LOCATOR, C_UOM C1
      WHERE M_INOUT.M_INOUT_ID = M_INOUTLINE.M_INOUT_ID
      AND M_INOUT.C_BPARTNER_ID = C_BPARTNER.C_BPARTNER_ID
      AND M_INOUTLINE.C_UOM_ID = C1.C_UOM_ID
      AND M_INOUTLINE.M_LOCATOR_ID = M_LOCATOR.M_LOCATOR_ID
      AND M_INOUT.PROCESSED = 'Y'
      AND M_INOUT.DOCSTATUS <> 'RE'
      AND M_INOUT.AD_CLIENT_ID IN ('1')
      AND M_INOUT.AD_ORG_ID IN ('1')
      AND M_INOUT.MOVEMENTDATE >= to_date(?)
      AND M_INOUT.MOVEMENTDATE < to_date(?)
      AND 1=1
      ORDER BY MOVEMENTTYPE, M_INOUT.C_BPARTNER_ID, M_INOUT.MOVEMENTDATE DESC, M_INOUT.DOCUMENTNO, M_PRODUCT.NAME
     ]]></Sql>
    <Parameter name="language"/>
    <Parameter name="adUserClient" type="replace" optional="true" after="AND M_INOUT.AD_CLIENT_ID IN (" text="'1'"/>
    <Parameter name="adOrgClient" type="replace" optional="true" after="AND M_INOUT.AD_ORG_ID IN (" text="'1'"/>
    <Parameter name="dateFrom"/>
    <Parameter name="dateTo"/>
    <Parameter name="cBpartner" optional="true" type="argument" after="1=1" text=" AND C_BPARTNER.C_BPARTNER_ID IN"/>
  </SqlMethod>
  <SqlMethod name="set" type="constant" return="multiple">
      <SqlMethodComment></SqlMethodComment>
      <Sql></Sql>
  </SqlMethod>
  <SqlMethod name="selectBpartner" type="preparedStatement" return="multiple">
    <SqlMethodComment></SqlMethodComment>
    <Sql>
    <![CDATA[
      SELECT C_BPARTNER_ID AS ID, C_BPARTNER.NAME
      FROM C_BPARTNER
      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="cBpartnerId" optional="true" type="argument" after="(1=2" text=" OR C_BPARTNER_ID IN"/>
  </SqlMethod>
</SqlClass>