MEMBERSHIPPROMO

Provides a way for organizations to extend terms of or reduce prices of memberships

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 promotion.
DESCRIPTION nvarchar(255) Default = '' The description of the promotion.
PROMOTIONTYPECODE tinyint Default = 0 The type of promotion: 0 - Discount, 1 - Term extension.
PROMOTIONTYPE nvarchar(14) (Computed) yes CASE [PROMOTIONTYPECODE] WHEN 0 THEN N'Discount' WHEN 1 THEN N'Term extension' END Provides a translation for the 'PROMOTIONTYPECODE' field.
EXTENSIONCALCULATIONTYPECODE tinyint Default = 0 The type of term extension: 0 - Day, 1 - Month
DISCOUNTCALCULATIONTYPECODE tinyint Default = 0 The type of discount: 0 - Amount, 1 - Percentage.
DISCOUNTCALCULATIONTYPE nvarchar(11) (Computed) yes CASE [DISCOUNTCALCULATIONTYPECODE] WHEN 0 THEN N'Amount off' WHEN 1 THEN N'Percent off' END Provides a translation for the 'DISCOUNTCALCULATIONTYPECODE' field.
APPLICATIONTYPECODE tinyint Default = 0 How the discount is applied: 0 - Manually, 1- Promo Code.
PERCENT decimal(5, 2) Default = 0.00 The percentage of a discount.
AMOUNT money Default = 0.00 The amount for a discount.
EXTENSIONVALUE int Default = 0 The number of days/months to extend the term by.
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.
EXTENSIONCALCULATIONTYPE nvarchar(14) (Computed) yes CASE [EXTENSIONCALCULATIONTYPECODE] WHEN 0 THEN N'Days added' WHEN 1 THEN N'Month(s) added' END Provides a translation for the 'EXTENSIONCALCULATIONTYPECODE' field.
APPLICATIONTYPE nvarchar(13) (Computed) yes CASE [APPLICATIONTYPECODE] WHEN 0 THEN N'Manually' WHEN 1 THEN N'With code' WHEN 2 THEN N'Automatically' END
ORGANIZATIONAMOUNT money Default = 0.00
FORMATTEDVALUE nvarchar(max) (Computed) yes case PROMOTIONTYPECODE when 0 then case DISCOUNTCALCULATIONTYPECODE when 0 then '$' + cast(AMOUNT as nvarchar(max)) + ' off' when 1 then cast([PERCENT] as nvarchar(6)) + '% off' end when 1 then case EXTENSIONCALCULATIONTYPECODE when 0 then cast(EXTENSIONVALUE as nvarchar(2)) + ' days' when 1 then cast(EXTENSIONVALUE as nvarchar(2)) + ' months' end end

Foreign Keys

Foreign Key Field Type Null Notes Description
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
BASECURRENCYID uniqueidentifier yes CURRENCY.ID
ORGANIZATIONEXCHANGERATEID uniqueidentifier yes CURRENCYEXCHANGERATE.ID

Indexes

Index Name Fields Unique Primary Clustered
IX_MEMBERSHIPPROMO_BASECURRENCYID BASECURRENCYID
IX_MEMBERSHIPPROMO_DATEADDED DATEADDED yes
IX_MEMBERSHIPPROMO_DATECHANGED DATECHANGED
IX_MEMBERSHIPPROMO_ORGANIZATIONEXCHANGERATEID ORGANIZATIONEXCHANGERATEID
PK_MEMBERSHIPPROMO ID yes yes
UC_MEMBERSHIPPROMO_NAME NAME yes

Triggers

Trigger Name Description
TR_MEMBERSHIPPROMO_AUDIT_UPDATE
TR_MEMBERSHIPPROMO_AUDIT_DELETE
TR_MEMBERSHIPPROMO_INSERTUPDATE_CURRENCY

Referenced by

Referenced by Field
BATCHMEMBERSHIPDUES MEMBERSHIPPROMOID
BATCHMEMBERSHIPDUES APPLIEDDISCOUNTID
CREDITITEM_EXT MEMBERSHIPPROMOID
DAILYSALEITEMMEMBERSHIPPROMO MEMBERSHIPPROMOID
MEMBERSHIPPROMOAVAILABILITY MEMBERSHIPPROMOID
MEMBERSHIPPROMOCODE MEMBERSHIPPROMOID
MEMBERSHIPTRANSACTION MEMBERSHIPPROMOID
SALESORDERITEMMEMBERSHIPITEMPROMOTION MEMBERSHIPPROMOID
SALESORDERITEMMEMBERSHIPPROMO MEMBERSHIPPROMOID
SALESORDERMEMBERSHIPPROMO MEMBERSHIPPROMOID