[dbo].[SysUserLaborTypeMap]
CREATE TABLE [dbo].[SysUserLaborTypeMap]
(
[SysUserLaborTypeMapID] [int] NOT NULL IDENTITY(1, 1),
[SysUserFID] [int] NOT NULL,
[LaborTypeFID] [int] NOT NULL,
[VendorID] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DateBasisFID] [int] NULL,
[Default] [bit] NOT NULL,
[HourlyWage] [decimal] (14, 4) NULL,
[HourlyWageOverTime] [decimal] (14, 4) NULL,
[HourlyWageDoubleTime] [decimal] (14, 4) NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SysUserLaborTypeMap] ADD CONSTRAINT [CK_SysUser_LongDistanceLaborType] CHECK (([dbo].[CheckSysUserToLongDistanceLaborType]([SysUserLaborTypeMapID],[SysUserFID],[LaborTypeFID])=(1)))
GO
ALTER TABLE [dbo].[SysUserLaborTypeMap] ADD CONSTRAINT [PK_SysUserLaborTypeMap] PRIMARY KEY NONCLUSTERED ([SysUserLaborTypeMapID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SysUserLaborTypeMap] ADD CONSTRAINT [IX_SysuserLaborTypeMap_SysUserFID_LaborTypeFID] UNIQUE NONCLUSTERED ([SysUserFID], [LaborTypeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SysUserLaborTypeMap] ADD CONSTRAINT [FK_SysUserLaborTypeMap_DateBasis] FOREIGN KEY ([DateBasisFID]) REFERENCES [dbo].[DateBasis] ([DateBasisID])
GO
ALTER TABLE [dbo].[SysUserLaborTypeMap] ADD CONSTRAINT [FK_SysUserLaborTypeMap_LaborType] FOREIGN KEY ([LaborTypeFID]) REFERENCES [dbo].[LaborType] ([PriKey])
GO
ALTER TABLE [dbo].[SysUserLaborTypeMap] ADD CONSTRAINT [FK_SysUserLaborTypeMap_SysUser] FOREIGN KEY ([SysUserFID]) REFERENCES [dbo].[Sysuser] ([SysUserID])
GO
GRANT SELECT ON [dbo].[SysUserLaborTypeMap] TO [MssExec]
GRANT INSERT ON [dbo].[SysUserLaborTypeMap] TO [MssExec]
GRANT DELETE ON [dbo].[SysUserLaborTypeMap] TO [MssExec]
GRANT UPDATE ON [dbo].[SysUserLaborTypeMap] TO [MssExec]
GO
EXEC sp_addextendedproperty N'Description', N'Holds a sysuser labor type mapping for a particular sysuser.', 'SCHEMA', N'dbo', 'TABLE', N'SysUserLaborTypeMap', NULL, NULL
GO
EXEC sp_addextendedproperty N'Description', N'Flag indicating whether a record is the default labor type for a sysuser.', 'SCHEMA', N'dbo', 'TABLE', N'SysUserLaborTypeMap', 'COLUMN', N'Default'
GO
EXEC sp_addextendedproperty N'Description', N'Foreign key to a labor type.', 'SCHEMA', N'dbo', 'TABLE', N'SysUserLaborTypeMap', 'COLUMN', N'LaborTypeFID'
GO
EXEC sp_addextendedproperty N'Description', N'Foreign key to a sysuser.', 'SCHEMA', N'dbo', 'TABLE', N'SysUserLaborTypeMap', 'COLUMN', N'SysUserFID'
GO
EXEC sp_addextendedproperty N'Description', N'Primary key of the SysUserLaborTypeMap table.', 'SCHEMA', N'dbo', 'TABLE', N'SysUserLaborTypeMap', 'COLUMN', N'SysUserLaborTypeMapID'
GO