<?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;  
  session_register("transper_d1");
 
  if($borrar==1){
  $transper_d1 = array();  
  }
 $rs=$objPer->getDatosTrans($mat_trans);	
 $row=$objPer->NextRow($rs);
 $cod_emp=$row['cod_emp'];
 $tipo_trans=$row['tipo_trans'];
 $via=$row['via'];
 $mat_trans=$row['mat_trans'];
 $model_trans=$row['model_trans'];
 $cappass_trans=$row['cappass_trans'];
 $tripnum_trans=$row['tripnum_trans'];
 $capcarg_trans=$row['capcarg_trans'];
 $combus=$row['combus'];
 $tipomedida=$row['tipomedida'];
 $capcarg_ext=$row['capcarg_ext'];
 $tarifam=$row['tarifam'];
 $tarifah=$row['tarifah'];
 $tarifav=$row['tarifav'];
 $seguro_fi=extraerfechanormal($row['seguro_fi']);
 $seguro_ff=extraerfechanormal($row['seguro_ff']);
 $tipohora=$row['tipohora'];
 $fecha_iniop=extraerfechanormal($row['fecha_iniop']);
 $fecha_finop=extraerfechanormal($row['fecha_finop']);
 $numcontrato=$row['numcontrato'];
 $dias_indotor=$row['dias_indotor'];
 $costo_mov=$row['costo_mov'];
 $costo_desmov=$row['costo_desmov'];
 $comentario=$row['comentario'];
?>
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="../../desing/estilos.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 language=JavaScript src="js/ajax_dettp.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/ajax_dettp1.js"></SCRIPT>
<SCRIPT language=JavaScript src="ajax_transper.js"></SCRIPT>
<SCRIPT language=JavaScript src="ajax_transperedit.js"></SCRIPT>
<script language="javascript" src="../../js/isiAJAX.js"></script>
<script>
function volver(form)
{
location.reload('<? echo $envia ?>');
}
</script>
<script>
function EnviarDatosTrans()
{
		var cappass_trans = parseInt(document.form1.cappass_trans.value);
		var tripnum_trans = parseInt(document.form1.tripnum_trans.value);
		var capcarg_trans = parseFloat(document.form1.capcarg_trans.value);
		var combus = parseFloat(document.form1.combus.value);
		var capcarg_ext = parseFloat(document.form1.capcarg_ext.value);
		//var detalle_per1 = parseInt(document.form1.detalle_per.value);
		if(form1.mat_trans.value==""){
		alert("Debe Ingresar la matricula de transporte");
		form1.mat_trans.focus();
		return;		
	    }
		if(form1.tipo_trans.value=="0"){
		alert("Debe Ingresar el tipo de transporte");
		form1.tipo_trans.focus();
		return;		
	    }
		
		if(form1.cappass_trans.value==""){
		alert("Debe Ingresar la capasidad de pasajeros");
		form1.cappass_trans.focus();
		return;		
	    }
		if(form1.capcarg_trans.value==""){
		alert("Debe Ingresar la capacidad de carga");
		form1.capcarg_trans.focus();
		return;		
	    }
		/* }else if(isNaN(cant_articulo)){alert('El Valor que Introducio en cantidad no es Numerico'); document.form1.cantidad.focus(); document.form1.cantidad.select();return;}  
	    else if(isNaN(parseFloat(peso_articulo))){alert('El Valor que Introducio en peso no es Numerico'); document.form1.peso.focus(); document.form1.peso.select();return;} */
		if(form1.model_trans.value==""){
		alert("Debe Ingresar el modelo de transporte");
		form1.model_trans.focus();
		return;		
	    }
		if(form1.tripnum_trans.value==""){
		alert("Debe Ingresar el numero de tripulantes");
		form1.tripnum_trans.focus();
		return;		
	    }
		if(form1.button.value)
		{
		form1.submit();
		}
}
</script>
</head>
<body>
<form name="form1" method="post" action="procesos/p_reg_trans_editar_g.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" >Actualizacion de Unidades de Transporte</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><div align="left">Empresa</div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left">
                        <select name="cod_emp" class="lblForm1" id="select3" onkeyup=fn(this.form,this)>
                          <option value="0">Seleccione</option>
                          <? 
							echo $objPer->getCboEmp1($cod_emp);
							?>
                        </select>
</div></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr class="lblCampo">
                      <td>Nave</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr class="lblCampo">
                      <td width="120"><div align="left">Tipo de Unidad </div></td>
                      <td width="5"><div align="left">:</div></td>
                      <td width="193"><div align="left">
                        <select name="tipo_trans" id="select" onkeyup=fn(this.form,this)>
                          <option value="0" <? if($tipo_trans=="0"){?> selected <? }?>>Seleccionar Tipo</option>
                          <option value="AVIONETA" <? if($tipo_trans=="AVIONETA"){?> selected <? }?>>AVIONETA</option>
                          <option value="AVION" <? if($tipo_trans=="AVION"){?> selected <? }?>>AVION</option>
                          <option value="RAPIDO" <? if($tipo_trans=="RAPIDO"){?> selected <? }?>>RAPIDO</option>
                          <option value="BARCAZA" <? if($tipo_trans=="BARCAZA"){?> selected <? }?>>BARCAZA</option>
                          <option value="HELICOPTERO" <? if($tipo_trans=="HELICOPTERO"){?> selected <? }?>>HELICOPTERO</option>
                          <option value="HIDROAVION" <? if($tipo_trans=="HIDROAVION"){?> selected <? }?>>HIDROAVION</option>
                        </select>
                      </div></td>
                      <td width="128"><div align="left">Viaje que realiza </div></td>
                      <td width="5"><div align="left">:</div></td>
                      <td width="228">				      <div align="left">
                        <select name="via" id="via" onChange="enviar1(this.options[this.options.selectedIndex].value)">
                          <option value="0" <? if($via=="0"){?> selected <? }?>>Seleciona</option>
                          <option value="A" <? if($via=="A"){?> selected <? }?>>AEREO</option>
                          <option value="F" <? if($via=="F"){?> selected <? }?>>FLUVIAL</option>
                        </select>
                      </div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Matricula de Unidad </div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left">
                        <input name="mat_trans" type="text" id="apellidos2" onKeyUp=fn(this.form,this) value="<? echo $mat_trans?>" size="20">
</div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left"></div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Modelo</div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left">
                        <input name="model_trans" type="text" id="model_trans2" onKeyUp=fn(this.form,this) value="<? echo $model_trans?>" size="30">
                      </div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left"></div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Caracteristicas</div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left"></div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Asientos pax </div></td>
                      <td><div align="left">:</div></td>
                      <td>                        <div align="left">
                        <input name="cappass_trans" type="text" id="cappass_trans2" onKeyUp=fn(this.form,this) value="<?=$cappass_trans?>" size="5">
</div></td>
                      <td>Asientos Tripulantes </td>
                      <td><div align="left">:</div></td>
                      <td><input name="tripnum_trans" type="text" id="tripnum_trans" onKeyUp=fn(this.form,this) value="<?=$tripnum_trans?>" size="5"></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Capacidad de Carga Int. </div></td>
                      <td><div align="left">:</div></td>
                      <td><div align="left">
                        <input name="capcarg_trans" type="text" id="capcarg_trans2" onKeyUp=fn(this.form,this) value="<?=$capcarg_trans?>" size="8">
Kgs.
                        </div></td>
                      <td><div align="left">Max. Consumo Combustible </div></td>
                      <td><div align="left">:</div></td>
                      <td>                        <div align="left">
                        <input name="combus" type="text" id="combus" value="<?=$combus?>" size="15">
                        <select name="tipomedida" id="tipomedida">
                          <option value="Gln/h">Gln/h</option>
                          <option value="Gln/v">Gln/v</option>
                        </select>
                      </div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Capacidad de Carga Ext. </div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left">
                        <input name="capcarg_ext" type="text" id="capcarg_trans" onKeyUp=fn(this.form,this) value="0.00" size="8"> 
                        Kgs. 
                      </div></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Tarifa</div></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Fijo Mensual </div></td>
                      <td>&nbsp;</td>
                      <td><div align="left">
                        <input name="tarifam" type="text" id="tarifam" value="0.00" size="15">
                      </div></td>
                      <td><div align="left">Por hora </div></td>
                      <td>&nbsp;</td>
                      <td><div align="left">
                        <input name="tarifah" type="text" id="tarifah" value="0.00" size="15">
                      </div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Por Viaje</div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left">
                        <input name="tarifav" type="text" id="tarifav" value="0.00" size="15">
                      </div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left">
                      </div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Seguro</div></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Inicio</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="seguro_fi" type="text" id="seguro_fi" title="FORMATO dd/mm/AA" onKeyUp=fn(this.form,this) value="<? echo $seguro_fi?>" size="12" maxlength="10">
                            </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.seguro_fi');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"> </a> </div></td>
                          </tr>
                        </table>
                      </div></td>
                      <td><div align="left">Vencimiento</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="seguro_ff" type="text" id="seguro_ff" title="FORMATO dd/mm/AA" onKeyUp=fn(this.form,this) value="<? echo $seguro_ff?>" size="12" maxlength="10">
                            </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.seguro_ff');"> <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">Tipo de hora </div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left">
                        <select name="tipohora" id="tipohora">
                          <option value="V">Hora Volada</option>
                          <option value="T">Hora Tecnica</option>
                        </select>
                      </div></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Operaciones</div></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Fecha Inicio Op. </div></td>
                      <td>&nbsp;</td>
                      <td><div align="left">
                        <table width="134" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="67"><div align="left">
                                <input name="fecha_iniop" type="text" id="fecha_iniop" title="FORMATO dd/mm/AA" onKeyUp=fn(this.form,this) value="<? echo $fecha_iniop?>" size="12" maxlength="10">
                            </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_iniop');"> <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 Termino Op.</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_finop" type="text" id="fecha_finop" title="FORMATO dd/mm/AA" onKeyUp=fn(this.form,this) value="<? echo $fecha_finop?>" size="12" maxlength="10">
                            </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_finop');"> <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">N&ordm; Contrato Ord. Servicio </div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left">
                        <input name="numcontrato" type="text" id="numcontrato" size="20">
                      </div></td>
                      <td><div align="left">Dias de Indisponiblidad Otor. </div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left">
                        <input name="dias_indotor" type="text" id="dias_indotor" value="0" size="5">
                      </div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Costo Movilizacion </div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left">
                        <input name="costo_mov" type="text" id="costo_mov" value="0.00" size="15">
                      </div></td>
                      <td><div align="left">Costo Desmovilizacion </div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left">
                        <input name="costo_desmov" type="text" id="costo_desmov" value="0.00" size="15">
                      </div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td><div align="left">Comentario</div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left">
                        <textarea name="comentario" cols="30" id="comentario"></textarea>
                      </div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left"></div></td>
                      <td><div align="left"></div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td colspan="6"><div align="left">Personal Adicional </div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td colspan="6"><div align="left">
					  <? if($via=='A'){?>
                        <table width="504" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="550"><div align="left">
                                <table width="500" border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td width="180"><div align="center">Tipo</div></td>
                                    <td width="157"><div align="center">Fecha Inicial </div></td>
                                    <td width="165"><div align="center">Fecha Termino </div></td>
                                    <td width="125"><div align="center">Costo Diario </div></td>
                                    <td width="48"><div align="center">
                                      <input name="cod_transper" type="hidden" id="cod_transper" value="<?=$cod_transper?>">
                                    </div></td>
                                  </tr>
                                  <tr>
                                    <td><div align="center">
                                        <select name="tipoper" id="tipoper">
                                          <option value="Piloto">Piloto</option>
                                          <option value="Copiloto">Copiloto</option>
                                          <option value="Mecanico">Mecanico</option>
                                        </select>
                                    </div></td>
                                    <td><div align="center">
                                        <table width="134" border="0" cellspacing="0" cellpadding="0">
                                          <tr>
                                            <td width="67"><div align="left">
                                                <input name="fechaini_tp" type="text" id="fechaini_tp" title="FORMATO dd/mm/AA" onKeyUp=fn(this.form,this) value="<? echo $fechaini_tp?>" size="12" maxlength="10">
                                            </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.fechaini_tp');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"> </a> </div></td>
                                          </tr>
                                        </table>
                                    </div></td>
                                    <td><div align="center">
                                        <table width="134" border="0" cellspacing="0" cellpadding="0">
                                          <tr>
                                            <td width="67"><div align="left">
                                                <input name="fechafin_tp" type="text" id="fechafin_tp" title="FORMATO dd/mm/AA" onKeyUp=fn(this.form,this) value="<? echo $fechafin_tp?>" size="12" maxlength="10">
                                            </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.fechafin_tp');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"> </a> </div></td>
                                          </tr>
                                        </table>
                                    </div></td>
                                    <td><div align="center">
                                        <input name="costod" type="text" id="costod" value="0.00" size="15">
                                    </div></td>
                                    <td><div align="center"><a href="#" onClick="enviarDatos1()"><img src="../imagenes/btn_siguiente.gif" width="25" height="25" border="0"></a></div></td>
                                  </tr>
                                </table>
                            </div></td>
                          </tr>
                          <tr>
                            <td>&nbsp;</td>
                          </tr>
                          <tr>
                            <td><div id="lista_tp">
                                <? //include('p_transper_detalle_ver.php');?>
                            </div></td>
                          </tr>
                          <tr>
                            <td><div align="center"> </div></td>
                          </tr>
                          
                        </table>
						<? }?>
                      </div></td>
                    </tr>
                    <tr class="lblCampo">
                      <td colspan="6"><div align="left" ></div></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="311"><div align="right">
                                <input name="button" type="button" style="<?=$stylo['st2']?>" class="botira" value=".: Editar Transporte :." onClick="EnviarDatosTrans()">
                              </div></td>
                              <td width="38"><div align="center">
                              </div></td>
                              <td width="311"><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>
</body>
</html>
