<?
session_start();
  include("../clases/BDConexion.php");
  include("../clases/clsPer.php");
  include("../clases/clsComb.php");
  include("Funciones.php");
  include("stilos/config.inc.php");
  $objPer=new clsPer;
  $objComb = new clsComb;

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin t&iacute;tulo</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">
<script language="JavaScript"> 
<!--
function Abrir_Ventanapopup1(sURL,x,y) { 
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();
}
function Abrir_Ventanapopup2(sURL,x,y) { 
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,"Nuevo",par)
			ventana.focus();
}
//--> 
</script>
<script language="javascript" type="text/javascript">
 function ActualizaLista(){
 	var clase = document.form1.clase.value;
	var id_combus = '<?=$id_combus?>';
	var id_mov = '<?=$id_mov?>';
	var tipo = '<?=$tipo?>';
	var cantidad = document.form1.cantidad.value;
  window.location = 'cvp_detalle_combus.php?tipoTrans='+clase+'&id_combus='+id_combus+'&id_mov='+id_mov+'&tipo='+tipo+'&cantgastada='+cantidad;
          }
</script>
<style type="text/css">
<!--
.Estilo1 {color: #FFFFFF}
-->
</style>
</head>

<body bgcolor="<?=$c_fondo['fondo']?>">
<table width="700" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <form name="form1" method="post" action="enviar_detped_combus.php">
    <td><div align="left">
      
        <table width="700" border="1" cellspacing="0" cellpadding="0" bordercolor="<?=$bordetabla?>" bgcolor="<?=$c_fondo['fondo tabla']?>" style="<?=$stylo['tabla']?>">
          <tr class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
            <td colspan="8"><div align="left">Detalle de Despacho :</div></td>
          </tr>
          <tr class="lblCampo" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
            <td width="79" ><div align="center" class="Estilo1">Combustible</div></td>
            <td width="40"><div align="center" class="Estilo1">Unidad</div></td>
            <td width="36"><div align="center" class="Estilo1">Cant</div></td>
            <td width="102"><div align="left" class="Estilo1">Locacion de Entrega </div></td>
            <td width="76"><span class="Estilo1">Tipo Destino </span></td>
            <td><span class="Estilo1">Destino</span></td>
            <td><span class="Estilo1">Observacion</span></td>
            <td width="44">			<div align="center" class="Estilo1">Add</div></td>
            </tr>
          <tr valign="top" class="lblCampo">
            <td valign="middle"><div align="center">
			<? echo $id_combus?> 
			<input name="id_combus" type="hidden" id="id_combus" value="<? echo $id_combus?>">               
			<span class="lblCampo">
                </span></div>
                <div align="left"> </div></td>
            <td valign="middle"><div align="center">
              <? echo 'GLS';?>
              <input name="um" type="hidden" id="um" value="GLS" size="4" readonly>
            </div></td>
            <td valign="middle">
              <div align="center">
                <input name="cantidad" type="text" id="cantidad" value="<? if (!isset($cantgastada)){echo '0';}else{echo $cantgastada;}?>" size="4">
            </div></td>
            <td valign="middle"><span class="rdoBanners Estilo4">
              <?php echo $objComb->CombolugarLocacion('locacion',$val)?>
            </span></td>
			<td valign="middle"><select name="clase" id="clase" onChange="ActualizaLista()">
              <option value="AEREO" selected>AEREO</option>
              <option value="FLUVIAL" <?php if($tipoTrans=='FLUVIAL'){echo 'selected';}?>>FLUVIAL</option>
              <option value="TERRESTRE" <?php if($tipoTrans=='TERRESTRE'){echo 'selected';}?>>TERRESTRE</option>
              <option value="LOCACION" <?php if($tipoTrans=='LOCACION'){echo 'selected';}?>>LOCACION</option>
              <option value="OTROS" <?php if($tipoTrans=='OTROS'){echo 'selected';}?>>OTROS</option>
            </select></td>
			<?php if(!isset($tipoTrans)){$tipoTrans='AEREO';}?>
            <td width="172" valign="middle" align="left"><?php echo $objComb->ListTrans('var_trans',$codtrans,$tipoTrans)?></td>
            <td width="133"><textarea name="detalle_otros" rows="2" id="detalle_otros"></textarea></td>
            <td valign="middle"><input name="Submit22" type="submit" style="<?=$stylo['st2']?>" class="botira" value="&gt;&gt;&gt;" ></td>
            </tr>
          <tr>
            <td colspan="8"><div align="center">
                <table width="690" border="0" cellspacing="0" cellpadding="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>">
                  <tr class="lblForm" >
                    <td ><strong>Item</strong></td>
                    <td><strong>Combustible</strong></td>
                    <td><div align="center"><strong>Cantidad</strong></div></td>
                    <td><div align="center"><strong>Galones</strong></div></td>
                    <td><strong>Tipo Destino </strong></td>
                    <td><div align="center"><strong>Destinatario</strong></div></td>
                    <td><strong>Otros</strong></td>
                    <td><strong>Lugar de Entrega </strong></td>
                    <td>&nbsp;</td>
                  </tr>
				  <? 	
$n=0;
$cantCombAgredado=0;
if (isset($pedidoc)){
while(list($clave,$valor)=each($pedidoc)){
$id_combus=$valor[0];
$cantidad=$valor[1];
$um=$valor[2];
$clase=$valor[3];
$tipo_transp=$valor[4];
$detalle_otros=$valor[5];
$locacion=$valor[6];
$n++; 
		  /*$resultado=$objPer->devolverArtPed($codigo_ap);
		  $filas=$objPer->NextRow($resultado);*/		  
?>
                  <?
//if ($linea){$color = "#ECE9D8";$linea=0;}else{$color = "#D4D0C8";$linea++;}
?>
                  <tr class="lblForm" >
                    <td width="60" >
                      <div align="center"> </div>
                      <div align="left"> <? echo $n.'._   ';?> </div></td>
                    <td width="105"><div align="left">
              <? 
			  echo $id_combus;			  
			  ?>
                    </div></td>
                    <td width="47">
                      <div align="center">
                <? echo $cantidad?>                    </div></td>
                    <td width="66"><div align="center">
                      <? 
				echo $um;				
				?> 
                      </div></td>
                    <td width="75"><div align="left"><? echo $clase?></div></td>
                    <td width="113"><div align="center"><? echo $tipo_transp?></div>                      
					</td>
                    <td width="95"><? echo $detalle_otros?></td>
                    <td width="95"><? echo $locacion?></td>
                    <td width="34"><div align="center"> 
					<a href="procesos/cvp_detalle_borrar_combus.php?item=<? echo $clave?>&id_combus=<? echo $id_combus?>">
					<img src="../imagenes/btn_eliminar.gif" width="15" height="15" border="0" >
					</a> 
					</div></td>
                  </tr>
                  <?  
				  $cantCombAgredado = $cantCombAgredado + $cantidad;
	} ?>
                  <? } ?>
                  <tr class="lblForm" >
                    <td>&nbsp;</td>
                    <td><div align="center"><strong>TOTAL </strong></div></td>
                    <td><div align="center"><? echo '<strong>'.$cantCombAgredado.'<strong>'?></div></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td colspan="3">&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                </table>
            </div></td>
          </tr>
        </table>
     
        </div></td>
    </form>
  </tr>
</table>
</body>
</html>
