src-db/database/model/views/C_INVOICE_V.xml
changeset 9910 6767429386d8
parent 7031 2aac4501bbd5
child 9911 444911e2b851
equal deleted inserted replaced
9909:56a1306e07a0 9910:6767429386d8
     1 <?xml version="1.0"?>
     1 <?xml version="1.0"?>
     2   <database name="VIEW C_INVOICE_V">
     2   <database name="VIEW C_INVOICE_V">
     3     <view name="C_INVOICE_V"><![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.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, i.poreference, i.dateordered, i.c_currency_id, i.paymentrule, i.c_paymentterm_id, i.c_charge_id, i.m_pricelist_id, i.c_campaign_id, i.c_project_id, i.c_activity_id, i.isprinted, i.isdiscountprinted, 
     3     <view name="C_INVOICE_V"><![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.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, i.poreference, i.dateordered,  i.c_currency_id, i.paymentrule, i.c_paymentterm_id, i.c_charge_id,  i.m_pricelist_id, i.c_campaign_id, i.c_project_id, i.c_activity_id,  i.isprinted, i.isdiscountprinted,  CASE WHEN substr(d.docbasetype, 3) = 'C' THEN i.chargeamt * (-1) ELSE i.chargeamt END AS chargeamt,  CASE WHEN substr(d.docbasetype, 3) = 'C' THEN i.totallines * (-1) ELSE i.totallines END AS totallines,  CASE WHEN substr(d.docbasetype, 3) = 'C' THEN i.grandtotal * (-1) ELSE i.grandtotal END AS grandtotal,  CASE WHEN substr(d.docbasetype, 3) = 'C' THEN (-1) ELSE 1 END AS multiplier,  CASE WHEN substr(d.docbasetype, 2, 1) = 'P' THEN (-1) ELSE 1 END AS multiplierap,  d.docbasetype FROM c_invoice i JOIN c_doctype d ON i.c_doctype_id = d.c_doctype_id]]></view>
     4 CASE
       
     5 WHEN substr(d.docbasetype, 3) = 'C' THEN i.chargeamt * (-1)
       
     6 ELSE i.chargeamt
       
     7 END AS chargeamt, 
       
     8 CASE
       
     9 WHEN substr(d.docbasetype, 3) = 'C' THEN i.totallines * (-1)
       
    10 ELSE i.totallines
       
    11 END AS totallines, 
       
    12 CASE
       
    13 WHEN substr(d.docbasetype, 3) = 'C' THEN i.grandtotal * (-1)
       
    14 ELSE i.grandtotal
       
    15 END AS grandtotal, 
       
    16 CASE
       
    17 WHEN substr(d.docbasetype, 3) = 'C' THEN (-1)
       
    18 ELSE 1
       
    19 END AS multiplier, 
       
    20 CASE
       
    21 WHEN substr(d.docbasetype, 2, 1) = 'P' THEN (-1)
       
    22 ELSE 1
       
    23 END AS multiplierap, d.docbasetype
       
    24 FROM c_invoice i
       
    25 JOIN c_doctype d ON i.c_doctype_id = d.c_doctype_id]]></view>
       
    26   </database>
     4   </database>