src-db/database/model/views/C_INVOICE_WEEK.xml
author Gorka Ion Damián <gorkaion.damian@openbravo.com>
Thu, 09 Oct 2008 12:06:24 +0000
changeset 1785 6fcdedddde3d
child 7022 825f121b6164
permissions -rw-r--r--
Some views have been renamed due to changes in the used prefixes

Modified views are: (old name, new name)

REPORT_PROJECTPROPOSAL C_PROJECTPROPOSAL_V
RV_BPARTNER C_BPARTNER_V
RV_CASH_DETAIL C_CASH_DETAIL
RV_C_INVOICE_CUSTOMERPRODQTR C_INVOICE_CUSTOMERPRODQTR
RV_C_INVOICE_CUSTOMERVENDQTR C_INVOICE_CUSTOMERVENDQTR
RV_C_INVOICE_DAY C_INVOICE_DAY
RV_C_INVOICELINE C_INVOICELINE_V
RV_C_INVOICE_MONTH C_INVOICE_MONTH
RV_C_INVOICE_PRODMONTH C_INVOICE_PRODMONTH
RV_C_INVOICE_PRODWEEK C_INVOICE_PRODWEEK
RV_C_INVOICE_VENDORMONTH C_INVOICE_VENDORMONTH
RV_C_INVOICE_WEEK C_INVOICE_WEEK
RV_C_INVOICE C_INVOICE_V2
RV_M_TRANSACTION_SUM M_TRANSACTION_SUM
RV_M_TRANSACTION M_TRANSACTION_V
RV_ORDER_OPEN C_ORDER_OPEN
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, 
gorkaion@1785
     4
        CASE sum(c_invoiceline_v2.linelistamt)
gorkaion@1785
     5
            WHEN 0 THEN 0
gorkaion@1785
     6
            ELSE round((sum(c_invoiceline_v2.linelistamt) - sum(c_invoiceline_v2.linenetamt)) / sum(c_invoiceline_v2.linelistamt) * 100, 2)
gorkaion@1785
     7
        END AS linediscount, sum(c_invoiceline_v2.lineoverlimitamt) AS lineoverlimitamt, 
gorkaion@1785
     8
        CASE sum(c_invoiceline_v2.linenetamt)
gorkaion@1785
     9
            WHEN 0 THEN 0
gorkaion@1785
    10
            ELSE 100 - round((sum(c_invoiceline_v2.linenetamt) - sum(c_invoiceline_v2.lineoverlimitamt)) / sum(c_invoiceline_v2.linenetamt) * 100, 2)
gorkaion@1785
    11
        END AS lineoverlimit
gorkaion@1785
    12
   FROM c_invoiceline_v2
gorkaion@1785
    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>