SELECT dbo.staff.id, dbo.staff.fullName, dbo.staff.dressCode, dbo.staff.lockerCode, dbo.staff.staffCode,
[dbo].[getCountOfStaffUnavailableDocumnet](dbo.staff.id) as unavailableDocumnet,
(select ' - ' + titleFa from allType where parent = 228 and id not in (select documentType from staffDocument where staff_id=dbo.staff.id)
and id not in(231,236,248,251,255,256)
order by titleFa
FOR XML PATH('')) as unavailableDocumnetTitle,
allType_restaurant.titleFa AS restaurant, allType_position.titleFa AS position, allType_jobStatus.titleFa AS jobStatus
FROM dbo.staff INNER JOIN
dbo.allType AS allType_restaurant ON dbo.staff.restaurant = allType_restaurant.id INNER JOIN
dbo.allType AS allType_position ON dbo.staff.position = allType_position.id INNER JOIN
dbo.allType AS allType_jobStatus ON dbo.staff.jobStatus = allType_jobStatus.id
ORDER BY dbo.staff.id DESC