<cfparam name="comment_type" default="1" type="numeric">

<cfquery name="getComments" datasource="#application.datasource#">
	SELECT id, idEmployee, idProject, dateComment, comment
	FROM projectComments
	WHERE type = #comment_type# 
				AND idProject = #comment_project#
	ORDER BY dateComment DESC
	LIMIT 0, 1
</cfquery>

<cfsavecontent variable="comment_var">
	<cfoutput>
		<cfif comment_type lt 4>
			<cfif getComments.RecordCount gt 0>
				#LSDateFormat(getComments.dateComment,application.dateFormat)# #LSTimeFormat(getComments.dateComment,'HH:mm')# 
				<br />
				#getComments.comment#
			<cfelse>
				no hay comentarios registrados 
			</cfif>
			<br />
			<input type="button" name="addButton" class="button100" value="Registrar" onclick="window.open('comments.cfm?comment_type=#comment_type#&comment_project=#comment_project#&comment_action=add','add','width=600,height=400,resizable=yes')">
			<cfif getComments.RecordCount gt 0><input type="button" name="historyButton" class="button100" value="Historial" onclick="window.open('comments.cfm?comment_type=#comment_type#&comment_project=#comment_project#&comment_action=history','history','width=600,height=400,resizable=yes')"></cfif>
		<cfelse>
			<table width="100%">
				<tr>
					<td><cfif getComments.RecordCount gt 0>#LSDateFormat(getComments.dateComment,application.dateFormat)# #LSTimeFormat(getComments.dateComment,'HH:mm')#  &nbsp; #getComments.comment#<cfelse>no hay comentarios registrados</cfif></td>
					<td align="right">
						<input type="button" name="addButton" class="button100" value="Registrar" onclick="window.open('comments.cfm?comment_type=#comment_type#&comment_project=#comment_project#&comment_action=add','add','width=600,height=400,resizable=yes')">
						<cfif getComments.RecordCount gt 0><input type="button" name="historyButton" class="button100" value="Historial" onclick="window.open('comments.cfm?comment_type=#comment_type#&comment_project=#comment_project#&comment_action=history','history','width=600,height=400,resizable=yes')"></cfif> 
					</td>
				</tr>
			</table>
		</cfif>
	</cfoutput>
</cfsavecontent>