<?php
	include("stilos/config.inc.php");
	include("../clases/BDConexion.php");
 
  include("../clases/clsPer.php");
  include("Funciones.php");
  include("funcion/funciones.php");
  session_start();
  $objPer=new clsPer;
  $resultado=$objPer->getCodRuta();
  $filas=$objPer->NextRow($resultado);
  $cod_ruta=$filas['valor_e'].getNumCeros($filas['valor']);
  $horasal_ruta=date("H:i:s");
  $horallega_ruta=date("H:i:s");
?>
<? //include "sc_lib_ventana.php"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><MMString:LoadString id="insertbar/formsHidden" /></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">

<link href="Estilos.css" rel="stylesheet" type="text/css">

<link href="stilos/Estilos.css" rel="stylesheet" type="text/css">
<SCRIPT language=JavaScript src="js/calendario.js"></SCRIPT>
<script type="text/javascript" src="js/ajax1.js"></script>
<script language="JavaScript"> 
<!--
//sURL,x,y
function Abrir_Ventanapopup1(sURL,x,y) { 
/*var especificaciones="top=0, left=0, toolbar=no,location=no, status=yes,menubar=no,scrollbars=no, resizable=no, width=1,height=1" 
var titulo="Titulo"
window.open(el_url,titulo,especificaciones);*/ 

if (!window.focus) return;
			var par;
			par = "width=" +x + ",height="+y+","
			par = par + "dependent=no,scrollbars=yes,resizable=no"
			par = par + "menubar=no,toolbar=no,status=yes"
			var ventana = window.open(sURL,"Ver",par)
			ventana.focus();
}
//--> 
</script>
<? 
$envia="fondo.php?k=$k&razonsocial=$razonsocial&distrito=$distrito";
$envia1="cvp_emp.php";
?>
<script>
function volverB(form)
{
location.reload('<? echo $envia1 ?>');
}
function volver(form)
{
location.reload('<? echo $envia ?>');
}
var vent = null;
function foco() {
   if (vent != null)
       vent.focus();
}
function cerrar() {
   vent = null;
}

</script>
<script language="JavaScript">
function selecciona(form)
{
 if(form.botones1.value)
  {
   form.zonasi.disabled=true;
  }
}

function cierra(form)
{
location.reload('../ventana.php');
}
function activainter(form)
{
   form.pais2.disabled=false;
   form.ciudad2.disabled=false;
   form.nacionalidad2.disabled=false;
   form.btn_ver2.disabled=false;
   form.btn_nuevo2.disabled=false;
   
   form.pais.value="";
   form.pais.disabled=true;
   form.ciudad.value="";
   form.ciudad.disabled=true;
   form.nacionalidad.value="";
   form.nacionalidad.disabled=true;
   form.idciudad1.value="";
   form.btn_ver1.disabled=true;
   form.btn_nuevo1.disabled=true;
}
</script>
<SCRIPT LANGUAGE=javascript>
function fn(form,field)
{
var next=0, found=false
var f=form
if(event.keyCode!=13) return;
for(var i=0;i<f.length;i++) {
if(field.name==f.item(i).name){
next=i+1;
found=true
break;
}
}
while(found){
if( f.item(next).disabled==false && f.item(next).type!='hidden'){
f.item(next).focus();
break;
}
else{
if(next<f.length-1)
next=next+1;
else
break;
}
}
}
</SCRIPT>
<script>
function enviar_url(form,url)
{

		if(form1.cod_ruta.value==""){
		alert("Debe Ingresar el codigo de la ruta");
		form1.cod_ruta.focus();
		return;		
	    }
		if(form1.orig_ruta.value=="0"){
		alert("Debe Ingresar el origen del lugar");
		form1.orig_ruta.focus();
		return;		
	    }
		
		if(form1.dest_ruta.value==""){
		alert("Debe Ingresar el destino del lugar");
		form1.dest_ruta.focus();
		return;		
	    }
		
		if(form1.fecha_ruta.value==""){
		alert("Debe Ingresar la fecha");
		form1.fecha_ruta.focus();
		return;		
	    }
		if(form1.via.value=="0"){
		alert("Debe Ingresar la via");
		form1.via.focus();
		return;		
	    }
		if(form1.horasal_ruta.value==""){
		alert("Debe Ingresar la hora");
		form1.horasal_ruta.focus();
		return;		
	    }
		if(form1.button.value)
		{
		form1.submit();
		}
}
</script>
<!-- Copyright 2000,2001 Macromedia, Inc. All rights reserved. -->
<!-- Copyright 2000,2001 Macromedia, Inc. All rights reserved. -->
<!-- Copyright 2000,2001 Macromedia, Inc. All rights reserved. -->
</head>

<body bgcolor="<?=$c_fondo['fondo']?>" onfocus="foco()" background="../imagenes/fondo.jpg">
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr valign="top" >
    <td height="25" colspan="4">
    <div align="left" ></div></td>
  </tr>
  <tr class="lblCampo" >
    <td colspan="4"><div align="center">
        <form name="form1" method="post" action="procesos/cvp_ruta_grabar.php">
          <table width="730" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="25"><img src="../estilo_tabla/parte_sup_izq.gif" width="25" height="25"></td>
              <td width="680" background="../estilo_tabla/parte_sup_cen.gif" valign="bottom">
                <div align="left" class="lblTitulo" >Registro de Rutas </div></td>
              <td width="25"><img src="../estilo_tabla/parte_sup_der.gif" width="25" height="25" border="0" usemap="#Map"></td>
            </tr>
            <tr>
              <td  background="../estilo_tabla/parte_med_izq.gif">&nbsp;</td>
              <td  height="86" background="../estilo_tabla/parte_med_cen.gif"><div align="center">
                  <table width="679" border="0" cellspacing="0" cellpadding="0">
                    <tr class="lblCampo">
                      <td colspan="6">&nbsp; </td>
                    </tr>
                    <tr class="lblCampo">
                      <td width="128"><div align="left">Codigo de Ruta </div></td>
                      <td width="4"><div align="left">:</div></td>
                      <td width="193"><div align="left">
                          <input name="cod_ruta" type="text" id="apellidos2" onkeyup=fn(this.form,this) value="<? echo $cod_ruta?>" size="20">
                          <input name="valor" type="hidden" id="valor" size="3" value="<? echo $filas['valor']?>">
                      </div></td>
                      <td width="121">Via</td>
                      <td width="5"><div align="left">:</div></td>
                      <td width="228"><select name="via" id="select2" onChange="enviar1(this.options[this.options.selectedIndex].value)">
                        <option value="0" >Seleccione</option>
                        <option value="A" <? if($via=='A'){?> selected <? }?>>Aerea</option>
                        <option value="F" <? if($via=='F'){?> selected <? }?>>Fluvial</option>
                      </select>					  
					  </td>
                    </tr>
                    
                    <tr class="lblCampo">
                      <td colspan="6"><div id="Cuerpo" align="left"></div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Lugar de  Origen </div></td>
                      <td><div align="left">:</div></td>
                      <td>
                        <div align="left">
                          <select name="orig_ruta" id="orig_ruta">
						  	<option value="0" <? if($orig_ruta=="0"){?> selected <? }?>>Seleccionar Origen</option>
							<? 
						    echo $objPer->getCboLugarIQTLBC($orig_ruta);
						    ?>
                          </select>
</div></td>
                      <td>Lugar de  Destino </td>
                      <td><div align="left">:</div></td>
                      <td>
					  <select name="dest_ruta" id="dest_ruta">
					  	<option value="0" <? if($dest_ruta=="0"){?> selected <? }?>>Seleccionar Origen</option>
						<? 
						    echo $objPer->getCboLugarIQTLBC($dest_ruta);
						?>
                      </select>
					  <input name="activo_ruta" type="hidden" id="appat_per32" onKeyUp=fn(this.form,this) value="1" size="5">					  
					  </td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Fecha Salida</div></td>
                      <td><div align="left">:</div></td>
                      <td><div align="left">
                        <table width="134" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="67"><div align="left">
                                <input name="fecha_ruta" type="text" id="fnac_per5" onKeyUp=fn(this.form,this) value="<? echo $fecha_ruta?>" size="12" maxlength="10" title="FORMATO dd/mm/AA">
                            </div></td>
                            <td width="10">&nbsp;</td>
                            <td width="109"><div align="left"> <a onMouseOver="window.status='Calendario';return true;" onMouseOut="window.status='';return true;"  href="javascript:show_calendar('form1.fecha_ruta');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"> </a> </div></td>
                          </tr>
                        </table>
                        </div></td>
                      <td><div align="left">Fecha de Llegada </div></td>
                      <td><div align="left">:</div></td>
                      <td>
                        <div align="left">                        
                          <table width="134" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td width="67"><div align="left">
                                  <input name="testimado_ruta" type="text" id="testimado_ruta" onKeyUp=fn(this.form,this) value="<? echo $testimado_ruta?>" size="12" maxlength="10" title="FORMATO dd/mm/AA">
                              </div></td>
                              <td width="10">&nbsp;</td>
                              <td width="109"><div align="left"> <a onMouseOver="window.status='Calendario';return true;" onMouseOut="window.status='';return true;"  href="javascript:show_calendar('form1.testimado_ruta');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"> </a> </div></td>
                            </tr>
                          </table>
                        </div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left"></div></td>
                      <td>&nbsp;</td>
                      <td><div align="left">                        <input name="tiporuta" type="hidden" id="tiporuta" value="1">
                      </div></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr class="normal">
                      <td colspan="6">
                        <hr align="left" size="1" color="#000000">
                      </td>
                    </tr>
                    <tr class="normal">
                      <td colspan="6">
					    <div align="center">
					      <table width="660" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                              <td width="220"><div align="right">
                                <input name="button" type="button" style="<?=$stylo['st2']?>" class="botira" value=".:Grabar:." onClick="enviar_url(form1,'procesos/cvp_ruta_grabar.php')">
                              </div></td>
                              <td width="220"><div align="center">
                              </div></td>
                              <td width="220"><div align="left">
                                <input name="Submit2" type="button" style="<?=$stylo['st2']?>" class="botira" value=".: Salir :." onClick="volver(this.form);">
                              </div></td>
                            </tr>
                          </table>
			          </div></td>
                    </tr>
                  </table>
              </div></td>
              <td background="../estilo_tabla/parte_med_der.gif">&nbsp;</td>
            </tr>
            <tr>
              <td><img src="../estilo_tabla/parte_inf_izq.gif" width="25" height="25"></td>
              <td background="../estilo_tabla/parte_inf_cen.gif">&nbsp;</td>
              <td><img src="../estilo_tabla/parte_inf_der.gif" width="25" height="25"></td>
            </tr>
          </table>
        </form>
    </div></td>
  </tr>
  <tr valign="top" class="lblCampo" >
    <td colspan="4">
    <div align="center"> </div></td>
  </tr>
</table>
<map name="Map">
  <area shape="rect" coords="3,4,23,21" href="fondo.php">
</map>
</body>
</html>

