reportOptions.leftMargin = ClipsConfig.getInstance().getSicklistLeftMarign();
reportOptions.fixRightMarign(SICK_LIST_SUBREPORT_PAGE_WIGHT);
reportOptions.topMargin = ClipsConfig.getInstance().getSicklistTopMarign();
reportOptions.bottomMargin = 0;
combined.setUpReport(null, reportOptions, null);
FormReportCreator creator = combined.createFormReporter(getClass(), 3);
GregorianCalendar dateFrom = getDateOpen();
ClientLocal client = getClient();
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("client", client.toString());
data.put("client_is_male", client.getSex().isMale());
if (client.getBorn() != null){
data.put("client_age", DateTimeUtils.calcAge(client.getBorn(), dateFrom.getTime()));
}
else{
data.put("client_age", null);
}
data.put("emc_code", client.getNumberEmc());
if (getProlongationCount() > 0){
Address adr = getSerRen(0).getPolisData().getAddress();
if (adr == null){
adr = client.getAddress();
}
data.put("client_address", adr == null? null: adr.toStringShort());
}
if (getOpener() == null){
data.put("collaborator", getAltOpener());
}
else{
ClientLocal clolClient = new ClientLocal(getOpener().getDetails().getClient(), null);
data.put("collaborator", clolClient.getSurname().getTitle());
}
DirectoryEnterpriseItem ent = getEnterprise();
data.put("clientJob", ent == null ? getOtherDirection() : ent.getTitle());
data.put("prev_sick_list_id", getPreviousSicklist() == null? null: getPreviousSicklist().getSerial());
data.put("day_month_open", dateFrom.get(GregorianCalendar.DAY_OF_MONTH) + " " + DateTimeUtils.monthToString(dateFrom.get(GregorianCalendar.MONTH)));
String yearOp = "" + dateFrom.get(GregorianCalendar.YEAR);
data.put("year_open", yearOp.substring(yearOp.length() - 2));
data.put("date_open", dateFrom.getTime());
data.put("dis_type", getDisability().getID());
data.put("date_close", getDateToWork() == null? null: getDateToWork().getTime());
if (getProlongationCount() > 0){
GregorianCalendar dateTill = getTill(0);
data.put("date_till_1", dateTill == null? null: dateTill.getTime());
}
else{
data.put("date_till_1", null);
}
if (getProlongationCount() > 1){
GregorianCalendar dateTill = getTill(1);
data.put("date_till_2", dateTill == null? null: dateTill.getTime());
}
else{
data.put("date_till_2", null);
}
if (getProlongationCount() > 2){
GregorianCalendar dateTill = getTill(2);
data.put("date_till_3", dateTill == null? null: dateTill.getTime());
}
else{
data.put("date_till_3", null);
}
if (getProlongationCount() > 3){
GregorianCalendar dateTill = getTill(3);
data.put("date_till_4", dateTill == null? null: dateTill.getTime());
}
else{
data.put("date_till_4", null);
}
creator.createReport(null, null, data.entrySet(), null);
creator.finish();
combined.finish();
}