registration.setActive(false);
registration.setEndDate(gdDateEndDate);
registration.addStatus(registrationStatus);
registration.setEndRegistrationEmployee(system.getPeople().get(employeeId));
RegistrationStatus status = getRegistrationStatus(system);
if(!noChangeParcels){
List<Parcel> parcels = registration.getParcels();
GDDate dateLastParcel = new GDDate();
int i = 0;
while (parcels.get(i).isPayed()) {
i++;
}
Parcel lastParcel = parcels.get(i);
dateLastParcel.setDayOfMonth((int) new GDDate(lastParcel.getDate()).getDayOfMonth());
dateLastParcel.setMonthOfYear((int) new GDDate().getMonth());
// Foi adicionado pois verifica se o usuario clicou em SIM ou NAO para remover parcelas existentes
if (option){
registration.setParcels(removeParcelsWhenRegistrationIsEnded(gdDateEndDate.getCalendar(), registration.getParcels(), system));
//if (registration.getParcels().size()>0){
dateLastParcel = new GDDate(registration.getParcel(registration.getParcels().size()-1).getDate());
dateLastParcel.addMonth(1);
// }
}
if(status.getCategory().equals("Desistiu")) {
// GDDate date;
// if (registration.getParcels().size()==0){
// date = new GDDate();
// }else{
// date = new GDDate(registration.getParcels().get(i).getDate());