if (idRegistration != null) {
registration = (Registration) system.query(new GetRegistration(idRegistration));
Person person = registration.getStudent();
Student student = (Student) person.getPersonType("student");
contractName = "Contrato de " + person.getName();
nameStudent = registration.getStudent().getName();
genderStudent = registration.getStudent().getGender();
birthDateStudent = registration.getStudent().getBirthDate();
civilStateStudent = registration.getStudent().getCivilState();
rgStudent = registration.getStudent().getRg();
cpfStudent = registration.getStudent().getCpf();
adressStudent = registration.getStudent().getStreet();
numberadressStudent = registration.getStudent().getStreetNumber();
complementadressStudent = registration.getStudent().getStreetComplement();
eighborhoodStudent = registration.getStudent().getNeighborhood();
cepStudent = registration.getStudent().getCep();
cityStudent = registration.getStudent().getCity();
stateStudent = registration.getStudent().getState();
phoneStudent = registration.getStudent().getPhone();
cellPhoneStudent = registration.getStudent().getCellPhone();
emailStudent = registration.getStudent().getEmail();
courses = new StringBuffer();
for (RegistrationItem registrationItem : registration.getRegistrationItems()) {
if (registrationItem.getCourse().getCoursesInThisPackage().size() > 0) {
for (Course course : registrationItem.getCourse().getCoursesInThisPackage()) {
courses.append(course.getDescription());
courses.append(", ");
}
} else {
courses.append(registrationItem.getCourse().getDescription());
courses.append(", ");
}
}
courses.delete(courses.length() > 2 ? courses.length() - 2 : courses.length(), courses.length());
registrationDuration = String.valueOf(registration.getDuration());
registrationInitDate = registration.getInitDate() != null ? registration.getInitDate().getFormatedDate() : "N�o cadastrada";
registrationValue = new Money(registration.getRegistrationValue()).getFormatedValue();
float registrationTaxValue = 0;
float totalParcelsValueWithDiscount = 0;
Parcel firstParcelRegistration = null;
firstParcelRegistration = ( registration.getParcel(0).isRegistrationTax() ? registration.getParcel(1) : registration.getParcel(0) );
int numberParcels= 0;
for (Parcel parcel : registration.getParcels()) {
if (parcel.isRegistrationTax()) {
registrationTaxValue = parcel.getValueAfterParcelDateExpiration();
} else {
totalParcelsValueWithDiscount += parcel.getValueBeforeParcelDateExpiration();
numberParcels++;
}
}
numberOfParcels = String.valueOf(numberParcels);
registrationTax = new Money(registrationTaxValue).getFormatedValue();
registrationValueWithTotalDiscount = new Money(totalParcelsValueWithDiscount).getFormatedValue();
registrationPontualityDiscount = registration.getPontualityDiscount().getFormatedValue();
registrationDateOfTheFirstParcel = firstParcelRegistration.getDate();
registrationParcelsValueBeforeDate = new Money(firstParcelRegistration.getValueBeforeParcelDateExpiration()).getFormatedValue();
registrationParcelsValueAfterDate = new Money(firstParcelRegistration.getValueAfterParcelDateExpiration()).getFormatedValue();
registrationDateOfTheNextParcels = String.valueOf(firstParcelRegistration.getDate().substring(0, 2));
attendancaEmployeeName = registration.getEmployee().getName();
attendancedate = registration.getRegistrationDate();
attendanceHowDoYouKnow = student.getHowDoYouKnowVisualMidia();
if (checkStudentUnderAge(birthDateStudent)) {
nameResponsable = student.getResponsableName();
rgResponsable = student.getResponsableRG();
cpfResponsable = student.getResponsableCPF();
kinshipResponsable = student.getResponsableRelation();
phoneResponsable = student.getResponsablePhone();
// responsableString = ", neste ato representado por " +
// nameResponsable + ", R.G. " + rgResponsable + ", CPF " +
// cpfResponsable;
} else {
nameResponsable = nameStudent;