<?php
require('../cfg/res.php');
mysql_query("SET NAMES 'utf8'");
$sql_idisp='select *from invsald order by item,lsub_descri, item';
$res_idisp=mysql_query($sql_idisp,$link_vcrx);

?>
<div style="overflow-y:scroll; height:300px;">

<table id="tabla_invdisp" width="100%" border="0" cellspacing="0" cellpadding="2" style="border-collapse:collapse;font-size:12px; border:#000000 solid 1px;">

<tr style="border-bottom:#000000 solid 2px; ">
	<th>ITEM</th>
	<th>NOMBRE</th>
	<th>SALDO</th>
	<th>B010</th>
	<th>B020</th>
	<th>B030</th>
</tr>
<?php 
$filax=1;
while($r_idisp=mysql_fetch_assoc($res_idisp)){?>
	<tr class="filax" id="<?php echo $r_ped['idnum1']; ?>" align="center" style=" <?php if($filax==3){echo 'border-bottom:dotted 1px #000;';$filax=1;}else{$filax++;} ?>" >


	<td><a href="#" onClick="invdisp_d('<?php echo $r_idisp['item'];?>',this);"><?php echo $r_idisp['item'];?></a></td>
	<td align="left"><?php echo $r_idisp['item_descri'];?></td>
   	<td align="right"><?php if($r_idisp['b000']<0){echo '<font color="red">';} ?> <?php echo $r_idisp['b000'];?></td>
   	<td align="right"><?php if($r_idisp['b010']<0){echo '<font color="red">';} ?> <?php echo $r_idisp['b010'];?></td>
   	<td align="right"><?php if($r_idisp['b020']<0){echo '<font color="red">';} ?> <?php echo $r_idisp['b020'];?></td>
   	<td align="right"><?php if($r_idisp['b030']<0){echo '<font color="red">';} ?> <?php echo $r_idisp['b030'];?></td>
    
</tr>
<?php }?>
</table>
</div>
<br>
<div id="invdisp2"></div>
<script type="text/javascript">
function invdisp_d(itex,obj)
{
	var obj2=obj.parentNode;
	var obj3=obj2.parentNode;	
	for(i=0;i<=document.getElementsByClassName('filax').length-1;i++)
	{
		document.getElementsByClassName('filax').item(i).style.background='#fff';
	}
       obj3.style.background='#09c';

$.ajax({
  url:'../lib/vrinvdisp2.php',
  type:'POST',
  data:{item:itex},
  success:function(dato){
  document.getElementById('invdisp2').innerHTML=dato;
  },
  error:function(objeto){console.log(objeto);}

});

}

</script>