<cfcomponent hint="Get Communications Assignees">

 <cffunction name="getCommAssignees" access="public" output="Yes" returntype="string">
  <cfargument name="CommId" type="string" required="Yes" />
  <cfparam default='' name='str'/>
  <cftransaction  isolation="read_uncommitted">
  <cfquery  name="geta" datasource="#Application.DataSrc#">
   SELECT ct.Viewed, e.Emp_Last, e.Emp_First,e.Emp_ID 
   FROM   #Request.prefix_db_agency#.communication_to ct, #Request.prefix_db_lookup#.pEmployee e
   WHERE  ct.Comm_Id = '#CommId#'
   AND    e.Emp_Id = ct.Employee_Id
   AND   e.Loc_ID = '#session.AgencyId#'
   ORDER BY e.Emp_Last, e.Emp_First
  </cfquery>
  <cfset i = 0 />
  <cfset str = str & "<table cellspacing='1' cellpadding='1'>" />
  <cfoutput query="geta">
   <cfset str = str & "<tr>" />
   <cfif geta.Viewed eq 'N'>
    <cfset str = str & "<td style='color:##f33;' nowrap='nowrap'>" & geta.Emp_Last & ", " & LEFT(geta.Emp_First,1) & ".</td>" />
    <cfset str = str & "<td></td>" />
    <cfset str = str & "<td></td>" />
   <cfelse>
    <cfset str = str & "<td title='First Viewed on #DateFormat(geta.Viewed, 'mm/dd/yyyy @ HH:MM')#'>" />
    <cfset str = str & geta.Emp_Last & ", " & LEFT(geta.Emp_First,1) & ".</td><td>-</td><td nowrap='nowrap'>" & DateFormat(geta.Viewed, "mm/dd") & "<span style='font-size:9px;'> @ </span>" & LCASE(TimeFormat(geta.Viewed, "hh:mm tt")) & "</td>" />
   </cfif>
   <cfset str = str & "</tr>" />
   <cfset i = i + 1 />
  </cfoutput>
  <cfset str = str & "</table>" />
  <cfreturn str />
 </cffunction>

 <cffunction name="getCommCreator" access="public" output="Yes" returntype="string">
  <cfargument name="CommId" type="string" required="Yes" />
  <cfparam default='' name='str'/>
  <cftransaction isolation="read_uncommitted">
  <cfquery  name="getc" datasource="#Application.DataSrc#">
   SELECT e.Emp_Last, e.Emp_First
   FROM   #Request.prefix_db_agency#.Communication c, #Request.prefix_db_lookup#.pEmployee e
   WHERE  c.Comm_Id = '#CommId#'
   AND    e.Emp_ID = c.Record_Created_By
   AND   e.Loc_ID = '#session.AgencyId#'
  </cfquery>
  <cfif getc.recordcount gt 0>
   <cfoutput query="getc">
    <cfset str = getc.Emp_Last & ", " & LEFT(getc.Emp_First,1) & "." />
   </cfoutput>
  <cfelse>
   <cfset str = "Admin" />
  </cfif>
	<cfreturn str />
 </cffunction>

</cfcomponent>
