src/org/openbravo/erpCommon/ad_reports/ReportPendingProductionJr_data.xsql
changeset 0 0247c26f10c6
child 6701 690d2af86089
equal deleted inserted replaced
-1:000000000000 0:0247c26f10c6
       
     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.0  (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 SL 
       
    15  * All portions are Copyright (C) 2001-2006 Openbravo SL 
       
    16  * All Rights Reserved. 
       
    17  * Contributor(s):  ______________________________________.
       
    18  ************************************************************************
       
    19 -->
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 <SqlClass name="ReportPendingProductionJrData" package="org.openbravo.erpCommon.ad_reports">
       
    25    <SqlClassComment></SqlClassComment>
       
    26    <SqlMethod name="select" type="preparedStatement" return="multiple">
       
    27       <SqlMethodComment></SqlMethodComment>
       
    28       <Sql>
       
    29       <![CDATA[
       
    30         SELECT C_ORDER.DOCUMENTNO AS DOCNO, C_ORDER.DATEORDERED AS ORDERED, C_ORDER.DATEPROMISED AS PROMISED,
       
    31              C_BPARTNER.NAME AS BPNAME, C_REGION.NAME AS RNAME, M_PRODUCT.VALUE, M_PRODUCT.NAME AS PNAME,
       
    32              C_ORDERLINE.QTYORDERED, STORAGE_DETAIL.QTYONHAND, STORAGE_DETAIL.PREQTYONHAND,
       
    33               CASE  WHEN C_ORDERLINE.QTYORDERED - STORAGE_DETAIL.QTYONHAND - STORAGE_DETAIL.PREQTYONHAND>0 THEN 'Color' ELSE 'Bordes' END AS NEGATIVE
       
    34          FROM C_ORDER, C_ORDERLINE, C_BPARTNER, M_PRODUCT, C_BPARTNER_LOCATION, C_LOCATION, C_REGION,
       
    35             (SELECT M_PRODUCT_ID, SUM(QTYONHAND) AS QTYONHAND, SUM(PREQTYONHAND) AS PREQTYONHAND  
       
    36              FROM M_STORAGE_DETAIL GROUP BY M_STORAGE_DETAIL.M_PRODUCT_ID) STORAGE_DETAIL 
       
    37          WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
       
    38            AND C_ORDER.C_BPARTNER_ID = C_BPARTNER.C_BPARTNER_ID
       
    39            AND C_ORDERLINE.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
       
    40            AND STORAGE_DETAIL.M_PRODUCT_ID = C_ORDERLINE.M_PRODUCT_ID
       
    41            AND C_BPARTNER_LOCATION.C_BPARTNER_LOCATION_ID = C_ORDER.C_BPARTNER_LOCATION_ID
       
    42            AND C_BPARTNER_LOCATION.C_LOCATION_ID = C_LOCATION.C_LOCATION_ID
       
    43            AND C_LOCATION.C_REGION_ID = C_REGION.C_REGION_ID
       
    44            AND C_ORDER.DOCSTATUS='CO'
       
    45            AND C_ORDER.C_ORDER_ID IN (SELECT C_Order_ID FROM M_InOut_Candidate_v)
       
    46            AND C_ORDER.ISSOTRX='Y' 
       
    47            AND C_ORDER.AD_CLIENT_ID IN ('1')
       
    48            AND C_ORDER.AD_ORG_ID IN ('1')
       
    49          ORDER BY C_ORDER.DATEORDERED
       
    50       ]]>
       
    51       </Sql>
       
    52     <Parameter name="adUserClient" type="replace" optional="true" after="AND C_ORDER.AD_CLIENT_ID IN (" text="'1'"/>  
       
    53     <Parameter name="adUserOrg" type="replace" optional="true" after="AND C_ORDER.AD_ORG_ID IN (" text="'1'"/>
       
    54    </SqlMethod>
       
    55 
       
    56    <SqlMethod name="set" type="constant" return="multiple">
       
    57       <SqlMethodComment></SqlMethodComment>
       
    58       <Sql></Sql>
       
    59    </SqlMethod>
       
    60 </SqlClass>