<%@ Language=VBScript%>
<!--#INCLUDE file="ADOVBS.inc"-->
<%
Response.Buffer=true
DIM STR_CONSULTA, int_folio, str_tiempo, dbl_hora, dbl_minutos, dbl_segundos, str_resultados(22)
DIM int_w, int_h
int_w="100%"
int_h="100%"
str_titulo ="Prueba Terman"

str_bd= application("bd_sieps")


str_valido= Request.Cookies("seiso")("4")
str_valido="SI"

int_folio= Request.Cookies("sieps")("folio")

if str_valido <>"SI" then
	Response.Redirect("uti_error.asp?or=inicio.asp&enca=ERROR&mens=" & server.urlencode("El sistema no ha iniciado correctamente"))
end if

SET RES_DATOS = server.CreateObject("ADODB.Recordset")
SET CNN = SERVER.CreateObject("ADODB.CONNECTION")

cnn.Open str_bd

' tiempo de prueba
STR_CONSULTA = "SELECT seri_tiempo FROM pruebas_series_terman WHERE seri_clave='Serie V'"
RES_DATOS.Open STR_CONSULTA, cnn,adOpenForwardOnly,adLockReadOnly,1
str_tiempo="000000"		
if res_datos.EOF= FALSE THEN
	str_tiempo = res_datos.Fields("seri_tiempo")
end if	
res_datos.Close
       
dbl_hora = Mid(str_tiempo, 1, 2)
dbl_minutos = Mid(str_tiempo, 3, 2)
dbl_Segundos = Mid(str_tiempo, 5, 2)

STR_CONSULTA = "SELECT * FROM dat_terman WHERE soli_folio=" & int_folio
RES_DATOS.Open STR_CONSULTA, CNN,adOpenForwardOnly,adLockReadOnly,1
for j=1 to 22
	str_resultados(j)=""
next

if res_datos.EOF= FALSE THEN
	str_proceso="cambio"
	for j=1 to 22
		str_resultados(j) = RES_DATOS.Fields("RJ"&j)
	next
else
	str_proceso="alta"
end if
res_datos.Close		

%>

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<!--#INCLUDE FILE="uti_utilerias_aplicacion.asp"-->
<SCRIPT LANGUAGE=javascript>
<!--

function abortar()
{
	
	document.form1.SALIR.value="SALIR";
	document.form1.submit();
}


function start()
{
	this.parent.frames[0].location="uti_tiempo.asp?terminar=SI&nombre=Prueba Terman (Serie X)"
	window.setTimeout("runningtime()",1000)
	avance()
}
window.onload()
{
	/*parent.frames(0).location="uti_tiempo.asp?terminar=SI&nombre=Prueba Terman (Serie X)"
	window.setTimeout("runningtime()",1000)
	avance()*/	

}
	 
function runningtime()
{
	if (document.form1.clockface.value !="false"){
		var int_hora=document.form1.TXT_HORA.value
		var int_minutos=document.form1.TXT_MINUTOS.value
		var int_segundos=document.form1.TXT_SEGUNDOS.value
		var str_tiempo= document.form1.TXT_TIEMPO.value
		var str_tiempo_actual = new Date()
		var str_termina =new Date()
		var valor
	
		int_dia=str_tiempo_actual.getDate()
		int_mes=str_tiempo_actual.getMonth()
		int_ano=str_tiempo_actual.getYear()
			
		int_hora_actual =str_tiempo_actual.getHours()
		int_minutos_actual =str_tiempo_actual.getMinutes()
		int_segundos_actual =str_tiempo_actual.getSeconds()
					
		if (str_tiempo=="")
		{	
			s=new Date(int_ano, int_mes, int_dia, int_hora, int_minutos, int_segundos)
			
			int_hora =s.getHours()
			int_minutos =s.getMinutes()
			int_segundos =s.getSeconds()
				
			str_tiempo=new Date(int_ano,int_mes, int_dia, int_hora_actual+ int_hora, int_minutos_actual+ int_minutos, int_segundos_actual+ int_segundos)
			document.form1.TXT_TIEMPO.value=str_tiempo
					
			}
		else
		{str_tiempo=new Date(str_tiempo)}
	
			valor=str_tiempo.getTime()-str_tiempo_actual.getTime()
					
			str_termina.setHours(0);
			str_termina.setMinutes(0);
			str_termina.setSeconds(0);
			str_termina.setMilliseconds(0);
			
			str_termina.setMilliseconds(valor)
			int_hora =str_termina.getHours()
			int_minutos=str_termina.getMinutes()
			int_segundos=str_termina.getSeconds()
			
			if (int_hora<10){
				int_hora="0"+int_hora
			}
			if(int_minutos<10){
				int_minutos="0"+int_minutos
			}
			
			if (int_segundos<10){
				int_segundos="0"+int_segundos
			}
			
			if(document.form1.TXT_AVANCE.value!=""){
				var int_avance=document.form1.TXT_AVANCE.value
		  		int_avance = Math.floor((int_avance/11)*100)
  				this.parent.frames[0].document.all.item("avance").innerText =int_avance+"%";
			}
												
			this.parent.frames[0].document.all.item("cronometro").innerText =int_hora +":" +int_minutos +":" + int_segundos 
			if (int_hora <="00" & int_minutos <="00" & int_segundos<="00"){						
				alert("Se ha terminado el Tiempo !!! ...")
				this.parent.frames[1].document.all.item("clockface").value=false
				this.parent.frames[1].document.form1.submit()
				}
			else
				{window.setTimeout("runningtime()",1000)}
	}
	
}


function avance()
{
	int_avance =0;
	for (i=1; i<12; i=i+1){
		var str_nombre_1="r"+i+"-1"
		var str_nombre_2="r"+i+"-2"
		if (document.all.item(str_nombre_1).value !="" && document.all.item(str_nombre_2).value !=""){
			var int_avance = Math.floor(int_avance) + 1
			}
	}	
	document.form1.TXT_AVANCE.value=int_avance
  	int_avance = Math.floor((int_avance/11)*100)
  	this.parent.frames[0].document.all.item("avance").innerText =int_avance+"%"
  	
}


//-->
</SCRIPT>

</HEAD>
<link REL="stylesheet" TYPE="text/css" HREF="stylesheet.css">
<form name="form1" id="form1" target="_top" method="post" action="term10_abc.asp?proceso=<%=str_proceso%>&folio=<%=int_folio%>">
<body onLoad="start()" class="body"  topmargin="6" bottommargin="6" leftmargin="6" rightmargin="6" bgColor="slategray"  onkeydown="evento()">
<!--#INCLUDE FILE="uti_fondo.asp"-->
			<br>
					
			<table width="550" Align="center" valign="top" border="1"  cellspacing="1" cellpadding="0">
				<tr>
					<td>
						<table width="100%" align="center" name="p1" id="p1" bgColor="WhiteSmoke" border="0" bordercolor="silver" cellspacing="0" cellpadding="4">
							<tr id="1-0" height="50">
								<td align="left" width="25%"><font class="eti_ari_11">1° renglón.-</font></td>
								<td width="55%" colspan="11"><font class="eti_ari_11_b">8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3</font></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r1-1" id="r1-1" maxlength="6" tabIndex="1" value="<%=str_resultados(1)%>"></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r1-2" id="r1-2" maxlength="6" tabIndex="2" value="<%=str_resultados(2)%>"></td>
							</tr>
							<tr id="2-0" height="50" bgColor="White">
								<td align="left" width="25%"><font class="eti_ari_11">2° renglón.-</font></td>
								<td width="55%" colspan="11"><font class="eti_ari_11_b">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;18&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;23&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;28</font></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r2-1" id="r2-1" maxlength="6" tabIndex="3" value="<%=str_resultados(3)%>"></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r2-2" id="r2-2" maxlength="6" tabIndex="4" value="<%=str_resultados(4)%>"></td>
							</tr>
							<tr id="3-0" height="50">
								<td align="left" width="25%"><font class="eti_ari_11">3° renglón.-</font></td>
								<td width="55%" colspan="11"><font class="eti_ari_11_b">1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32</font></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r3-1" id="r3-1" maxlength="6" tabIndex="5" value="<%=str_resultados(5)%>"></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r3-2" id="r3-2" maxlength="6" tabIndex="6" value="<%=str_resultados(6)%>"></td>
							</tr>
							<tr id="4-0"  height="50" bgColor="White">
								<td align="left" width="25%"><font class="eti_ari_11">4° renglón.-</font></td>
								<td width="55%" colspan="11"><font class="eti_ari_11_b">8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4</font></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r4-1" id="r4-1" maxlength="6" tabIndex="7" value="<%=str_resultados(7)%>"></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r4-2" id="r4-2" maxlength="6" tabIndex="8" value="<%=str_resultados(8)%>"></td>
							</tr>
							<tr id="5-0" height="50">
								<td align="left" width="25%"><font class="eti_ari_11">5° renglon.-</font></td>
								<td width="55%" colspan="11"><font class="eti_ari_11_b">11.3/4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;12.1/4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;12.1/2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;12.3/4</font></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r5-1" id="r5-1" maxlength="6" tabIndex="9" value="<%=str_resultados(9)%>"></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r5-2" id="r5-2" maxlength="6" tabIndex="10" value="<%=str_resultados(10)%>"></td>
							</tr>
							<tr id="6-0"  height="50" bgColor="White">
								<td align="left" width="25%"><font class="eti_ari_11">6° renglón.-</font></td>
								<td width="55%" colspan="11"><font class="eti_ari_11_b">8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;17</font></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r6-1" id="r6-1" maxlength="6" tabIndex="11" value="<%=str_resultados(11)%>"></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r6-2" id="r6-2" maxlength="6" tabIndex="12" value="<%=str_resultados(12)%>"></td>
							</tr>
							<tr id="7-0" height="50">
								<td align="left" width="25%"><font class="eti_ari_11">7° renglón.-</font></td>
								<td width="55%" colspan="11"><font class="eti_ari_11_b">16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1/2</font></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r7-1" id="r7-1" maxlength="6" tabIndex="13" value="<%=str_resultados(13)%>"></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r7-2" id="r7-2" maxlength="6" tabIndex="14" value="<%=str_resultados(14)%>"></td>
							</tr>
							<tr id="8-0" height="50" bgColor="White">
								<td align="left" width="25%"><font class="eti_ari_11">8° renglón.-</font></td>
								<td width="55%" colspan="11"><font class="eti_ari_11_b">31.3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;40.3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;49.3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;58.3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;67.3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;76.3</font></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r8-1" id="r8-1" maxlength="6" tabIndex="15" value="<%=str_resultados(15)%>"></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r8-2" id="r8-2" maxlength="6" tabIndex="16" value="<%=str_resultados(16)%>"></td>
							</tr>
							<tr id="9-0" height="50">
								<td align="left" width="25%"><font class="eti_ari_11">9° renglón.-</font></td>
								<td width="55%" colspan="11"><font class="eti_ari_11_b">3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;7</font></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r9-1" id="r9-1" maxlength="6" tabIndex="17" value="<%=str_resultados(17)%>"></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r9-2" id="r9-2" maxlength="6" tabIndex="18" value="<%=str_resultados(18)%>"></td>
							</tr>
							<tr id="10-0" height="50">
								<td align="left" width="25%"><font class="eti_ari_11">10° renglón.-</font></td>
								<td width="55%" colspan="11"><font class="eti_ari_11_b">7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;24&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;29</font></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r10-1" id="r10-1" maxlength="6" tabIndex="19" value="<%=str_resultados(19)%>"></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r10-2" id="r10-2" maxlength="6" tabIndex="20" value="<%=str_resultados(20)%>"></td>
							</tr>
							<tr id="11-0"  height="50" bgColor="White">
								<td align="left" width="25%"><font class="eti_ari_11">11° renglón.-</font></td>
								<td width="55%" colspan="11"><font class="eti_ari_11_b">1/25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1/5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5</font></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r11-1" id="r11-1" maxlength="6" tabIndex="21" value="<%=str_resultados(21)%>"></td>
								<td align="center" width="10%"><input onBlur="avance()" class="eti_ari_11_b" size="3" name="r11-2" id="r11-2" maxlength="6" tabIndex="22" value="<%=str_resultados(22)%>"></td>
							</tr>
						</table>																											
						<INPUT name="clockface" type="hidden">
						<input type="hidden" name="TXT_TIEMPO">
						<input type="hidden" name="TXT_HORA" value="<%=dbl_hora%>">
						<input type="hidden" name="TXT_MINUTOS" value="<%=dbl_minutos%>">
						<input type="hidden" name="TXT_SEGUNDOS" value="<%=dbl_segundos%>">
						<input type="hidden" name="TXT_AVANCE" value="<%=dbl_avance%>">
						<input type="hidden" name="TXT_AVANCE_TOTAL" value="11">
						<input type="hidden" name="TXT_TIPO" value="tiempo">
						<input type="hidden" name="SALIR">
					</td>
				</tr>
			</table>
			<br>
	
<!--#INCLUDE FILE="uti_calce.asp"-->
</BODY>
</form>
</HTML>
