DISCOUNT

Stores information for discounts.

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
NAME nvarchar(100) Default = '' The name used to identify the discount.
DESCRIPTION nvarchar(255) Default = '' The description of the discount.
APPLIESTOCODE tinyint Default = 0 The type of discount: 0 - Order, 1 - Item
PERCENT decimal(5, 2) Default = 0 The percentage of a discount.
AMOUNT money Default = 0 The amount for a discount.
ISACTIVE bit Default = 1 Indicates if the discount is currently active.
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.
APPLICATIONTYPECODE tinyint Default = 0 How the discount is applied: 0 - Automatically, 1 - Manually, 2- Promo Code.
NUMBERTOPURCHASE int Default = 1 The number of items to be purchased for the discount to occur.
NUMBERTODISCOUNT int Default = 1 The maximum number of eligible items to be discounted in purchase.
NUMBEROFDISCOUNTSPERORDER int Default = 1 The maximum number of instances for this discount per order.
DISCOUNTTICKETSFORCODE tinyint Default = 0 Discount tickets for same event or program: 0 - event, 1 - program.
LIMITDISCOUNTSPERORDER bit Default = 0 Are number of discounts per order limited?
APPLIESTO nvarchar(5) (Computed) yes CASE [APPLIESTOCODE] WHEN 0 THEN N'Order' WHEN 1 THEN N'Item' END Provides a translation for the 'APPLIESTOCODE' field.
APPLICATIONTYPE nvarchar(13) (Computed) yes CASE [APPLICATIONTYPECODE] WHEN 0 THEN N'Automatically' WHEN 1 THEN N'Manually' WHEN 2 THEN N'With code' END Provides a translation for the 'APPLICATIONTYPECODE' field.
DISCOUNTTYPECODE tinyint Default = 0 The type of discount: 0 - Standard, 1 - Item with purchase of same item.
CALCULATIONTYPECODE tinyint Default = 0 The calculation type for the discount: 0 - Amount, 1 - Percentage.
NUMBERTODISCOUNTTYPECODE tinyint Default = 0 Items to included per discount: 0 - number, 1 - unlimited.
NUMBERTODISCOUNTTYPE nvarchar(17) (Computed) yes CASE [NUMBERTODISCOUNTTYPECODE] WHEN 0 THEN N'Specific quantity' WHEN 1 THEN N'Unlimited' END Provides a translation for the 'NUMBERTODISCOUNTTYPECODE' field.
DISCOUNTTICKETSFOR nvarchar(35) (Computed) yes CASE [DISCOUNTTICKETSFORCODE] WHEN 0 THEN N'Same event as the purchased event' WHEN 1 THEN N'Same program as the purchased event' END Provides a translation for the 'DISCOUNTTICKETSFORCODE' field.
CALCULATIONTYPE nvarchar(14) (Computed) yes CASE [CALCULATIONTYPECODE] WHEN 0 THEN N'Amount off' WHEN 1 THEN N'Percent off' WHEN 2 THEN N'Specific price' END Provides a translation for the 'CALCULATIONTYPECODE' field.
APPLIESTOMERCHANDISE bit Default = 0 Indicates that an item discount or order discount calculated by percent applies to merchandise
APPLIESTOTICKETS bit Default = 1 Indicates that an item discount or order discount calculated by percent applies to tickets.
MERCHANDISEPERCENT decimal(5, 2) Default = 0.00 The percentage of a discount that is applied to merchandise.
MERCHANDISEAMOUNT money Default = 0.00 The amount for a discount that is applied to merchandise.
QUALIFYINGITEMTYPECODE tinyint Default = 0 Type of qualifying purchase for requiring a purchase discount: 0 - tickets, 1 - merchandise.
QUALIFYINGITEMTYPE nvarchar(11) (Computed) yes CASE [QUALIFYINGITEMTYPECODE] WHEN 0 THEN N'Tickets' WHEN 1 THEN N'Merchandise' END Provides a translation for the 'QUALIFYINGITEMTYPECODE' field.
DISCOUNTMERCHANDISEFORCODE tinyint Default = 0 Discount merchandise for : 0 - same item, 1 - department, 2 - no restriction.
DISCOUNTITEMTYPECODE tinyint Default = 0 Type of discount purchase for requiring a purchase discount: 0 - tickets, 1 - merchandise.
DISCOUNTITEMTYPE nvarchar(11) (Computed) yes CASE [DISCOUNTITEMTYPECODE] WHEN 0 THEN N'Tickets' WHEN 1 THEN N'Merchandise' END Provides a translation for the 'DISCOUNTITEMTYPECODE' field.
DISCOUNTTYPE nvarchar(22) (Computed) yes CASE [DISCOUNTTYPECODE] WHEN 0 THEN N'Standard' WHEN 1 THEN N'With required purchase' WHEN 2 THEN N'By quantity' END Provides a translation for the 'DISCOUNTTYPECODE' field.
DISCOUNTMERCHANDISEFOR nvarchar(41) (Computed) yes CASE [DISCOUNTMERCHANDISEFORCODE] WHEN 0 THEN N'Same merchandise as purchased merchandise' WHEN 1 THEN N'Same department as purchased merchandise' WHEN 2 THEN N'No restriction' END Provides a translation for the 'DISCOUNTMERCHANDISEFORCODE' field.
ORIGINALDISCOUNTID uniqueidentifier yes
ISHISTORICALVERSION bit (Computed) yes cast(case when SUPERSEDEDBYID is null then 0 else 1 end as bit)

Foreign Keys

Foreign Key Field Type Null Notes Description
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
SUPERSEDEDBYID uniqueidentifier yes DISCOUNT.ID

Indexes

Index Name Fields Unique Primary Clustered
IX_DISCOUNT_DATEADDED DATEADDED yes
IX_DISCOUNT_DATECHANGED DATECHANGED
IX_DISCOUNT_SUPERSEDEDBYID SUPERSEDEDBYID
PK_DISCOUNT ID yes yes
UC_DISCOUNT_NAME NAME yes
UIX_DISCOUNT_SUPERSEDEDBYID SUPERSEDEDBYID yes

Triggers

Trigger Name Description
TR_DISCOUNT_AUDIT_DELETE
TR_DISCOUNT_AUDIT_UPDATE

Referenced by

Referenced by Field
CREDITITEM_EXT DISCOUNTID
DAILYSALEITEMDISCOUNT DISCOUNTID
DISCOUNTADDRESS ID
DISCOUNTAVAILABILITY DISCOUNTID
DISCOUNTCONSTITUENCY DISCOUNTID
DISCOUNTGLMAPPING ID
DISCOUNTGROUP DISCOUNTID
DISCOUNTMEMBER DISCOUNTID
DISCOUNTPRICETYPE DISCOUNTID
DISCOUNTQUALIFYINGPRICETYPE DISCOUNTID
DISCOUNTTAX DISCOUNTID
GROUPSIZEDISCOUNT DISCOUNTID
PROGRAMDISCOUNT DISCOUNTID
PROMOTIONALCODE DISCOUNTID
SALESMETHODDISCOUNT DISCOUNTID
SALESORDERDISCOUNTLIMITOVERRIDE DISCOUNTID
SALESORDERITEMITEMDISCOUNT DISCOUNTID
SALESORDERITEMORDERDISCOUNT DISCOUNTID
SALESORDERMANUALDISCOUNT DISCOUNTID