<?
session_start();
require('../valtiempoinact.php');
require("funciones.php");
require("../conectar.php");
$idcliente=$_GET["idcliente"];
$idrenta=$_GET["idrenta"];
$hoy=$_GET["hoy"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">	 
     <head>
	 
<script language="JavaScript" type="text/javascript">
function ventana(id){

window.open("valdocumento.php?idexp="+id, "Titulo Pagina",  'width=720, height=130, top=250, left=150');
}
</script>
	     <style>
		      .cont-busc{position:relative;height:auto;min-height:400px !important;font-family:arial;color:#086A87;top:10px;overflow-x:hidden;margin:auto;}
			  .cont-busc .bar-busc{position:relative;height:90px;font-family:arial;color:#086A87;top:0px;margin:auto;}
			  .cont-res{position:relative;font-family:arial;color:#086A87;top:0px;margin:auto;}
			  .datos{border:0;-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius: 5px;-khtml-border-radius: 5px;border-collapse: collapse;color:#0d0d0d;font-family:arial;width:99%;}
			  .datos .tl{-moz-box-shadow:inset 0 0 20px #000000;-webkit-box-shadow: inset 0 0 20px #000000;box-shadow: inset 0 0 20px #000000;}
			  .datos .trs{min-height:30px !important;max-height:30px !important;height:30px !important;background:url(images/tcancion.jpg) repeat-x;color:#ffffff;font-size:12px;}
			  .datos .trs .link{-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius: 5px;-khtml-border-radius: 5px;background:#86B404;padding:3px;text-decoration:none;float:left;}
			  .datos .trs .link:hover{background:#A5DF00;}
              .datos .trsb{min-height:15px !important;max-height:15px !important;height:15px !important;background:url(images/tcancion2.png);color:#58D3F7;font-size:12px;}
			  .datos .trsb td{border-left:solid 1px #6E6E6E;}
			  .datos .trsb td:first-child{border-left:none;}
			  .datos .tr{min-height:20px !important;max-height:20px !important;height:20px !important;background:#ffffff;border-top:solid 1px #D8D8D8; color:#084B8A;font-size:10px;}
			  
			  .datos .trb{min-height:20px !important;max-height:20px !important;height:20px !important; background:#ffffff;border-top:solid 1px #D8D8D8; color:#0D0D0D;font-size:9px;}
			  .datos .trb1{min-height:20px !important;max-height:20px !important;height:20px !important; background:#CCCCCC;border-top:solid 1px #D8D8D8; color:#0D0D0D;font-size:9px;}
			  .datos .trb td{border-left:solid 1px #D8D8D8;padding-left:10px;}
			  .datos .trb td:first-child{border-left:none;}
			  .datos .trssb{min-height:15px !important;max-height:15px !important;height:15px !important;background:url(images/tcancion2.png);color:#848484;}	
			  .datos .tr td{border-left:solid 1px #D8D8D8;padding-left:10px;}
			  .datos .tr td:first-child{border-left:none;}
	          .datos .tr:hover{background:#01A9DB;color:#ffffff;}	
	          .datos .tr:hover a{color:#ffffff;}
              .datos .tr1{min-height:20px !important;max-height:20px !important;height:20px !important;background:#E0F8F7;border-top:solid 1px #D8D8D8; color:#084B8A;font-size:13px;}	
              .datos .tr1 td{border-left:solid 1px #D8D8D8;padding-left:10px;}
			  .datos .tr1 td:first-child{border-left:none;}
	          .datos .tr1:hover{background:#01A9DB;color:#ffffff;}	
	          .datos .tr1:hover a{color:#ffffff;}	
			  .datos .activo{min-height:20px !important;max-height:20px !important;height:20px !important;background:#F3E2A9;border-top:solid 1px #D8D8D8; color:#084B8A;font-size:13px;}
			  .ipt{border:none;background:none;color:#ffffff;font-weight:bold;text-align:right;}
			  .loading{position:fixed;left:50%;top:50%;width:250px;height:70px;margin-left:-125px;margin-top:-35px;display:none;background:url(images/bkloading.png);background-repeat:no-repeat;color:#ffffff;padding-top:25px;text-align:center;font-family:arial;font-size:12px;}
               .rentas{position:absolute;top:40px;width:800px;left:50%;margin-left:-421px;border:solid 1px  #D8D8D8; background:#FFFFFF; display:none;padding:20px;-Moz-box-shadow: 0 0 85px #000;-webkit-box-shadow: 0 0 85px #000; box-shadow: 0 0 85px #000;}
               .rentatab{border-collapse:collapse;color:#0d0d0d;font-family:arial;font-size:12px;}
               .rentatab .filatit{min-height:20px !important;max-height:20px !important;height:20px !important;background:#D8D8D8;border-top:solid 1px #D8D8D8;font-size:13px;}			   
               .rentatab .fila{min-height:20px !important;max-height:20px !important;height:20px !important;background:#ffffff;border-top:solid 1px #D8D8D8; color:#084B8A;font-size:12px;}
               .rentatab .fila td{border-left:solid 1px #D8D8D8;padding-left:5px;}
               .rentatab .fila td:first-child{border-left:none;}
               .cerrar{float:right;margin-top:-20px;margin-right:-20px;}
	     </style>
	 </head>
	 <body>
	     <div class="cont-busc">
		   <center>
	         <table class="datos">
			     <tr>
				     <td align="center" class="trs" colspan="13"><a class="link" href="documentosnoval.php?idcliente=<?echo $idcliente?>&idrenta=<?echo $idrenta?>&hoy=<?if($hoy==1){?>0<?}else{?>1<?}?>">
					 <?if($hoy==1){?>Ver todos los documentos validados<?}
					   else{?>Ver Documentos sin validar<?}?></a></td>
				 </tr>
				 <tr class="trb1">
				     <td align="center"><b>No</b></td>
				     <td align="center"><b>Fecha </b></td>
					 <td align="center"><b>Cliente</b></td>
					 <td align="center"><b>Recibio</b></td>
					 <td align="center"><b>Comp.</b></td>
					 <td align="center"><b>Valido</b></td>
				 </tr>
				 <?
				     if($hoy==1){
					 $condicion="exp.validacion<>'111'";
					 }else{$condicion="exp.validacion='111'";}
					 $sql="SELECT exp.idexp, exp.freg, exp.idcliente, c.a_pat,c.a_mat,c.nombre, c.id_emp, exp.idval FROM expedienteCliente as exp  
					 INNER JOIN clientes as c ON exp.idcliente=c.id_cliente
					 WHERE $condicion AND exp.idcliente<>0 and idrenta<>0 and idconcepto<>0 order by exp.freg desc";
					$re=mysql_query($sql);
					$k=1;
					while($ls=mysql_fetch_array($re)){
						$id_val=$ls['idval'];
								$e="SELECT a_mat, a_pat, nombre FROM empleados  WHERE id_empleado='$id_val'";	
								$em=mysql_query($e);	
								$emp=mysql_fetch_array($em);
								$admon=$emp['nombre']." ".$emp['a_pat']." ".$emp['a_mat'];
					    	$admonval=htmlentities($admon);
						 if($ls['validacion']=='s'){$ch="checked";$img="<img src='images/emok.png' width='15' height='15' border='0'>";}else{$ch="";$img="";}
						 $cliente=$ls['a_pat']." ".$ls['a_mat']." ".$ls['nombre'];
						 $nomcliente=htmlentities($cliente);
						 $idcliente=$ls['id_cliente'];
						 $select="SELECT emp.nombre, emp.a_pat FROM empleados as emp
						 INNER JOIN clientes as c ON c.id_emp=emp.id_empleado 
						 WHERE emp.id_empleado='$ls[id_emp]'";
						 $q=mysql_query($select);
						 $e=mysql_fetch_array($q);
						 $recibio=$e["nombre"]." ".$e["a_pat"];
					   
						?>
						 <tr class="trb">
						     <td><?echo $k;?></td>
						     <td><?echo fechatexto($ls['freg']);?></td>
							 <td><?echo$nomcliente;?></td>
						    
						     <td><?echo htmlentities($recibio)?></td>
						     <td><img onclick="ventana(<?echo$ls['idexp']?>)" src="images/zoom.png" width="18" height="18" border='0' style="margin-left:-5px;" alt="Ver comprobante"></td>
							 <td><?echo $admonval?></td>
						 </tr>
						<?
						$k++;
					}
				 ?>
		     </table>
			 <br>
			 <br>
			 <br>
			 <br>
			 <br>
			</center>
		 </div>
	 </body>
	 
</html>	