<cfcomponent displayname="Orders Functions" hint="I Return Orders Information" output="false">

	<cfset client.Loc_ID = 0 />
	
   <cffunction name="init" displayname="Initialize Component" access="public" returntype="Orders" hint="I initialize and return the Orders object.">
		<cfreturn this>
	</cffunction>

	<cffunction name="getdischargesummary"  returntype="any" access="public" output="false" >
	      <cfargument name="patid" required="yes" default="0"  hint="patient_ID" >
	      <cfargument name="assid" required="no" default="0"  hint="AssessmentId">
	      <cfargument name="Loc_ID" required="no" hint="Loc_ID" default="#client.Loc_ID#"> 
	      <cfset client.Loc_ID = session.agencyid />
			<cfquery name = "getallassessment" datasource="#Application.DataSrc#">
				SELECT * FROM #Request.prefix_db_agency#.pAssessments 
				LEFT OUTER JOIN #Request.prefix_db_agency#.pPatients ON pAssessments.Patient_ID = pPatients.Patient_ID
				 WHERE pPatients.Loc_ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#client.Loc_ID#">
				 AND  pAssessments.Patient_ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.patid#">
				 <cfif arguments.assid neq 0>
				 AND  pAssessments.Assmt_ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.assid#">
				 </cfif>
				 AND pAssessments.status = 0 
				 AND pPatients.status = 0 
			</cfquery>
		<cfreturn  getallassessment>
	</cffunction>
</cfcomponent>