STOCKSALETEMP

Stores details about a stock sale.

Fields

Field Field Type Null Notes Description
ID uniqueidentifier Default = (newid()) Primary Key.
STOCKDETAILID uniqueidentifier FK to STOCKDETAIL
SALEDATE datetime The date to use when posting the sold stock.
SALEAMOUNT money Default = 0 The price at which the stock was sold.
FEE money Default = 0 The fee payed to the broker in the stock sale.
NUMBEROFUNITS decimal(20, 3) Default = 0 The number of stock units sold.
LOWPRICE decimal(19, 4) Default = 0 The low price the stock sold for.
MEDIANPRICE decimal(19, 4) Default = 0 The median price the stock sold for.
HIGHPRICE decimal(19, 4) Default = 0 The high price the stock sold for.
SALEPOSTDATE datetime yes The date to use when posting the sold stock record.
SALEPOSTSTATUSCODE tinyint Default = 1 Flag used to indicate whether sold stock has been posted, should be posted or needs to be posted.
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.
SALEPOSTSTATUS nvarchar(11) (Computed) yes CASE [SALEPOSTSTATUSCODE] WHEN 0 THEN N'Posted' WHEN 1 THEN N'Not Posted' WHEN 2 THEN N'Do Not Post' END Provides a translation for the 'SALEPOSTSTATUSCODE' field.
ORGANIZATIONSALEAMOUNT money Default = 0 The price at which the stock was sold in the organization currency.
ORGANIZATIONFEE money Default = 0 The fee payed to the broker in the stock sale in the organization currency.
ORGANIZATIONLOWPRICE decimal(19, 4) Default = 0 The low price the stock sold for in the organization currency.
ORGANIZATIONMEDIANPRICE decimal(19, 4) Default = 0 The median price of the stock in the organization currency.
ORGANIZATIONHIGHPRICE decimal(19, 4) Default = 0 The high price the stock sold for in the organization currency.
TRANSACTIONSALEAMOUNT money Default = 0 The price at which the stock was sold in the transaction currency.
TRANSACTIONFEE money Default = 0 The fee payed to the broker in the stock sale in the transaction currency.
TRANSACTIONLOWPRICE decimal(19, 4) Default = 0 The low price the stock sold for in the transaction currency.
TRANSACTIONMEDIANPRICE decimal(19, 4) Default = 0 The median price of the stock in the transaction currency.
TRANSACTIONHIGHPRICE decimal(19, 4) Default = 0 The high price the stock sold for in the transaction currency.
BASECURRENCYID uniqueidentifier yes The base currency associated with this record.
ORGANIZATIONEXCHANGERATEID uniqueidentifier yes The exchange rate used to calculate the organization amount.
TRANSACTIONCURRENCYID uniqueidentifier yes The transaction currency associated with this record.
BASEEXCHANGERATEID uniqueidentifier yes The exchange rate used to calculate the base amount.

Indexes

Index Name Fields Unique Primary Clustered
IX_STOCKSALE_DATEADDED DATEADDED yes

Triggers

Trigger Name Description
TR_STOCKSALE_INSERTUPDATE_CURRENCY
TR_STOCKSALE_T2BDELETE
TR_STOCKSALE_AUDIT_UPDATE
TR_STOCKSALE_AUDIT_DELETE