INVOICE

Defines invoices.

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
DATEDUE datetime Date the Invoice is Due
PURCHASEORDERID nvarchar(20) Default = '' User Defined Purchase Order Number
DISCOUNTPERCENT decimal(20, 4) Default = 0 Discount percent
DISCOUNTAMOUNT money Default = 0 Discounted Amount
DISCOUNTEXPIRATIONDATE datetime yes The date the Discount Expires.
SEPARATEPAYMENT bit Default = 0 Marks if a separate payment should be created for this invoice.
HOLDPAYMENT bit Default = 0 Marks if this payment should held.
PAYMENTMETHODCODE tinyint Default = 0 Payment Method
PAYMENTMETHOD nvarchar(5) (Computed) yes CASE [PAYMENTMETHODCODE] WHEN 0 THEN N'Check' END Provides a translation for the 'PAYMENTMETHODCODE' field.
DATEADDED datetime Default = getdate() Indicates the date this record was added.
DATECHANGED datetime Default = getdate() Indicates the date this record was last changed.
TS timestamp Timestamp.
TSLONG bigint (Computed) yes CONVERT(bigint, TS) Numeric representation of the timestamp.
ZEROBALANCE bit Default = 0 True when the invoice is paid
TYPE int (Computed) 101 The Financial Transaction Type
BALANCE money (Computed) yes dbo.UFN_INVOICE_GETBALANCE(ID)
DISCOUNTEDTOTAL money (Computed) yes dbo.UFN_FINANCIALTRANSACTION_GETAMOUNT(ID) - DISCOUNTAMOUNT

Foreign Keys

Foreign Key Field Type Null Notes Description
ID uniqueidentifier FINANCIALTRANSACTION.ID Primary Key.
REMITADDRESSID uniqueidentifier yes ADDRESS.LOCALID Foreign Key to the Address Table
BANKACCOUNTID uniqueidentifier yes BANKACCOUNT.ID Foreign Key to the BankAccount table
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
DISBURSEMENTPROCESSID uniqueidentifier yes DISBURSEMENTPROCESS.ID Link to the current disbursement process selecting this credit memo

Indexes

Index Name Fields Unique Primary Clustered
IX_INVOICE_DATEADDED DATEADDED yes
IX_INVOICE_DATECHANGED DATECHANGED
IX_INVOICE_DATEDUE DATEDUE
IX_INVOICE_DISBURSEMENTPROCESSID DISBURSEMENTPROCESSID
IX_INVOICE_REMITADDRESSID REMITADDRESSID
PK_INVOICE ID yes yes

Triggers

Trigger Name Description
TR_INVOICE_INSERT_UPDATE
TR_INVOICE_INSERTONLY
TR_INVOICE_DELETE
TR_INVOICE_AUDIT_UPDATE
TR_INVOICE_AUDIT_DELETE

Referenced by

Referenced by Field
INVOICESCHEDULEINFORMATION ID