MERCHANDISEPRODUCTINSTANCE

An actual instance of an item which can be sold.

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
LOOKUPCODE nvarchar(25) Default = '' An alternate lookup code that can be a sku, upc, etc...
COST money Default = 0 The cost of the item when purchased from the vendor.
SALEPRICE money Default = 0 The price at which the product is sold to patrons.
MARKUP money (Computed) yes SALEPRICE-COST The difference between price and cost.
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.
ONHANDQUANTITY int Default = 0 The on hand quantity for the product instance.
ISACTIVE bit Default = 1 The active status of the product instance.
CUSTOMIDENTIFIER nvarchar(100) Default = '' User-definable custom identifier.
SEQUENCEID int Identity column used to increment the default lookupid.
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.
BARCODE nvarchar(24) (Computed) yes 'SKU0' + cast(SEQUENCEID as nvarchar(20)) Stores the unique system generated barcode for a product instance.
ITEMDETAILS nvarchar(150) (Computed) yes dbo.UFN_MERCHANDISEPRODUCTINSTANCE_BUILDDESCRIPTION(ID)

Foreign Keys

Foreign Key Field Type Null Notes Description
MERCHANDISEPRODUCTID uniqueidentifier MERCHANDISEPRODUCT.ID The product from which the instance is created.
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
VENDORID uniqueidentifier yes VENDOR.ID

Indexes

Index Name Fields Unique Primary Clustered
IX_MERCHANDISEPRODUCTINSTANCE_DATEADDED DATEADDED yes
IX_MERCHANDISEPRODUCTINSTANCE_DATECHANGED DATECHANGED
IX_MERCHANDISEPRODUCTINSTANCE_LOOKUPCODE LOOKUPCODE
IX_MERCHANDISEPRODUCTINSTANCE_MERCHANDISEPRODUCTID MERCHANDISEPRODUCTID
PK_MERCHANDISEPRODUCTINSTANCE ID yes yes
UC_MERCHANDISEPRODUCTINSTANCE_LOOKUPID LOOKUPID yes
UIX_MERCHANDISEPRODUCTINSTANCE_BARCODE BARCODE yes

Triggers

Trigger Name Description
TR_MERCHANDISEPRODUCTINSTANCE_AUDIT_UPDATE
TR_MERCHANDISEPRODUCTINSTANCE_AUDIT_DELETE

Referenced by

Referenced by Field
BATCHMERCHANDISEINVENTORY MERCHANDISEPRODUCTINSTANCEID
MERCHANDISEPRODUCTINSTANCEHISTORY MERCHANDISEPRODUCTINSTANCEID
MERCHANDISEPRODUCTINSTANCELOOKUPCODE MERCHANDISEPRODUCTINSTANCEID
MERCHANDISEPRODUCTINSTANCEOPTIONVALUE MERCHANDISEPRODUCTINSTANCEID
MERCHANDISEPRODUCTINSTANCEVENDOR MERCHANDISEPRODUCTINSTANCEID
MERCHANDISEPRODUCTLABLEPRINTHISTORY MERCHANDISEPRODUCTINSTANCEID
REVENUESPLITORDER MERCHANDISEPRODUCTINSTANCEID
SALESORDERITEMMERCHANDISE MERCHANDISEPRODUCTINSTANCEID