src-db/database/model/views/C_INVOICE_VENDORMONTH.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_VENDORMONTH">
     2   <database name="VIEW C_INVOICE_VENDORMONTH">
     3     <view name="C_INVOICE_VENDORMONTH"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, po.c_bpartner_id, TRUNC(il.dateinvoiced, 'MM') AS dateinvoiced, sum(il.linenetamt) AS linenetamt, sum(il.linelistamt) AS linelistamt, sum(il.linelimitamt) AS linelimitamt, sum(il.linediscountamt) AS linediscountamt, 
     3     <view name="C_INVOICE_VENDORMONTH"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, po.c_bpartner_id,  TRUNC(il.dateinvoiced, 'MM') AS dateinvoiced,  sum(il.linenetamt) AS linenetamt, sum(il.linelistamt) AS linelistamt,  sum(il.linelimitamt) AS linelimitamt,  sum(il.linediscountamt) AS linediscountamt,  CASE sum(il.linelistamt) WHEN 0 THEN 0 ELSE round((sum(il.linelistamt) - sum(il.linenetamt)) / sum(il.linelistamt) * 100, 2) END AS linediscount,  sum(il.lineoverlimitamt) AS lineoverlimitamt,  CASE sum(il.linenetamt) WHEN 0 THEN 0 ELSE 100 - round((sum(il.linenetamt) - sum(il.lineoverlimitamt)) / sum(il.linenetamt) * 100, 2) END AS lineoverlimit,  sum(il.qtyinvoiced) AS qtyinvoiced FROM c_invoiceline_v2 il, m_product_po po WHERE il.m_product_id = po.m_product_id GROUP BY il.ad_client_id, il.ad_org_id, po.c_bpartner_id, TRUNC(il.dateinvoiced, 'MM')]]></view>
     4 CASE sum(il.linelistamt)
       
     5 WHEN 0 THEN 0
       
     6 ELSE round((sum(il.linelistamt) - sum(il.linenetamt)) / sum(il.linelistamt) * 100, 2)
       
     7 END AS linediscount, sum(il.lineoverlimitamt) AS lineoverlimitamt, 
       
     8 CASE sum(il.linenetamt)
       
     9 WHEN 0 THEN 0
       
    10 ELSE 100 - round((sum(il.linenetamt) - sum(il.lineoverlimitamt)) / sum(il.linenetamt) * 100, 2)
       
    11 END AS lineoverlimit, sum(il.qtyinvoiced) AS qtyinvoiced
       
    12 FROM c_invoiceline_v2 il, m_product_po po
       
    13 WHERE il.m_product_id = po.m_product_id
       
    14 GROUP BY il.ad_client_id, il.ad_org_id, po.c_bpartner_id, TRUNC(il.dateinvoiced, 'MM')]]></view>
       
    15   </database>
     4   </database>