<?php
$PorIngreso = ($datos['nroing'] and $datos['esting']=='PROC')?true:false;
$datos['criterio'] = ($PorIngreso)?'por_cobrados':'por_factura';
$Tutulo = ($PorIngreso)?'ANTICIPOS COBRADOS':'ANTICIPOS PENDIENTES POR COBRAR';
$objcxc->Grid->BloqGrid = ($PorIngreso)?true:false;
$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

$objcxc->Grid->IdGrid = 'GridAnt';
$objcxc->Grid->AddColumn(1,'',20);
$objcxc->Grid->AddColumn(2,'Cliente',180);
$objcxc->Grid->AddColumn(3,'N°',60);
$objcxc->Grid->AddColumn(4,'Fec Reg',60);
$objcxc->Grid->AddColumn(5,'Nro Cont',80);
$objcxc->Grid->AddColumn(6,'Concep',180);
$objcxc->Grid->AddColumn(7,'Estatus',70);
$objcxc->Grid->AddColumn(8,'Porc(%)',70);
$objcxc->Grid->AddColumn(9,'Mon',40);
$objcxc->Grid->AddColumn(10,'Tasa',40);
$objcxc->Grid->AddColumn(11,'Monto('.$objcxc->DatosMonedaDef['abrmon'].')',100);
$objcxc->Grid->AddColumn(12,'A Cob('.$objcxc->DatosMonedaDef['abrmon'].')',100);
$objcxc->Grid->AddColumn(13,'Cob('.$objcxc->DatosMonedaDef['abrmon'].')',100);
$objcxc->Grid->AddColumn(14,'Mon Ext',100);
$objcxc->Grid->AddColumn(15,'Saldo',100);
$objcxc->Grid->NroFila=1;

$objcxc->Grid->InitMarcoGrid();
$objcxc->Grid->TituloGrid($Tutulo);
$objcxc->Grid->EncabezadoGrid();
foreach($filas['rs'] as $datosRow) {
			
		 $datosRow = $objcxc->FormatDatosAntPresent($datosRow);

		$cargarAnt = 'ObjForm.IngresarCobAnticipo('."'".$datosRow['id_cliente']."','".
												   $datosRow['nroant']."','".
												   $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.');';
		
		$aceptarAnt =  $datos['SelAnt']?$aceptar:"";
		$aceptar = (!$datos['SelAnt'])?$aceptar:"";
		
		$acobrar = '0,00';
		
		$datosRow['id_doc']=$datosRow['idant'];
		$cobrado = $objcxc->BuscarMontoCobradoAnt($datosRow);		
		$Saldo = $objcxc->SaldoAnt($datosRow);
		
		$onblur="ObjForm.ActualizarTotales(); ObjForm.ValidarEdicionFilaGridAnt(".$objcxc->Grid->NroFila.");";
		$onKeyPress="resp = ObjForm.ValidarTotales(); if(resp===false){return false;} return(cj_formatonumero(this,'.',',',event));";
																   
		if($datosRow['abrmon']=='E'){$datosRow['abrmon']='&#x20AC';}								
				
		$objcxc->Grid->InitRow();	
		$objcxc->Grid->OnClickCell = "";
		$objcxc->Grid->JsOnClickComp[1] = "ObjForm.IngresarCobAnticipo(".$objcxc->Grid->NroFila.")";		
		$objcxc->Grid->JsOnblurComp[12] = $onblur;
		$objcxc->Grid->JsOnKeyPress[12] = $onKeyPress;
		$objcxc->Grid->Checked[1] = $cobrado?true:false;						 
		$objcxc->Grid->AddDataCell(1,'chkant',$objcxc->Grid->NroFila,'center','chk');				
		$objcxc->Grid->AddDataCell(2,'nombre_cliente',$datosRow['nombre_cliente'],'left','cell');
		$objcxc->Grid->AddDataCell(3,'nroant',$datosRow['nroant'],'center','html');
		$objcxc->Grid->AddDataCell(4,'fecant',$datosRow['fecant'],'center','html');
		$objcxc->Grid->AddDataCell(5,'nrocontrato',$datosRow['nrocontrato'],'center','html');
		$objcxc->Grid->AddDataCell(6,'conant',$datosRow['conant'],'left','cell');
		$objcxc->Grid->AddDataCell(7,'estant',$datosRow['estant'],'center','html');
		$objcxc->Grid->AddDataCell(8,'porant',$datosRow['porant'],'center','html');
		$objcxc->Grid->AddDataCell(9,'abrmon',$datosRow['abrmon'],'center','html');
		$objcxc->Grid->AddDataCell(10,'tascam',$datosRow['tascam'],'right','html');
		$objcxc->Grid->AddDataCell(11,'monant',$datosRow['monant'],'right','html');
		$objcxc->Grid->AddDataCell(12,'monacob',$acobrar,'right','numericEdit',15);
		$objcxc->Grid->AddDataCell(13,'moncob',$cobrado,'right','cell_numeric',15);
		$objcxc->Grid->AddDataCell(14,'monantext',$datosRow['monantext'],'right','html');
		$objcxc->Grid->AddDataCell(15,'saldo',$Saldo,'right','cell_numeric',15);
		$objcxc->Grid->AddCampoHidden('idant',$datosRow['idant']);
		$objcxc->Grid->AddCampoHidden('conant',$datosRow['conant']);
		$objcxc->Grid->AddCampoHidden('conanuant',$datosRow['conanuant']);		
		$objcxc->Grid->AddCampoHidden('nroant',$datosRow['nroant']);
		$objcxc->Grid->AddCampoHidden('monant',$datosRow['monant']);
		$objcxc->Grid->AddCampoHidden('id_cliente',$datosRow['id_cliente']);	
		$objcxc->Grid->FilaGrid();
		$objcxc->Grid->NroFila++; 
		
}
$objcxc->Grid->EndMarcoGrid();
?>

         