I want to do that search within all cartola__c and all Pendiente_de_Recaudar__c registration if you find the codes are the same values that pass the contrary object,
but there are so many records that I get a CPU error "apex cpu time limit exceeded "apparently gives me the error that is where I have the for and finally a nested IF