[dbo].[CommissionableSalespeople]
CREATE VIEW [dbo].[CommissionableSalespeople]
AS
select
SysUserLaborTypeMap.SysUserLaborTypeMapID as SysUserLaborTypeMapID,
dbo.FormatLastNameFirstName( SysUser.LASTNAME, SysUser.FIRSTNAME ) as FullName,
case
when LaborType.LaborType = 'Coor' then 'Coordinator'
else LaborType.LaborType
end as LaborType
from Sysuser
inner join LaborType on LaborType.IsSalesTeamType = 1
inner join SysUserLaborTypeMap on
SysUserLaborTypeMap.SysUserFID = Sysuser.SysUserID and
SysUserLaborTypeMap.LaborTypeFID = LaborType.PriKey
inner join Status on Status.PriKey = Sysuser.Status
where
Status.Status != 'INACTIVE' and
SysUserLaborTypeMap.VendorID is not null
GO
GRANT SELECT ON [dbo].[CommissionableSalespeople] TO [MssExec]
GRANT INSERT ON [dbo].[CommissionableSalespeople] TO [MssExec]
GRANT DELETE ON [dbo].[CommissionableSalespeople] TO [MssExec]
GRANT UPDATE ON [dbo].[CommissionableSalespeople] TO [MssExec]
GO