src-db/database/model/views/RV_C_INVOICE.xml
author Anthony Wolski <anthony.wolski@openbravo.com>
Thu, 30 Oct 2008 10:10:27 +0000
changeset 1867 a2cb0934dfb0
permissions -rw-r--r--
Reintegrate branch process-scheduler
anthony@1867
     1
<?xml version="1.0"?>
anthony@1867
     2
  <database name="VIEW RV_C_INVOICE">
anthony@1867
     3
    <view name="RV_C_INVOICE"><![CDATA[SELECT i.c_invoice_id, i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby, i.updated, i.updatedby, i.issotrx, i.documentno, i.docstatus, i.docaction, i.isprinted, i.isdiscountprinted, i.processing, i.processed, i.c_doctype_id, i.c_doctypetarget_id, i.c_order_id, i.description, i.salesrep_id, i.dateinvoiced, i.dateprinted, i.dateacct, i.c_bpartner_id, i.c_bpartner_location_id, i.ad_user_id, b.c_bp_group_id, i.poreference, i.dateordered, i.c_currency_id, i.paymentrule, i.c_paymentterm_id, i.m_pricelist_id, i.c_campaign_id, i.c_project_id, i.c_activity_id, i.c_charge_id, 
anthony@1867
     4
        CASE substr(d.docbasetype, 3)
anthony@1867
     5
            WHEN 'C' THEN i.chargeamt * (-1)
anthony@1867
     6
            ELSE i.chargeamt
anthony@1867
     7
        END AS chargeamt, 
anthony@1867
     8
        CASE substr(d.docbasetype, 3)
anthony@1867
     9
            WHEN 'C' THEN i.totallines * (-1)
anthony@1867
    10
            ELSE i.totallines
anthony@1867
    11
        END AS totallines, 
anthony@1867
    12
        CASE substr(d.docbasetype, 3)
anthony@1867
    13
            WHEN 'C' THEN i.grandtotal * (-1)
anthony@1867
    14
            ELSE i.grandtotal
anthony@1867
    15
        END AS grandtotal, 
anthony@1867
    16
        CASE substr(d.docbasetype, 3)
anthony@1867
    17
            WHEN 'C' THEN (-1)
anthony@1867
    18
            ELSE 1
anthony@1867
    19
        END AS multiplier
anthony@1867
    20
   FROM c_invoice i, c_doctype d, c_bpartner b
anthony@1867
    21
  WHERE i.c_doctype_id = d.c_doctype_id AND i.c_bpartner_id = b.c_bpartner_id]]></view>
anthony@1867
    22
  </database>