src-db/database/model/views/C_INVOICELINE_V2.xml
changeset 9910 6767429386d8
parent 9378 0148e17e8647
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_INVOICELINE_V2">
     2   <database name="VIEW C_INVOICELINE_V2">
     3     <view name="C_INVOICELINE_V2"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.c_invoiceline_id, i.c_invoice_id, i.salesrep_id, i.c_bpartner_id, i.c_bp_group_id, il.m_product_id, p.m_product_category_id, i.dateinvoiced, i.dateacct, il.qtyinvoiced * i.multiplier AS qtyinvoiced, il.pricelist, il.priceactual, il.pricelimit, 
     3     <view name="C_INVOICELINE_V2"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.c_invoiceline_id, i.c_invoice_id,  i.salesrep_id, i.c_bpartner_id, i.c_bp_group_id, il.m_product_id,  p.m_product_category_id, i.dateinvoiced, i.dateacct,  il.qtyinvoiced * i.multiplier AS qtyinvoiced, il.pricelist,  il.priceactual, il.pricelimit,  CASE il.pricelist WHEN 0 THEN 0 ELSE round((il.pricelist - il.priceactual) / il.pricelist * 100, 2) END AS discount,  CASE il.pricelimit WHEN 0 THEN 0 ELSE round((il.priceactual - il.pricelimit) / il.pricelimit * 100, 2) END AS margin,  round(i.multiplier * il.linenetamt, 2) AS linenetamt,  round(i.multiplier * il.pricelist * il.qtyinvoiced, 2) AS linelistamt,  CASE WHEN il.pricelimit IS NULL THEN round(i.multiplier * il.linenetamt, 2) ELSE round(i.multiplier * il.pricelimit * il.qtyinvoiced, 2) END AS linelimitamt,  round(i.multiplier * il.pricelist * il.qtyinvoiced - il.linenetamt, 2) AS linediscountamt,  CASE WHEN il.pricelimit IS NULL THEN 0 ELSE round(i.multiplier * il.linenetamt - il.pricelimit * il.qtyinvoiced, 2) END AS lineoverlimitamt,  il.account_id FROM c_invoice_v2 i,  c_invoiceline il LEFT JOIN m_product p ON il.m_product_id = p.m_product_id WHERE i.c_invoice_id = il.c_invoice_id]]></view>
     4 CASE il.pricelist
       
     5 WHEN 0 THEN 0
       
     6 ELSE round((il.pricelist - il.priceactual) / il.pricelist * 100, 2)
       
     7 END AS discount, 
       
     8 CASE il.pricelimit
       
     9 WHEN 0 THEN 0
       
    10 ELSE round((il.priceactual - il.pricelimit) / il.pricelimit * 100, 2)
       
    11 END AS margin, round(i.multiplier * il.linenetamt, 2) AS linenetamt, round(i.multiplier * il.pricelist * il.qtyinvoiced, 2) AS linelistamt, 
       
    12 CASE
       
    13 WHEN il.pricelimit IS NULL THEN round(i.multiplier * il.linenetamt, 2)
       
    14 ELSE round(i.multiplier * il.pricelimit * il.qtyinvoiced, 2)
       
    15 END AS linelimitamt, round(i.multiplier * il.pricelist * il.qtyinvoiced - il.linenetamt, 2) AS linediscountamt, 
       
    16 CASE
       
    17 WHEN il.pricelimit IS NULL THEN 0
       
    18 ELSE round(i.multiplier * il.linenetamt - il.pricelimit * il.qtyinvoiced, 2)
       
    19 END AS lineoverlimitamt, il.account_id
       
    20 FROM c_invoice_v2 i, c_invoiceline il
       
    21 LEFT JOIN m_product p ON il.m_product_id = p.m_product_id
       
    22 WHERE i.c_invoice_id = il.c_invoice_id]]></view>
       
    23   </database>
     4   </database>