SALESORDERAVAILABLEDISCOUNTGROUPCOMBINATION

Support table for auto apply discounts - Available discount group price type combinations for the sales order.

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
DISCOUNTID uniqueidentifier Foreign key to the DISCOUNT table
APPLIEDMANUALLY bit Default = 0 Denotes whether the discount was manually added to order
LIMITDISCOUNTSPERORDER bit Default = 0 LIMITDISCOUNTSPERORDER value for discount.
NUMBEROFDISCOUNTSPERORDER int Default = 0 NUMBEROFDISCOUNTSPERORDER value for discount.
DISCOUNTGROUPID uniqueidentifier Foreign key to the DISCOUNTGROUP table.
DISCOUNTTICKETSFORCODE tinyint Default = 0 DISCOUNTTICKETSFORCODE value for discount
QUALIFYINGGROUPITEMID uniqueidentifier Foreign key to either EVENTID or PROGRAMID depending on value of DISCOUNTTICKETSFORCODE (0 - EVENTID; 1 - PROGRAMID) for the qualifying item.
QUALIFYINGORDERITEMID uniqueidentifier Foreign key to the SALESORDERITEM table for the order item to be used to qualify for the discount.
QUALIFYINGPRICETYPECODEID uniqueidentifier Foreign key to the PRICETYPECODE table for the price type of the order item to be used to qualify for the discount.
QUALIFYINGUNITPRICE money Default = 0 Unit price of the qualifying item.
NUMBERTOPURCHASE int Default = 0 NUMBERTOPURCHASE value for discount.
DISCOUNTEDGROUPITEMID uniqueidentifier Foreign key to either EVENTID or PROGRAMID depending on value of DISCOUNTTICKETSFORCODE (0 - EVENTID; 1 - PROGRAMID) for the item to be discounted.
DISCOUNTEDORDERITEMID uniqueidentifier Foreign key to the SALESORDERITEM table for the order item to be discounted.
DISCOUNTEDPRICETYPECODEID uniqueidentifier Foreign key to the PRICETYPECODE table for the price type of the order item to be discounted.
DISCOUNTEDUNITPRICE money Default = 0 Unit price of the discounted item.
NUMBERTODISCOUNT int Default = 0 NUMBERTODISCOUNT value for discount.
DISCOUNTTYPECODE tinyint Default = 0 DISCOUNTTYPECODE value for discount.
CALCULATIONTYPECODE tinyint Default = 0 CALCULATIONTYPECODE value for discount.
UNITDISCOUNTAMOUNT decimal(5, 2) Default = 0 PERCENTAGE or AMOUNT value for discount depending on CALCULATIONTYPECODE.
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.
DISCOUNTEDPROGRAMID uniqueidentifier Foreign key to either PROGRAMID - to be used to group discount scenarios during discount combination.

Foreign Keys

Foreign Key Field Type Null Notes Description
SALESORDERID uniqueidentifier SALESORDER.ID Foreign key to the SALESORDER table
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.

Indexes

Index Name Fields Unique Primary Clustered
IX_SALESORDERAVAILABLEDISCOUNTGROUPCOMBINATION_DATEADDED DATEADDED yes
IX_SALESORDERAVAILABLEDISCOUNTGROUPCOMBINATION_DATECHANGED DATECHANGED
IX_SALESORDERAVAILABLEDISCOUNTGROUPCOMBINATION_SALESORDERID SALESORDERID
PK_SALESORDERAVAILABLEDISCOUNTGROUPCOMBINATION ID yes yes

Triggers

Trigger Name Description
TR_SALESORDERAVAILABLEDISCOUNTGROUPCOMBINATION_AUDIT_UPDATE
TR_SALESORDERAVAILABLEDISCOUNTGROUPCOMBINATION_AUDIT_DELETE

Referenced by

Referenced by Field
SALESORDERITEMDISCOUNTOPTION SALESORDERAVAILABLEDISCOUNTGROUPCOMBINATIONID