Primary Key Field Type
 ID uniqueidentifier

Field Field Type Null Notes Description
 REFERENCE nvarchar(255)   Default = '' The reference used for the transaction.
 AMOUNT money   Default = 0 The amount of the transaction.
 ACCOUNT nvarchar(100)   Default = '' The account string for the record.
 TRANSACTIONTYPECODE tinyint   Default = 0 The transaction type (debit or credit) for the record.
 TRANSACTIONTYPE nvarchar(6) (Computed) CASE [TRANSACTIONTYPECODE] WHEN 0 THEN N'Debit' WHEN 1 THEN N'Credit' END Provides a translation for the 'TRANSACTIONTYPECODE' 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) CONVERT(bigint, TS) Numeric representation of the timestamp.
 OUTDATED bit   Default = 0 Specifies whether or not this distribution is outdated.
 REVENUEID uniqueidentifier Logical foreign key to REVENUE table. Links discount credit to sales order revenue.

Foreign Key Field Type Null Notes Description
 GLTRANSACTIONID uniqueidentifier GLTRANSACTION.ID Foreign key to the GLTRANSACTION table.
 CREDITITEMID uniqueidentifier CREDITITEM.ID Foreign key to the CREDITITEM table.
 ADDEDBYID uniqueidentifier   CHANGEAGENT.ID FK to CHANGEAGENT.
 CHANGEDBYID uniqueidentifier   CHANGEAGENT.ID FK to CHANGEAGENT.
 CREDITPAYMENTID uniqueidentifier CREDITPAYMENT.ID Foreign key to the CREDITPAYMENT table. Links refund credit items to credit payment refunding them.
 DISCOUNTCREDITITEMID uniqueidentifier CREDITITEM.ID Foreign key to CREDITITEM table. Links refund credit items to discount credit item being 'paid back' by refund.

Index Name Field(s) Unique Primary Clustered
 IX_CREDITGLDISTRIBUTION_CREDITITEMID CREDITITEMID      
 IX_CREDITGLDISTRIBUTION_CREDITPAYMENTID CREDITPAYMENTID      
 IX_CREDITGLDISTRIBUTION_DATEADDED DATEADDED    
 IX_CREDITGLDISTRIBUTION_DATECHANGED DATECHANGED      
 IX_CREDITGLDISTRIBUTION_GLTRANSACTIONID GLTRANSACTIONID      
 IX_CREDITGLDISTRIBUTION_REVENUEID REVENUEID      
 PK_CREDITGLDISTRIBUTION ID  

Trigger Name Description
 TR_CREDITGLDISTRIBUTION_DELETE_GLTRANSACTION
 TR_CREDITGLDISTRIBUTION_AUDIT_UPDATE
 TR_CREDITGLDISTRIBUTION_AUDIT_DELETE

Entity-Relationship diagram of this table