<?php
session_start();
require_once($ruta."clases/covensol_cxc_c_cuentasxcobrar.php");
$objcxc = new covensol_cxc_cuentasxcobrar();
$objcxc->io_conexiones->decodificar_post();
$opciones = $objcxc->io_conexiones->asignar_post();
$resultado = $objcxc->consulta_caja($opciones);
?>
<link href="../shared/css/catalogos.css" rel="stylesheet" type="text/css">
<?php 
$ancho[1] = 50;
$ancho[2] = 300;
$ancho[3] = 300;
$ancho[4] = 30;
$ancho_total = array_sum($ancho);
$clave=0;
?>

<table width="<?php echo $ancho_total; ?>" border="0" cellpadding="0" cellspacing="0"  class='fondo-tabla'>
  <tr class="titulo-celda">
     <td width="<?php echo $ancho[1]; ?>"><div align="center">COD</div></td>
     <td width="<?php echo $ancho[2]; ?>"><div align="center">NOMBRE</div></td>
     <td width="<?php echo $ancho[3]; ?>"><div align="center">SUCURSAL</div></td> 
     <td width="<?php echo $ancho[4]; ?>"><div align="center">EST.</div></td>   
  </tr>
  <?php foreach($resultado['rs'] as $fila) { ?>
          <?php
		  	$seguridad = true;	
			if($seguridad){	
			$clave++;
			
			//SEGURIDAD DE LA SUCURSAL
			$objcxc->codintper = $fila['codsuc'];		
			if(!$objcxc->obtSegCxc()){continue;}
			
			//SEGURIDAD DE LA CAJA
			$objcxc->codintper = $fila['codsuc'].' - '.$fila['codcaj'];		
			if(!$objcxc->obtSegCxc()){continue;}
						
			$aceptar="aceptar('".$fila['codcaj']."','".
			                     $fila['codsuc']."','".
								 $fila['scg_cuenta']."','".
								 $fila['estcaj']."','".
								 $fila['codseriecaj']."','".
								 $fila['nrofacinicaj']."','".
								 $clave."')";
		   ?>    
                  <tr id="consulta">
                    <td width="<?php echo $ancho[1]; ?>"><div align="left"><a href="#" onClick="<?php echo $aceptar; ?>"><?php echo $fila['codcaj'];?></a></div></td>
                    <td width="<?php echo $ancho[2]; ?>"><div align="left"><a href="#" onClick="<?php echo $aceptar; ?>"><?php echo $fila['nomsuc'];?></a></div></td>
                    <td width="<?php echo $ancho[3]; ?>"><div align="left"><a href="#" onClick="<?php echo $aceptar; ?>"><?php echo $fila['nomcaj'];?></a></div></td>
                    <td width="<?php echo $ancho[4]; ?>"><div align="left"><a href="#" onClick="<?php echo $aceptar; ?>"><?php echo $fila['estcaj'];?></a></div></td>
                  </tr>
                  <tr>
                    <td height="1" bgcolor="#BBBBBB" colspan="4">
                    			<input name="hnomcaj<?php echo $clave;?>" type="hidden" id="hnomcaj<?php echo $clave;?>"  value="<?php echo $fila['nomcaj']; ?>"/>
                                <input name="hnomsuc<?php echo $clave;?>" type="hidden" id="hnomsuc<?php echo $clave;?>"  value="<?php echo $fila['nomsuc']; ?>"/>
                                <input name="hdenominacion<?php echo $clave;?>" type="hidden" id="hdenominacion<?php echo $clave;?>"  value="<?php echo $fila['denominacion']; ?>"/>
                     	</td>
                  </tr>
          <?php } ?>
  <?php }  ?>
</table>