try {
List<Person> employeeList = new ArrayList<Person>();
if(idEmployee == null){
Map<String, Person> employeesMap = (Map<String, Person>) system.query(new GetEmployee());
for (Person person : employeesMap.values()) {
Employee employee = (Employee) person.getPersonType("employee");
// if (date.get(Calendar.DAY_OF_MONTH) == Integer.parseInt(employee.getPaymentDay()) && employee.isActivated()) {
if (employee.isActivated()) {
employeeList.add(person);
}
}
} else
// if(date == null){
// Person person = (Person) system.query(new GetEmployee(idEmployee));
// employeeList.add(person);
// } else
{
Person person = (Person) system.query(new GetEmployee(idEmployee));
Employee employee = (Employee) person.getPersonType("employee");
if (employee.isActivated()) {
// if (date.get(Calendar.DAY_OF_MONTH) == Integer.parseInt(employee.getPaymentDay()) && employee.isActivated()) {
employeeList.add(person);
}
}
for(Person person : employeeList){
Employee employee = (Employee) person.getPersonType("employee");
int posX = convert(10);
int posY = convert(7);
JRPrintPage page = new JRBasePrintPage();
page.addElement(printImage("titleReport.gif", posX, posY, 535, 45));
// page.addElement(printImage("logoReport.gif", posX+11, posY, 65, 45));
page.addElement(insertTitle("HOLERITE", posX+200, posY+11, 250));
page.addElement(printImage("corporateLogo.jpg", posX+456, posY, 77, 45));
posY += 50;
page.addElement(drawGrayRectangle(posX, posY, 535, 20, 3));
page.addElement(insertBoldText("Nome: ", posX+5, posY+3, 40));
page.addElement(insertNormalText(person.getName(), posX+45, posY+3, convert(190)-40, 15));
posY += 25;
page.addElement(insertBoldText("CPF: ", posX+2, posY, 30));
page.addElement(insertNormalText(person.getCpf(), posX+30, posY, 100, 15));
page.addElement(insertBoldText("RG: ", posX+132, posY, 30));
page.addElement(insertNormalText(person.getRg(), posX+160, posY, 100, 15));
page.addElement(insertBoldText("Per�odo de �", posX+262, posY, convert(190)-262));
page.addElement(drawHorizontalLine(posX, posY+15, convert(190)));
posY += 15;
createFinantialTableHeader(posX, posY, page);
posY += 15;
int cont = 1;
Money totalCredit = new Money(0);
Money totalDebit = new Money(0);
for(FinancialInfo financialInfo : employee.getFinantialInfo()){
if(isDateIntoFinancialInfo(financialInfo, date)) {
page.addElement(drawRectangle(posX, posY, convert(190), 15, 0));
page.addElement(insertRightText(String.valueOf(cont), posX+2, posY, 36));
page.addElement(drawVerticalLine(posX+40, posY, 15));
page.addElement(insertRightText(String.valueOf(financialInfo.getDate().getMonth()), posX+42, posY, 66));