[dbo].[MssWebGetOrderPersonnelContacts]
create procedure [dbo].[MssWebGetOrderPersonnelContacts]
(
@inOrderID int
)
as
begin
set nocount on
select
PersonnelData.PersonnelType,
PersonnelData.Personnel,
UserName = PersonnelData.Personnel,
DisplayPhone = dbo.GetFormattedPhoneNumber(SysUserPhoneNumber.CountryCodeStandardFID, SysUserPhoneNumber.AreaCode, SysUserPhoneNumber.LocalNumber),
CountryCode = CountryCodeStandard.PhoneCountryCode,
AreaCode = SysUserPhoneNumber.AreaCode,
LocalNumber = SysUserPhoneNumber.LocalNumber,
PhoneType = SysUserPhoneType.TypeName
from dbo.udfGetOrderPersonnel( @inOrderID ) PersonnelData
inner join Sysuser on Sysuser.SysUserID = PersonnelData.SysUserID
inner join SysUserPhoneNumber on SysUserPhoneNumber.SysUserFID = Sysuser.SysUserID
left outer join SysUserPhoneType on SysUserPhoneType.SysUserPhoneTypeID = SysUserPhoneNumber.SysUserPhoneTypeFID
left outer join CountryCodeStandard on SysUserPhoneNumber.CountryCodeStandardFID = CountryCodeStandard.CountryCodeStandardID
where SysUserPhoneType.TypeName='cell'
end
GO
GRANT EXECUTE ON [dbo].[MssWebGetOrderPersonnelContacts] TO [MssExec]
GO