Purchasing |
04/26/2006 |
PRIMARY |
336 |
144 |
4012 |
General purchase order information. See PurchaseOrderDetail. |
|
|
PurchaseOrderID |
int |
4 |
|
|
|
|
Primary key. |
|
|
RevisionNumber |
tinyint |
1 |
|
((0)) |
|
|
Incremental number to track changes to the purchase order over time. |
|
|
Status |
tinyint |
1 |
|
((1)) |
|
|
Order current status. 1 = Pending; 2 = Approved; 3 = Rejected; 4 = Complete |
|
|
EmployeeID |
int |
4 |
|
|
|
|
Employee who created the purchase order. Foreign key to Employee.EmployeeID. |
|
|
VendorID |
int |
4 |
|
|
|
|
Vendor with whom the purchase order is placed. Foreign key to Vendor.VendorID. |
|
|
ShipMethodID |
int |
4 |
|
|
|
|
Shipping method. Foreign key to ShipMethod.ShipMethodID. |
|
|
OrderDate |
datetime |
8 |
|
(getdate()) |
|
|
Purchase order creation date. |
|
|
ShipDate |
datetime |
8 |
|
|
|
|
Estimated shipment date from the vendor. |
|
|
SubTotal |
money |
8 |
|
((0.00)) |
|
|
Purchase order subtotal. Computed as SUM(PurchaseOrderDetail.LineTotal)for the appropriate PurchaseOrderID. |
|
|
TaxAmt |
money |
8 |
|
((0.00)) |
|
|
Tax amount. |
|
|
Freight |
money |
8 |
|
((0.00)) |
|
|
Shipping cost. |
|
|
TotalDue |
money |
8 |
|
|
|
|
Total due to vendor. Computed as Subtotal + TaxAmt + Freight. |
|
|
ModifiedDate |
datetime |
8 |
|
(getdate()) |
|
|
Date and time the record was last updated. |
Total: 13 column(s)
|
PurchaseOrderID |
1 |
1 |
|
Total: 3 index(es)
Total: 1 trigger(s)
|
CK_PurchaseOrderHeader_Freight |
([Freight]>=(0.00)) |
|
CK_PurchaseOrderHeader_ShipDate |
([ShipDate]>=[OrderDate] OR [ShipDate] IS NULL) |
|
CK_PurchaseOrderHeader_Status |
([Status]>=(1) AND [Status]<=(4)) |
|
CK_PurchaseOrderHeader_SubTotal |
([SubTotal]>=(0.00)) |
|
CK_PurchaseOrderHeader_TaxAmt |
([TaxAmt]>=(0.00)) |
Total: 5 constraint(s)
Total: 1 table(s)
Total: 3 table(s)
Total: 9 object(s)
Total: 4 object(s)
CREATE TABLE [PurchaseOrderHeader] (
[PurchaseOrderID] [int] IDENTITY (1, 1) NOT NULL ,
[RevisionNumber] [tinyint] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_RevisionNumber] DEFAULT ((0)),
[Status] [tinyint] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_Status] DEFAULT ((1)),
[EmployeeID] [int] NOT NULL ,
[VendorID] [int] NOT NULL ,
[ShipMethodID] [int] NOT NULL ,
[OrderDate] [datetime] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_OrderDate] DEFAULT (getdate()),
[ShipDate] [datetime] NULL ,
[SubTotal] [money] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_SubTotal] DEFAULT ((0.00)),
[TaxAmt] [money] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_TaxAmt] DEFAULT ((0.00)),
[Freight] [money] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_Freight] DEFAULT ((0.00)),
[TotalDue] AS (isnull(([SubTotal]+[TaxAmt])+[Freight],(0))) ,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_PurchaseOrderHeader_ModifiedDate] DEFAULT (getdate()),
CONSTRAINT [PK_PurchaseOrderHeader_PurchaseOrderID] PRIMARY KEY CLUSTERED
(
[PurchaseOrderID]
) ON [PRIMARY] ,
CONSTRAINT [FK_PurchaseOrderHeader_Employee_EmployeeID] FOREIGN KEY
(
[EmployeeID]
) REFERENCES [Employee] (
[EmployeeID]
),
CONSTRAINT [FK_PurchaseOrderHeader_ShipMethod_ShipMethodID] FOREIGN KEY
(
[ShipMethodID]
) REFERENCES [ShipMethod] (
[ShipMethodID]
),
CONSTRAINT [FK_PurchaseOrderHeader_Vendor_VendorID] FOREIGN KEY
(
[VendorID]
) REFERENCES [Vendor] (
[VendorID]
),
CONSTRAINT [CK_PurchaseOrderHeader_Freight] CHECK ([Freight]>=(0.00)),
CONSTRAINT [CK_PurchaseOrderHeader_ShipDate] CHECK ([ShipDate]>=[OrderDate] OR [ShipDate] IS NULL),
CONSTRAINT [CK_PurchaseOrderHeader_Status] CHECK ([Status]>=(1) AND [Status]<=(4)),
CONSTRAINT [CK_PurchaseOrderHeader_SubTotal] CHECK ([SubTotal]>=(0.00)),
CONSTRAINT [CK_PurchaseOrderHeader_TaxAmt] CHECK ([TaxAmt]>=(0.00))
) ON [PRIMARY]
GO
List of tables