<?php
  include("stilos/config.inc.php");
  include("../clases/BDConexion.php");
  include("../clases/clsPer.php");
  include("funcion/funciones.php");
  include("Funciones.php");
  session_start();
  $objPer=new clsPer;
  
?>
<!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>
<!-- Copyright 2000,2001 Macromedia, Inc. All rights reserved. -->
<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=yes"
			par = par + "menubar=no,toolbar=no,status=no"
			var ventana = window.open(sURL,"Ver",par)
			ventana.focus();
}
//--> 
</script>

</head>

<body 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">
        <table width="671" 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" > Personal x Ruta x Cia. </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 width="25" background="../estilo_tabla/parte_med_izq.gif">&nbsp;</td>
            <td width="680" height="86" background="../estilo_tabla/parte_med_cen.gif"><div align="center">
              <table width="614" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="15" colspan="5"><div align="center"></div></td>
                </tr>
                <tr>
				<form action="cvp_per_lugar.php" method="post" name="form1" >
                  <td height="15" colspan="5" class="lblCampo">				    				                                            
				    <div align="left">
				      <table width="535" border="0" cellspacing="0" cellpadding="0">
                        <tr class="lblCampo">
                          <td width="29"><div align="left">Cia : </div></td>
                          <td width="155"><div align="left">
                            <select name="cod_emp" id="cod_emp">
                              <option value="0">Sleccione Compania</option>
                              <? 
							echo $objPer->getCboCia($cod_emp);
							?>
                            </select>
                            </div></td>
                          <td width="69"><div align="right">Lugar</div></td>
                          <td width="112">						  <div align="left">
						    <select name="dest_ruta" id="dest_ruta">
						  	  <option value="0" <? if($dest_ruta=="0"){?> selected <? }?>>Lugar</option>
							  <? 
						    echo $objPer->getCboLugares($dest_ruta);
						    ?>
                            </select>
						      </div></td>
                          <td width="170">
                                <div align="left">
                                  <input type="submit" name="Submit" value="Buscar" style="<?=$stylo['st2']?>" class="botira">
                                </div></td>
                        </tr>
                      </table>
					
					</div>
				</td>
				  </form>
                </tr>
                <tr>
                  <td colspan="5"><div align="center">
                    <table width="596" border="1" cellpadding="0" cellspacing="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>">
                      <tr valign="top" class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
                        <td width="211"><div align="left">Nombres</div></td>
                        <td width="75"><div align="center">Doc. I </div></td>
                        <td width="143">						<div align="left">Origen</div>
						  </td>
                        <td><div align="left">Destino</div>                          <div align="center">
						  
						  </div></td>
                        </tr>
                      <? 				   
				    $registros = 20;
					$pagina = $_GET["pagina"];
					
					if (!$pagina) { 
						$inicio = 0; 
						$pagina = 1; 
					}else { 
						$inicio = ($pagina - 1) * $registros; 
					} 				
						$resultado=$objPer->getPerxRutaxCia($cod_emp,$dest_ruta,$inicio,$registros);
						$resultadot=$objPer->getPerxRutaxCiaT($cod_emp,$dest_ruta);
					
					$total_registros=$objPer->totalrows($resultadot);
				    $total_paginas = ceil($total_registros / $registros); 		  			

				  if($total_registros) {
                  while($filas=$objPer->NextRow($resultado))
                   {
				   $n++;
				   ?>
                      <tr valign="top" class="lblForm" >
                        <td class="lblForm">
                          <div align="left"><?php echo strtoupper($filas['nombre']); ?> </div>
						</td>
                        <td class="lblForm"><div align="center">                          
						<? 
						  echo $filas['dociden_per']; 
						 // $tpass=$tpass+$filas['cantidad'];
						  ?>
                        </div></td>
                        <td class="lblForm">						
						<div align="left"><?php echo strtoupper($filas['origen']); ?>
						</div>						
						  </td>
                        <td class="lblForm"><div align="left"><?php echo strtoupper($filas['destino']); ?></div>
						  <div align="center">
						    
						  </div></td>
                        </tr>
                      
                      <? 
			}
			$objPer->Liberar($resultado); 
			} 
			?> 
			<tr valign="top" class="lblForm" >
                        <td class="lblForm">TOTAL PERSONAL </td>
                        <td class="lblForm"><div align="center"><? echo $n;?></div></td>
                        <td class="lblForm">&nbsp;</td>
                        <td class="lblForm">&nbsp;</td>
                        </tr>
			</table>
			 </div>
			 </td>
                </tr>				
                <tr>
                  <td colspan="5"><div align="left"><span class="lblForm"></span></div></td>
                </tr>
                <tr>
                  <td width="310">
				    <div align="left">Pagina
					<? echo ($pagina);?> de <? echo $total_paginas;?>					
                    </div></td>
                  <td width="122"><div align="center">
       <? if($total_registros) {
		
		echo "<center>";
		
		if(($pagina - 1) > 0) {
			echo "<a href='cvp_per_lugar.php?pagina=".($pagina-1)."&cod_emp=$cod_emp&dest_ruta=$dest_ruta'>< Anterior</a> ";
		}
		
		for ($i=1; $i<=$total_paginas; $i++){ 
			if ($pagina == $i) {
				echo "<b>".$pagina."</b> "; 
			} else {
				echo "<a href='cvp_per_lugar.php?pagina=$i&cod_emp=$cod_emp&dest_ruta=$dest_ruta'>$i</a> "; 
			}	
		}
	  
		if(($pagina + 1)<=$total_paginas) {
			echo " <a href='cvp_per_lugar.php?pagina=".($pagina+1)."&cod_emp=$cod_emp&dest_ruta=$dest_ruta'>Siguiente ></a>";
		}
		
		echo "</center>";
		
	}
	?>
                  </div></td>
                  <td width="247" colspan="3"><div align="right">Total de Registros <? echo $total_registros?></div></td>
                </tr>				  
                 <tr>
                   <td colspan="5">&nbsp;</td>
                 </tr>
                 <tr>
				<form name="form2" method="post" action="cvp_tot_per_ruta_cia_print.php">
                  <td colspan="5">
				  <div align="center">
				    <table width="450" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="104"><div align="right">
                            <input type="submit" name="Submit2" value=".:Imprimir:." style="<?=$stylo['st2']?>" class="botira">
                        </div></td>
                        <td width="93">                              <input name="fecha1" type="hidden" id="fecha1" value="<? echo $fecha1?>">
                              <input name="fecha2" type="hidden" id="fecha2" value="<? echo $fecha2?>"></td><td width="104"><div align="left">
                            <input type="button" name="Submit2" value=".:Regresar:." style="<?=$stylo['st2']?>" class="botira" onClick="volver(this.form);">
                        </div></td>
                      </tr>
                    </table>
				  		
				  </div>
				  </td>
				  </form> 
                </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="20"></td>
            <td background="../estilo_tabla/parte_inf_cen.gif">&nbsp;</td>
            <td><img src="../estilo_tabla/parte_inf_der.gif" width="25" height="20"></td>
          </tr>
        </table>
    </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="2,5,22,21" href="fondo.php">
</map>
</body>

</html>

