database/model/views/RV_C_INVOICE.xml
author Adrián Romero <adrian.romero@openbravo.com>
Tue, 20 Nov 2007 16:27:14 +0000
changeset 94 4e7ba7b8a4ad
parent 0 0247c26f10c6
child 132 33c5ca45fcff
permissions -rw-r--r--
fix: Changed check constraint names and foreign key names to fit in to
30 characteres.
adrian@94
     1
<?xml version="1.0"?>
adrian@94
     2
  <database name="VIEW RV_C_INVOICE">
adrian@94
     3
    <view name="RV_C_INVOICE" updatable="false">
adrian@94
     4
SELECT i.C_Invoice_ID,
adrian@94
     5
  i.AD_Client_ID,i.AD_Org_ID,i.IsActive,i.Created,i.CreatedBy,i.Updated,i.UpdatedBy,
adrian@94
     6
  i.IsSOTrx, i.DocumentNo, i.DocStatus, i.DocAction,
adrian@94
     7
  i.IsPrinted, i.IsDiscountPrinted, i.Processing, i.Processed, i.IsTransferred, i.IsPaid,
adrian@94
     8
  i.C_DocType_ID, i.C_DocTypeTarget_ID, i.C_Order_ID, i.Description, i.IsApproved,
adrian@94
     9
  i.SalesRep_ID, i.DateInvoiced, i.DatePrinted, i.DateAcct,
adrian@94
    10
  i.C_BPartner_ID, i.C_BPartner_Location_ID, i.AD_User_ID, b.C_BP_Group_ID,
adrian@94
    11
  i.PoReference, i.DateOrdered, i.C_Currency_ID, i.PaymentRule, i.C_PaymentTerm_ID,
adrian@94
    12
  i.M_PriceList_ID, i.C_Campaign_ID, i.C_Project_ID, i.C_Activity_ID,
adrian@94
    13
  --  Amounts
adrian@94
    14
  i.C_Charge_ID,
adrian@94
    15
  (CASE SUBSTR(d.DocBaseType,3) WHEN 'C' THEN i.ChargeAmt*-1 ELSE i.ChargeAmt END) AS ChargeAmt,
adrian@94
    16
  (CASE SUBSTR(d.DocBaseType,3) WHEN 'C' THEN i.TotalLines*-1 ELSE i.TotalLines END) AS TotalLines,
adrian@94
    17
  (CASE SUBSTR(d.DocBaseType,3) WHEN 'C' THEN i.GrandTotal*-1 ELSE i.GrandTotal END) AS GrandTotal,
adrian@94
    18
  (CASE SUBSTR(d.DocBaseType,3) WHEN 'C' THEN -1 ELSE 1 END) AS Multiplier
adrian@94
    19
FROM  C_Invoice i, C_DocType d, C_BPartner b
adrian@94
    20
WHERE i.C_DocType_ID=d.C_DocType_ID
adrian@94
    21
  AND i.C_BPartner_ID=b.C_BPartner_ID
adrian@94
    22
</view>
adrian@94
    23
  </database>