public function Verificar()
{
	$arr = $this->LeerDigitosNiveles();
	$cuentasincero=uf_spg_cuenta_sin_cero($this->sig_cuenta);
	$oCuenta1 =  new planUnicoRe();
	$oCuenta1->cuenta = $cuentasincero;
	if($oCuenta1->TieneHijas())
	{
		$cantidadDigitos=strlen($cuentasincero);
	}
	else
	{
		
		$cantidadDigitos=strlen(trim($this->sig_cuenta));
	}
	//var_dump($cantidadDigitos);
	//die();
	$arrAnteriores=array();
	foreach($arr as $nivel=>$numerodedigitos)
	{
		if($numerodedigitos==$cantidadDigitos)
		{
			
			
			for($i=1;$i<$this->nivelCuenta;$i++)
			{
				$arrAnteriores[$i]=$i;	
			}
		
			$niveldelacuenta= $nivel;
			break;
		}
	}

	if($niveldelacuenta==$this->nivelCuenta or array_search($niveldelacuenta,$arrAnteriores))
	{
		return true;
	}
	else
	{
		return false;
	}
	
}
function reporte_estado_de_resultados2()
{	 ////////////////////////////////////////////////////////////////////////////////////////////////////////
	 //	      Function :  uf_spg_reportes_presupuesto_de_caja
	 //     Argumentos : adt_fecdes ... adt_fechas  // rango de fecha del reporte
	 //                  adts_datastore  // datastore que imprime el reporte
     //	       Returns : Retorna true o false si se realizo la consulta para el reporte
	 //	   Description : Reporte que genera salida del Presupuesto de Caja
	 //     Creado por : Ing. Arnaldo Suárez
	 // Fecha Creación : 18/06/2008                       Fecha última Modificacion :      Hora :
  	 ///////////////////////////////////////////////////////////////////////////////////////////////////////

		$la_cuenta[18]=array();
		// ----> 1.  INGRESOS CORRIENTES
		//$la_cuenta[0]["detalles"]=Array('302000000','303000000','304000000','305000000');
		$la_cuenta[0]["cuenta"]='300000000'.$ls_ceros;
		
		$la_cuenta[1]["cuenta"]='305000000'.$ls_ceros;
		
		$la_cuenta[2]["cuenta"]='301090000'.$ls_ceros;
		
		$la_cuenta[3]["cuenta"]='408070000'.$ls_ceros; // ---> Menos Descuentos, Bonificaciones y Devoluciones
        // ---> Ventas Netas
		$la_cuenta[4]["cuenta"]='301030000'.$ls_ceros;
		$la_cuenta[5]["cuenta"]='303000000'.$ls_ceros;
		
		// ---> 2. GASTOS CORRIENTES
		
		
		$la_cuenta[6]["cuenta"]='301040000'.$ls_ceros;
		$la_cuenta[7]["cuenta"]='301050000'.$ls_ceros;
		$la_cuenta[8]["cuenta"]='301100000'.$ls_ceros;
		$la_cuenta[9]["cuenta"]='300200000'.$ls_ceros;
			
		$la_cuenta[10]["cuenta"]='401000000'.$ls_ceros;
		$la_cuenta[11]["cuenta"]='402000000'.$ls_ceros;
		$la_cuenta[12]["cuenta"]='403000000'.$ls_ceros;
		$la_cuenta[13]["cuenta"]='408010000'.$ls_ceros;
		// ---> Variación de Inventarios (Detallar)
		// ---> b. Otros Gastos Corrientes
		$la_cuenta[14]["cuenta"]='407000000'.$ls_ceros;
		$la_cuenta[15]["cuenta"]='408020000'.$ls_ceros;
		$la_cuenta[16]["cuenta"]='408050000'.$ls_ceros;
		$la_cuenta[17]["cuenta"]='408060000'.$ls_ceros;
		$la_cuenta[18]["cuenta"]='408080000'.$ls_ceros;
	    
		$datastore0=array();
	    $id0=0;
		$datastore1=array();
	    $id1=0;
	    $datastore2=array();
	    $id2=0;
	    $datastore3=array();
	    $id3=0;
	    $datastore4=array();
	    $id4=0;
	    $datastore5=array();
	    $id5=0;
	    $datastore6=array();
	    $id6=0;
	    $datastore7=array();
	    $id7=0;
	    $datastore8=array();
	    $id8=0;
	    
		for($i=0;$i<=18;$i++)
		{
			if($i==0)
			{
				$oCuenta= new planIngreso();
				$oCuenta->sig_cuenta = $la_cuenta[$i]["cuenta"];
		  		$resp = $oCuenta->LeerSaldo();
				if($resp!=false)
				{		  						
					$datastore0[$id0]=$oCuenta->LeerSaldoInRes();	
			  		$id0++;
				}
				if(is_array($la_cuenta[$i]["detalles"]))
  				{
  					for($j=0;$j<count($la_cuenta[$i]["detalles"]);$j++)
  					{	
  						$oCuenta=new planIngreso();
  						$oCuenta->sig_cuenta=$la_cuenta[$i]["detalles"][$j];	
  						$resp = $oCuenta->LeerSaldo();
						if($resp!=false)
						{		  						
	  						$datastore0[$id0]=$oCuenta->LeerSaldo();
	  						$id0++;
						}
					}
  				}
			}
		
			if($i==1)
			{
				$oCuenta1 =  new planUnicoRe();
				$cuentasinceros=uf_spg_cuenta_sin_cero($la_cuenta[$i]["cuenta"]);
				
				$oCuenta1->sig_cuenta = $cuentasinceros;
				$oCuenta1->sig_cuentacomp = $la_cuenta[$i]["cuenta"];
				$rsGrupo = $oCuenta1->LeerGrupo();
				while($rec =$rsGrupo->FetchRow())
				{
					$oCuenta= new planIngreso();
					$oCuenta->sig_cuenta = $rec["sig_cuenta"];
					$oCuenta->nivelCuenta=$this->nivel;	
					$resp = $oCuenta->Verificar();
					if($resp!=false)
					{
						$resp = $oCuenta->LeerSaldo();
						if($resp!=false)
						{		  						
							$datastore1[$id1]=$oCuenta->LeerSaldo();	
					  		$id1++;
						}
					}
				}
			}
			
				
			if($i==2)
			{
				$oCuenta1 =  new planUnicoRe();
				$cuentasinceros=uf_spg_cuenta_sin_cero($la_cuenta[$i]["cuenta"]);
				$oCuenta1->sig_cuenta = $cuentasinceros;
				$oCuenta1->sig_cuentacomp = $la_cuenta[$i]["cuenta"];
				$rsGrupo = $oCuenta1->LeerGrupo();
				while($rec =$rsGrupo->FetchRow())
				{
					$oCuenta= new planIngreso();
					$oCuenta->sig_cuenta = $rec["sig_cuenta"];
					$oCuenta->nivelCuenta=$this->nivel;	
					$resp = $oCuenta->Verificar();
					if($resp!=false)
					{
						$resp = $oCuenta->LeerSaldo();
						if($resp!=false)
						{		  						
							$datastore2[$id2]=$oCuenta->LeerSaldo();	
					  		$id2++;
						}
					}
				}
			}
			
			
			if($i==3)
			{
				$oCuenta1 =  new planUnicoRe();
				$cuentasinceros=uf_spg_cuenta_sin_cero($la_cuenta[$i]["cuenta"]);
				$oCuenta1->sig_cuenta = $cuentasinceros;
				$oCuenta1->sig_cuentacomp = $la_cuenta[$i]["cuenta"];
				$rsGrupo = $oCuenta1->LeerGrupo();
				while($rec =$rsGrupo->FetchRow())
				{
					$oCuenta= new intGastosDao();
					$oCuenta->sig_cuenta = $rec["sig_cuenta"];
					$oCuenta->nivelCuenta=$this->nivel;	
					$resp = $oCuenta->Verificar();
					if($resp!=false)
					{
						$resp = $oCuenta->LeerSaldo();
						if($resp!=false)
						{		  						
							$datastore3[$id3]=$oCuenta->LeerSaldo();	
					  		$id3++;
						}
					}
				}
			}
  			
  				
  			if($i>3 && $i<=5)
  			{
				$oCuenta1 =  new planUnicoRe();
				$cuentasinceros=uf_spg_cuenta_sin_cero($la_cuenta[$i]["cuenta"]);
				$oCuenta1->sig_cuenta = $cuentasinceros;
				$oCuenta1->sig_cuentacomp = $la_cuenta[$i]["cuenta"];
				$rsGrupo = $oCuenta1->LeerGrupo();
				
				while($rec =$rsGrupo->FetchRow())
				{
					$oCuenta= new planIngreso();
					$oCuenta->sig_cuenta = $rec["sig_cuenta"];
					$oCuenta->nivelCuenta=$this->nivel;	
					$resp = $oCuenta->Verificar();
					if($resp!=false)
					{	
						$resp = $oCuenta->LeerSaldo();
						if($resp!=false)
						{		  			
							$datastore4[$id4]=$oCuenta->LeerSaldo();	
					  		$id4++;
						}
					}
				}	
  			}
  			
  			
			if($i>5 && $i<=9)
  			{					 	//echo $i;
				$oCuenta1 =  new planUnicoRe();
				$cuentasinceros=uf_spg_cuenta_sin_cero($la_cuenta[$i]["cuenta"]);
				$oCuenta1->sig_cuenta = $cuentasinceros;
				$oCuenta1->sig_cuentacomp = $la_cuenta[$i]["cuenta"];
				$rsGrupo = $oCuenta1->LeerGrupo();
				while($rec =$rsGrupo->FetchRow())
				{
					$oCuenta= new planIngreso();
					$oCuenta->sig_cuenta = $rec["sig_cuenta"];
					$oCuenta->nivelCuenta=$this->nivel;	
					$resp = $oCuenta->Verificar();
					if($resp!=false)
					{
						$resp = $oCuenta->LeerSaldo();
						if($resp!=false)
						{		  						
							$datastore5[$id5]=$oCuenta->LeerSaldo();	
					  		$id5++;
						}
					}
				}
  					
    		}
  			
  			if($i>=10 && $i<=13)
  			{
				$oCuenta1 =  new planUnicoRe();
				$cuentasinceros=uf_spg_cuenta_sin_cero($la_cuenta[$i]["cuenta"]);
				$oCuenta1->sig_cuenta = $cuentasinceros;
				$oCuenta1->sig_cuentacomp = $la_cuenta[$i]["cuenta"];
				$rsGrupo = $oCuenta1->LeerGrupo();
				while($rec =$rsGrupo->FetchRow())
				{
					$oCuenta= new intGastosDao();
					$oCuenta->sig_cuenta = $rec["sig_cuenta"];
					$oCuenta->nivelCuenta=$this->nivel;	
					$resp = $oCuenta->Verificar();
					if($resp!=false)
					{
						$resp = $oCuenta->LeerSaldo();
						if($resp!=false)
						{		  						
							$datastore6[$id6]=$oCuenta->LeerSaldo();	
					  		$id6++;
						}
					}
				}
  				 
  			}
  			
  			if($i>=14 && $i<=18)
  			{					 	//echo $i;
				$oCuenta1 =  new planUnicoRe();
				$cuentasinceros=uf_spg_cuenta_sin_cero($la_cuenta[$i]["cuenta"]);
				$oCuenta1->sig_cuenta = $cuentasinceros;
				$oCuenta1->sig_cuentacomp = $la_cuenta[$i]["cuenta"];
				$rsGrupo = $oCuenta1->LeerGrupo();
				while($rec =$rsGrupo->FetchRow())
				{
					$oCuenta= new intGastosDao();
					$oCuenta->sig_cuenta = $rec["sig_cuenta"];
					$oCuenta->nivelCuenta=$this->nivel;	
					$resp = $oCuenta->Verificar();
					if($resp!=false)
					{
						$resp = $oCuenta->LeerSaldo();
						if($resp!=false)
						{		  						
							$datastore7[$id7]=$oCuenta->LeerSaldo();	
					  		$id7++;
						}
					}
				}
  			}
   		}	 		

   	
   		$oCuenta=new intGastosDao();
		//$oCuenta->sig_cuenta="400000000";
		$datastore8[0]=$oCuenta->LeerSaldoEgEstRes();
		if($id0==0)
		{
			$datastore0[0] = $this->leerDatosPorDefecto();
		}
		if($id1==0)
		{
			$datastore1[0] = $this->leerDatosPorDefecto();
		}	
		if($id2==0)
		{
			$datastore2[0] = $this->leerDatosPorDefecto();
		}
		if($id3==0)
		{
			$datastore3[0] = $this->leerDatosPorDefecto();
		}
		if($id4==0)
		{
			$datastore4[0] = $this->leerDatosPorDefecto();
		}
		if($id5==0)
		{
			$datastore5[0] = $this->leerDatosPorDefecto();
		}
		if($id6==0)
		{
			$datastore6[0] = $this->leerDatosPorDefecto();
		}
		
		if($id7==0)
		{
			$datastore7[0] = $this->leerDatosPorDefecto();
		}
		
   		$arrDatos["datos0"]=$datastore0;
  		//$arrDatos["datos0"]=$datastore0;
		$arrDatos["datos1"]=$datastore1;
		$arrDatos["datos2"]=$datastore2;
		$arrDatos["datos3"]=$datastore3;
		$arrDatos["datos4"]=$datastore4;
		$arrDatos["datos5"]=$datastore5;
		$arrDatos["datos6"]=$datastore6;
		$arrDatos["datos7"]=$datastore7;
		$arrDatos["datos8"]=$datastore8;
		
  		return  $arrDatos;
		

}//fin uf_spg_reportes_estado2