CREDITTEMP

Stored credits.

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
SALESORDERID uniqueidentifier yes The sales order record for this credit.
AMOUNT money Default = 0 The actual amount of the credit.
ADDEDBYID uniqueidentifier FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier FK to CHANGEAGENT.
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.
CREDITREASONCODEID uniqueidentifier yes FK to CREDITREASONCODE
COMMENT nvarchar(500) Default = '' The comment attached to the credit item.
TRANSACTIONDATE datetime yes The date of the order transaction.
APPUSERID uniqueidentifier yes The application user who entered the payment.
TYPECODE tinyint Default = 0 The type of credit (discount, refund) of this record.
TYPE nvarchar(8) (Computed) yes CASE [TYPECODE] WHEN 0 THEN N'Refund' WHEN 1 THEN N'Discount' END Provides a translation for the 'TYPECODE' field.
DISCOUNTID uniqueidentifier yes The discount record for this credit.
CONSTITUENTID uniqueidentifier yes The constituent linked to this credit.
TRANSACTIONDATEWITHTIMEOFFSET datetimeoffset yes The date of the order transaction with time zone awareness.
MEMBERSHIPPROMOID uniqueidentifier yes The membership promo record for this credit
SALESORDERITEMMEMBERSHIPITEMPROMOTIONID uniqueidentifier yes The sales order item membership promo record for this credit

Indexes

Index Name Fields Unique Primary Clustered
IX_CREDIT_CONSTITUENTID CONSTITUENTID
IX_CREDIT_DATEADDED DATEADDED yes
IX_CREDIT_DATECHANGED DATECHANGED
IX_CREDIT_SALESORDERID SALESORDERID
IX_CREDIT_TRANSACTIONDATE TRANSACTIONDATE (DESC)
PK_CREDIT ID yes yes

Triggers

Trigger Name Description
TR_CREDIT_AUDIT_UPDATE
TR_CREDIT_AUDIT_DELETE
TR_CREDIT_UPDATE_TRANSACTIONDATETIMEWITHOFFSET