<?php
session_start();
$ruta='../';
require_once("clases/covensol_cxc_c_cuentasxcobrar.php");
$obj_principal = new covensol_cxc_cuentasxcobrar();
$obj_principal->io_conexiones->decodificar_post();
$opciones = $obj_principal->io_conexiones->asignar_post();

			
			
				
			$opciones['criterio']='por_listado';			
			$filas = $obj_principal->consulta_clientes($opciones);
			
			$ancho[0] = 80;
			$ancho[1] = 80;
			$ancho[2] = 250;
			$ancho[3] = 80;
			$ancho[4] = 80;
			$ancho[5] = 200;
			$ancho[6] = 150;
			$ancho[7] = 80;
			
			$ancho_total = array_sum($ancho);
			
			if($filas['cantidad']){
			
							 
			
			?>
                                <link href="../shared/css/catalogos.css" rel="stylesheet" type="text/css">
                                <link href="../shared/css/tablas.css" rel="stylesheet" type="text/css">
                                <table width="<?php echo $ancho_total; ?>" border="0" cellpadding="0" cellspacing="0"   class='fondo-tabla'>
                                  <tr class="titulo-celda">
                                    
                                    <td width="<?php echo $ancho[0] ?>" align="center">Código</td>
                                    <td width="<?php echo $ancho[1] ?>" align="center">Estatus</td>
                                    <td width="<?php echo $ancho[2] ?>" align="center">Cliente</td>
                                    <td width="<?php echo $ancho[3] ?>" align="center">Rif.</td>
                                    <td width="<?php echo $ancho[4] ?>" align="center">Tipo</td>
                                    <td width="<?php echo $ancho[5] ?>" align="center">Clasificación</td>                
                                    <td width="<?php echo $ancho[6] ?>" align="center">Zona</td>                
                                    <td width="<?php echo $ancho[7] ?>" align="center">Teléfono</td>                                   
                                                
                                  </tr>
                                  <?php do {  ?>
                                  
                                  <?php
                                   $mostrar=1;
								   
                                   if($mostrar==1){	
                                        
										
										$aceptar = 'onClick="aceptar('.$filas['fila']['id_cliente'].",'".$filas['fila']['codcliente']."','".$filas['fila']['estclient']."')".'"';                                       
                                  										
										switch($filas['fila']['estclient']){
										
												case 'A':
												    	 $color_fila='style="background-color:#FFFFFF"';
													break;
												
												case 'I':
												    	$color_fila='style="background-color:#FFFFBB"';
													break;
													
												case 'B':
												    	 $color_fila='style="background-color:#E1ECEC"';
													break;
													
												case 'S':
												    
													break;
										
										}
																				                                   				
                                        
                                    ?>
                                              <tr id="consulta" <?php echo $color_fila; ?> > 
                                              <td width="<?php echo $ancho[0] ?>" align="left"><a href="#" <?php echo $aceptar; ?>><?php echo $filas['fila']['codcliente']; ?></a></td>
                                              <td width="<?php echo $ancho[1] ?>" align="left"><a href="#" <?php echo $aceptar; ?>><?php echo $filas['fila']['estclient']; ?></a></td>
                                                <td width="<?php echo $ancho[2] ?>" align="left"><a href="#" <?php echo $aceptar; ?>><?php echo $filas['fila']['nombre_cliente']; ?></a></td>
                                                <td width="<?php echo $ancho[3] ?>" align="left"><a href="#" <?php echo $aceptar; ?>><?php echo $filas['fila']['tipperrif'].'-'.$filas['fila']['numpririf'].'-'.$filas['fila']['numterrif']; ?></a></td>							
                                                <td width="<?php echo $ancho[4] ?>" align="left"><a href="#" <?php echo $aceptar; ?>><?php echo $filas['fila']['tipo_cliente']; ?></a></td>
                                                <td width="<?php echo $ancho[5] ?>" align="left"><a href="#" <?php echo $aceptar; ?>><?php echo $filas['fila']['clasif_cliente']; ?></a></td>
                                                <td width="<?php echo $ancho[6] ?>" align="left"><a href="#" <?php echo $aceptar; ?>><?php echo $filas['fila']['zona']; ?></a></td>
                                                <td width="<?php echo $ancho[7] ?>" align="left"><a href="#" <?php echo $aceptar; ?>><?php echo $filas['fila']['telcliente'];?></a></td>
                                               
                                  </tr>
                                              <tr>
                                                <td height="1" bgcolor="#BBBBBB" colspan="5">
                                                	<input name="hnombre_cliente<?php echo $filas['fila']['id_cliente'];?>" type="hidden" id="hnombre_cliente<?php echo $filas['fila']['id_cliente'];?>"  value="<?php echo $filas['fila']['nombre_cliente']; ?>"/>
                                                </td>
                                              </tr>
                                    <?php } ?>
                                  <?php } while($filas['fila'] = $obj_sql->fetch_row($filas['rs']));?>
                                </table>	
  <?php 
  
  }// CIERRE DEL IF PRINCIPAL
  else{
  
  		$mensaje = 'No hay clientes para este criterio de busqueda.<br>';
		$obj_principal->io_conexiones->mensajes_ajax($mensaje);
  
  }
  
  
  ?>          