Purchasing |
04/26/2006 |
PRIMARY |
512 |
168 |
8845 |
Individual products associated with a specific purchase order. See PurchaseOrderHeader. |
|
|
PurchaseOrderID |
int |
4 |
|
|
|
|
Primary key. Foreign key to PurchaseOrderHeader.PurchaseOrderID. |
|
|
PurchaseOrderDetailID |
int |
4 |
|
|
|
|
Primary key. One line number per purchased product. |
|
|
DueDate |
datetime |
8 |
|
|
|
|
Date the product is expected to be received. |
|
|
OrderQty |
smallint |
2 |
|
|
|
|
Quantity ordered. |
|
|
ProductID |
int |
4 |
|
|
|
|
Product identification number. Foreign key to Product.ProductID. |
|
|
UnitPrice |
money |
8 |
|
|
|
|
Vendor's selling price of a single product. |
|
|
LineTotal |
money |
8 |
|
|
|
|
Per product subtotal. Computed as OrderQty * UnitPrice. |
|
|
ReceivedQty |
decimal |
5 |
|
|
|
|
Quantity actually received from the vendor. |
|
|
RejectedQty |
decimal |
5 |
|
|
|
|
Quantity rejected during inspection. |
|
|
StockedQty |
decimal |
5 |
|
|
|
|
Quantity accepted into inventory. Computed as ReceivedQty - RejectedQty. |
|
|
ModifiedDate |
datetime |
8 |
|
(getdate()) |
|
|
Date and time the record was last updated. |
Total: 11 column(s)
|
PurchaseOrderDetailID |
1 |
1 |
|
Total: 2 index(es)
Total: 2 trigger(s)
|
CK_PurchaseOrderDetail_OrderQty |
([OrderQty]>(0)) |
|
CK_PurchaseOrderDetail_ReceivedQty |
([ReceivedQty]>=(0.00)) |
|
CK_PurchaseOrderDetail_RejectedQty |
([RejectedQty]>=(0.00)) |
|
CK_PurchaseOrderDetail_UnitPrice |
([UnitPrice]>=(0.00)) |
Total: 4 constraint(s)
Total: 2 table(s)
Total: 15 object(s)
Total: 2 object(s)
CREATE TABLE [PurchaseOrderDetail] (
[PurchaseOrderID] [int] NOT NULL ,
[PurchaseOrderDetailID] [int] IDENTITY (1, 1) NOT NULL ,
[DueDate] [datetime] NOT NULL ,
[OrderQty] [smallint] NOT NULL ,
[ProductID] [int] NOT NULL ,
[UnitPrice] [money] NOT NULL ,
[LineTotal] AS (isnull([OrderQty]*[UnitPrice],(0.00))) ,
[ReceivedQty] [decimal](8, 2) NOT NULL ,
[RejectedQty] [decimal](8, 2) NOT NULL ,
[StockedQty] AS (isnull([ReceivedQty]-[RejectedQty],(0.00))) ,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_PurchaseOrderDetail_ModifiedDate] DEFAULT (getdate()),
CONSTRAINT [PK_PurchaseOrderDetail_PurchaseOrderID_PurchaseOrderDetailID] PRIMARY KEY CLUSTERED
(
[PurchaseOrderID],
[PurchaseOrderDetailID]
) ON [PRIMARY] ,
CONSTRAINT [FK_PurchaseOrderDetail_Product_ProductID] FOREIGN KEY
(
[ProductID]
) REFERENCES [Product] (
[ProductID]
),
CONSTRAINT [FK_PurchaseOrderDetail_PurchaseOrderHeader_PurchaseOrderID] FOREIGN KEY
(
[PurchaseOrderID]
) REFERENCES [PurchaseOrderHeader] (
[PurchaseOrderID]
),
CONSTRAINT [CK_PurchaseOrderDetail_OrderQty] CHECK ([OrderQty]>(0)),
CONSTRAINT [CK_PurchaseOrderDetail_ReceivedQty] CHECK ([ReceivedQty]>=(0.00)),
CONSTRAINT [CK_PurchaseOrderDetail_RejectedQty] CHECK ([RejectedQty]>=(0.00)),
CONSTRAINT [CK_PurchaseOrderDetail_UnitPrice] CHECK ([UnitPrice]>=(0.00))
) ON [PRIMARY]
GO
List of tables