<?php
$datos['criterio'] = 'por_listado';
//$datos['estant'] = 'COB';
$filas = $objcxc->ConsultaAnticipo($datos);

if(!$filas['rs']->RecordCount()){exit();}

?>
<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">
<link href="../shared/css/catalogos.css" rel="stylesheet" type="text/css">
<?php

$Titulo='Anticipos Cliente';
$objcxc->Grid->IdGrid = 'GridAntCli';
$objcxc->Grid->AddColumn(1,'',20);
$objcxc->Grid->AddColumn(2,'N°',20);
$objcxc->Grid->AddColumn(3,'Nro Cont',70);
$objcxc->Grid->AddColumn(4,'Fec',60);
$objcxc->Grid->AddColumn(5,'Est',25);
$objcxc->Grid->AddColumn(6,'total',80);
$objcxc->Grid->AddColumn(7,'saldo',80);
$objcxc->Grid->AddColumn(8,'Aplicado',80);
$objcxc->Grid->AddColumn(9,'Por Aplic',80);
$objcxc->Grid->NroFila=1;
$objcxc->Grid->InitMarcoGrid();
$objcxc->Grid->TituloGrid($Titulo);
$objcxc->Grid->EncabezadoGrid();
foreach($filas['rs'] as $datosRow) {
		/*
		//SEGURIDAD DE LA SUCURSAL
        $objcxc->codintper = $datosRow['codsuc'];		
        if(!$objcxc->obtSegCxc()){continue;}
        
        //SEGURIDAD DE LA CAJA
        $objcxc->codintper = $datosRow['codsuc'].' - '.$datosRow['codcaj'];		
        if(!$objcxc->obtSegCxc()){continue;}
		*/
		$datosRow = $objcxc->FormatDatosAntPresent($datosRow);	
		//$datosRow['monant'] = $objcxc->formato_numerico_us($datosRow['monant']);
		$datosRow['id_cliente']	= $datos['id_cliente'];	
		$datosRow['id_fact']	= $datos['id_fact'];	
		$saldoapl = $objcxc->SaldoAntApliFact($datosRow);		
				
		$onblur="ObjForm.ValidarEdicionFilaGridAnt(".$objcxc->Grid->NroFila.");";
		$onKeyPress=" return(cj_formatonumero(this,'.',',',event)); ";			   
		if($datosRow['abrmon']=='E'){$datosRow['abrmon']='&#x20AC';}								
			
		$objcxc->Grid->InitRow();		
		//$objcxc->Grid->JsOnClickRow = $cargar;
		//echo $saldoapl.'<br>';		
		$objcxc->Grid->OnClickCell = "";
		$objcxc->Grid->JsOnClickComp[1] = "ObjForm.AplicarSaldoAnt(".$objcxc->Grid->NroFila.")";
		$objcxc->Grid->JsOnKeyPress[9] = " return(cj_formatonumero(this,'.',',',event)); ";
		$objcxc->Grid->JsOnblurComp[9] = "ObjForm.AplicarSaldoAnt(".$objcxc->Grid->NroFila.")";
		
		$objcxc->Grid->JsOnblurComp[8] = $onblur;
		$objcxc->Grid->JsOnKeyPress[8] = $onKeyPress;
		$objcxc->Grid->EstiloRow="cursor:pointer";
		$objcxc->Grid->CaracteresCell[5] = 2;
		$objcxc->Grid->CaracteresCell[7] = 12;
		$objcxc->Grid->CaracteresCell[8] = 12;
		$objcxc->Grid->AddDataCell(1,'chkant',$objcxc->Grid->NroFila,'center','chk');			
		$objcxc->Grid->AddDataCell(2,'nroant',$datosRow['nroant'],'center','html');	
		$objcxc->Grid->AddDataCell(3,'nrocontrato',$datosRow['nrocontrato'],'center','html');		
		$objcxc->Grid->AddDataCell(4,'fecant',$datosRow['fecant'],'center','html');
		$objcxc->Grid->AddDataCell(5,'estant',$datosRow['estant'],'center','cell',2);
		$objcxc->Grid->AddDataCell(6,'monant',$datosRow['monant'],'right','html');		
		$objcxc->Grid->AddDataCell(7,'saldo_ant',$datosRow['saldo_ant'],'right','cell_numeric',12);
		$objcxc->Grid->AddDataCell(8,'aplicado',$saldoapl,'right','cell_numeric',12);			
		$objcxc->Grid->AddDataCell(9,'saldoapl',$saldoapl,'right','numericEdit',12);
		$objcxc->Grid->AddCampoHidden('nroant',$datosRow['nroant']);
		$objcxc->Grid->AddCampoHidden('idant',$datosRow['idant']);
		$objcxc->Grid->AddCampoHidden('scg_cuenta_ant',$datosRow['scg_cuenta_ant']);		
		$objcxc->Grid->AddCampoHidden('saldo_act',number_format($datosRow['saldo_ant'],2,',','.'));	
		$objcxc->Grid->AddCampoHidden('saldoapliact',number_format($saldoapl,2,',','.'));	
		$objcxc->Grid->FilaGrid();
		$objcxc->Grid->NroFila++; 
		
}
$objcxc->Grid->EndMarcoGrid();
?>

         