SALESORDER

This table stores information pertaining to a sales order.

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
TRANSACTIONDATE datetime yes The date of the order transaction.
STATUSCODE tinyint Default = 0 Status of the condition of the order.
COMMENTS nvarchar(1000) Default = '' Remarks about this sales order.
CUSTOMIDENTIFIER nvarchar(100) Default = '' User-definable custom identifier.
SEQUENCEID int Identity column used to increment the default lookupid.
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.
SALESMETHODTYPECODE tinyint Default = 0 The type of sales method.
SALESMETHODTYPE nvarchar(13) (Computed) yes CASE [SALESMETHODTYPECODE] WHEN 0 THEN N'Daily Sales' WHEN 1 THEN N'Advance Sales' WHEN 2 THEN N'Online Sales' WHEN 3 THEN N'Group Sales' END Provides a translation for the 'SALESMETHODTYPECODE' field.
LOOKUPID nvarchar(100) (Computed) yes (CASE LEN(CUSTOMIDENTIFIER) WHEN 0 THEN '8-' + CAST(SEQUENCEID AS nvarchar(20)) ELSE CUSTOMIDENTIFIER END) Unique identifier that supports user defined values as well as system generated values.
SAMEASPATRON bit Default = 0 Determines if delivery information is same as patron information
TRANSACTIONDATEWITHTIMEOFFSET datetimeoffset yes The date of the order transaction.
LASTRECALCULATIONDATE datetime yes The date of the last recalculation of taxes, fees, and discounts.
STATUS nvarchar(10) (Computed) yes CASE [STATUSCODE] WHEN 0 THEN N'Pending' WHEN 1 THEN N'Complete' WHEN 2 THEN N'Tentative' WHEN 3 THEN N'Confirmed' WHEN 4 THEN N'Finalized' WHEN 5 THEN N'Cancelled' WHEN 6 THEN N'Reserved' WHEN 7 THEN N'Unresolved' END Provides a translation for the 'STATUSCODE' field.
REFUNDSTATUS int (Computed) yes dbo.UFN_SALESORDER_GETREFUNDSTATUS(ID)
AMOUNT money (Computed) yes dbo.UFN_SALESORDER_TOTAL(ID)
ITEMDISCOUNTSCALCULATED bit Default = 0

Foreign Keys

Foreign Key Field Type Null Notes Description
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CONSTITUENTID uniqueidentifier yes CONSTITUENT.LOCALID The constituent linked to the order.
REVENUEID uniqueidentifier yes FINANCIALTRANSACTION.ID The revenue item linked to the order.
DELIVERYMETHODID uniqueidentifier yes DELIVERYMETHOD.ID The delivery method used to deliver the tickets in this order
RECIPIENTID uniqueidentifier yes CONSTITUENT.LOCALID The constituent to receive the order; contact in group sales
ADDRESSID uniqueidentifier yes ADDRESS.LOCALID The address used to deliver the order
PHONEID uniqueidentifier yes PHONE.LOCALID The phone number for the recipient
EMAILADDRESSID uniqueidentifier yes EMAILADDRESS.ID The email address for the recipient
APPUSERID uniqueidentifier yes APPUSER.ID The application user who entered the order
CONTACTRELATIONSHIPID uniqueidentifier yes RELATIONSHIP.ID

Indexes

Index Name Fields Unique Primary Clustered
IX_SALESORDER_ADDRESSID ADDRESSID
IX_SALESORDER_APPUSERID APPUSERID
IX_SALESORDER_CONSTITUENTID CONSTITUENTID
IX_SALESORDER_CONTACTRELATIONSHIPID CONTACTRELATIONSHIPID
IX_SALESORDER_DATEADDED DATEADDED
IX_SALESORDER_DATECHANGED DATECHANGED
IX_SALESORDER_EMAILADDRESSID EMAILADDRESSID
IX_SALESORDER_PHONEID PHONEID
IX_SALESORDER_RECIPIENTID RECIPIENTID
IX_SALESORDER_REVENUEID REVENUEID
IX_SALESORDER_SEQUENCEID SEQUENCEID yes
IX_SALESORDER_TRANSACTIONDATE TRANSACTIONDATE (DESC)
PK_SALESORDER ID yes yes
UC_SALESORDER_LOOKUPID LOOKUPID yes

Triggers

Trigger Name Description
TR_SALESORDER_AUDIT_UPDATE
TR_SALESORDER_AUDIT_DELETE
TR_SALESORDER_UPDATE_TRANSACTIONDATETIMEWITHOFFSET

Referenced by

Referenced by Field
CMSUSERSALESORDER SALESORDERID
CREDIT_EXT SALESORDERID
CREDITITEM_EXT SALESORDERID
DOCUMENTPRINTINGHISTORY SALESORDERID
RESERVATION ID
SALESORDERADJUSTABLEDISCOUNT SALESORDERID
SALESORDERATTACHMENT SALESORDERID
SALESORDERAVAILABLEDISCOUNTGROUPCOMBINATION SALESORDERID
SALESORDERBBPAYTRANSACTION SALESORDERID
SALESORDERCLEANUPERRORLOG ID
SALESORDERDISCOUNTLIMITOVERRIDE SALESORDERID
SALESORDERDISCOUNTSCENARIOCOMBINATION SALESORDERID
SALESORDERFEEDELETED SALESORDERID
SALESORDERITEM SALESORDERID
SALESORDERITEMDISCOUNTOPTION SALESORDERID
SALESORDERITEMSCENARIOSDONE SALESORDERID
SALESORDERMANUALDISCOUNT SALESORDERID
SALESORDERMARKETINGINFORMATION ID
SALESORDERMARKETINGSURVEYRESPONSE SALESORDERID
SALESORDERMEDIALINK SALESORDERID
SALESORDERMEMBERSHIPPROMO SALESORDERID
SALESORDERNOTE SALESORDERID
SALESORDERPAYMENT SALESORDERID
SALESORDERRESERVEDITEM SALESORDERID
SALESORDERTAXEXEMPTINFO ID
TICKET APPLIEDTOMEMBERSHIPSALESORDERID