<?php session_start();
require('../cfg/res.php'); 
$usrd_sql='select *from user0 where user_cedula="'.$_POST['id'].'"';
$usrd_res=mysql_query($usrd_sql,$link_vcrx);
if(mysql_num_rows($usrd_res)==0)
{
	die('No se encontro resultados');
}
$usrd_cod=mysql_result($usrd_res,0,'user_cedula');
$usrd_des=mysql_result($usrd_res,0,'user_descri');
$usrd_tip=mysql_result($usrd_res,0,'user_tipo');

?>
<table>
<tr>
<td>Codigo:</td>
<td><?php echo $usrd_cod;?></td>

<td>Descri:</td>
<td><input type="text" value="<?php echo $usrd_des;?>" /></td>

<td>Tipo:</td>
<td><input type="text" value="<?php echo $usrd_tip;?>" /></td>
</tr>

</table>

<?php

//$usrd_sql='select usrdoc1.*,enti0.enti_descri  from usrdoc1 LEFT JOIN enti0 ON usrdoc1.user=enti0.enti_codigo where 1=1 ';
$usrd_sql='select * from usrdoc11 where 1=1 ';

if(isset($_POST['id']) && !empty($_POST['id']))
//{$usrd_sql.=' and trim(user_codigo)="'.$_POST['id'].'"';}
{$usrd_sql.=' and user="'.$_POST['id'].'"';}

if(isset($_POST['modu']) && !empty($_POST['modu']))
{$usrd_sql.=' and docu_tipo like "'.substr($_POST['modu'],0,4).'"';}


if(isset($_POST['docu']) && !empty($_POST['docu']))
{$usrd_sql.=' and docu like "'.substr($_POST['docu'],0,4).'"';}

$usrd_sql.=' order by user,docu_tipo,docu ';

//echo $usrd_sql;

$usrd_res=mysql_query($usrd_sql,$link_vcrx);
if(mysql_num_rows($usrd_res)==0)
{
	die('No se encontro resultados');
}
?>

<input type="button" id="btn_guarda" class="btn" value="Guardar" onclick=""  />
<table border="0" width="80%" cellpadding="4" cellspacing="2" style="border-collapse:collapse">
	<tr>
    	<th style="border-left:solid 1px">USER</th>
        <th style="border-left:solid 1px">TIPO</th>
        <th style="border-left:solid 1px">DOCU</th>
        <th style="border-left:solid 1px">NUE</th>
        <th>MOD</th>
        <th>APR</th>
        <th>PRO</th>
        <th style="border-left:solid 1px">ANU</th>
        <th>ELI</th>
        <th style="border-left:solid 1px">CON</th>
        <th>INF</th>
        <th>ESP</th>
        <th style="border-left:solid 1px"></th>
   </tr>     
<tr style="border-bottom:dotted 1px" >
    	<td align="left" style="border-left:solid 1px">TODOS</td>
        <td style="border-left:solid 1px"></td>
        <td style="border-left:solid 1px"></td>
        <td align="center" style="border-left:solid 1px"><input type="checkbox" id="t_nuev"  onclick="todos('cl_nuev','t_nuev');"  /></td>
        <td align="center"><input type="checkbox" id="t_modi"  onclick="todos('cl_modi','t_modi');" /></td>
        <td align="center"><input type="checkbox" id="t_apro"  onclick="todos('cl_apro','t_apro');" /></td>
        <td align="center"><input type="checkbox" id="t_proc"  onclick="todos('cl_proc','t_proc');" /></td>
        <td align="center"  style="border-left:solid 1px"><input type="checkbox" id="t_anul"  onclick="todos('cl_anul','t_anul');" /></td>
        <td align="center"><input type="checkbox" id="t_elim"  onclick="todos('cl_elim','t_elim');" /></td>
		<td align="center" style="border-left:solid 1px"><input type="checkbox" id="t_cons"  onclick="todos('cl_cons','t_cons');" /></td>
        <td align="center"><input type="checkbox" id="t_info"  onclick="todos('cl_info','t_info');" /></td>
        <td align="center"><input type="checkbox" id="tespe"  onclick="todos('cl_espe','t_espe');" /></td>
		<td align="center" style="border-left:solid 1px"></td>
</tr>     


<?php
$filax=0;
while($usrd_r=mysql_fetch_assoc($usrd_res)) {$i=0;?>
<tr class="filax" id="<?php echo $usrd_r['docu']; ?>" align="center" style="<?php if($filax>=4){echo 'border-top:dotted 1px #000;';$filax=1;}else{$filax++;} ?>">
	<td align="left" style="border-left:solid 1px">
		<?php echo '<span title="'.$usrd_r['user'].'-'.$usrd_r['user_email'].'">'.$usrd_r['user_descri'].'</span>';?>
	</td>
	<td align="center" style="border-left:solid 1px">
		<?php echo '<span title="'.$usrd_r['modu_descri'].'">'.$usrd_r['docu_tipo'].'</span>';?>
	</td>
	<td style="border-left:solid 1px">
		<?php echo '<span title="'.$usrd_r['docu_descri'].'">'.$usrd_r['docu'].'</span>';?>
        <input type="hidden"   class="cl_enti"  value="<?php echo $usrd_r['user'];?>" />
        <input type="hidden"   class="cl_docu"  value="<?php echo $usrd_r['docu'];?>" />
    </td>
	<td align="center" style="border-left:solid 1px"><input type="checkbox" class="cl_nuev"  <?php if($usrd_r['nuev']=='1'){echo 'checked="checked"';}?>  /></td>
	<td align="center"><input type="checkbox" class="cl_modi" <?php if($usrd_r['modi']=='1'){echo 'checked="checked"';}?>  /></td>
	<td align="center"><input type="checkbox" class="cl_apro" <?php if($usrd_r['apro']=='1'){echo 'checked="checked"';}?>  /></td>
	<td align="center"><input type="checkbox" class="cl_proc" <?php if($usrd_r['proc']=='1'){echo 'checked="checked"';}?>  /></td>
	<td align="center" style="border-left:solid 1px"><input type="checkbox" class="cl_anul" <?php if($usrd_r['anul']=='1'){echo 'checked="checked"';}?>  /></td>
	<td align="center"><input type="checkbox" class="cl_elim" <?php if($usrd_r['elim']=='1'){echo 'checked="checked"';}?>  /></td>                        
	<td align="center" style="border-left:solid 1px"><input type="checkbox" class="cl_cons" <?php if($usrd_r['cons']=='1'){echo 'checked="checked"';}?>  /></td>
	<td align="center"><input type="checkbox" class="cl_info" <?php if($usrd_r['info']=='1'){echo 'checked="checked"';}?>  /></td>                        
	<td align="center"><input type="checkbox" class="cl_espe" <?php if($usrd_r['espe']=='1'){echo 'checked="checked"';}?>  /></td>                        
	<td align="left" style="border-left:solid 1px;font-size:12px;">
		<?php echo '<span title="'.$usrd_r['docu'].'">'.$usrd_r['docu_descri'].'</span>';?>
	</td>
</tr>

<?php	}?>        
    </tr>
</table>
