UNREALIZEDGAINLOSSADJUSTMENT

Stores adjustments made to posted unrealized gains and losses.

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
PREVIOUSAMOUNT money Default = 0 Amount of gift prior to adjustment
DATE datetime yes The date of the adjustment to the record.
POSTDATE datetime yes The date to use when posting the adjustment.
POSTSTATUSCODE tinyint Default = 1 Flag used to indicate if the adjustment has been posted.
POSTSTATUS nvarchar(11) (Computed) yes CASE [POSTSTATUSCODE] WHEN 0 THEN N'Posted' WHEN 1 THEN N'Not Posted' WHEN 2 THEN N'Do Not Post' END Provides a translation for the 'POSTSTATUSCODE' field.
REASON nvarchar(300) Default = '' Gives further details for why this adjustment was made.
ADJUSTMENTCODE tinyint Default = 0 Type of adjustment
ADJUSTMENT nvarchar(19) (Computed) yes CASE [ADJUSTMENTCODE] WHEN 0 THEN N'System' WHEN 1 THEN N'Constituent' WHEN 2 THEN N'Manual distribution' END Provides a translation for the 'ADJUSTMENTCODE' field.
TRANSACTIONPREVIOUSAMOUNT money Default = 0 The previous amount in the transaction currency.
ORGANIZATIONPREVIOUSAMOUNT money Default = 0 The previous amount in the organization currency.
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.

Foreign Keys

Foreign Key Field Type Null Notes Description
REVENUEID uniqueidentifier FINANCIALTRANSACTION.ID FK to REVENUE
REASONCODEID uniqueidentifier yes ADJUSTMENTREASONCODE.ID Indicates the reason this adjustment was made.
TRANSACTIONCURRENCYID uniqueidentifier yes CURRENCY.ID The transaction currency associated with this record.
BASECURRENCYID uniqueidentifier yes CURRENCY.ID The base currency associated with this record.
BASEEXCHANGERATEID uniqueidentifier yes CURRENCYEXCHANGERATE.ID The exchange rate used to calculate the base amount.
ORGANIZATIONEXCHANGERATEID uniqueidentifier yes CURRENCYEXCHANGERATE.ID The exchange rate used to calculate the organization amount.
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.

Indexes

Index Name Fields Unique Primary Clustered
IX_UNREALIZEDGAINLOSSADJUSTMENT_BASECURRENCYID BASECURRENCYID
IX_UNREALIZEDGAINLOSSADJUSTMENT_BASEEXCHANGERATEID BASEEXCHANGERATEID
IX_UNREALIZEDGAINLOSSADJUSTMENT_DATEADDED DATEADDED yes
IX_UNREALIZEDGAINLOSSADJUSTMENT_DATECHANGED DATECHANGED
IX_UNREALIZEDGAINLOSSADJUSTMENT_ORGANIZATIONEXCHANGERATEID ORGANIZATIONEXCHANGERATEID
IX_UNREALIZEDGAINLOSSADJUSTMENT_REVENUEID REVENUEID
IX_UNREALIZEDGAINLOSSADJUSTMENT_TRANSACTIONCURRENCYID TRANSACTIONCURRENCYID
PK_UNREALIZEDGAINLOSSADJUSTMENT ID yes yes

Triggers

Trigger Name Description
TR_UNREALIZEDGAINLOSSADJUSTMENT_INSERTUPDATE_CURRENCY
TR_UNREALIZEDGAINLOSSADJUSTMENT_AUDIT_UPDATE
TR_UNREALIZEDGAINLOSSADJUSTMENT_AUDIT_DELETE