SELECT
  CD.DocID,
  CD.TypeID,
  CD.FileName,
  CD.Folder,
  CD.Description,
  CD.UploadDate,
  U1.FullName AS UploadedBy,
  IF(CS.ClientStatus = 1, "Active", "Cancelled") AS ClientStatus,
  CS.GroupName AS ClientName,
  0 AS FileSize,
  '' AS FileSizeLabel,
  0 AS FileExists
FROM
  taDocument AS CD
    LEFT JOIN taClients AS CS ON (CS.ClientID = CD.TypeID)
    LEFT JOIN taUsers AS U1 ON (U1.UserID = CD.UploadedBy)
WHERE
  (CD.DocType = 'Client')
  @pClientStatus
  @pFromDate
  @pToDate
  @pFilter
