src-db/database/model/views/M_INOUT_CANDIDATE_V.xml
author Antonio Moreno <antonio.moreno@openbravo.com>
Mon, 04 Feb 2013 09:27:53 +0100
changeset 9910 6767429386d8
parent 7031 2aac4501bbd5
child 9911 444911e2b851
permissions -rw-r--r--
Changes required to support PostgreSQL 9.2
<?xml version="1.0"?>
  <database name="VIEW M_INOUT_CANDIDATE_V">
    <view name="M_INOUT_CANDIDATE_V"><![CDATA[SELECT o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id,  o.documentno, o.dateordered, o.c_doctype_id, o.totallines AS amountlines,  sum((l.qtyordered - l.qtydelivered) * l.priceactual) AS totallines FROM c_order o JOIN c_orderline l ON o.c_order_id = l.c_order_id WHERE o.docstatus = 'CO' AND o.isdelivered = 'N' AND (o.c_doctype_id IN (SELECT c_doctype.c_doctype_id FROM c_doctype WHERE c_doctype.docbasetype = 'SOO' AND (c_doctype.docsubtypeso NOT IN ('ON', 'OB', 'WR')))) AND l.qtyordered <> l.qtydelivered AND l.directship = 'N' AND l.m_product_id IS NOT NULL GROUP BY o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id, o.documentno, o.dateordered, o.totallines, o.c_doctype_id]]></view>
  </database>