<?php
	
?>
<? //include "sc_lib_ventana.php"?>

<html>
<head>
<title></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/ajax.js"></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');
}

</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.mat_trans.value==""){
		alert("Debe Ingresar el transporte");
		form1.mat_trans.focus();
		return;		
	    }
		if(form1.fecha_ruta.value==""){
		alert("Debe Ingresar la fecha");
		form1.fecha_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="550" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="135"><div align="left">Transporte
    </div></td>
    <td colspan="3"><div align="left">
      <select name="matricula" id="select" onkeyup=fn(this.form,this)>
        
        <? 
						echo $objPer->getCboTransViaEdit($via,$matricula);
						?>
      </select>
    </div></td>
  </tr>
  <tr>
    <td><div align="left">Fecha Salida</div></td>
    <td width="161"><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 width="105"><div align="left">Fecha LLegada </div></td>
    <td width="149"><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_ruta2" 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>
    <td>Combustible</td>
    <td><div align="left">
      <input name="combustible" type="text" id="combustible" value="<?=$combustible?>" size="12">
    Gln.</div></td>
    <td><div align="left">Facturable</div></td>
    <td><div align="left">
      <select name="facturable" id="facturable">
        <option value="SI" <? if($facturable=='SI'){?> selected<? }?>>SI</option>
        <option value="NO" <? if($facturable=='NO'){?> selected<? }?>>NO</option>
      </select>
    </div></td>
  </tr>
  <tr>
    <td colspan="4"><div align="left">
      <table width="538" border="1" cellspacing="0" cellpadding="0">
        <tr class="lblCampo">
          <td height="13" colspan="2"><div align="center">Ruta</div></td>
          <td height="13" colspan="4"><div align="center">Tiempo</div></td>
          <td width="151" rowspan="2"><div align="center">Observacion
                  <input name="vias" type="hidden" value="<?=$via?>" size="5">
          </div></td>
          <td>&nbsp;</td>
        </tr>
        <tr class="lblCampo">
          <td height="13"><div align="center">De</div></td>
          <td><div align="center">Para</div></td>
          <? if($_POST['via']=='A'){?>
          <td><div align="center">HAR</div></td>
          <? }?>
          <td><div align="center">HSAL</div></td>
          <td><div align="center">HLLE</div></td>
          <? if($_POST['via']=='A'){?>
          <td><div align="center">HAP</div></td>
          <? }?>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td width="72"><div align="center">
              <select name="origen" id="select7">
                <option value="0" <? if($origen=="0"){?> selected <? }?>>Origen</option>
                <? 
						    echo $objPer->getCboLugarH($origen);
						    ?>
              </select>
          </div></td>
          <td width="72"><div align="center">
              <select name="destino" id="select6">
                <option value="0" <? if($destino=="0"){?> selected <? }?>>Destino</option>
                <? 
						    echo $objPer->getCboLugarH($destino);
						?>
              </select>
          </div></td>
          <? if($_POST['via']=='A'){?>
          <td width="50"><div align="center">
              <input name="harranq_dch" type="text" id="harranq_dch" value="00:00" size="8" maxlength="5">
          </div></td>
          <? }else{?>
          <input name="harranq_dch" type="hidden" id="harranq_dch" value="00:00" size="8" maxlength="5">
          <? }?>
          <td width="50"><div align="center">
              <input name="haire_dch" type="text" id="haire_dch" value="00:00" size="8" maxlength="5">
          </div></td>
          <td width="50">
            <div align="center">
              <input name="htierra_dch" type="text" id="htierra_dch" value="00:00" size="8" maxlength="5">
          </div></td>
          <? if($_POST['via']=='A'){?>
          <td width="50"><div align="center">
              <input name="hapaga_dch" type="text" id="hapaga_dch" value="00:00" size="8" maxlength="5">
          </div></td>
          <? }else{?>
          <input name="hapaga_dch" type="hidden" id="hapaga_dch" value="00:00" size="8" maxlength="5">
          <? }?>
          <td>
            <div align="center"> </div>
            <div align="center">
              <textarea name="obser" cols="27" rows="2" id="textarea"></textarea>
            </div>
            <div align="center"> </div>
            <div align="center"> </div>
            <div align="center"> </div>
            <div align="center"> </div>
            <div align="center"> </div>
            <div align="center"> </div>
            <div align="center"> </div>
            <div align="center"> </div>
            <div align="center"> </div>
            <div align="center"> </div>
            <div align="center"></div>
            <div align="center"> </div>
            <div align="center"> </div></td>
          <td width="25"><div align="center"><a href="#" onClick="enviarDatos()"><img src="../imagenes/btn_siguiente.gif" width="25" height="25" border="0"></a> </div>
              <!-- <input name="boton_Per2" type="button" class="lblForm" id="boton_Per22" onClick="Enviar()" value="&gt;&gt;&gt;"> --></td>
        </tr>
      </table>
      </div></td>
  </tr>
  <tr>
    <td colspan="4">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="4"><div id="canasta">
      <? //include('p_rutas_detalle.php');?>
    </div></td>
  </tr>
  <tr>
    <td colspan="4"><div align="center">
      <table width="373" 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/p_rutas_grabarcon_detalle.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>
  <? if($via=='A'){?>
  <? }
  if($via=='A' || $via=='F'){
  ?>
  <? }?>
</table>
</body>
</html>

