src-db/database/model/views/M_INOUT_LINE_VT.xml
author Eduardo Argal Guibert <eduardo.argal@openbravo.com>
Sat, 03 Apr 2010 15:59:56 +0200
changeset 6917 20af736f8ca9
parent 6912 38c773f35773
child 7022 825f121b6164
permissions -rw-r--r--
wrong views posstgre 8.4
adrian@94
     1
<?xml version="1.0"?>
adrian@94
     2
  <database name="VIEW M_INOUT_LINE_VT">
antonio@776
     3
    <view name="M_INOUT_LINE_VT"><![CDATA[SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, uom.ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line, iol.movementqty, uom.uomsymbol, COALESCE(COALESCE(pt.name, p.name), iol.description) AS name, 
eduardo@6917
     4
        CASE
eduardo@6917
     5
            WHEN COALESCE(pt.name, p.name) IS NOT NULL THEN iol.description
eduardo@6917
     6
            ELSE NULL
eduardo@6917
     7
        END AS description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id
eduardo@6917
     8
   FROM m_inoutline iol
eduardo@6917
     9
   JOIN c_uom_trl 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@777
    11
   LEFT JOIN m_product_trl pt ON iol.m_product_id = pt.m_product_id AND uom.ad_language = pt.ad_language
antonio@776
    12
UNION 
eduardo@6917
    13
 SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, uom.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, COALESCE(pt.name, p.name) AS name, b.description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id
eduardo@6917
    14
   FROM m_product_bom b
eduardo@6917
    15
   JOIN m_inoutline iol ON b.m_product_id = iol.m_product_id
antonio@777
    16
   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
    17
   JOIN m_product p ON b.m_productbom_id = p.m_product_id
antonio@777
    18
   JOIN c_uom_trl uom ON p.c_uom_id = uom.c_uom_id
antonio@777
    19
   JOIN m_product_trl pt ON iol.m_product_id = pt.m_product_id AND uom.ad_language = pt.ad_language]]></view>
adrian@94
    20
  </database>