<?php
session_start();
$ruta='../';
require_once("clases/covensol_cxc_c_cuentasxcobrar.php");
$objcxc = new covensol_cxc_cuentasxcobrar();
$objcxc->io_conexiones->decodificar_post();
$opciones = $objcxc->io_conexiones->asignar_post();
$resp = $objcxc->MonedaPorDefecto();	
			
$datos['criterio']='por_listado';			
$filas = $objcxc->ConsultaAnticipo($datos);

if(!$filas['rs']->RecordCount()){	
	exit();
}
$ancho[0] = 20;
$ancho[1] = 180;
$ancho[2] = 60;
$ancho[3] = 60;
$ancho[4] = 80;
$ancho[5] = 180;
$ancho[6] = 70;
$ancho[10] = 70;
$ancho[11] = 70;
$ancho[12] = 100;
$ancho[13] = 100;
$ancho[14] = 100;		
$ancho_total = array_sum($ancho);
$cellspacing=20;
$clave=1;

?>
<link href="../shared/css/tablas.css" rel="stylesheet" type="text/css">
<link href="../shared/css/ventanas.css" rel="stylesheet" type="text/css">
<link href="../shared/css/cabecera.css" rel="stylesheet" type="text/css">
<link href="../shared/css/general.css" rel="stylesheet" type="text/css">
<br />
<table width="<?php echo $ancho_total + $cellspacing*2; ?>" border="0" align="center" cellpadding="0" cellspacing="<?php echo $cellspacing; ?>" class="contorno">
      <tr>
        <td>
            <table  id="GridAnt" width="<?php echo $ancho_total; ?>" border="1" cellpadding="0" cellspacing=""  bordercolor="#CCCCCC" bgcolor="#FFFFFF" style="border-collapse:collapse">
              <tr class="titulo-celda">
                <td width="<?php echo $ancho[0] ?>" align="center"></td>
                <td width="<?php echo $ancho[1] ?>" align="center">Cliente</td>
                <td width="<?php echo $ancho[2] ?>" align="center">N°</td>
                <td width="<?php echo $ancho[3] ?>" align="center">Fec Reg</td>
                <td width="<?php echo $ancho[4] ?>" align="center">Nro Cont</td>
                <td width="<?php echo $ancho[5] ?>" align="center">Concep</td>
                <td width="<?php echo $ancho[6] ?>" align="center">Estatus</td>
                <td width="<?php echo $ancho[10] ?>" align="center">Porc(%)</td>
                <td width="<?php echo $ancho[11] ?>" align="center">Tasa.</td>
                <td width="<?php echo $ancho[12] ?>" align="center">Monto(<?php echo $objcxc->DatosMonedaDef['abrmon'] ?>)</td>
                <td width="<?php echo $ancho[13] ?>" align="center">Cob(<?php echo $objcxc->DatosMonedaDef['abrmon'] ?>)</td>
                <td width="<?php echo $ancho[14] ?>" align="center">Mon Ext</td> 
              </tr>
            
              <?php foreach($filas['rs'] as $datosRow) {
                            
                    $datosRow = $objcxc->FormatDatosAntPresent($datosRow);
                       
					        
                     $aceptar = 'onClick="ObjForm.CargarAnticipo('."'".$datosRow['id_cliente']."','".
                                                                       $datosRow['nroant']."','".
																	   $datosRow['idant']."','".
                                                                       $datosRow['nroproy']."','".
                                                                       $datosRow['nrocontrato']."','".
                                                                       $datosRow['scg_cuenta_ant']."','".
                                                                       $datosRow['fecant']."','".
                                                                       $datosRow['porant']."','".
                                                                       $datosRow['codmon']."','".
                                                                       $datosRow['tascam']."','".
                                                                       $datosRow['abrmon']."','".		
                                                                       $datosRow['monant']."','".									   
                                                                       $datosRow['estant']."','".
                                                                       $datosRow['fecanuant']."','".
                                                                       $datosRow['fecregant']."','".                                                                      
                                                                       $datosRow['usuregant']."','".
                                                                       $datosRow['horaregant']."','".												  				   
                                                                       $clave."');  return false;".'"';
                    
					$datosRow['id_doc']=$datosRow['idant'];
					$cobrado = $objcxc->BuscarMontoCobradoAnt($datosRow);		
					$Saldo = $objcxc->SaldoAnt($datosRow);
					
					$aceptarAnt =  $datos['SelAnt']?$aceptar:"";
					$aceptar = (!$datos['SelAnt'])?$aceptar:"";
					                                                           
                    if($datosRow['abrmon']=='E'){$datosRow['abrmon']='&#x20AC';}								
                     $moncob=0;
                    //$monret = $objcxc->BuscarMontoRetencionesMovCob($datosRow);
                ?>
                   <tr id="filagrid" <?php echo $color_fila; ?>> 
                     <td width="<?php echo $ancho[0] ?>" align="left" valign="top"> 
                          <?php if($datos['SelAnt']){?>                          
                     		<input type="checkbox" name="GridAnt-cell-chkant<?php echo $clave;?>" id="GridAnt-cell-chkant<?php echo $clave;?>" onclick="<?php echo $aceptarAnt; ?>" value="<?php echo $clave;?>" />
                     	  <?php } ?>
                     </td>
                     <td width="<?php echo $ancho[1] ?>" align="left" valign="top">
                     	<a href="#" <?php echo $aceptar; ?>>					 	
                        <input type="text" class="sin-borde" size="35" name="GridAnt-cell-nombre_cliente<?php echo $clave;?>" id="GridAnt-cell-nombre_cliente<?php echo $clave;?>"  value="<?php echo $datosRow['nombre_cliente']; ?>" readonly/>
                       </a>
                     </td>
                     <td width="<?php echo $ancho[2] ?>" align="center" valign="top"><a href="#" <?php echo $aceptar; ?>><?php echo $datosRow['nroant']; ?></a></td>
                     <td width="<?php echo $ancho[3] ?>" align="center" valign="top"><a href="#" <?php echo $aceptar; ?>><?php echo $datosRow['fecant']; ?></a></td>
                     <td width="<?php echo $ancho[4] ?>" align="center" valign="top"><a href="#" <?php echo $aceptar; ?>><?php echo $datosRow['nrocontrato']; ?></a></td>
                     <td width="<?php echo $ancho[5] ?>" align="left" valign="top">
                     <a href="#" <?php echo $aceptar; ?>>                       
                       <input type="text" class="sin-borde" size="35" name="GridAnt-cell-conant<?php echo $clave;?>"id="GridAnt-cell-conant<?php echo $clave;?>" value="<?php echo $datosRow['conant']; ?>" readonly/>                       
                     </a>
                     </td>
                     <td width="<?php echo $ancho[6] ?>" align="center" valign="top"><a href="#" <?php echo $aceptar; ?>><?php echo $datosRow['estant']; ?></a></td>
                     <td width="<?php echo $ancho[10] ?>" align="center" valign="top"><a href="#" <?php echo $aceptar; ?>><?php echo $datosRow['porant']; ?></a></td>
                     <td width="<?php echo $ancho[11] ?>" align="center" valign="top"><a href="#" <?php echo $aceptar; ?>><?php echo $datosRow['tascam']; ?></a></td>
                     <td width="<?php echo $ancho[12] ?>" align="right" valign="top"><a href="#" <?php echo $aceptar; ?>><?php echo $datosRow['monant']; ?></a></td>
                     <td width="<?php echo $ancho[13] ?>" align="right" valign="top"><a href="#" <?php echo $aceptar; ?>><?php echo number_format($cobrado,2,',','.'); ?></a></td>
                     <td width="<?php echo $ancho[14] ?>" align="right" valign="top"><a href="#" <?php echo $aceptar; ?>><?php echo $datosRow['monantext']; ?></a>
                     <input name="hconant<?php echo $clave;?>" type="hidden" id="hconant<?php echo $clave;?>"  value="<?php echo $datosRow['conant']; ?>"/>
                     <input name="hconanuant<?php echo $clave;?>" type="hidden" id="hconanuant<?php echo $clave;?>"  value="<?php echo $datosRow['conanuant']; ?>"/>
                     <input name="hnombre_cliente<?php echo $clave;?>" type="hidden" id="hnombre_cliente<?php echo $clave;?>"  value="<?php echo $datosRow['nombre_cliente']; ?>"/>
            		 <input name="hid_clienteant<?php echo $clave;?>" type="hidden" id="hid_clienteant<?php echo $clave;?>"  value="<?php echo $datosRow['id_cliente']; ?>"/>
                     <input name="hnroant<?php echo $clave;?>" type="hidden" id="hnroant<?php echo $clave;?>"  value="<?php echo $datosRow['nroant']; ?>"/>
                     <input name="hmonant<?php echo $clave;?>" type="hidden" id="hmonant<?php echo $clave;?>"  value="<?php echo $datosRow['monant']; ?>"/>
                     
                     <input name="GridAnt-cell-txttascam<?php echo $clave;?>" type="hidden" id="GridAnt-cell-txttascam<?php echo $clave;?>"  value="<?php echo $datosRow['tascam']; ?>"/>
                     <input name="GridAnt-cell-txtcodmon<?php echo $clave;?>" type="hidden" id="GridAnt-cell-txtcodmon<?php echo $clave;?>"  value="<?php echo $datosRow['codmon']; ?>"/>
                     <input name="GridAnt-cell-txtabrmon<?php echo $clave;?>" type="hidden" id="GridAnt-cell-txtabrmon<?php echo $clave;?>"  value="<?php echo $datosRow['abrmon']; ?>"/>
                      </td>
              </tr>
                
            
              <?php $clave++; } ?>
            </table>
    </td>
   </tr>
</table>
         