src-db/database/model/views/M_INOUT_LINE_V.xml
author Adrián Romero <adrianromero@openbravo.com>
Tue, 02 Mar 2010 12:23:55 +0100
changeset 6544 2e60729b9c13
parent 799 fef2c5e2feb7
child 6545 27d9578201da
permissions -rw-r--r--
Fixes issue 0012014: Error in Project Profitability
adrian@94
     1
<?xml version="1.0"?>
adrian@94
     2
  <database name="VIEW M_INOUT_LINE_V">
antonio@776
     3
    <view name="M_INOUT_LINE_V"><![CDATA[SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, 'en_US' AS ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line, iol.movementqty, uom.uomsymbol, COALESCE(p.name, iol.description) AS name, 
adrianromero@6544
     4
                CASE
adrianromero@6544
     5
                    WHEN p.name IS NOT NULL THEN iol.description
adrianromero@6544
     6
                    ELSE NULL
adrianromero@6544
     7
                END AS description, p.documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id
adrianromero@6544
     8
           FROM m_inoutline iol
adrianromero@6544
     9
      JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id
antonio@777
    10
   LEFT JOIN m_product p ON iol.m_product_id = p.m_product_id
antonio@776
    11
UNION 
adrianromero@6544
    12
         SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, 'en_US' AS ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line + b.line / 100 AS line, iol.movementqty * b.bomqty AS movementqty, uom.uomsymbol, p.name, b.description, p.documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id
adrianromero@6544
    13
           FROM m_product_bom b
adrianromero@6544
    14
      JOIN m_inoutline iol ON b.m_product_id = iol.m_product_id
antonio@777
    15
   JOIN m_product bp ON bp.m_product_id = iol.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.ispicklistprintdetails = 'Y'
antonio@777
    16
   JOIN m_product p ON b.m_productbom_id = p.m_product_id
antonio@777
    17
   JOIN c_uom uom ON p.c_uom_id = uom.c_uom_id]]></view>
adrian@94
    18
  </database>