// 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));
page.addElement(drawVerticalLine(posX+110, posY, 15));
page.addElement(insertNormalText(financialInfo.getDescription(), posX+112, posY, 271, 15));
page.addElement(drawVerticalLine(posX+385, posY, 15));
page.addElement(insertRightText(financialInfo.isCredit() ? financialInfo.getValue().getFormatedValue() : "", posX+387, posY, 67));
page.addElement(drawVerticalLine(posX+460, posY, 15));
page.addElement(insertRightText(financialInfo.isCredit() ? "" : financialInfo.getValue().getFormatedValue(), posX+462, posY, 67));
posY += 15;
cont++;
if(financialInfo.isCredit())
totalCredit.credit(financialInfo.getValue());
else
totalDebit.credit(financialInfo.getValue());
}
}
page.addElement(drawRectangle(posX, posY, convert(190), 15, 0));
page.addElement(insertBoldText("TOTAL", posX+2, posY, 381));
page.addElement(drawVerticalLine(posX+385, posY, 15));
page.addElement(insertRightText(totalCredit.getFormatedValue(), posX+387, posY, 67));
page.addElement(drawVerticalLine(posX+460, posY, 15));
page.addElement(insertRightText(totalDebit.getFormatedValue(), posX+462, posY, 67));
posY += 20;
Money total = new Money(totalCredit);
total.debit(totalDebit);
page.addElement(insertBoldText("Total L�quido: R$ " + total.getFormatedValue() , posX+370, posY, convert(190)-370));
posY += 35;
page.addElement(insertNormalText("Recebi a importancia de R$ " + total.getFormatedValue() + " dando plena, geral e irrevog�vel quita��o referente aos itens acima descritos:", posX, posY, convert(190), 30));
posY += 35;
page.addElement(drawHorizontalDottedLine(0, posY, convert(210)));
page.addElement(drawGrayRectangle(posX+200, posY+10, 135, 20, 3));
page.addElement(insertCenterBoldText("R E C I B O", posX+200, posY+15, 135));
posY += 50;
page.addElement(insertBoldText("Per�odo de �", posX+262, posY, convert(190)-262));
posY += 15;
page.addElement(drawRectangle(posX, posY, 535, 100, 5));
page.addElement(insertNormalText("Referente �:", posX+5, posY+5, 530, 15));
posY += 200;
page.addElement(insertNormalText("Data: _____/_____/_________.", posX, posY-15, 200, 15));
page.addElement(drawHorizontalLine(posX+convert(95), posY, convert(95)));
page.addElement(insertCenterBoldText(person.getName(), posX+convert(95), posY, +convert(95)));
page.addElement(insertFooter());
jasperPrint.addPage(page);
}