<?php require('../cfg/res.php'); 

$tabla=$_POST['docu'].'0';
$codig=$_POST['docu'].'_codigo';
$descr=$_POST['docu'].'_descri';

$sql_cta='select *from '.$tabla;

//if($_POST['list_cod']>"")
//{$sql_cta.=' where '.$codig. ' like "%'.$_POST['list_cod'].'%" or '.$descr.' like "%'.$_POST['list_cod'].'%"';}

if($_POST['docu']=='enti')
{$sql_cta.=' order by enti_descri';}

$res_list=mysql_query($sql_cta,$link_vcrx);

$ind_list=0;
?>
<table id="tablita" style="border-collapse:collapse; font-size:12px;">
<tr>
<th></th>
<th>CODIGO</th>
<th>DESCRIPCION</th>

<?php
if($_POST['docu']=='enti')
{
echo '<th>DIRECCION</th>';
echo '<th>TELEFONO</th>';
} 
?>

<?php
if($_POST['docu']=='item')
{
echo '<th>LINEA</th>';
echo '<th>P.UNIT</th>';
echo '<th>P.V.P.</th>';
} 
?>


</tr>

<?php 
while($r_list=mysql_fetch_assoc($res_list))
{ 
$ind_list++;?>
<tr id="list_fila<?php echo $ind_list;?>" class="list_filax" 
	onkeypress="if(event.keyCode==13)
			{list_agrega('<?php echo $r_list[$codig];?>','<?php echo $r_list[$descr];?>','<?php echo $_POST['list_cod'];?>','<?php echo $_POST['list_desc'];?>');}" 
	ondblclick="list_agrega('<?php echo $r_list[$codig];?>','<?php echo $r_list[$descr];?>','<?php echo $_POST['list_cod'];?>','<?php echo $_POST['list_desc'];?>');">

<td><input type="radio" name="lista" class="opt" onfocus="list_filabg('<?php echo $ind_list;?>');" ondblclick="list_agrega('<?php echo $r_list[$codig];?>','<?php echo $r_list[$descr];?>','<?php echo $_POST['list_cod'];?>','<?php echo $_POST['list_desc'];?>');" /></td>

<td><?php echo $r_list[$codig];?></td>
<td><?php echo $r_list[$descr];?></td>

<?php 
if($_POST['docu']=='enti')
{
echo '<td>'.$r_list['enti_direccion'].'</td>';
echo '<td>'.$r_list['enti_telefono'].'</td>';
}
?>

<?php 
if($_POST['docu']=='item')
{
echo '<td>'.$r_list['lsub_descri'].'</td>';
echo '<td>'.$r_list['item_puni'].'</td>';
echo '<td>'.$r_list['item_pvp0'].'</td>';
}
?>


</tr>

<?php } ?>
</table>