STOCKSALEADJUSTMENT

Stores adjustments made to posted sold stock sale.

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
PREVIOUSAMOUNT money Default = 0 Stock sale amount prior to adjustment
DATE datetime yes The date of the adjustment to the stock sale record.
POSTDATE datetime yes The date to use when posting the adjustment to the stock sale record.
POSTSTATUSCODE tinyint Default = 1 Flag used to indicate if the adjustment has been posted.
REASON nvarchar(300) Default = '' Gives further details for why this adjustment was made.
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.
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.
ORGANIZATIONPREVIOUSAMOUNT money Default = 0 The price at which the stock was sold in the organization currency.
TRANSACTIONPREVIOUSAMOUNT money Default = 0 The price at which the stock was sold in the transaction currency.

Foreign Keys

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

Indexes

Index Name Fields Unique Primary Clustered
IX_STOCKSALEADJUSTMENT_BASECURRENCYID BASECURRENCYID
IX_STOCKSALEADJUSTMENT_BASEEXCHANGERATEID BASEEXCHANGERATEID
IX_STOCKSALEADJUSTMENT_DATEADDED DATEADDED yes
IX_STOCKSALEADJUSTMENT_DATECHANGED DATECHANGED
IX_STOCKSALEADJUSTMENT_ORGANIZATIONEXCHANGERATEID ORGANIZATIONEXCHANGERATEID
IX_STOCKSALEADJUSTMENT_STOCKSALEID STOCKSALEID
IX_STOCKSALEADJUSTMENT_TRANSACTIONCURRENCYID TRANSACTIONCURRENCYID
PK_STOCKSALEADJUSTMENT ID yes yes

Triggers

Trigger Name Description
TR_STOCKSALEADJUSTMENT_AUDIT_UPDATE
TR_STOCKSALEADJUSTMENT_AUDIT_DELETE
TR_STOCKSALEADJUSTMENT_INSERTUPDATE_CURRENCY

Referenced by

Referenced by Field
ADJUSTMENTHISTORYSTOCK STOCKSALEADJUSTMENTID