<?
session_start();
  include("../clases/BDConexion.php");
  include("../clases/clsPer.php");
  include("Funciones.php");
  include("stilos/config.inc.php");
  $objPer=new clsPer;
?>
<!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"> 
<!--
//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>
</head>
<? if($foco==1){?>
<body bgcolor="<?=$c_fondo['fondo']?>" onload=document.form1.des.focus()>
<? }else{?>
<body bgcolor="<?=$c_fondo['fondo']?>">
<? }?>
<table width="766" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--  enviar.php-->
  <form name="form1" method="post" action="p_per_man_ver_edit.php">
    <td><div align="left">
      
        <table width="763" 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="5"><div align="left">Detalle de Pasajeros y Tripulantes Nave seleccionada :<? echo $mat_trans."-".$tipo_trans;?></div></td>
          </tr>
          <tr class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
            <td width="306"><div align="center">Apellidos del Personal </div></td>
            <td width="65"><div align="center">Peso del Pasajero </div></td>
            <td width="69"><div align="center">Peso del Equipaje </div></td>
            <td width="167"><div align="center">Tipo de Pasjero
                    <input name="num" type="hidden" id="num3" value="<? echo $num?>" size="3">
                    <? echo count($pasajes);?> </div></td>
            <td width="38">&nbsp;</td>
          </tr>
          <tr class="lblCampo">
            <td colspan="5">			<div align="left">
                <select name="opciones" id="opciones">
                  <option value="appat_per">Apellido</option>
                  <option value="dociden_per">DNI</option>
                </select>
                <input name="des" type="text" id="des" size="40" >
                <input name="Submit22" type="submit" style="<?=$stylo['st2']?>" class="botira" value="&gt;&gt;&gt;" >
				<a href="cvp_nuevo_pers01.php">
              Nuevo
			  </a>
				<input name="dociden_per" type="hidden" size="5" id="dociden_per">
</div>
              </td>
            </tr>
          <tr>
            <td colspan="5"><div align="center">
                <table width="753" border="0" cellspacing="0" cellpadding="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>">
                  <? 
if($q==1){	   
$resultadop=$objPer->getPassDatosT($cod_man,$via);	
while($filasp=$objPer->NextRow($resultadop)){
$dociden_per=$filasp['dociden_per'];
$peso_mpass=$filasp['peso_mpass'];
$pesoeq_mpass=$filasp['pesoeq_mpass'];
$tipo_mpass=$filasp['tipo_mpass'];
$ccosto=$filasp['ccosto'];
$codigo_mpass=$filasp['codigo_mpass'];
						
$pasajes[]=array("$dociden_per",$peso_mpass,$pesoeq_mpass,$tipo_mpass,$ccosto,$codigo_mpass);
}
}				  	
$n=0;
if (isset($pasajes)){
while(list($clave,$valor)=each($pasajes)){
$dociden_per=$valor[0];
$peso_mpass=$valor[1];
$pesoeq_mpass=$valor[2];
$tipo_mpass=$valor[3];
$ccosto=$valor[4];
$codigo_mpass=$valor[5];
$n++; 
		  $resultado=$objPer->devolverPer($dociden_per);
		  $filas=$objPer->NextRow($resultado);		  
?>
                  <?
//if ($linea){$color = "#ECE9D8";$linea=0;}else{$color = "#D4D0C8";$linea++;}
?>
                  <tr class="lblForm" >
                    <td width="217" >
                      <div align="center"> </div>
                      <div align="left"> <? echo $filas['nom_per'];?> <? echo $filas['appat_per'];?> <? echo $filas['apmat_per'];?></div></td>
                    <td width="187"><div align="center">
                        <? 
			  echo $peso_mpass;
			  $peso_total=$peso_total+$peso_mpass;
			  ?>
                    </div></td>
                    <td width="83">
                      <div align="center">
                        <? 
				echo $pesoeq_mpass;
				$pesoeq_total=$pesoeq_total+$pesoeq_mpass;
				?>
                    </div></td>
                    <td width="146"><div align="center"><?=$tipo_mpass?> </div></td>
                    <td width="72"><div align="center"><?=$ccosto?></div></td>
                    <td width="48"><div align="center"> <a href="procesos/p_det_man_sel_edit_borrar.php?item=<? echo $clave?>&codigo_mpass=<?=$codigo_mpass?>&cod_man=<?=$cod_man?>&via=<?=$via?>&dociden_per=<?=$dociden_per?>"><img src="../imagenes/btn_eliminar.gif" width="15" height="15" border="0"></a> </div></td>
                  </tr>
                  <?  
	} ?>
                  <? } ?>
                  <tr class="lblForm" >
                    <td>&nbsp;</td>
                    <td><div align="center">-----------</div></td>
                    <td><div align="center">--------------</div></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr class="lblForm" >
                    <td>&nbsp;</td>
                    <td><div align="center"><? echo $peso_total;?></div></td>
                    <td><div align="center"><? echo $pesoeq_total;?></div></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr class="lblForm" >
                    <td><div align="right">Total peso pasajero + peso equipaje </div></td>
                    <td colspan="2"><div align="center">
                        <? 
			  echo $_SESSION['pesototal2']=$peso_total+$pesoeq_total;
			  ?>
                    </div></td>
                    <td><div align="center">
                        <? //echo $n;?>
                    </div></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr class="lblForm" >
                    <td>&nbsp;</td>
                    <td colspan="2"><div align="center">----------------</div></td>
                    <td colspan="2">&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr class="lblForm" >
                    <td><div align="right">Total de capacidad de carga de la nave</div></td>
                    <td colspan="2"><div align="center"><? echo $_SESSION['carga'];?></div></td>
                    <td colspan="2"><div align="center"> </div></td>
                    <td>&nbsp;</td>
                  </tr>
                </table>
            </div></td>
          </tr>
        </table>
     
        </div></td>
    </form>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><div align="left">
      <form name="form2" method="post" action="enviar_carga_edit.php">
        <table width="764" 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="9"><div align="left">Detalle del Embarque </div></td>
          </tr>
          <tr class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>" valign="top">
            <td width="183"><div align="center">Descripcion del Embarque</div></td>
            <td width="135"><div align="center">Compania</div></td>
            <td><div align="center">Guia Remision</div></td>
            <td width="26"><div align="center">Cant.</div></td>
            <td width="100"><div align="center">Centro Costo </div></td>
            <td width="82"><div align="center">Peso</div></td>
            <td width="52"><div align="center">Tipo Carga </div></td>
            <td width="59"><div align="center">SubTotal</div></td>
            <td><? echo count($cargac);?></td>
          </tr>
          <tr>
            <td><div align="left">
              <input name="des_w" type="text" id="des_w" size="35">
</div>
                <div align="left"> </div></td>
            <td>
              <div align="center">
                <input name="compania" type="text" id="compania" size="23">
              </div></td>
            <td width="59">
              <div align="center">
                <input name="guia_w" type="text" id="peso_mpass23" size="10">
</div></td>
            <td><div align="center">
              <input name="cant_w" type="text" id="peso_mpass22" value="0" size="5" maxlength="5">
</div></td>
            <td><div align="center">
              <select name="ccosto_w" id="select">
                <option value="0" <? if($ccosto=="0"){?> selected <? }?>>Centro Costo</option>
                <? 
						    echo $objPer->getCboCCostoT();
						?>
              </select>
</div></td>
            <td><div align="center">
              <select name="tipounidad" id="tipounidad">
                <option value="UND">UND</option>
                <option value="KG">KG</option>
                <option value="BULTOS">BULTOS</option>
                <option value="GAL">GALONES</option>
              </select>
            </div></td>
            <td><div align="center">
              <select name="ttc" id="ttc">
                <option value="Ext">Ext</option>
                <option value="Int">Int</option>
              </select>
            </div></td>
            <td><div align="center">
              <input name="peso_w" type="text" id="pesoeq_mpass22" value="0" size="8" maxlength="7">
            </div></td>
            <td width="48"><div align="left">
                <input name="Submit222" type="submit" style="<?=$stylo['st2']?>" class="botira" value="&gt;&gt;" >
            </div></td>
          </tr>
          <tr>
            <td colspan="9"><div align="center">
                <table width="739" border="0" cellspacing="0" cellpadding="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>">
                  <? 
if($q==1){	   
$resultadom=$objPer->getCargaDatos($cod_man,$via);	
while($filasm=$objPer->NextRow($resultadom)){
$des_w=$filasm['des_w'];
$guia_w=$filasm['guia_w'];
$cant_w=$filasm['cant_w'];
$peso_w=$filasm['peso_w'];
$compania=$filasm['compania'];
$tipounidad=$filasm['tipounidad'];
$ttc=$filasm['ttc'];
$ccosto_w=$filasm['ccosto'];
$codigo_w=$filasm['codigo_w'];
				
$cargac[]=array("$des_w",$guia_w,$cant_w,$peso_w,$compania,$tipounidad,$ttc,$ccosto_w,$codigo_w);
}
}
				  
if (isset($cargac)){
while(list($clave1,$valor1)=each($cargac)){

$des_w=$valor1[0];
$guia_w=$valor1[1];
$cant_w=$valor1[2];
$peso_w=$valor1[3];
$compania=$valor1[4];
$tipounidad=$valor1[5];
$ttc=$valor1[6];
$ccosto_w=$valor1[7];
$codigo_w=$valor1[8];


		  /*$resultado=$objPer->devolverPer($dociden_per);
		  $filas=$objPer->NextRow($resultado);*/		  
?>
                  <?
//if ($linea){$color = "#ECE9D8";$linea=0;}else{$color = "#D4D0C8";$linea++;}
?>
                  <tr class="lblForm" >
                    <td width="186" >
                      <div align="center"> </div>
                      <div align="left">
                        <? 
			  echo $des_w."/".$codigo_w;
			  
			  ?>
                      </div></td>
                    <td width="94" ><div align="center">
                      <? 
			  echo $compania;
			  
			  ?>

<? 
			  //echo $ccosto_w;
			  
			  ?>
</div></td>
                    <td width="68"><div align="center">
                        <? 
			  echo $guia_w;
			  
			  ?>
                    </div></td>
                    <td width="50">
                      <div align="center">
                        <? 
				echo $cant_w;
				$cant_total=$cant_total+$cant_w;
				?>
                    </div></td>
                    <td width="53"><div align="center"><? echo $ttc;?>
					 </div></td>
                    <td width="63"><div align="center"><? echo $ccosto_w;?></div></td>
                    <td width="64"><div align="center"><? echo $tipounidad;?></div></td>
                    <td width="119"><div align="center">
					<? 
					echo $peso_w;
					
					$ptotal_w=$ptotal_w+($peso_w);
					?></div></td>
                    <td width="42"><div align="center"> <a href="procesos/p_det_man_sel__edit_borrar.php?item1=<? echo $clave1?>&codigo_w=<?=$codigo_w?>"><img src="../imagenes/btn_eliminar.gif" width="15" height="15" border="0"></a> </div></td>
                  </tr>
                  <?  
	} ?>
                  <? } ?>
                  <tr class="lblForm" >
                    <td colspan="2">&nbsp;</td>
                    <td><div align="center"></div></td>
                    <td><div align="center">---------</div></td>
                    <td><div align="center"></div></td>
                    <td><div align="center"></div></td>
                    <td>&nbsp;</td>
                    <td><div align="center">-----------</div></td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr class="lblForm" >
                    <td colspan="2">&nbsp;</td>
                    <td><div align="center"></div></td>
                    <td><div align="center">
                      <? echo $cant_total;?>
                    </div></td>
                    <td>
                      <div align="center"></div></td>
                    <td><div align="center"></div></td>
                    <td>&nbsp;</td>
                    <td><div align="center"><? echo $ptotal_w;?></div></td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr class="lblForm" >
                    <td colspan="4"><div align="right">Total Emabrque Seleccionado </div>                      <div align="center">                    </div>                      <div align="center">
                      </div></td>
                    <td><div align="center"></div></td>
                    <td><div align="center"></div></td>
                    <td>&nbsp;</td>
                    <td>
					  <div align="center">
					    <? 
			  //$_SESSION['pesototal22']=$cant_total*$pesoc_total;
			  $_SESSION['pesototal22']=$ptotal_w;
			  echo $_SESSION['pesototal22']."/";
			  echo $_SESSION['pesototal2']=$_SESSION['pesototal2']+$_SESSION['pesototal22'];
			  ?>
				      </div></td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr class="lblForm" >
                    <td colspan="2">&nbsp;</td>
                    <td><div align="center"></div></td>
                    <td><div align="center"></div></td>
                    <td><div align="center"></div></td>
                    <td><div align="center"></div></td>
                    <td>&nbsp;</td>
                    <td><div align="center">----------</div></td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr class="lblForm" >
                    <td colspan="4"><div align="right">Total de capacidad de carga de la nave</div>                      
                      <div align="center"></div>                      <div align="center">
                      </div></td>
                    <td><div align="center"></div></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td><div align="center"><? echo $_SESSION['carga']-$_SESSION['pesototal2'];?></div></td>
                    <td>&nbsp;</td>
                  </tr>
                </table>
            </div></td>
          </tr>
        </table>
      </form>
    </div></td>
  </tr>
</table>
</body>
</html>
