Example usage for com.itextpdf.text Paragraph Paragraph

List of usage examples for com.itextpdf.text Paragraph Paragraph

Introduction

In this page you can find the example usage for com.itextpdf.text Paragraph Paragraph.

Prototype

public Paragraph(Phrase phrase) 

Source Link

Document

Constructs a Paragraph with a certain Phrase.

Usage

From source file:be.mxs.common.util.pdf.general.chuk.GeneralPDFCreator.java

protected void printKeyData(SessionContainerWO sessionContainerWO) {
    try {/*from   w w w  .jav  a  2 s. co m*/
        doc.add(new Paragraph(" "));
        table = new PdfPTable(15);
        table.setWidthPercentage(100);

        // kernel-data
        cell = new PdfPCell(new Paragraph(getTran("Web.Occup", "medwan.common.kernel-data").toUpperCase(),
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0),
                        Font.ITALIC)));
        cell.setColspan(15);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
        table.addCell(cell);

        // row 1 : last-periodical-examination
        Paragraph par = new Paragraph(
                getTran("Web.Occup", "medwan.common.last-periodical-examination").toUpperCase() + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        TransactionVO tran = sessionContainerWO.getLastTransaction(IConstants_PREFIX + "TRANSACTION_TYPE_MER");
        ItemVO item;
        if (tran != null) {
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_MER_EXAMINATION_DATE");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD)));
            }
        }
        cell = new PdfPCell(par);
        cell.setColspan(5);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 1 : next-periodical-examination
        par = new Paragraph(
                getTran("Web.Occup", "medwan.common.next-periodical-examination").toUpperCase() + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        if (sessionContainerWO.getFlags().getLastExaminationReport() != null && sessionContainerWO.getFlags()
                .getLastExaminationReport().getNewExaminationDueDate() != null) {
            par.add(new Chunk(
                    dateFormat.format(sessionContainerWO.getFlags().getLastExaminationReport()
                            .getNewExaminationDueDate()),
                    FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD)));
        }
        cell = new PdfPCell(par);
        cell.setColspan(5);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 1 : next-driver-examination / Volgend onderzoek medische schifting
        par = new Paragraph(getTran("Web.Occup", "medwan.common.next-driver-examination").toUpperCase() + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        if (sessionContainerWO.getFlags().getLastDrivingCertificate() != null) {

            // CBMT only : only display newExaminationDueDate if patient has riskcode "070" (drivinglicense)
            boolean riskCode070Found = false;

            if (riskCode070Found) {
                String newExamDueDateMinus = ScreenHelper.checkString(sessionContainerWO.getFlags()
                        .getLastDrivingCertificate().getNewExaminationDueDateMinus());
                if (newExamDueDateMinus.length() > 0) {
                    par.add(new Chunk(newExamDueDateMinus.replaceAll("-", "/"),
                            FontFactory.getFont(FontFactory.HELVETICA,
                                    Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD)));
                }
            }
        } else {
            // no data available
            par.add(new Chunk(getTran("Web.Occup", "medwan.common.no-data"), FontFactory.getFont(
                    FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD)));
        }

        cell = new PdfPCell(par);
        cell.setColspan(5);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 2 : Biometrie
        par = new Paragraph(getTran("Web.Occup", "medwan.common.biometry").toUpperCase() + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        tran = sessionContainerWO.getLastTransactionTypeBiometry();
        if (tran != null) {
            // height
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_BIOMETRY_HEIGHT");
            String sHeight = "", sWeight = "";
            if (item != null) {
                sHeight = item.getValue();
                par.add(new Chunk(getTran("Web.Occup", "medwan.common.length") + ": " + sHeight + " cm\n",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }

            // weight
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_BIOMETRY_WEIGHT");
            if (item != null) {
                sWeight = item.getValue();
                par.add(new Chunk(getTran("Web.Occup", "medwan.common.weight") + ": " + sWeight + " kg\n",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }

            // BMI
            if (sWeight.length() > 0 && sHeight.length() > 0) {
                try {
                    DecimalFormat deci = new DecimalFormat("0.0");
                    Float bmi = new Float(Float.parseFloat(sWeight.replaceAll(",", ".")) * 10000
                            / (Float.parseFloat(sHeight.replaceAll(",", "."))
                                    * Float.parseFloat(sHeight.replaceAll(",", "."))));
                    par.add(new Chunk("BMI: " + deci.format(bmi), FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }

        cell = new PdfPCell(par);
        cell.setColspan(3);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 2 : Urineonderzoek
        par = new Paragraph("URINE\n", FontFactory.getFont(FontFactory.HELVETICA,
                Math.round((double) 7 * fontSizePercentage / 100.0), Font.ITALIC));
        tran = sessionContainerWO.getLastTransactionTypeUrineExamination();
        if (tran != null) {
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_URINE_ALBUMINE");
            if (item != null) {
                par.add(new Chunk("Albumine: " + getTran("Web.Occup", item.getValue()) + "\n",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_URINE_GLUCOSE");
            if (item != null) {
                par.add(new Chunk("Glucose: " + getTran("Web.Occup", item.getValue()) + "\n",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_URINE_BLOOD");
            if (item != null) {
                par.add(new Chunk(
                        getTran("Web.Occup", "medwan.common.blood") + ": "
                                + getTran("Web.Occup", item.getValue()),
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
        }

        cell = new PdfPCell(par);
        cell.setColspan(3);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 2 : Audiometrie
        par = new Paragraph(getTran("Web.Occup", "medwan.common.audiometry").toUpperCase() + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        tran = sessionContainerWO.getLastTransactionTypeAudiometry();
        if (tran != null) {
            par.add(new Chunk(getTran("Web.Occup", "medwan.common.mean-hearing-loss").toUpperCase() + "\n",
                    FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 6 * fontSizePercentage / 100.0), Font.ITALIC)));
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_AUDIOMETRY_RIGHT_LOSS");
            if (item != null) {
                par.add(new Chunk(
                        getTran("Web.Occup", "medwan.common.right") + ": -" + item.getValue() + " dB\n",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_AUDIOMETRY_LEFT_LOSS");
            if (item != null) {
                par.add(new Chunk(
                        getTran("Web.Occup", "medwan.common.left") + ": -" + item.getValue() + " dB\n",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
        }
        cell = new PdfPCell(par);
        cell.setColspan(3);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 2 : Visus
        par = new Paragraph(
                getTran("Web.Occup", "medwan.common.vision").toUpperCase() + " - "
                        + getTran("Web.Occup",
                                IConstants_PREFIX + "item_type_opthalmology_screen_visiotest_vision_far")
                                        .toUpperCase()
                        + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        tran = sessionContainerWO.getLastTransactionTypeOphtalmology();
        if (tran != null) {
            par.add(new Chunk(getTran("Web.Occup", "medwan.common.right-left-binocular").toUpperCase() + "\n",
                    FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 6 * fontSizePercentage / 100.0), Font.ITALIC)));
            par.add(new Chunk(getTran("Web.Occup", "medwan.common.without-correction") + ": ",
                    FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));

            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_OD_WITHOUT_GLASSES");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA,
                    Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));

            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_OG_WITHOUT_GLASSES");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA,
                    Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));

            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_BONI_WITHOUT_GLASSES");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            par.add(new Chunk("\n" + getTran("Web.Occup", "medwan.common.with-correction") + ": ",
                    FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));

            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_OD_WITH_GLASSES");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA,
                    Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));

            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_OG_WITH_GLASSES");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA,
                    Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));

            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_BONI_WITH_GLASSES");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
        }
        cell = new PdfPCell(par);
        cell.setColspan(3);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 2 : Bloeddruk
        par = new Paragraph(getTran("Web.Occup", "medwan.common.blood-pressure").toUpperCase() + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        tran = sessionContainerWO.getLastTransactionTypeGeneralClinicalExamination();
        if (tran != null) {
            // right
            ItemVO item1 = tran.getItem(
                    IConstants_PREFIX + "ITEM_TYPE_CARDIAL_CLINICAL_EXAMINATION_SYSTOLIC_PRESSURE_RIGHT");
            item = tran.getItem(
                    IConstants_PREFIX + "ITEM_TYPE_CARDIAL_CLINICAL_EXAMINATION_DIASTOLIC_PRESSURE_RIGHT");
            if (item1 != null || item != null) {
                par.add(new Chunk(getTran("Web.Occup", "medwan.common.right") + ": ",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                if (item1 != null) {
                    par.add(new Chunk(item1.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                }
                par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));
                if (item != null) {
                    par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                }
                par.add(new Chunk(" mmHg\n", FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }

            // left
            item = tran.getItem(
                    IConstants_PREFIX + "ITEM_TYPE_CARDIAL_CLINICAL_EXAMINATION_SYSTOLIC_PRESSURE_LEFT");
            item1 = tran.getItem(
                    IConstants_PREFIX + "ITEM_TYPE_CARDIAL_CLINICAL_EXAMINATION_DIASTOLIC_PRESSURE_LEFT");
            if (item != null || item1 != null) {
                par.add(new Chunk(getTran("Web.Occup", "medwan.common.left") + ": ",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                if (item != null) {
                    par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                }
                par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));
                if (item1 != null) {
                    par.add(new Chunk(item1.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                }
                par.add(new Chunk(" mmHg\n", FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
        }

        cell = new PdfPCell(par);
        cell.setColspan(3);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        doc.add(table);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:be.mxs.common.util.pdf.general.chuk.GeneralPDFCreator.java

protected void printAdminHeader(AdminPerson activePerson) {
    try {//from w w  w.  ja  v  a 2  s .  c  o m
        doc.add(new Paragraph(" "));
        table = new PdfPTable(4);
        table.setWidthPercentage(100);

        // title
        cell = new PdfPCell(
                new Paragraph(getTran("Web.Occup", "medwan.common.administrative-data").toUpperCase(),
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 8 * fontSizePercentage / 100.0), Font.ITALIC)));
        cell.setColspan(4);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
        table.addCell(cell);

        // firstname
        cell = new PdfPCell(new Paragraph(activePerson.firstname + " " + activePerson.lastname,
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0),
                        Font.BOLD)));
        cell.setColspan(2);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);

        // dateOfBirth
        cell = new PdfPCell(new Paragraph("" + activePerson.dateOfBirth, FontFactory.getFont(
                FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD)));
        cell.setColspan(1);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);

        // gender
        cell = new PdfPCell(new Paragraph(activePerson.gender + "", FontFactory.getFont(FontFactory.HELVETICA,
                Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD)));
        cell.setColspan(1);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);

        // address
        AdminPrivateContact contact = activePerson.getActivePrivate();
        if (contact != null) {
            cell = new PdfPCell(new Paragraph(
                    contact.district + " - "
                            + ScreenHelper.getTran(null, "province", contact.province, sPrintLanguage),
                    FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 8 * fontSizePercentage / 100.0), Font.NORMAL)));
            cell.setColspan(4);
            cell.setBorder(PdfPCell.BOX);
            cell.setBorderColor(BaseColor.LIGHT_GRAY);
            cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
            table.addCell(cell);
        }

        doc.add(table);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java

protected void printHRContracts(SessionContainerWO sessionContainerWO, AdminPerson activePatient)
        throws Exception {
    table = new PdfPTable(24);
    table.setWidthPercentage(pageWidth);

    // title/*w w  w . j a  v  a 2  s. c  o m*/
    table.addCell(createTitleCell(getTran("web", "contracts"), 24));

    // compose object to pass search criteria with
    Contract findObject = new Contract();
    findObject.personId = Integer.parseInt(activePatient.personid); // required

    List contracts = Contract.getList(findObject);
    if (contracts.size() > 0) {
        // header
        table.addCell(createHeaderCell(getTran("web.hr", "id"), 2)); // contractId
        table.addCell(createHeaderCell(getTran("web.hr", "begindate"), 2));
        table.addCell(createHeaderCell(getTran("web.hr", "enddate"), 2));
        table.addCell(createHeaderCell(getTran("web.hr", "duration"), 5));
        table.addCell(createHeaderCell(getTran("web.hr", "function"), 2)); // functionCode
        table.addCell(createHeaderCell(getTran("web.hr", "functionTitle"), 4));
        table.addCell(createHeaderCell(getTran("web.hr", "functionDescription"), 7));

        Hashtable hSort = new Hashtable();
        Contract contract;

        // sort on contract.beginDate
        for (int i = 0; i < contracts.size(); i++) {
            contract = (Contract) contracts.get(i);
            hSort.put(contract.beginDate.getTime() + "=" + contract.getUid(), contract);
        }

        Vector keys = new Vector(hSort.keySet());
        Collections.sort(keys);
        Collections.reverse(keys);

        Iterator iter = keys.iterator();
        while (iter.hasNext()) {
            contract = (Contract) hSort.get(iter.next());

            // one record
            table.addCell(createValueCell(Integer.toString(contract.objectId), 2));
            table.addCell(createValueCell(ScreenHelper.getSQLDate(contract.beginDate), 2));
            table.addCell(createValueCell(ScreenHelper.getSQLDate(contract.endDate), 2));
            table.addCell(
                    createValueCell(calculatePeriod(contract.beginDate, contract.endDate, sPrintLanguage), 5));
            table.addCell(createValueCell(
                    getTran("hr.contract.functioncode", checkString(contract.functionCode)), 2));
            table.addCell(createValueCell(checkString(contract.functionTitle), 4));
            table.addCell(createValueCell(contract.functionDescription.replaceAll("\r\n", " "), 7));

            addContractDetails(table, contract); // legal reference codes
        }
    } else {
        // no records found
        table.addCell(createValueCell(getTran("web", "noRecordsFound"), 24));
    }

    // add transaction to doc
    if (table.size() > 0) {
        doc.add(new Paragraph(" "));
        doc.add(table);
    }
}

From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java

protected void printHRSkills(SessionContainerWO sessionContainerWO, AdminPerson activePatient)
        throws Exception {
    table = new PdfPTable(10);
    table.setWidthPercentage(pageWidth);

    // title//from  ww  w.  j ava  2  s .c o m
    table.addCell(createTitleCell(getTran("web", "skills"), 10));

    Skill skill = Skill.get(activePatient.personid);
    if (skill != null) {
        displayLanguageSkills(table, skill.languages);
        displayComputerSkills(table, skill);

        //*** varia skills ***
        table.addCell(createHeaderCell(getTran("web.hr", "varia"), 10));

        // drivingLicense
        table.addCell(createValueCell(getTran("web.hr", "drivingLicense"), 4));
        table.addCell(createValueCell(getTran("hr.skills.drivinglicense", skill.drivingLicense), 6));

        // communicationSkills
        table.addCell(createValueCell(getTran("web.hr", "communicationSkills"), 4));
        table.addCell(createValueCell(getTran("hr.skills.range2", skill.communicationSkills), 6));

        // stressResistance
        table.addCell(createValueCell(getTran("web.hr", "stressResistance"), 4));
        table.addCell(createValueCell(getTran("hr.skills.range2", skill.stressResistance), 6));

        // comment
        table.addCell(createValueCell(getTran("web.hr", "comment"), 4));
        table.addCell(createValueCell(skill.comment.replaceAll("\r\n", " "), 6));
    } else {
        // no records found
        table.addCell(createValueCell(getTran("web", "noRecordsFound"), 10));
    }

    // add transaction to doc
    if (table.size() > 0) {
        doc.add(new Paragraph(" "));
        doc.add(table);
    }
}

From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java

protected void printHRCareer(SessionContainerWO sessionContainerWO, AdminPerson activePatient)
        throws Exception {
    table = new PdfPTable(12);
    table.setWidthPercentage(pageWidth);

    // title/*from   w  w  w. ja v a2  s . co  m*/
    table.addCell(createTitleCell(getTran("web", "career"), 12));

    // compose object to pass search criteria with
    Career findObject = new Career();
    findObject.personId = Integer.parseInt(activePatient.personid); // required

    List careers = Career.getList(findObject);
    if (careers.size() > 0) {
        // header
        table.addCell(createHeaderCell(getTran("web.hr", "begin"), 1));
        table.addCell(createHeaderCell(getTran("web.hr", "end"), 1));
        table.addCell(createHeaderCell(getTran("web", "duration"), 2));
        table.addCell(createHeaderCell(getTran("web.hr", "position"), 2));
        table.addCell(createHeaderCell(getTran("web", "department"), 4));
        table.addCell(createHeaderCell(getTran("web.hr", "grade"), 1));
        table.addCell(createHeaderCell(getTran("web.hr", "status"), 1));

        Hashtable hSort = new Hashtable();
        Career career;

        // sort on career.begin
        for (int i = 0; i < careers.size(); i++) {
            career = (Career) careers.get(i);
            hSort.put(career.begin.getTime() + "=" + career.getUid(), career);
        }

        Vector keys = new Vector(hSort.keySet());
        Collections.sort(keys);
        Collections.reverse(keys);

        Iterator iter = keys.iterator();
        while (iter.hasNext()) {
            career = (Career) hSort.get(iter.next());

            // service
            String sServiceName = "";
            if (career.serviceUid.length() > 0) {
                sServiceName = "[" + career.serviceUid + "] " + getTran("service", career.serviceUid);
            }

            // one career
            table.addCell(createValueCell(ScreenHelper.getSQLDate(career.begin), 1));
            table.addCell(createValueCell(ScreenHelper.getSQLDate(career.end), 1));
            table.addCell(createValueCell(calculatePeriod(career.begin, career.end, sPrintLanguage), 2));
            table.addCell(createValueCell(career.position, 2));
            table.addCell(createValueCell(sServiceName, 4));
            table.addCell(createValueCell(getTran("hr.career.grade", career.grade), 1));
            table.addCell(createValueCell(getTran("hr.career.status", career.status), 1));

            addCareerDetails(table, career); // comment
        }
    } else {
        // no records found
        table.addCell(createValueCell(getTran("web", "noRecordsFound"), 12));
    }

    // add transaction to doc
    if (table.size() > 0) {
        doc.add(new Paragraph(" "));
        doc.add(table);
    }
}

From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java

protected void printHRDisciplinaryRecord(SessionContainerWO sessionContainerWO, AdminPerson activePatient)
        throws Exception {
    table = new PdfPTable(12);
    table.setWidthPercentage(pageWidth);

    // title// w  w w .  j av a 2 s  .co  m
    table.addCell(createTitleCell(getTran("web", "disciplinaryRecord"), 12));

    // compose object to pass search criteria with
    DisciplinaryRecord findObject = new DisciplinaryRecord();
    findObject.personId = Integer.parseInt(activePatient.personid); // required

    List disRecs = DisciplinaryRecord.getList(findObject);
    if (disRecs.size() > 0) {
        // header
        table.addCell(createHeaderCell(getTran("web.hr", "date"), 1));
        table.addCell(createHeaderCell(getTran("web.hr", "title"), 3));
        table.addCell(createHeaderCell(getTran("web.hr", "description"), 3));
        table.addCell(createHeaderCell(getTran("web.hr", "decision"), 1));
        table.addCell(createHeaderCell(getTran("web.hr", "decisionBy"), 2));
        table.addCell(createHeaderCell(getTran("web.hr", "duration"), 2));

        Hashtable hSort = new Hashtable();
        DisciplinaryRecord disRec;

        // sort on disRec.date
        for (int i = 0; i < disRecs.size(); i++) {
            disRec = (DisciplinaryRecord) disRecs.get(i);
            hSort.put(disRec.date.getTime() + "=" + disRec.getUid(), disRec);
        }

        Vector keys = new Vector(hSort.keySet());
        Collections.sort(keys);
        Collections.reverse(keys);

        Iterator iter = keys.iterator();
        while (iter.hasNext()) {
            disRec = (DisciplinaryRecord) hSort.get(iter.next());

            // one record 
            table.addCell(createValueCell(ScreenHelper.getSQLDate(disRec.date), 1));
            table.addCell(createValueCell(checkString(disRec.title), 3));
            table.addCell(createValueCell(disRec.description.replaceAll("\r\n", " "), 3));
            table.addCell(createValueCell(getTran("hr.disrec.decision", disRec.decision), 1));
            table.addCell(createValueCell(disRec.decisionBy, 2));
            table.addCell(createValueCell(disRec.duration + " " + getTran("web", "days"), 2));

            addDisciplinaryRecordDetails(table, disRec); // follow-up
        }
    } else {
        // no records found
        table.addCell(createValueCell(getTran("web", "noRecordsFound"), 12));
    }

    // add transaction to doc
    if (table.size() > 0) {
        doc.add(new Paragraph(" "));
        doc.add(table);
    }
}

From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java

protected void printHRLeaves(SessionContainerWO sessionContainerWO, AdminPerson activePatient)
        throws Exception {
    table = new PdfPTable(12);
    table.setWidthPercentage(pageWidth);

    // title/*from   w w w  . j a v a  2s  .com*/
    table.addCell(createTitleCell(getTran("web", "leaves"), 12));

    // compose object to pass search criteria with
    Leave findObject = new Leave();
    findObject.personId = Integer.parseInt(activePatient.personid); // required

    List leaves = Leave.getList(findObject);
    DecimalFormat deci = new DecimalFormat(MedwanQuery.getInstance().getConfigParam("priceFormat", "0.00"));

    if (leaves.size() > 0) {
        // header
        table.addCell(createHeaderCell(getTran("web.hr", "begin"), 1));
        table.addCell(createHeaderCell(getTran("web.hr", "end"), 1));
        table.addCell(createHeaderCell(getTran("web", "duration"), 2));
        table.addCell(createHeaderCell(getTran("web.hr", "type"), 2));
        table.addCell(createHeaderCell(getTran("web.hr", "episodeCode"), 2));
        table.addCell(createHeaderCell(getTran("web.hr", "requestDate"), 1));
        table.addCell(createHeaderCell(getTran("web.hr", "authorizationDate"), 1));
        table.addCell(createHeaderCell(getTran("web.hr", "authorizedBy"), 2));

        Hashtable hSort = new Hashtable();
        Leave leave;

        // sort on leave.begin
        for (int i = 0; i < leaves.size(); i++) {
            leave = (Leave) leaves.get(i);
            hSort.put(leave.begin.getTime() + "=" + leave.getUid(), leave);
        }

        Vector keys = new Vector(hSort.keySet());
        Collections.sort(keys);
        Collections.reverse(keys);

        Iterator iter = keys.iterator();
        while (iter.hasNext()) {
            leave = (Leave) hSort.get(iter.next());

            // one record
            table.addCell(createValueCell(ScreenHelper.getSQLDate(leave.begin), 1));
            table.addCell(createValueCell(ScreenHelper.getSQLDate(leave.end), 1));
            table.addCell(createValueCell(
                    deci.format(leave.duration).replaceAll(",", ".") + " " + getTran("web", "days"), 2));
            table.addCell(createValueCell(getTran("hr.leave.type", leave.type), 2));
            table.addCell(createValueCell(leave.episodeCode, 2));
            table.addCell(createValueCell(ScreenHelper.getSQLDate(leave.requestDate), 1));
            table.addCell(createValueCell(ScreenHelper.getSQLDate(leave.authorizationDate), 1));
            table.addCell(createValueCell(leave.authorizedBy, 2));

            addLeaveDetails(table, leave); // comment
        }
    } else {
        // no records found
        table.addCell(createValueCell(getTran("web", "noRecordsFound"), 12));
    }

    // add transaction to doc
    if (table.size() > 0) {
        doc.add(new Paragraph(" "));
        doc.add(table);
    }
}

From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java

protected void printHRSalary(SessionContainerWO sessionContainerWO, AdminPerson activePatient)
        throws Exception {
    table = new PdfPTable(30);
    table.setWidthPercentage(pageWidth);

    // title/* ww  w. j av a 2s  .  c  o  m*/
    table.addCell(createTitleCell(getTran("web", "salary"), 30));

    // compose object to pass search criteria with
    Salary findObject = new Salary();
    findObject.personId = Integer.parseInt(activePatient.personid); // required

    List salaries = Salary.getList(findObject);
    if (salaries.size() > 0) {
        DecimalFormat deci = new DecimalFormat(MedwanQuery.getInstance().getConfigParam("priceFormat", "0.00"));

        // header
        table.addCell(createHeaderCell(getTran("web.hr", "begin"), 3));
        table.addCell(createHeaderCell(getTran("web.hr", "end"), 3));
        table.addCell(createHeaderCell(getTran("web.hr", "contract"), 6));
        table.addCell(createHeaderCell(getTran("web.hr", "grossSalary"), 4));
        table.addCell(createHeaderCell(getTran("web.hr", "grossSalaryPeriod"), 6));
        table.addCell(createHeaderCell(getTran("web.hr", "comment"), 8));

        Hashtable hSort = new Hashtable();
        Salary salary;

        // sorted on salary.beginDate
        for (int i = 0; i < salaries.size(); i++) {
            salary = (Salary) salaries.get(i);
            hSort.put(salary.begin.getTime() + "=" + salary.getUid(), salary);
        }

        Vector keys = new Vector(hSort.keySet());
        Collections.sort(keys);
        Collections.reverse(keys);

        Iterator iter = keys.iterator();
        while (iter.hasNext()) {
            salary = (Salary) hSort.get(iter.next());

            // contractName == contractId (not uid)
            String sContractName = "";
            if (checkString(salary.contractUid).length() > 0) {
                sContractName = salary.contractUid.substring(salary.contractUid.indexOf(".") + 1);
            }

            // one record
            table.addCell(createValueCell(ScreenHelper.getSQLDate(salary.begin), 3));
            table.addCell(createValueCell(ScreenHelper.getSQLDate(salary.end), 3));
            table.addCell(createValueCell(sContractName, 6));

            cell = createValueCell(deci.format(salary.salary) + " "
                    + MedwanQuery.getInstance().getConfigParam("currency", ""), 4);
            cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
            table.addCell(cell);

            table.addCell(createValueCell(getTran("hr.salary.period", salary.salaryPeriod), 6));
            table.addCell(createValueCell(salary.comment.replaceAll("\r\n", " "), 8));

            addSalaryDetails(table, salary);
        }
    } else {
        // no records found
        table.addCell(createValueCell(getTran("web", "noRecordsFound"), 30));
    }

    // add transaction to doc
    if (table.size() > 0) {
        doc.add(new Paragraph(" "));
        doc.add(table);
    }
}

From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java

protected void printHRWorkSchedules(SessionContainerWO sessionContainerWO, AdminPerson activePatient)
        throws Exception {
    table = new PdfPTable(10);
    table.setWidthPercentage(pageWidth);

    // title//from   ww w  .j  a  v  a2  s . co  m
    table.addCell(createTitleCell(getTran("web", "workSchedule"), 10));

    // compose object to pass search criteria with
    Workschedule findObject = new Workschedule();
    findObject.personId = Integer.parseInt(activePatient.personid); // required

    List workschedules = Workschedule.getList(findObject);
    String sReturn = "";

    if (workschedules.size() > 0) {
        // header
        table.addCell(createHeaderCell(getTran("web.hr", "begin"), 1));
        table.addCell(createHeaderCell(getTran("web.hr", "end"), 1));
        table.addCell(createHeaderCell(getTran("web.hr", "fte.short"), 1));
        table.addCell(createHeaderCell(getTran("web.hr", "type"), 2));
        table.addCell(createHeaderCell(getTran("web.hr", "details"), 4));
        table.addCell(createHeaderCell(getTran("web.hr", "duration"), 1));

        Hashtable hSort = new Hashtable();
        Workschedule workschedule;

        // sort on workschedule.getUid
        for (int i = 0; i < workschedules.size(); i++) {
            workschedule = (Workschedule) workschedules.get(i);
            hSort.put(workschedule.getUid() + "=" + workschedule.getUid(), workschedule);
        }

        Vector keys = new Vector(hSort.keySet());
        Collections.sort(keys);
        Collections.reverse(keys);

        Iterator iter = keys.iterator();
        while (iter.hasNext()) {
            workschedule = (Workschedule) hSort.get(iter.next());

            // parse xml
            String sXML = checkString(workschedule.scheduleXml);
            String sScheduleType = "", sScheduleHours = "";

            if (sXML.length() > 0) {
                SAXReader reader = new SAXReader(false);
                org.dom4j.Document xmlDoc = reader.read(new StringReader(sXML));

                // fetch type and hours
                org.dom4j.Element workScheduleElem = xmlDoc.getRootElement();
                if (workScheduleElem != null) {
                    org.dom4j.Element scheduleElem = workScheduleElem.element("Schedule");
                    if (scheduleElem != null) {
                        sScheduleType = checkString(scheduleElem.attributeValue("type"));

                        if (sScheduleType.equalsIgnoreCase("day")) {
                            sScheduleHours = checkString(scheduleElem.elementText("HoursPerDay"));
                        } else if (sScheduleType.equalsIgnoreCase("week")) {
                            org.dom4j.Element weekSchedule = scheduleElem.element("WeekSchedule");
                            if (weekSchedule != null) {
                                sScheduleHours = checkString(weekSchedule.elementText("HoursPerWeek"));
                            }
                        } else if (sScheduleType.equalsIgnoreCase("month")) {
                            sScheduleHours = checkString(scheduleElem.elementText("HoursPerMonth")) + " "
                                    + getTran("web.hr", "hours").toLowerCase();
                        }
                    }
                }
                workschedule.type = sScheduleType;
            }

            // one record
            table.addCell(createValueCell(ScreenHelper.getSQLDate(workschedule.begin), 1));
            table.addCell(createValueCell(ScreenHelper.getSQLDate(workschedule.end), 1));
            table.addCell(createValueCell(workschedule.fte + "%", 1));
            table.addCell(createValueCell(getTran("web.hr", sScheduleType + "Schedule")
                    + (sScheduleType.equals("week") ? " (" + getPredefinedWeekScheduleName(workschedule) + ")"
                            : ""),
                    2));
            table.addCell(createValueCell(getWorkscheduleDetails(workschedule), 4));
            table.addCell(createValueCell(sScheduleHours, 1));

            //addWorkscheduleDetails(table,workschedule);
        }
    } else {
        // no records found
        table.addCell(createValueCell(getTran("web", "noRecordsFound"), 10));
    }

    // add transaction to doc
    if (table.size() > 0) {
        doc.add(new Paragraph(" "));
        doc.add(table);
    }
}

From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java

protected void printHRTraining(SessionContainerWO sessionContainerWO, AdminPerson activePatient)
        throws Exception {
    table = new PdfPTable(11);
    table.setWidthPercentage(pageWidth);

    // title/*from www. j a  v  a 2 s .co m*/
    table.addCell(createTitleCell(getTran("web", "training"), 11));

    // compose object to pass search criteria with
    Training findObject = new Training();
    findObject.personId = Integer.parseInt(activePatient.personid); // required

    List trainings = Training.getList(findObject);
    if (trainings.size() > 0) {
        // header
        table.addCell(createHeaderCell(getTran("web.hr", "begin"), 1));
        table.addCell(createHeaderCell(getTran("web.hr", "end"), 1));
        table.addCell(createHeaderCell(getTran("web.hr", "titleOrDiploma"), 4));
        table.addCell(createHeaderCell(getTran("web.hr", "level"), 1)); // traininglevel
        table.addCell(createHeaderCell(getTran("web.hr", "institute"), 3));
        table.addCell(createHeaderCell(getTran("web.hr", "date"), 1)); // diplomaDate

        Hashtable hSort = new Hashtable();
        Training training;

        // sort on training.begin
        for (int i = 0; i < trainings.size(); i++) {
            training = (Training) trainings.get(i);
            hSort.put(training.begin.getTime() + "=" + training.getUid(), training);
        }

        Vector keys = new Vector(hSort.keySet());
        Collections.sort(keys);
        Collections.reverse(keys);

        Iterator iter = keys.iterator();
        while (iter.hasNext()) {
            training = (Training) hSort.get(iter.next());

            // one record 
            table.addCell(createValueCell(ScreenHelper.getSQLDate(training.begin), 1));
            table.addCell(createValueCell(ScreenHelper.getSQLDate(training.end), 1));
            table.addCell(createValueCell(checkString(training.diploma), 4));
            table.addCell(createValueCell(getTran("hr.training.level", training.level), 1));
            table.addCell(createValueCell(checkString(training.institute), 3));
            table.addCell(createValueCell(ScreenHelper.stdDateFormat.format(training.diplomaDate), 1));
        }
    } else {
        // no records found
        table.addCell(createValueCell(getTran("web", "noRecordsFound"), 11));
    }

    // add transaction to doc
    if (table.size() > 0) {
        doc.add(new Paragraph(" "));
        doc.add(table);
    }
}