SALESORDERADJUSTABLEDISCOUNT

Holds adjustable discount information for sales orders

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
CALCULATIONTYPECODE tinyint Default = 0 The calculation type for the discount: 0 - Amount, 1 - Percentage.
CALCULATIONTYPE nvarchar(11) (Computed) yes CASE [CALCULATIONTYPECODE] WHEN 0 THEN N'Amount off' WHEN 1 THEN N'Percent off' END Provides a translation for the 'CALCULATIONTYPECODE' field.
PERCENT decimal(5, 2) Default = 0.00 The percentage of a discount.
AMOUNT money Default = 0.00 The amount for a discount.
DISCOUNTNAME nvarchar(100) Default = '' Name of discount at time of sale.
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
SALESORDERID uniqueidentifier SALESORDER.ID FK to SALESORDER
DISCOUNTREASONCODEID uniqueidentifier DISCOUNTREASONCODE.ID The reason for the adjustable discount
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.

Indexes

Index Name Fields Unique Primary Clustered
IX_SALESORDERADJUSTABLEDISCOUNT_DATEADDED DATEADDED yes
IX_SALESORDERADJUSTABLEDISCOUNT_DATECHANGED DATECHANGED
PK_SALESORDERADJUSTABLEDISCOUNT ID yes yes
UIX_SALESORDERADJUSTABLEDISCOUNT_SALESORDERID SALESORDERID yes

Triggers

Trigger Name Description
TR_SALESORDERADJUSTABLEDISCOUNT_AUDIT_UPDATE
TR_SALESORDERADJUSTABLEDISCOUNT_AUDIT_DELETE