src-db/database/model/views/C_INVOICE_WEEK.xml
author Antonio Moreno <antonio.moreno@openbravo.com>
Wed, 14 Apr 2010 11:56:39 +0200
changeset 7031 2aac4501bbd5
parent 7022 825f121b6164
child 9910 6767429386d8
permissions -rw-r--r--
Related to issue 12786. Slightly modified views so that they don't change in Oracle too.
gorkaion@1785
     1
<?xml version="1.0"?>
gorkaion@1785
     2
  <database name="VIEW C_INVOICE_WEEK">
gorkaion@1785
     3
    <view name="C_INVOICE_WEEK"><![CDATA[SELECT c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id, c_invoiceline_v2.salesrep_id, TRUNC(c_invoiceline_v2.dateinvoiced, 'DY') AS dateinvoiced, sum(c_invoiceline_v2.linenetamt) AS linenetamt, sum(c_invoiceline_v2.linelistamt) AS linelistamt, sum(c_invoiceline_v2.linelimitamt) AS linelimitamt, sum(c_invoiceline_v2.linediscountamt) AS linediscountamt, 
antonio@7022
     4
CASE sum(c_invoiceline_v2.linelistamt)
antonio@7022
     5
WHEN 0 THEN 0
antonio@7022
     6
ELSE round((sum(c_invoiceline_v2.linelistamt) - sum(c_invoiceline_v2.linenetamt)) / sum(c_invoiceline_v2.linelistamt) * 100, 2)
antonio@7022
     7
END AS linediscount, sum(c_invoiceline_v2.lineoverlimitamt) AS lineoverlimitamt, 
antonio@7022
     8
CASE sum(c_invoiceline_v2.linenetamt)
antonio@7022
     9
WHEN 0 THEN 0
antonio@7022
    10
ELSE 100 - round((sum(c_invoiceline_v2.linenetamt) - sum(c_invoiceline_v2.lineoverlimitamt)) / sum(c_invoiceline_v2.linenetamt) * 100, 2)
antonio@7022
    11
END AS lineoverlimit
antonio@7022
    12
FROM c_invoiceline_v2
antonio@7031
    13
GROUP BY c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id, c_invoiceline_v2.salesrep_id, TRUNC(c_invoiceline_v2.dateinvoiced, 'DY')]]></view>
gorkaion@1785
    14
  </database>