[dbo].[JobCostingItemActualOnly]
CREATE TABLE [dbo].[JobCostingItemActualOnly]
(
[OrderFID] [int] NOT NULL,
[Date] [date] NULL,
[ExpenseCategoryFID] [int] NOT NULL,
[ExpenseType] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Quantity] [decimal] (12, 2) NULL,
[Cost] [decimal] (12, 2) NOT NULL,
[RatedAmount] [decimal] (12, 2) NULL,
[LocServFID] [int] NULL,
[QuantityPerUnit] [decimal] (12, 2) NULL,
[LaborTotal] [int] NULL,
[RatePerHour] [decimal] (12, 2) NULL,
[LaborRatingTypeFID] [int] NULL
) ON [PRIMARY]
GO
CREATE CLUSTERED INDEX [IX_JobCostingItemActualOnly_OrderFID] ON [dbo].[JobCostingItemActualOnly] ([OrderFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[JobCostingItemActualOnly] ADD CONSTRAINT [FK_JobCostingItemActualOnly_ExpenseCategory] FOREIGN KEY ([ExpenseCategoryFID]) REFERENCES [dbo].[ExpenseCategory] ([ExpenseCategoryID])
GO
ALTER TABLE [dbo].[JobCostingItemActualOnly] ADD CONSTRAINT [FK_JobCostingItemActualOnly_LaborRatingType] FOREIGN KEY ([LaborRatingTypeFID]) REFERENCES [dbo].[LaborRatingType] ([LaborRatingTypeID])
GO
ALTER TABLE [dbo].[JobCostingItemActualOnly] ADD CONSTRAINT [FK_JobCostingItemActualOnly_LocServ] FOREIGN KEY ([LocServFID]) REFERENCES [dbo].[LocServ] ([PriKey]) ON DELETE SET NULL
GO
ALTER TABLE [dbo].[JobCostingItemActualOnly] ADD CONSTRAINT [FK_JobCostingItemActualOnly_Orders] FOREIGN KEY ([OrderFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
GRANT SELECT ON [dbo].[JobCostingItemActualOnly] TO [MssExec]
GRANT INSERT ON [dbo].[JobCostingItemActualOnly] TO [MssExec]
GRANT DELETE ON [dbo].[JobCostingItemActualOnly] TO [MssExec]
GRANT UPDATE ON [dbo].[JobCostingItemActualOnly] TO [MssExec]
GO