Example usage for com.lowagie.text Element ALIGN_LEFT

List of usage examples for com.lowagie.text Element ALIGN_LEFT

Introduction

In this page you can find the example usage for com.lowagie.text Element ALIGN_LEFT.

Prototype

int ALIGN_LEFT

To view the source code for com.lowagie.text Element ALIGN_LEFT.

Click Source Link

Document

A possible value for paragraph alignment.

Usage

From source file:s2s.luna.reports.Report_REP_ANA_UNI_SIC.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception { //----------------------------------------------------------------------
    SecurityWrapper Security = SecurityWrapper.getInstance();

    IUnitaSicurezzaHome home_uni = (IUnitaSicurezzaHome) PseudoContext.lookup("UnitaSicurezzaBean");
    IUnitaSicurezza bean_uni = home_uni.findByPrimaryKey(new Long(lCOD_UNI_SIC));
    lCOD_AZL = bean_uni.getCOD_AZL();/*from   www  .  j a  va 2  s.  co  m*/

    IAziendaHome home = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda bean_az = home.findByPrimaryKey(new Long(lCOD_AZL));

    initDocument("the doc", null,
            ApplicationConfigurator.LanguageManager.getString("Organigramma.della.sicurezza"),
            bean_az.getRAG_SCL_AZL(), null);

    if (IncludeLogo) {
        AddImage();
    }

    writeTitle("\n" + ApplicationConfigurator.LanguageManager.getString("Organigramma.della.sicurezza"));// bean_uni.getNOM_UNI_ORG()

    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        if (bStandAlone) {
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Azienda/Ente"));
            tbl.addCell(bean_az.getRAG_SCL_AZL());//
        }
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Responsabile.azienda"));
        tbl.addCell(bean_az.getNOM_RSP_AZL());

        m_document.add(tbl);
    }
    {

        CenterMiddleTable tbl = null;
        if (ApplicationConfigurator.isModuleEnabled(MODULES.UNI_SIC_4_DIP)) {
            tbl = new CenterMiddleTable(3);

            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Nome.unit.sic."));
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Lavoratori"));
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Ruoli.sicurezza"));
            tbl.endHeaders();
            tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
            tbl.addCell(bean_uni.getNOM_UNI_SIC());
            USResponsabileView dpd_ruo_sic = getResponsabileSicurezza(bean_uni);
            tbl.addCell(dpd_ruo_sic.strNOM_RESP_SIC);
            tbl.addCell(dpd_ruo_sic.strNOM_RUO_SIC);
            drawChildrenSicurezza(tbl, home_uni, bean_uni, 1);
        } else {
            tbl = new CenterMiddleTable(2);

            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Nome.unit.sic."));
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Responsabili"));
            tbl.endHeaders();
            tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
            tbl.addCell(bean_uni.getNOM_UNI_SIC());
            tbl.addCell(getResponsabile(bean_uni));
            drawChildren(tbl, home_uni, bean_uni, 1);
        }
        m_document.add(tbl);
    }
    closeDocument();
}

From source file:s2s.luna.reports.Report_REP_LUO_FSC.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception { //----------------------------------------------------------------------
    SecurityWrapper Security = SecurityWrapper.getInstance();

    IAnagrLuoghiFisiciHome home_lf = (IAnagrLuoghiFisiciHome) PseudoContext.lookup("AnagrLuoghiFisiciBean");
    IAnagrLuoghiFisici bean_lf = home_lf.findByPrimaryKey(new Long(lCOD_LUO_FSC));
    IRischioHome home_ris = (IRischioHome) PseudoContext.lookup("RischioBean");
    lCOD_AZL = bean_lf.getCOD_AZL();/*from w  w  w .ja  v a 2  s  . c  om*/
    IAziendaHome home = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda bean_az = home.findByPrimaryKey(new Long(lCOD_AZL));
    boolean luoghiFisici3Livelli = ApplicationConfigurator.isModuleEnabled(MODULES.LUOGHI_FISICI_3_LIVELLI);

    initDocument("the doc", null, ApplicationConfigurator.LanguageManager.getString("SCHEDA.LUOGO.FISICO"),
            bean_az.getRAG_SCL_AZL(), bean_lf.getNOM_LUO_FSC());
    if (IncludeLogo) {
        AddImage();
    }

    writeIndent();
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        if (bStandAlone) {
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Azienda/Ente"));
            tbl.addCell(bean_az.getRAG_SCL_AZL());
        }
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("SCHEDA.LUOGO.FISICO"));
        tbl.addTitleCell(bean_lf.getNOM_LUO_FSC());
        m_document.add(tbl);
        writeLine();
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.toLeft();
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Descrizione.luogo.fisico"));
        tbl.addCell(bean_lf.getDES_LUO_FSC());

        m_document.add(tbl);
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Responsabile.del.luogo.fisico"),
                2);
        tbl.setDefaultColspan(1);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Nome/Cognome/Qualifica"));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("E-mail"));
        tbl.endHeaders();
        tbl.addCell(bean_lf.getNOM_RSP_LUO_FSC() + "/" + bean_lf.getQLF_RSP_LUO_FSC());
        tbl.addCell(bean_lf.getIDZ_PSA_ELT_RSP_LUO_FSC());
        m_document.add(tbl);
    }
    {
        int colNums = luoghiFisici3Livelli ? 2 : 1;
        CenterMiddleTable tbl = new CenterMiddleTable(colNums);
        tbl.toLeft();
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Sito.aziendale"));
        if (luoghiFisici3Livelli) {
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Immobile"));
        }
        tbl.endHeaders();
        ISitaAziendeHome home_sit_azl = (ISitaAziendeHome) PseudoContext.lookup("SitaAziendeBean");
        ISitaAziende bean_sit_azl = null;
        if (luoghiFisici3Livelli) {
            IImmobili3lvHome imm3lvHome = (IImmobili3lvHome) PseudoContext.lookup("Immobili3lvBean");
            IImmobili3lv imm3lvBean = imm3lvHome.findByPrimaryKey(bean_lf.getCOD_IMM_3LV());
            bean_sit_azl = home_sit_azl.findByPrimaryKey(imm3lvBean.getCOD_SIT_AZL());
            tbl.addCell(bean_sit_azl.getNOM_SIT_AZL());
            tbl.addCell(imm3lvBean.getNOM_IMM());
        } else {
            if (bean_lf.getCOD_SIT_AZL() != 0) {
                bean_sit_azl = home_sit_azl.findByPrimaryKey(bean_lf.getCOD_SIT_AZL());
                tbl.addCell(bean_sit_azl.getNOM_SIT_AZL());
            }
        }
        m_document.add(tbl);
    }

    Iterator it = bean_lf.getReportAnagrLuoghiFisici_Rischi_View().iterator();
    {
        CenterMiddleTable t = new CenterMiddleTable(1);
        t.toLeft();
        t.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Lista.dei.rischi.associati"));
        m_document.add(t);
    }
    while (it.hasNext()) {
        ReportAnagrLuoghiFisici_Rischi_View w = (ReportAnagrLuoghiFisici_Rischi_View) it.next();
        {
            CenterMiddleTable t = new CenterMiddleTable(2);
            t.toLeft();
            //t.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Lista.dei.rischi.associati"), 2);
            //t.setDefaultColspan(1);
            t.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Rischio"));
            t.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Descrizione"));
            t.endHeaders();

            t.addCell(w.strNOM_RSO);
            t.addCell(w.strDES_RSO);
            m_document.add(t);
        }
        if (ApplicationConfigurator.isModuleEnabled(MODULES.LUO_FSC_MIS_PET) == true) {

            {// TABELLA DEL RISCHIO - INIZIO
                CenterMiddleTable tbl = null;
                short sMOD_CLC_RSO = Security.getAziendaModalitaCalcoloRischio();

                if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_BASE) {
                    tbl = new CenterMiddleTable(3);
                    tbl.setWidth(50);
                } else if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
                    tbl = new CenterMiddleTable(5);
                    tbl.setWidth(100);
                }
                tbl.setAlignment(Element.ALIGN_LEFT);
                {
                    tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager.getString("Probabilit"));
                    tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager.getString("Danno"));
                    if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager.getString("Frequenza"));
                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager.getString("Numero"));
                    }
                    tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager.getString("Rischio"));
                    tbl.endHeaders();
                    tbl.addCell(w.lPRB_EVE_LES + "");
                    tbl.addCell(w.lENT_DAN + "");
                    if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
                        tbl.addCell(w.lFRQ_RIP_ATT_DAN + "");
                        tbl.addCell(w.lNUM_INC_INF + "");
                    }
                    tbl.addCell(w.lSTM_NUM_RSO + "");
                }
                m_document.add(tbl);
            }
            {// MISURE DI PREVENZIONE E PROTEZIONE - INIZIO
             // bug 2015.02.20 MSR

                Iterator it4 = home_ris.getMisurePpView(w.lCOD_RSO, lCOD_AZL, lCOD_LUO_FSC).iterator();
                // bug 2015.02.20 MSR
                if (it4.hasNext()) {
                    writeLine();
                    writeParagraph3_2(ApplicationConfigurator.LanguageManager
                            .getString("Elenco.misure.prevenzione.e.protezione.associate.al.rischio"));

                    CenterMiddleTable tbl = null;

                    if (this.allModuleByProfile.booleanValue()) {
                        tbl = new CenterMiddleTable(2);
                        tbl.setDeafaultOffset();
                        int width[] = { 30, 70 };
                        tbl.setWidths(width);
                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager.getString("Nome.misura"));
                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager.getString("Descrizione"));
                        tbl.endHeaders();
                        tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
                        while (it4.hasNext()) {
                            RischioMisurePp_Nome_Descrizione_View w1 = (RischioMisurePp_Nome_Descrizione_View) it4
                                    .next();
                            tbl.addCell(w1.strNOM_MIS_PET);
                            tbl.addCell(w1.strDES_MIS_PET);
                        }
                    }

                    if (!this.allModuleByProfile.booleanValue()) {
                        tbl = new CenterMiddleTable(1);
                        tbl.setDeafaultOffset();
                        int width[] = { 70 };
                        tbl.setWidths(width);
                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager.getString("Descrizione"));
                        tbl.endHeaders();
                        tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
                        while (it4.hasNext()) {
                            RischioMisurePp_Nome_Descrizione_View w1 = (RischioMisurePp_Nome_Descrizione_View) it4
                                    .next();
                            tbl.addCell(w1.strDES_MIS_PET);
                        }
                    }
                    m_document.add(tbl);
                }
            } // MISURE DI PREVENZIONE E PROTEZIONE - FINE
        }
    }
    closeDocument();
}

From source file:s2s.luna.reports.Report_REP_MAN.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception {
    SecurityWrapper Security = SecurityWrapper.getInstance();
    IAttivitaLavorativeHome home_man = (IAttivitaLavorativeHome) PseudoContext.lookup("AttivitaLavorativeBean");
    IAttivitaLavorative bean_man = home_man.findByPrimaryKey(new AttivitaLavorativePK(lCOD_AZL, lCOD_MAN));
    lCOD_AZL = bean_man.getCOD_AZL();/*from   ww  w.j a v  a 2  s  .c o m*/
    IAziendaHome home = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda bean_az = home.findByPrimaryKey(new Long(lCOD_AZL));
    IOperazioneSvoltaHome home_opesvo = (IOperazioneSvoltaHome) PseudoContext.lookup("OperazioneSvoltaBean");

    initDocument("the doc", null,
            ApplicationConfigurator.LanguageManager.getString("SCHEDA.ATTIVITA'.LAVORATIVA"),
            bean_az.getRAG_SCL_AZL(), bean_man.getNOM_MAN());

    if (IncludeLogo) {
        AddImage();
    }

    writeIndent();
    {
        // AZIENDA / ENTE
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        if (bStandAlone) {
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Azienda/Ente"));
            tbl.addCell(bean_az.getRAG_SCL_AZL());
        }

        // SCHEDA ATTIVITA' LAVORATIVA
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("SCHEDA.ATTIVITA'.LAVORATIVA"));
        tbl.addTitleCell(bean_man.getNOM_MAN());
        m_document.add(tbl);
    }
    writeLine();

    // REPARTO
    if (ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_GSE) == false) {
        {
            MiddleTable tbl = new MiddleTable(1);

            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Reparto"));
            String strTemp = ApplicationConfigurator.LanguageManager.getString("Descrizione") + "\n"
                    + ApplicationConfigurator.LanguageManager.getString("Responsabilit.e.competenze") + "\n";
            //ApplicationConfigurator.LanguageManager.getString("Indice.rischio.chimico") + "\n";

            if (bLuoghiLavoro) {
                strTemp = strTemp + ApplicationConfigurator.LanguageManager.getString("Luoghi.di.lavoro")
                        + "\n";
            }
            if (bAttivitaSvolte) {
                strTemp = strTemp + ApplicationConfigurator.LanguageManager.getString("Operazioni.svolte")
                        + "\n";
                if (bRischi) {
                    strTemp = strTemp + ApplicationConfigurator.LanguageManager.getString("Rischi") + "\n";
                }
            }
            if (bAgentiChimici) {
                strTemp = strTemp
                        + ApplicationConfigurator.LanguageManager.getString("Valutazione.rischio.chimico")
                        + "\n";
            }
            if (bInformazioneFormazione) {
                strTemp = strTemp
                        + ApplicationConfigurator.LanguageManager.getString("Informazione.e.formazione") + "\n";
            }
            if (bDPI) {
                strTemp = strTemp + ApplicationConfigurator.LanguageManager.getString("D.P.I.") + "\n";
            }
            if (bSorveglianzaSanitaria) {
                strTemp = strTemp + ApplicationConfigurator.LanguageManager.getString("Sorveglianza.sanitaria")
                        + "\n";
            }
            if (bMacchineAttrezatureMansioni) {
                strTemp = strTemp + ApplicationConfigurator.LanguageManager
                        .getString(ApplicationConfigurator.isModuleEnabled(MODULES.MOD_FORM_GSE)
                                ? "Macchine.attrezzature.impianti.associate.mansioni"
                                : "Macchine/Attrezzature.associate.mansioni")
                        + "\n";
            }
            if (bDocumentazione) {
                strTemp = strTemp + ApplicationConfigurator.LanguageManager.getString("Documentazione") + "\n";
            }

            tbl.addCell(strTemp);
            m_document.add(tbl);
        }
        writePage();
    }

    {
        // DESCRIZIONE
        writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Descrizione"));
        writeParagraph2(bean_man.getDES_MAN());
        writeLine();
    }
    if (ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_GSE) == false) {
        {
            // RESPONSABILITA' E COMPETENZE
            writeParagraph1(ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_SDP)
                    ? ApplicationConfigurator.LanguageManager.getString("Gruppi.omogenei.di.rferimento")
                    : ApplicationConfigurator.LanguageManager
                            .getString("Descrizione.responsabilit.e.competenze"));
            writeParagraph2(bean_man.getDES_RSP_COM());
            writeLine();
        }
    }
    /*
     {
     // INDICE RISCHIO CHIMICO
     writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Indice.rischio.chimico"));
     double IDX_RSO_CHI = bean_man.getIDX_RSO_CHI();
     String livelloRischio = "";
     switch((int)bean_man.getRSO_VAL()){
     case 1: livelloRischio = ApplicationConfigurator.LanguageManager.getString("Moderato"); break;
     case 2: livelloRischio = ApplicationConfigurator.LanguageManager.getString("Non.moderato"); break;
     }
     writeParagraph2(
     IDX_RSO_CHI +
     " ("+bean_man.getDescRischio(IDX_RSO_CHI)+")" +
     (!livelloRischio.equals("")?" - "+livelloRischio:""));
     }
     */

    // LUOGHI DI LAVORO
    if (bLuoghiLavoro) {
        IAnagrLuoghiFisiciHome home_lfis = (IAnagrLuoghiFisiciHome) PseudoContext
                .lookup("AnagrLuoghiFisiciBean");

        if (ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_GSE)) {
            // Disegno questa parte secondo uno schema tabellare richiestoci da GSE.
            Collection<AnagrLuoghiFisici_4Sede_List_View> listaLuoghiFisici = home_lfis
                    .getAnagrLuoghiFisici_4Sede_List_View(lCOD_AZL, lCOD_MAN);
            if (listaLuoghiFisici != null && listaLuoghiFisici.isEmpty() == false) {
                writePage();
                long codice_sede = -1;
                long codice_immobile = -1;
                CenterMiddleTable tbl = null;
                for (AnagrLuoghiFisici_4Sede_List_View luogoFisico : listaLuoghiFisici) {
                    // Stampo le informazioni relative alla sede.
                    if (codice_sede != luogoFisico.COD_SIT_AZL) {
                        if (tbl != null) {
                            m_document.add(tbl);
                            writeLine();
                            codice_immobile = -1;
                        }
                        tbl = new CenterMiddleTable(2);
                        tbl.setDeafaultOffset();
                        int width[] = { 70, 30 };
                        tbl.setWidths(width);
                        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Luoghi.di.lavoro")
                                + "\n" + ApplicationConfigurator.LanguageManager.getString("Sede") + ": "
                                + luogoFisico.NOM_SIT_AZL, 2);
                        tbl.endHeaders();
                        tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
                    }
                    // Stampo le informazioni relative all'immobile.
                    if (codice_immobile != luogoFisico.COD_IMO) {
                        tbl.addCellB(ApplicationConfigurator.LanguageManager.getString("Immobile") + ": "
                                + (luogoFisico.NOM_IMO == null ? "" : luogoFisico.NOM_IMO), 13, 2);
                        tbl.addCellB(ApplicationConfigurator.LanguageManager.getString("Luogo.di.lavoro"), 13,
                                1);
                        tbl.addCellB(ApplicationConfigurator.LanguageManager.getString("Piano"), 13, 1);
                    }
                    // Stampo le informazioni relative al luogo fisico.
                    tbl.addCell(luogoFisico.NOM_LUO_FSC);
                    tbl.addCell(luogoFisico.NOM_PNO);

                    codice_sede = luogoFisico.COD_SIT_AZL;
                    codice_immobile = luogoFisico.COD_IMO;
                }
                if (tbl != null) {
                    m_document.add(tbl);
                }
            }
        } else {
            java.util.Iterator itt = home_lfis.getAnagrLuoghiFisici_List_View(lCOD_AZL, lCOD_MAN).iterator();
            if (itt.hasNext()) {
                writePage();
                writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Luoghi.di.lavoro"));
                {
                    CenterMiddleTable tbl = new CenterMiddleTable(1);
                    tbl.setDeafaultOffset();
                    tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Luogo.di.lavoro"));
                    tbl.endHeaders();
                    tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);

                    while (itt.hasNext()) {
                        AnagrLuoghiFisici_List_View w = (AnagrLuoghiFisici_List_View) itt.next();
                        tbl.addCell(w.NOM_LUO_FSC);
                    }
                    m_document.add(tbl);
                }
            }
        }
    }

    // OPERAZIONI SVOLTE
    Collection<AttLav_OperazioniSvolte_View> op_svo_list = null;
    if (bAttivitaSvolte) {
        op_svo_list = bean_man.getOperazioniSvolte_View();
        if (op_svo_list != null && op_svo_list.isEmpty() == false) {
            writePage();
            writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Operazioni.svolte"));
            {
                CenterMiddleTable tbl = new CenterMiddleTable(1);
                tbl.setDeafaultOffset();
                tbl.addHeaderCellB(
                        ApplicationConfigurator.LanguageManager.getString("Descrizione.dell'attivit"));
                tbl.endHeaders();
                tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
                for (AttLav_OperazioniSvolte_View w : op_svo_list) {
                    tbl.addCell(w.NOM_OPE_SVO);
                }
                m_document.add(tbl);
            }
        }

        // RISCHI
        IRischioFattoreHome home_fatr = (IRischioFattoreHome) PseudoContext.lookup("RischioFattoreBean");
        IRischioHome home_ris = (IRischioHome) PseudoContext.lookup("RischioBean");

        // Estraggo le categorie dei fattori di rischio.
        ICategorioRischioHome home_cr = (ICategorioRischioHome) PseudoContext.lookup("CategorioRischioBean");
        Collection<CategorioRischio_Name_Address_View> cat_ris_list = home_cr
                .getCategorioRischio_Name_Address_View();
        int count2 = 0;
        {
            // Determino se raggruppare i rischi per:
            // - CATEGORIA DEL FATTORE DI RISCIO (GSE)
            // - OPERAZIONE SVOLTA (DEFAULT)
            for (Object item : ApplicationConfigurator.isModuleEnabled(MODULES.REP_MAN_BY_CAG_FAT)
                    ? cat_ris_list
                    : op_svo_list) {
                java.util.Iterator it3 = (item instanceof CategorioRischio_Name_Address_View)
                        ? home_fatr.getReport_RischioFattore_ComboView_CAG_FAT_RSO(lCOD_AZL, lCOD_MAN,
                                ((CategorioRischio_Name_Address_View) item).COD_CAG_FAT_RSO).iterator()
                        : home_fatr.getReport_RischioFattore_ComboView(lCOD_AZL, lCOD_MAN,
                                ((AttLav_OperazioniSvolte_View) item).COD_OPE_SVO).iterator();

                if (it3.hasNext()) {
                    {
                        // Scrivo l'operazione svolta / categoria fattore di rischio
                        writePage();
                        CenterMiddleTable tbl = new CenterMiddleTable(1);
                        tbl.setDeafaultOffset();
                        tbl.addHeaderCellB((item instanceof CategorioRischio_Name_Address_View)
                                ? ((CategorioRischio_Name_Address_View) item).NOM_CAG_FAT_RSO
                                : ApplicationConfigurator.LanguageManager.getString("Operazione.svolta") + "\n"
                                        + ((AttLav_OperazioniSvolte_View) item).NOM_OPE_SVO.toUpperCase());
                        tbl.endHeaders();
                        m_document.add(tbl);
                    }
                    // Scrivo la descrizione dell'operazione svolta
                    if (!(item instanceof CategorioRischio_Name_Address_View)) {
                        writeLine();
                        writeParagraph2(((AttLav_OperazioniSvolte_View) item).DES_OPE_SVO);
                    }
                    if ((ApplicationConfigurator.isModuleEnabled(MODULES.DVR_MAC_4_OPE_SVO) == true)
                            && (ApplicationConfigurator.isModuleEnabled(MODULES.REP_MAN_BY_CAG_FAT) == false)) {
                        if (bMacchineAttrezature) {

                            IOperazioneSvolta bean_ope = home_opesvo
                                    .findByPrimaryKey(((AttLav_OperazioniSvolte_View) item).COD_OPE_SVO);
                            java.util.Collection col = bean_ope.getMacchine_View(lCOD_AZL);
                            java.util.Iterator it = col.iterator();
                            if (it.hasNext() != false) {
                                writeLine();
                                writeLine();
                                writeParagraph3_2(ApplicationConfigurator.LanguageManager
                                        .getString(ApplicationConfigurator.isModuleEnabled(MODULES.MOD_FORM_GSE)
                                                ? "Elenco.macchine.attrezzature.impianti.associate.al.rischio"
                                                : "Elenco.macchine/attrezzature.associate.al.rischio"));
                                CenterMiddleTable tbl = new CenterMiddleTable(2);
                                tbl.setDeafaultOffset();
                                int width[] = { 40, 60 };
                                tbl.setWidths(width);
                                tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                        .getString(ApplicationConfigurator.isModuleEnabled(MODULES.MOD_FORM_GSE)
                                                ? "Nome.macchina.attrezzatura.impianto"
                                                : "Nome.macchina/attrezzatura"));
                                tbl.addHeaderCellI(
                                        ApplicationConfigurator.LanguageManager.getString("Descrizione"));
                                tbl.endHeaders();
                                tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
                                while (it.hasNext()) {

                                    OpSvolte_Macchine_View rc = (OpSvolte_Macchine_View) it.next();
                                    tbl.addCell(rc.IDE_MAC);
                                    tbl.addCell(rc.DES_MAC);

                                }
                                m_document.add(tbl);
                            }

                        }
                    }
                    int count = 0;
                    while (it3.hasNext()) { // FATTORE DI RISCHIO
                        RischioFattore_ComboView2 w = (RischioFattore_ComboView2) it3.next();

                        if (!bRischi) {
                            continue;
                        }
                        Iterator it31 = (item instanceof CategorioRischio_Name_Address_View)
                                ? home_fatr.getReport_RischioFattore_RischioView(lCOD_AZL, lCOD_MAN,
                                        w.lCOD_FAT_RSO).iterator()
                                : home_fatr.getReport_RischioFattore_RischioView(lCOD_AZL, lCOD_MAN,
                                        ((AttLav_OperazioniSvolte_View) item).COD_OPE_SVO, w.lCOD_FAT_RSO)
                                        .iterator();
                        if (it31.hasNext()) {
                            // Scrivo il nome del fattore di rischio
                            writeLine();
                            if (ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_GSE) == true) {

                                CenterMiddleTable tbll = new CenterMiddleTable(1);
                                tbll.toLeft();
                                tbll.addHeaderCell(w.strNOM_FAT_RSO);
                                if (ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_GSE) == false) {
                                    writeLine();
                                } else if (count >= 1) {
                                    writePage();
                                } else {
                                    writeLine();
                                }
                                m_document.add(tbll);
                            } else {
                                writeParagraph2(w.strNOM_FAT_RSO);
                            }
                            while (it31.hasNext()) { // RISCHIO
                                Report_RischioFattore_RischioView ww = (Report_RischioFattore_RischioView) it31
                                        .next();
                                // Scrivo il nome e la descrizione del rischio
                                writeLine();
                                writeLine();
                                if (ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_GSE) == true) {
                                    CenterMiddleTable tbll = new CenterMiddleTable(1);
                                    tbll.toLeft();
                                    //tbll.addHeaderCellB(ww.strNOM_RSO, 1, false);
                                    tbll.addHeaderCellMagenta(ww.strNOM_RSO);
                                    tbll.addCell(ww.strDES_RSO);
                                    m_document.add(tbll);
                                    //writeLine();
                                } else {
                                    writeParagraph3_2(ww.strNOM_RSO);
                                    writeLine();
                                    writeText3_2(ww.strDES_RSO);
                                    writeLine();
                                }
                                {
                                    CenterMiddleTable tbl = null;
                                    short sMOD_CLC_RSO = Security.getAziendaModalitaCalcoloRischio();

                                    if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_BASE) {
                                        tbl = new CenterMiddleTable(3);
                                        tbl.setWidth(50);
                                    } else if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
                                        tbl = new CenterMiddleTable(5);
                                        tbl.setWidth(100);
                                    }
                                    tbl.setDeafaultOffset();
                                    tbl.setAlignment(Element.ALIGN_LEFT);
                                    {
                                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                .getString("Probabilit"));
                                        tbl.addHeaderCellI(
                                                ApplicationConfigurator.LanguageManager.getString("Danno"));
                                        if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
                                            tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                    .getString("Frequenza"));
                                            tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                    .getString("Numero"));
                                        }
                                        tbl.addHeaderCellI(
                                                ApplicationConfigurator.LanguageManager.getString("Rischio"));
                                        tbl.addCell(ww.lPRB_EVE_LES + "");
                                        tbl.addCell(ww.lENT_DAN + "");
                                        if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
                                            tbl.addCell(ww.lFRQ_RIP_ATT_DAN + "");
                                            tbl.addCell(ww.lNUM_INC_INF + "");
                                        }
                                        tbl.addCell(ww.lSTM_NUM_RSO + "");
                                    }
                                    m_document.add(tbl);
                                }
                                if (ApplicationConfigurator
                                        .isModuleEnabled(MODULES.DVR_MAC_4_OPE_SVO) == false) {
                                    // MACCHINE ATTREZZATURE
                                    if (bMacchineAttrezature) {
                                        Iterator it32 = (item instanceof CategorioRischio_Name_Address_View)
                                                ? home_ris
                                                        .getReportRischioMachineAttrezzature_Numero_Modelo_Descr_View(
                                                                lCOD_AZL, ww.lCOD_RSO)
                                                        .iterator()
                                                : home_ris
                                                        .getReportRischioMachineAttrezzature_Numero_Modelo_Descr_View(
                                                                lCOD_AZL,
                                                                ((AttLav_OperazioniSvolte_View) item).COD_OPE_SVO,
                                                                ww.lCOD_RSO)
                                                        .iterator();
                                        if (it32.hasNext()) {
                                            writeLine();
                                            writeLine();
                                            writeParagraph3_2(ApplicationConfigurator.LanguageManager
                                                    .getString(ApplicationConfigurator
                                                            .isModuleEnabled(MODULES.MOD_FORM_GSE)
                                                                    ? "Elenco.macchine.attrezzature.impianti.associate.al.rischio"
                                                                    : "Elenco.macchine/attrezzature.associate.al.rischio"));
                                            CenterMiddleTable tbl = new CenterMiddleTable(2);
                                            tbl.setDeafaultOffset();
                                            int width[] = { 40, 60 };
                                            tbl.setWidths(width);
                                            tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                    .getString(ApplicationConfigurator
                                                            .isModuleEnabled(MODULES.MOD_FORM_GSE)
                                                                    ? "Nome.macchina.attrezzatura.impianto"
                                                                    : "Nome.macchina/attrezzatura"));
                                            tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                    .getString("Descrizione"));
                                            tbl.endHeaders();
                                            tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
                                            while (it32.hasNext()) {
                                                ReportRischioMachineAttrezzature_Numero_Modelo_Descr_View ww1 = (ReportRischioMachineAttrezzature_Numero_Modelo_Descr_View) it32
                                                        .next();
                                                tbl.addCell(ww1.strMDL_MAC);
                                                tbl.addCell(ww1.strDES_MAC);
                                            }
                                            m_document.add(tbl);
                                        }
                                    }
                                }
                                // MISURE DI PREVENZIONE E PROTEZIONE
                                if (ApplicationConfigurator.isModuleEnabled(MODULES.MIS_PET_ISTR_OPE) == true) {
                                    // MILANO SERRAVALLE
                                    Iterator it32 = bean_man.getMisurePreventiveView(ww.lCOD_RSO).iterator();
                                    if (it32.hasNext()) {
                                        writeLine();
                                        writeParagraph3_2(ApplicationConfigurator.LanguageManager.getString(
                                                "Elenco.misure.prevenzione.e.protezione.associate.al.rischio"));

                                        int colonneTabella = 3;
                                        int width[] = { 30, 50, 20 };

                                        if (!this.allModuleByProfile.booleanValue()) {
                                            colonneTabella = 2;
                                            int width1[] = { 70, 30 };
                                            width = width1;
                                        }
                                        CenterMiddleTable tbl = new CenterMiddleTable(colonneTabella);
                                        tbl.setDeafaultOffset();

                                        tbl.setWidths(width);
                                        if (this.allModuleByProfile.booleanValue()) {
                                            tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                    .getString("Nome.misura"));
                                        }
                                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                .getString("Descrizione"));
                                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                .getString("Istruzioni.Operative.correlate"));
                                        tbl.endHeaders();
                                        tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
                                        while (it32.hasNext()) {
                                            ReportAttLav_MisurePreventive_View ww1 = (ReportAttLav_MisurePreventive_View) it32
                                                    .next();
                                            if (this.allModuleByProfile.booleanValue()) {
                                                tbl.addCell(ww1.NOM_MIS_PET);
                                            }
                                            tbl.addCell(ww1.DES_MIS_PET);
                                            tbl.addCell(ww1.IST_OPE_COR);
                                        }
                                        m_document.add(tbl);
                                    }
                                } else {
                                    Iterator it32 = bean_man.getMisurePreventiveView(ww.lCOD_RSO).iterator();
                                    if (it32.hasNext()) {
                                        writeLine();
                                        writeParagraph3_2(ApplicationConfigurator.LanguageManager.getString(
                                                "Elenco.misure.prevenzione.e.protezione.associate.al.rischio"));
                                        CenterMiddleTable tbl = new CenterMiddleTable(2);
                                        tbl.setDeafaultOffset();
                                        int width[] = { 30, 70 };
                                        tbl.setWidths(width);
                                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                .getString("Nome.misura"));
                                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                .getString("Descrizione"));
                                        tbl.endHeaders();
                                        tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
                                        while (it32.hasNext()) {
                                            ReportAttLav_MisurePreventive_View ww1 = (ReportAttLav_MisurePreventive_View) it32
                                                    .next();
                                            tbl.addCell(ww1.NOM_MIS_PET);
                                            tbl.addCell(ww1.DES_MIS_PET);
                                        }
                                        m_document.add(tbl);
                                    }
                                }
                                // SOSTANZE CHIMICHE
                                {
                                    Iterator it33 = (item instanceof CategorioRischio_Name_Address_View)
                                            ? home_ris.getReportRischioSostanzeChimiche_View(lCOD_AZL, lCOD_MAN)
                                                    .iterator()
                                            : home_ris.getReportRischioSostanzeChimiche_View(ww.lCOD_RSO,
                                                    ((AttLav_OperazioniSvolte_View) item).COD_OPE_SVO, lCOD_MAN,
                                                    lCOD_AZL).iterator();
                                    if (it33.hasNext()) {
                                        writeLine();
                                        writeParagraph3_2(ApplicationConfigurator.LanguageManager
                                                .getString("Elenco.sostanze.chimiche.associate.al.rischio"));
                                        CenterMiddleTable tbl = new CenterMiddleTable(4);
                                        tbl.setDeafaultOffset();
                                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                .getString("Nome.sostanza/preparato"));
                                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                .getString("Stato.fisico"));
                                        //tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager.getString("Frasi.R"));
                                        //tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager.getString("Cons.S"));
                                        tbl.addHeaderCellI(
                                                ApplicationConfigurator.LanguageManager.getString("Simbolo"));
                                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                .getString("Descrizione"));
                                        tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
                                        tbl.endHeaders();
                                        tbl.setAlignment(Element.ALIGN_LEFT);
                                        while (it33.hasNext()) {
                                            ReportRischioSostanzeChimiche_View ww2 = (ReportRischioSostanzeChimiche_View) it33
                                                    .next();
                                            tbl.addCell(ww2.strNOM_COM_SOS);
                                            tbl.addCell(ww2.strDES_STA_FSC);
                                            //tbl.addCell(ww2.strFRS_R);
                                            //tbl.addCell(ww2.strFRS_S);
                                            tbl.addCell(ww2.strDES_SIM);
                                            tbl.addCell(ww2.strDES_SOS_CHI);
                                        }
                                        m_document.add(tbl);
                                    }
                                }
                            } // RISCHIO
                            count2 = count2 + 1;
                        }
                        count = count + 1;
                    } // FATTORE DI RISCHIO
                }
            } // OPERAZIONE SVOLTA
        }
    }

    /**
     *
     * ALLEGATI (CORSI, DOCUMENTI, DPI, MACCHINARI MANSIONE, SORVEGLIANZA
     * SANITARIA)
     *
     *
     */
    if (bAgentiChimici || bInformazioneFormazione || bDocumentazione || bDPI || bSorveglianzaSanitaria
            || bMacchineAttrezatureMansioni) {
        writePage();

        if (bStandAlone) {
            writeBig(ApplicationConfigurator.LanguageManager.getString("Allegato.1"));
            writeLine();
        }

        // AgentiChimici
        if (bAgentiChimici) {
            Report_ChildAgentiChimici childAgentiChimici = new Report_ChildAgentiChimici(lCOD_MAN, lCOD_AZL,
                    IncludeLogo, this.getCurrentReport());
            childAgentiChimici.writeRecordCard(bean_man);

            //                writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Valutazione.rischio.chimico"));
            //
            //                CenterMiddleTable tbl = new CenterMiddleTable(2);
            //                int width[] = {30, 70};
            //                tbl.setWidths(width);
            //                tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Indice.rischio.chimico"));
            //                    tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Note"));
            //                    tbl.endHeaders();
            //                    tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
            //                //Collection<AttLavAGE_CHI_View> listaAgentiChimici = bean_man.getAgentiChimici_View_Report();
            //
            //                // for (AttLavAGE_CHI_View agente : listaAgentiChimici) {
            //                if ((bean_man.getRSO_VAL() != 0) || (!bean_man.getNOTE().equals(""))) {
            //                   
            //                    String a = Long.toString(bean_man.getRSO_VAL());
            //
            //                    switch (Integer.valueOf(a)) {
            //                        case 0:
            //                            a = "";
            //                            break;
            //                        case 1:
            //                            a = "moderato";
            //                            break;
            //                        case 2:
            //                            a = "non moderato";
            //                            break;
            //                    }
            //                    tbl.addCell(a);
            //                    tbl.addCell(bean_man.getNOTE());
            //                    m_document.add(tbl);
            //                } else {
            //
            //                    tbl.endHeaders();
            //                    tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
            //                    m_document.add(tbl);
            //                    writeParagraph3(DATI_NON_PRESENTI);
            //                }
            //                //  if (listaAgentiChimici.isEmpty()) {
            //                //      writeParagraph3(DATI_NON_PRESENTI);
            //                //  }
            //                    
            //                writeLine();
        }

        // CORSI
        if (bInformazioneFormazione) {
            Report_ChildCorsi childCorsi = new Report_ChildCorsi(lCOD_MAN, lCOD_AZL, IncludeLogo,
                    this.getCurrentReport());
            childCorsi.writeRecordCard(bean_man);

            //                writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Informazione.e.formazione"));
            //
            //                CenterMiddleTable tbl = new CenterMiddleTable(1);
            //                tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Corso"));
            //                tbl.endHeaders();
            //                tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
            //                Collection<AttLav_Corsi_View> listaCorsi = bean_man.getCorsi_View();
            //                for (AttLav_Corsi_View corso : listaCorsi) {
            //                    tbl.addCell(corso.NOM_COR);
            //                }
            //                m_document.add(tbl);
            //                if (listaCorsi.isEmpty()) {
            //                    writeParagraph3(DATI_NON_PRESENTI);
            //                }
            //                writeLine();
        }

        // DPI
        if (bDPI) {
            Report_ChildDPI childDPI = new Report_ChildDPI(lCOD_MAN, lCOD_AZL, IncludeLogo,
                    this.getCurrentReport());
            childDPI.writeRecordCard(bean_man);

            //                writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Tipologia.D.P.I."));
            //                writeText2(ApplicationConfigurator.LanguageManager.getString("MSG_REP_0012"));
            //                CenterMiddleTable tbl = new CenterMiddleTable(2);
            //                int width[] = {30, 79};
            //                tbl.setWidths(width);
            //                tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Tipologia.D.P.I."));
            //                tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Descrizione"));
            //                tbl.endHeaders();
            //                tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
            //                Collection<AttLav_DPI_ViewEx> listaDPI = bean_man.getDPI_ViewEx();
            //                for (AttLav_DPI_ViewEx DPI : listaDPI) {
            //                    tbl.addCell(DPI.NOM_TPL_DPI);
            //                    tbl.addCell(DPI.DES_CAR_DPI);
            //                }
            //                m_document.add(tbl);
            //                if (listaDPI.isEmpty()) {
            //                    writeParagraph3(DATI_NON_PRESENTI);
            //                }
            //                writeLine();
        }

        // SORVEGLIANZA SANITARIA
        if (bSorveglianzaSanitaria) {
            Report_ChildSorveglianzaSanitaria childorveglianzaSanitaria = new Report_ChildSorveglianzaSanitaria(
                    lCOD_MAN, lCOD_AZL, IncludeLogo, this.getCurrentReport());
            childorveglianzaSanitaria.writeRecordCard(bean_man);

            //                writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Sorveglianza.sanitaria"));
            //                writeText2(ApplicationConfigurator.LanguageManager.getString("MSG_REP_0011"));
            //                CenterMiddleTable tbl = new CenterMiddleTable(2);
            //                tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Esami.dell'attivit.lavorativa"));
            //                tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Periodicit"));
            //                tbl.endHeaders();
            //                tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
            //                Collection<AttLav_VisteMediche_View> listaVisite = bean_man.getVisteMediche_View();
            //                for (AttLav_VisteMediche_View Visita : listaVisite) {
            //                    tbl.addCell(Visita.NOM_VST_IDO);
            //                    // Periodicit Mensile
            //                    if (Visita.FAT_PER.equals("M")) {
            //                        if (Visita.PER_VSTL == 1) {
            //                            tbl.addCell(Visita.PER_VSTL + " "
            //                                    + ApplicationConfigurator.LanguageManager.getString("mese"));
            //                        } else {
            //                            tbl.addCell(Visita.PER_VSTL + " "
            //                                    + ApplicationConfigurator.LanguageManager.getString("mesi"));
            //                        }
            //                        // Periodicit Unica
            //                    } else if (Visita.FAT_PER.equals("U")) {
            //                        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Unica"));
            //                    }
            //                }
            //                m_document.add(tbl);
            //                if (listaVisite.isEmpty()) {
            //                    writeParagraph3(DATI_NON_PRESENTI);
            //                }
            //                writeLine();
        }

        //  MACCHINE/ATTREZZATURE ASSOCIATE ALLE MANSIONI
        if (ApplicationConfigurator.isModuleEnabled(MODULES.ATT_LAV_MAC) && bMacchineAttrezatureMansioni) {
            //
            //Esttraggo i dati relativi alle schede Macchine/Attrezzaure
            //

            Report_ChildMacchineAttrezzature childMacchineAttrezzature = new Report_ChildMacchineAttrezzature(
                    lCOD_MAN, lCOD_AZL, IncludeLogo, this.getCurrentReport());
            childMacchineAttrezzature.writeRecordCard(bean_man);
            //                Collection<MacchinaByAttivitaLavorative_View> listaMacchina = bean_man.getMacchina_View();
            //               
            //                writeParagraph1(ApplicationConfigurator.LanguageManager.getString(
            //                        ApplicationConfigurator.isModuleEnabled(MODULES.MOD_FORM_GSE)
            //                        ? "Macchine.attrezzature.impianti.associate.mansioni"
            //                        : "Macchine/Attrezzature.associate.mansioni"));
            //                //Se non ci sono dati per il solo profilo MSR il DVR non riporta alcuna informazione
            //                if (!listaMacchina.isEmpty()) {
            //                CenterMiddleTable tbl = new CenterMiddleTable(1);
            //                tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString(
            //                        ApplicationConfigurator.isModuleEnabled(MODULES.MOD_FORM_GSE)
            //                        ? "Macchine.attrezzature.impianti"
            //                        : "Macchine/Attrezzature"));
            //                tbl.endHeaders();
            //                tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
            //               
            //                for (MacchinaByAttivitaLavorative_View macchina : listaMacchina) {
            //                    tbl.addCell(macchina.DES_MAC);
            //                }
            //                m_document.add(tbl);
            //                if (listaMacchina.isEmpty()) {
            //                    writeParagraph3(DATI_NON_PRESENTI);
            //                }
            //                }
            //                writeLine();
        }

        // DOCUMENTI
        if (bDocumentazione) {
            Report_ChildDocumentazione childDocumentazione = new Report_ChildDocumentazione(lCOD_MAN, lCOD_AZL,
                    IncludeLogo, this.getCurrentReport());
            childDocumentazione.writeRecordCard(bean_man);

            //                writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Documenti"));
            //                CenterMiddleTable tbl = new CenterMiddleTable(1);
            //                tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Titolo.del.documento"));
            //                tbl.endHeaders();
            //                tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
            //                Collection<ReportAttLav_Documenti_View> listaDocumenti = bean_man.getReportDocumenti_View();
            //                for (ReportAttLav_Documenti_View Documento : listaDocumenti) {
            //                    tbl.addCell(Documento.TIT_DOC);
            //                }
            //                m_document.add(tbl);
            //                if (listaDocumenti.isEmpty()) {
            //                    writeParagraph3(DATI_NON_PRESENTI);
            //                }
        }
    }
    closeDocument();
}

From source file:s2s.luna.reports.Report_REP_SCH_COR.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception {
    //----------------------------------------------------------------------
    SecurityWrapper Security = SecurityWrapper.getInstance();
    lCOD_AZL = Security.getAziendaR();
    IAziendaHome azienda_home = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda azienda = azienda_home.findByPrimaryKey(new Long(lCOD_AZL));
    ////ww  w.  j a va  2 s. co m
    ICorsiHome corso_home = (ICorsiHome) PseudoContext.lookup("CorsiBean");
    ICorsi corso = corso_home.findByPrimaryKey(new Long(lCOD_COR));
    initDocument("the doc", null, ApplicationConfigurator.LanguageManager.getString("SCHEDA.CORSO"),
            azienda.getRAG_SCL_AZL(), null);
    AddImage();
    writeIndent();
    //
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Azienda/Ente"));
        tbl.addCell(azienda.getRAG_SCL_AZL());
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("SCHEDA.CORSO"));
        tbl.addCell(Formatter.format(corso.getNOM_COR()));
        m_document.add(tbl);
    }
    //
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 25, 75 };
        tbl.setWidths(width);
        tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Descrizione"), 2);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Descrizione"));
        tbl.addCell(Formatter.format(corso.getDES_COR()));
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Durata"));
        tbl.addCell(Formatter.format(corso.getDUR_COR_GOR()));
        String att_freq = ApplicationConfigurator.LanguageManager.getString("si");
        String punteggio = ApplicationConfigurator.LanguageManager.getString("si");
        if (corso.getUSO_ATE_FRE_COR().equals("N")) {
            att_freq = ApplicationConfigurator.LanguageManager.getString("no");
        }
        if (corso.getUSO_PTG_COR().equals("N")) {
            punteggio = ApplicationConfigurator.LanguageManager.getString("no");
        }
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Attestato.di.frequenza"));
        tbl.addCell(att_freq);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Punteggio.test"));
        tbl.addCell(punteggio);
        m_document.add(tbl);
    }
    //
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 85, 15 };
        tbl.setWidths(width);
        tbl.setDefaultHorizontalAlignment(Element.ALIGN_CENTER);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Elenco.materiale"), 2);
        tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Titolo"));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Data"));
        tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
        //------------------------------------------------------
        java.util.Iterator it = corso.getDocCorsoMateriali_List_View().iterator();
        while (it.hasNext()) {
            DOC_CorsoMateriali_View w = (DOC_CorsoMateriali_View) it.next();
            tbl.addCell(Formatter.format(w.TIT_DOC));
            tbl.addCell(Formatter.format(w.DAT_REV_DOC));
        }
        m_document.add(tbl);
    }
    //
    {
        CenterMiddleTable tbl = new CenterMiddleTable(3);
        tbl.toLeft();
        int width[] = { 60, 20, 20 };
        tbl.setWidths(width);
        tbl.setDefaultHorizontalAlignment(Element.ALIGN_CENTER);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Elenco.docenti"), 3);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Nominativo"));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Inizio.docenza"));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Fine.docenza"));
        //------------------------------------------------------
        java.util.Iterator it = corso.getDocentiForCorso_List_View().iterator();
        while (it.hasNext()) {
            DocentiForCorso_List_View w = (DocentiForCorso_List_View) it.next();
            tbl.addCell(Formatter.format(w.NOM_DCT));
            tbl.addCell(Formatter.format(w.DAT_INZ));
            tbl.addCell(Formatter.format(w.DAT_FIE));
        }
        m_document.add(tbl);
    }
    //
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.setDefaultHorizontalAlignment(Element.ALIGN_CENTER);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Elenco.erogazioni.aziendali"));
        tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Azienda/Ente"));
        tbl.addCell(azienda.getRAG_SCL_AZL());
        m_document.add(tbl);
    }
    //
    {
        CenterMiddleTable tbl = new CenterMiddleTable(5);
        tbl.toLeft();
        int width[] = { 15, 15, 25, 25, 20 };
        tbl.setWidths(width);
        tbl.setDefaultHorizontalAlignment(Element.ALIGN_CENTER);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Dati.erogazione"), 5);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Data.pianificata"));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Data.effettiva"));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Cognome"));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Nome"));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Stato"));
        //------------------------------------------------------
        java.util.Iterator it = corso.getErogazioneForCorso_List_View(this.lCOD_AZL).iterator();
        while (it.hasNext()) {
            ErogazioneForCorso_List_View w = (ErogazioneForCorso_List_View) it.next();
            tbl.addCell(Formatter.format(w.DAT_PIF_EGZ_COR));
            tbl.addCell(Formatter.format(w.DAT_EFT_EGZ_COR));
            tbl.addCell(Formatter.format(w.COG_DPD));
            tbl.addCell(Formatter.format(w.NOM_DPD));
            tbl.addCell(Formatter.format(w.STA_EGZ_COR));
        }
        m_document.add(tbl);
    }
    //----------------------
    closeDocument();
}

From source file:s2s.luna.reports.Report_REP_SOP.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception {

    SecurityWrapper Security = SecurityWrapper.getInstance();
    ISopraluogoHome home1 = (ISopraluogoHome) PseudoContext.lookup("SopraluogoBean");
    ISopraluogo bean = home1.findByPrimaryKey(new Long(new Long(request.getParameter("ID"))));
    IAnagrProcedimentoHome home_pro = (IAnagrProcedimentoHome) PseudoContext.lookup("AnagrProcedimentoBean");
    IAnagrProcedimento bean_pro = home_pro.findByPrimaryKey(new Long(bean.getCOD_PRO()));
    IDipendenteHome home_dpd = (IDipendenteHome) PseudoContext.lookup("DipendenteBean");

    ICantiereHome home_can = (ICantiereHome) PseudoContext.lookup("CantiereBean");
    ICantiere bean_can = home_can.findByPrimaryKey(new Long(bean.getCOD_CAN()));

    IAnagrOpereHome home_ope = (IAnagrOpereHome) PseudoContext.lookup("AnagrOpereBean");
    IAnagrOpere bean_ope = null;/*from   w w  w .ja va2s .  c om*/
    long COD_OPE = bean.getCOD_OPE();
    if (COD_OPE != 0) {
        bean_ope = home_ope.findByPrimaryKey(COD_OPE);
    }

    lCOD_AZL = Security.getAziendaR();
    IAziendaHome home_az = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda bean_az = home_az.findByPrimaryKey(new Long(lCOD_AZL));

    initDocument("the doc",
            // Intestazione - Cella a sinistra
            bean_pro.getstrDES(),
            // Intestazione - Cella centrale
            bean_can.getNOM_CAN() + " - " + bean.getNUM_SOP(),
            // Pi di pagina Cella a sinistra
            bean_az.getRAG_SCL_AZL(),
            // Pi di pagina Cella a destra
            formatPlain(bean.getDAT_SOP()));

    m_handler.bShowDate = false;

    // LOGO E TITOLO
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.setDefaultCellBorder(0);
        int width[] = { 15, 75 };
        tbl.setWidths(width);
        if (IncludeLogo) {
            Image png = loadImage("LOGO");
            png.scalePercent(50);
            png.setAlignment(Image.ALIGN_LEFT);
            Cell cImage = new Cell(png);
            tbl.addCell(cImage);
        } else {
            tbl.addCell("");
        }
        CenterMiddleTable tbl2 = new CenterMiddleTable(1);
        tbl2.setDefaultCellBorder(0);
        tbl2.addCellBU(ApplicationConfigurator.CUSTOMER_NAME.toUpperCase(), 15);
        tbl2.addCellBU(ApplicationConfigurator.LanguageManager.getString("Coordinamento.sicurezza.cantieri")
                .toUpperCase(), 15);

        Cell cText = new Cell(tbl2);
        tbl.addCell(cText);
        m_document.add(tbl);
    }

    writeIndent();
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        if (bStandAlone) {
        }
        m_document.add(tbl);
    }

    // DATI DEL SOPRALLUOGO
    {
        CenterMiddleTable tbl = new CenterMiddleTable(4);
        tbl.toLeft();
        int width[] = { 30, 20, 25, 25 };
        tbl.setWidths(width);
        tbl.addCell(
                ApplicationConfigurator.LanguageManager.getString("Sopralluogo.N") + "  " + bean.getNUM_SOP(),
                defaultFontSize);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("del") + "  "
                + formatPlain(bean.getDAT_SOP()), defaultFontSize);
        tbl.addCell(
                ApplicationConfigurator.LanguageManager.getString("Inizio.h")
                        + (bean.getORA_INI() != null ? bean.getORA_INI().toString().substring(0, 5) : ""),
                defaultFontSize);
        tbl.addCell(
                ApplicationConfigurator.LanguageManager.getString("Fine.h")
                        + (bean.getORA_FIN() != null ? bean.getORA_FIN().toString().substring(0, 5) : ""),
                defaultFontSize);
        m_document.add(tbl);
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(3);
        tbl.toLeft();
        int width[] = { 34, 33, 33 };
        tbl.setWidths(width);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Linea") + ":  " + bean_pro.getstrDES(),
                defaultFontSize);
        tbl.addCell(
                ApplicationConfigurator.LanguageManager.getString("Stazione") + ":  " + bean_can.getNOM_CAN(),
                defaultFontSize);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Opera") + ":  "
                + (bean_ope != null ? bean_ope.getstrNOM_OPE() : ""), defaultFontSize);
        m_document.add(tbl);
    }

    // PRESENTI AZIENDA
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 25, 70 };
        tbl.setWidths(width);
        tbl.border();
        java.util.Collection col = home_dpd.getDipendentiBySOP_View(lCOD_SOP);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Presenti.RM"), defaultFontSize);
        java.util.Iterator it = col.iterator();
        String presentiRM = "";
        while (it.hasNext()) {
            DipendentiBySOP_View obj = (DipendentiBySOP_View) it.next();
            presentiRM += (StringManager.isEmpty(presentiRM) ? "" : ", ") + obj.COG_DPD + " " + obj.NOM_DPD;
        }
        tbl.addCell(presentiRM, defaultFontSize);
        m_document.add(tbl);
    }

    // PRESENTI IMPRESA
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        tbl.setPadding(1 / 2);
        int width[] = { 25, 70 };
        tbl.setWidths(width);
        tbl.border();
        java.util.Collection col = home_dpd.getDipendentiEstBySOP_View(lCOD_SOP);
        java.util.Iterator it = col.iterator();
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Presenti.impresa"), defaultFontSize);
        String presentiIMP = "";
        while (it.hasNext()) {
            DipendentiBySOP_View obj = (DipendentiBySOP_View) it.next();
            presentiIMP += (StringManager.isEmpty(presentiIMP) ? "" : ", ") + obj.COG_DPD + " " + obj.NOM_DPD
                    + " (" + obj.IMPRESA + ")";
        }
        tbl.addCell(presentiIMP, defaultFontSize);
        m_document.add(tbl);
    }
    writeLine();

    // CONSTATAZIONI
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.toLeft();
        int width[] = { 100 };
        tbl.setWidths(width);
        tbl.addHeaderCellB2(ApplicationConfigurator.LanguageManager.getString("CONSTATAZIONI"), 1, false, 11);
        m_document.add(tbl);
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 5, 85 };
        tbl.setWidths(width);
        java.util.Collection col = home1.getConstatazioniSop(lCOD_SOP);
        java.util.Iterator it = col.iterator();
        tbl.setWidths(width);
        String constElementSeparator = " - ";
        Alphabet c = new Alphabet();
        String REV1 = c.getNextElement("1");
        while (it.hasNext()) {
            jbConstatazione obj = (jbConstatazione) it.next();

            // Numerazione alfabetica
            Cell cell = new Cell(new Phrase(Formatter.format(REV1), REPORT_SETTINGS.ftText9B));
            cell.setVerticalAlignment(Element.ALIGN_TOP);
            tbl.addCell(cell);

            // Constatazione
            tbl.addCell(Formatter.format(
                    (StringManager.isNotEmpty(obj.sRAG_SCL_DTE) ? obj.sRAG_SCL_DTE + constElementSeparator : "")
                            + (StringManager.isNotEmpty(obj.sNOM_ATT)
                                    ? obj.sNOM_ATT + constElementSeparator
                                    : "")
                            + (StringManager.isNotEmpty(obj.sDES_LIB) ? obj.sDES_LIB + constElementSeparator
                                    : "")
                            + obj.sDESC),
                    defaultFontSize);
            REV1 = c.getNextElement(REV1);
        }
        m_document.add(tbl);
    }
    writeLine();

    // DISPOSIZIONI
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.toLeft();
        int width[] = { 85 };
        tbl.setWidths(width);
        tbl.addHeaderCellB2(ApplicationConfigurator.LanguageManager.getString("DISPOSIZIONI"), 1, false, 11);
        m_document.add(tbl);
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 5, 85 };
        java.util.Collection col = home1.getConstatazioniSop(lCOD_SOP);
        java.util.Iterator it = col.iterator();
        tbl.setWidths(width);
        Alphabet c = new Alphabet();
        String REV2 = c.getNextElement("1");
        while (it.hasNext()) {
            jbConstatazione obj = (jbConstatazione) it.next();

            // Numerazione alfabetica
            Cell cell = new Cell(new Phrase(Formatter.format(REV2), REPORT_SETTINGS.ftText9B));
            cell.setVerticalAlignment(Element.ALIGN_TOP);
            tbl.addCell(cell);

            // Disposizione generata
            tbl.addCell(Formatter.format(obj.sDIS_GEN), defaultFontSize);
            REV2 = c.getNextElement(REV2);
        }
        m_document.add(tbl);
    }

    // FIRME
    // Spazio per le firme
    for (int i = 1; i <= 5; i++) {
        writeLine();
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        int width[] = { 50, 50 };
        tbl.setWidths(width);
        tbl.setDefaultCellBorder(0);

        // Firme del personale dell'azienda
        Cell cell = new Cell(
                new Phrase(ApplicationConfigurator.CUSTOMER_NAME.toUpperCase(), REPORT_SETTINGS.ftText9));
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        tbl.addCell(cell);

        // Firme del personale delle imprese
        Cell cell2 = new Cell(
                new Phrase(ApplicationConfigurator.LanguageManager.getString("Impresa").toUpperCase(),
                        REPORT_SETTINGS.ftText9));
        cell2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        tbl.addCell(cell2);

        m_document.add(tbl);
    }

    // FOTO
    {
        Collection<jbMedia> listaFoto = home1.getMediaSOP(lCOD_SOP);
        if (listaFoto != null && listaFoto.size() > 0) {

            // STAMPA L'INDICE DELLE FOTO.
            boolean firstFoto = true;
            int fotoIndex = 0;
            for (jbMedia foto : listaFoto) {
                try {
                    // Verifica che l'immagine sia in un formato supportato.
                    Image.getInstance(foto.mediaData);
                    fotoIndex++;
                    if (firstFoto) {
                        writePage();
                        writeTitle(ApplicationConfigurator.LanguageManager.getString("Indice.foto.allegate"));
                        firstFoto = false;
                    }
                    writeLine();
                    // Stampo il progessivo della foto, nel formato "Foto n".
                    writeText2Bold(ApplicationConfigurator.LanguageManager.getString("Foto") + " " + fotoIndex);
                    // Stampo il "nome" o se questo  assente, "il nome file".
                    writeText2(StringManager.isNotEmpty(foto.sNOM_MED) ? Formatter.format(foto.sNOM_MED)
                            : Formatter.format(foto.sFile));
                    // Stampo, se presente, la "descrizione".
                    writeText2(StringManager.isNotEmpty(foto.sDES_MED) ? Formatter.format(foto.sDES_MED) : "");
                } catch (Exception ex) {
                    // Eccezione silenziosa.
                    // Gestisce il caso in cui l'allegato non sia un immagine
                }
            }
            // STAMPA LE FOTO.
            firstFoto = true;
            fotoIndex = 0;
            byte SPACE_FOR_TITLE = 20;
            byte SPACE_FOR_BOTTOM_MARGIN = 20;
            boolean strictImageSequence = m_writer.isStrictImageSequence();
            m_writer.setStrictImageSequence(true);
            for (jbMedia foto : listaFoto) {
                Element image = prepareImage(m_document, foto.mediaData);
                if (image != null) {
                    fotoIndex++;
                    if (firstFoto) {
                        writePage();
                        firstFoto = false;
                    }
                    if (m_document.getPageSize().getHeight() - m_document.topMargin()
                            + 20 < getAvailablePageSpace(m_document, m_writer)) {
                        writeLine();
                    }
                    if (getAvailablePageSpace(m_document, m_writer)
                            - (SPACE_FOR_TITLE + SPACE_FOR_BOTTOM_MARGIN) < ((Image) image).getScaledHeight()) {
                        writePage();
                    }
                    // Stampo il progessivo della foto, nel formato "Foto n".
                    writeText2(ApplicationConfigurator.LanguageManager.getString("Foto") + " " + fotoIndex);
                    // Stampo l'immagine.
                    m_document.add(image);
                }
            }
            m_writer.setStrictImageSequence(strictImageSequence);
        }
    }
    // DOCUMENTI ALLEGATI
    Collection<DocumentiAssociati_Sopralluogo_View> listadocumenti = home1
            .getDocumentiCantiereSOP_STAMPA(lCOD_SOP);
    if (listadocumenti != null && listadocumenti.size() > 0) {

        // STAMPA L'INDICE DEI DOCUMENTI ALLEGATI
        // i documenti allegati sono quei documenti la cui tipologia risulta avere attivo
        //il flag di stampa in sopralluogo.
        boolean firstdocument = true;
        int documentIndex = 0;
        for (DocumentiAssociati_Sopralluogo_View documento : listadocumenti) {
            try {
                // Verifica che l'immagine sia in un formato supportato.
                documentIndex++;
                if (firstdocument) {
                    writePage();
                    writeTitle(ApplicationConfigurator.LanguageManager.getString("Indice.documenti.allegati"));
                    firstdocument = false;
                }
                writeLine();
                // Stampo il "titolo" del documento.
                writeText3Bold(documentIndex + ")"
                        + (StringManager.isNotEmpty(documento.TIT_DOC) ? Formatter.format(documento.TIT_DOC)
                                : Formatter.format(documento.NOM_TPL_DOC)));
                // Stampo, se presente, la "descrizione".
                if (!(documento.DES).equals("")) {
                    writeLine();
                }
                writeText3_3(StringManager.isNotEmpty(documento.DES) ? Formatter.format(documento.DES) : "");

                IAnagrDocumentoHome doc_home = (IAnagrDocumentoHome) PseudoContext.lookup("AnagrDocumentoBean");
                AnagDocumentoFileInfo fileInfo = null;
                AnagDocumentoFileInfo fileInfoLink = null;
                fileInfo = doc_home.getFileInfoU("", documento.lCOD_DOC);
                fileInfoLink = doc_home.getFileInfoULink("", documento.lCOD_DOC);

                // se esiste stampo il file allegato
                if (fileInfo != null) {
                    writeLine();
                    writeText3_3(Formatter.format("   " + "File Allegato:  " + fileInfo.strName));
                } else {
                    writeLine();
                    writeText3_3(Formatter.format("   " + "File Allegato:  "));
                }

                // se esiste stampo il file link allegato
                if (fileInfoLink != null) {
                    writeText3_3(Formatter.format("   " + "File Link Allegato:  " + fileInfoLink.strName));
                } else {
                    writeText3_3(Formatter.format("   " + "File Link Allegato:  "));
                }
                writeLine();
            } catch (Exception ex) {
                // Eccezione silenziosa.
                // Gestisce il caso in cui l'allegato non sia un immagine
            }

        }
        writePage();
        // Stampa documenti allegati
        boolean endWithNewPage = false;
        endWithNewPage = StampaDocumenti(home1, bean.getCOD_SOP(), m_document, m_writer);

    }
    closeDocument();
}

From source file:s2s.luna.reports.Report_REP_VAL_RSO_DVR.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception {
    SecurityWrapper Security = SecurityWrapper.getInstance();
    IAziendaHome home = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda bean = home.findByPrimaryKey(new Long(lCOD_AZL));

    initDocument("the doc", null,
            ApplicationConfigurator.LanguageManager.getString("Tabella.valutazione.rischio"),
            bean.getRAG_SCL_AZL(), null);

    writeIndent();// w  w w  .  j a  va  2 s .c o  m
    {
        ZREPORT_SETTINGS repSetting = new ZREPORT_SETTINGS();
        int tableFontSize = 10;
        int numberOfColumns = 4;
        short sMOD_CLC_RSO = Security.getAziendaModalitaCalcoloRischio();
        numberOfColumns = (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) ? numberOfColumns + 2
                : numberOfColumns;

        // Intestazione generale
        CenterMiddleTable tblTopHeader = new CenterMiddleTable(1);
        tblTopHeader.toCenter();
        tblTopHeader.addHeaderCellB(
                ApplicationConfigurator.LanguageManager.getString("Tabella.valutazione.rischio"));
        m_document.add(tblTopHeader);

        writeLine();

        // Intestazione di dettaglio
        CenterMiddleTable tblData = new CenterMiddleTable(numberOfColumns);
        if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_BASE) {
            int width[] = { 55, 15, 15, 15 };
            tblData.setWidths(width);
        } else if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
            int width[] = { 40, 12, 12, 12, 12, 12 };
            tblData.setWidths(width);
        }
        tblData.toCenter();
        tblData.toMiddle();

        tblData.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Rischio"), 1, true, 12);
        tblData.addHeaderCellFirstBold(
                ApplicationConfigurator.LanguageManager.getString("P") + "\n"
                        + StringManager
                                .bracket(ApplicationConfigurator.LanguageManager.getString("Probabilit")),
                1, true, 12, 10);
        tblData.addHeaderCellFirstBold(
                ApplicationConfigurator.LanguageManager.getString("D") + "\n"
                        + StringManager
                                .bracket(ApplicationConfigurator.LanguageManager.getString("Entit.del.danno")),
                1, true, 12, 10);
        if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
            tblData.addHeaderCellFirstBold(ApplicationConfigurator.LanguageManager.getString("F") + "\n"
                    + StringManager.bracket(ApplicationConfigurator.LanguageManager
                            .getString("Frequenza.dell'attivit.a.rischio")),
                    1, true, 12, 10);
            tblData.addHeaderCellFirstBold(
                    ApplicationConfigurator.LanguageManager.getString("N") + "\n"
                            + StringManager.bracket(ApplicationConfigurator.LanguageManager
                                    .getString("Numero.di.incidenti/infortuni.(negli.ultimi.3.anni)")),
                    1, true, 12, 10);
        }
        tblData.addHeaderCellFirstBold(
                ApplicationConfigurator.LanguageManager.getString("R") + "\n" + StringManager.bracket(
                        ApplicationConfigurator.LanguageManager.getString("Stima.numerica.del.rischio")),
                1, true, 12, 10);

        // Dati
        IRischioHome home_rso = (IRischioHome) PseudoContext.lookup("RischioBean");
        Collection<Rischio_Nome_Fattore_View> listaRischi = home_rso.findEx(lCOD_AZL, null, null, null, null,
                null, null, null, null, null, null, null, null, 0);
        for (Rischio_Nome_Fattore_View rischio : listaRischi) {
            Cell rischioCell = new Cell(new Phrase(rischio.strNOM_RSO, repSetting.ftText10));
            rischioCell.setHorizontalAlignment(Element.ALIGN_LEFT);
            tblData.addCell(rischioCell);
            tblData.addCell(Long.toString(rischio.PRB_EVE_LES), tableFontSize);
            tblData.addCell(Long.toString(rischio.ENT_DAN), tableFontSize);
            if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
                tblData.addCell(Long.toString(rischio.FRQ_RIP_ATT_DAN), tableFontSize);
                tblData.addCell(Long.toString(rischio.NUM_INC_INF), tableFontSize);
            }
            tblData.addCellB(Long.toString(rischio.STM_NUM_RSO), tableFontSize, 1);
        }
        m_document.add(tblData);
    }
    closeDocument();
}

From source file:s2s.luna.reports.Report_SCD_MAC.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception {
    //----------------------------------------------------------------------
    Checker c = new Checker();
    //-------------------------------------
    String strTYPE = "";
    String strSCH_MAC = "";
    String strSTA_INT = "";
    String NB_COD_MAC = "0";
    String NB_COD_DPD = "0";
    String NB_ATI_SVO = "";
    String RG_GROUP = "";
    java.sql.Date dDAT_PIF_INR_DAL = null;
    java.sql.Date dDAT_PIF_INR_AL;
    java.sql.Date dDAT_ATI_MNT_DAL = null;
    java.sql.Date dDAT_ATI_MNT_AL = null;
    //------------------------------------
    if (request.getParameter("TYPE") != null) {
        strTYPE = request.getParameter("TYPE");
    }//from  w  w  w  . j a  v  a  2s . c o m

    strSTA_INT = c.checkString("STA_INT", request.getParameter("STA_INT"), false);
    RG_GROUP = c.checkString("RG_GROUP", request.getParameter("R_T"), false);
    strSCH_MAC = c.checkString("strSCH_MAC", request.getParameter("SCH_MAC"), false);
    NB_COD_MAC = c.checkString("NB_COD_MAC", request.getParameter("COD_MAC"), false);
    dDAT_PIF_INR_AL = c.checkDate(ApplicationConfigurator.LanguageManager.getString("Data.pianif.al"),
            request.getParameter("DAT_PIF_AL"), false);
    dDAT_PIF_INR_DAL = c.checkDate(ApplicationConfigurator.LanguageManager.getString("Data.pianif.dal"),
            request.getParameter("DAT_PIF_DAL"), false);
    dDAT_ATI_MNT_AL = c.checkDate(ApplicationConfigurator.LanguageManager.getString("Data.intervento.al"),
            request.getParameter("DAT_EFT_AL"), false);
    dDAT_ATI_MNT_DAL = c.checkDate(ApplicationConfigurator.LanguageManager.getString("Data.intervento.dal"),
            request.getParameter("DAT_EFT_DAL"), false);
    NB_COD_DPD = c.checkString("NB_COD_DPD", request.getParameter("COD_DPD"), false);
    NB_ATI_SVO = c.checkString("NB_ATI_SVO", request.getParameter("ATI_SVO"), false);

    // ---- Errors ---
    if (c.isError) {
        String err = c.printErrors();
        myOut.print("<script>err=true;alert(\"" + err + "\");</script>");
        return;
    }

    if ((dDAT_ATI_MNT_DAL != null) && (dDAT_ATI_MNT_AL != null)) {
        if (dDAT_ATI_MNT_DAL.compareTo(dDAT_ATI_MNT_AL) > 0) {
            /*
            writeText2(ApplicationConfigurator.LanguageManager.getString("MSG_0085"));
            closeDocument();
            return;
             */
            myOut.print("<script>alert(\"" + ApplicationConfigurator.LanguageManager.getString("MSG_0085")
                    + "\");close();</script>");
            return;
        }
    }
    if ((dDAT_PIF_INR_DAL != null) && (dDAT_PIF_INR_AL != null)) {
        if (dDAT_PIF_INR_DAL.compareTo(dDAT_PIF_INR_AL) > 0) {
            /*
            writeText2(ApplicationConfigurator.LanguageManager.getString("MSG_0079"));
            closeDocument();
            return;
             */
            myOut.print("<script>alert(\"" + ApplicationConfigurator.LanguageManager.getString("MSG_0079")
                    + "\");close();</script>");
            return;
        }
    }
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    if (bStandAlone) {
        lCOD_AZL = new Long(request.getParameter("COD_AZL")).longValue();
    }
    IAziendaHome azienda_home = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda azienda = azienda_home.findByPrimaryKey(new Long(lCOD_AZL));
    String CA = "";
    if (bStandAlone) {
        CA = azienda.getRAG_SCL_AZL();
    }
    initDocument("the doc", null,
            ApplicationConfigurator.LanguageManager
                    .getString(ApplicationConfigurator.isModuleEnabled(MODULES.MOD_FORM_GSE)
                            ? "Scadenzario.macchine.attrezzature.impianti"
                            : "Scadenzario.macchine/attrezzature"),
            "", null);
    AddImage();
    writeIndent();
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Azienda/Ente"));
        tbl.addCell(azienda.getRAG_SCL_AZL());
        if (bStandAlone) {
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager
                    .getString(ApplicationConfigurator.isModuleEnabled(MODULES.MOD_FORM_GSE)
                            ? "Scadenzario.macchine.attrezzature.impianti"
                            : "Scadenzario.macchine/attrezzature"));
        }
        m_document.add(tbl);
    }
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    {

        ISchedaAttivitaSegnalazioneHome home = (ISchedaAttivitaSegnalazioneHome) PseudoContext
                .lookup("SchedaAttivitaSegnalazioneBean");
        //--- create table ----
        //-------------------------------------------------------------------------
        java.util.Collection col = home.getMacchina_for_SCHMAC_View(lCOD_AZL, strSCH_MAC, strSTA_INT,
                dDAT_PIF_INR_DAL, dDAT_PIF_INR_AL, dDAT_ATI_MNT_DAL, dDAT_ATI_MNT_AL, RG_GROUP,
                new Long(NB_COD_MAC).longValue(), new Long(NB_COD_DPD).longValue(), NB_ATI_SVO, strTYPE);
        CenterMiddleTable tbl = new CenterMiddleTable(4);
        tbl.toLeft();
        int width[] = { 15, 15, 35, 35 };
        tbl.setWidths(width);
        tbl.setDefaultHorizontalAlignment(Element.ALIGN_CENTER);
        //--- table header ---
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Data.pianif."));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Data.interv."));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Responsabile"));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString(
                ApplicationConfigurator.isModuleEnabled(MODULES.MOD_FORM_GSE) ? "Macchina.attrezzatura.impianto"
                        : "Macchina/Attrezzatura"));
        tbl.endHeaders();
        //--- table body ---
        java.util.Iterator it_nr = col.iterator();
        while (it_nr.hasNext()) {
            Macchina_for_SCHMAC_View nr = (Macchina_for_SCHMAC_View) it_nr.next();
            tbl.setDefaultHorizontalAlignment(Element.ALIGN_CENTER);
            tbl.addCell(Formatter.format(nr.DAT_PIF_INR));
            tbl.addCell(Formatter.format(nr.DAT_ATI_MNT));
            tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
            tbl.addCell(Formatter.format(nr.DIP));
            tbl.addCell(Formatter.format(nr.DES_MAC));
        }
        m_document.add(tbl);
    }
    //---------------------------------------------------------------------------
    closeDocument();
}

From source file:s2s.luna.reports.Report_SCD_VST_IDO.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception {
    //----------------------------------------------------------------------
    Checker c = new Checker();
    //-------------------------------------
    long lCOD_UNI_ORG = 0;
    String strVISITA = "M";
    String strSTATO = "N";
    java.sql.Date dDAT_PIF_VST_D = null;
    java.sql.Date dDAT_PIF_VST_A = null;
    java.sql.Date dDAT_EFT_VST_D = null;
    java.sql.Date dDAT_EFT_VST_A = null;
    String strTPL_ACR_VLU_RSO = "";
    String strRAGGRUPPATI = "N";
    String strSTA_INT = "";
    //----//from  w  w  w. j  av  a 2  s  .com
    String strSORT_DAT_PIF = ", 'a'.'dat_pif_vst_med' asc ";
    String strSORT_DAT_EFT = "X";
    String strSORT_TPL_ACC = "X";
    //------------------------------------
    if (request.getParameter("COD_UNI_ORG") != null) {
        lCOD_UNI_ORG = c.checkLong("COD Unita Organizzativa", request.getParameter("COD_UNI_ORG"), false);
    }
    if (request.getParameter("R_VISITA") != null) {
        strVISITA = c.checkString(ApplicationConfigurator.LanguageManager.getString("Visita"),
                request.getParameter("R_VISITA"), false);
    }
    if (request.getParameter("R_STATO") != null) {
        strSTATO = c.checkString(ApplicationConfigurator.LanguageManager.getString("Stato"),
                request.getParameter("R_STATO"), false);
    }
    if (request.getParameter("STA_INT") != null) {
        strSTA_INT = c.checkString(ApplicationConfigurator.LanguageManager.getString("Stato.misura"),
                request.getParameter("STA_INT"), false);
    }
    if (request.getParameter("TPL_ACR_VLU_RSO") != null) {
        strTPL_ACR_VLU_RSO = c.checkString(
                ApplicationConfigurator.LanguageManager.getString("Tipologia.accertamento"),
                request.getParameter("TPL_ACR_VLU_RSO"), false);
    }
    if (request.getParameter("DAT_PIF_VST_D") != null) {
        dDAT_PIF_VST_D = c.checkDate(ApplicationConfigurator.LanguageManager.getString("Data.pianificata.dal"),
                request.getParameter("DAT_PIF_VST_D"), false);
    }
    if (request.getParameter("DAT_PIF_VST_A") != null) {
        dDAT_PIF_VST_A = c.checkDate(ApplicationConfigurator.LanguageManager.getString("Data.pianificata.al"),
                request.getParameter("DAT_PIF_VST_A"), false);
    }
    if (request.getParameter("DAT_EFT_VST_D") != null) {
        dDAT_EFT_VST_D = c.checkDate(ApplicationConfigurator.LanguageManager.getString("Data.effettuata.dal"),
                request.getParameter("DAT_EFT_VST_D"), false);
    }
    if (request.getParameter("DAT_EFT_VST_A") != null) {
        dDAT_EFT_VST_A = c.checkDate(ApplicationConfigurator.LanguageManager.getString("Data.effettuata.al"),
                request.getParameter("DAT_EFT_VST_A"), false);
    }
    //************************ SORT ******************* 
    if (request.getParameter("SORT_DAT_PIF") != null) {
        strSORT_DAT_PIF = c.checkString("", request.getParameter("SORT_DAT_PIF"), false);
    }
    if (request.getParameter("SORT_DAT_EFT") != null) {
        strSORT_DAT_EFT = c.checkString("", request.getParameter("SORT_DAT_EFT"), false);
    }
    if (request.getParameter("SORT_TPL_ACC") != null) {
        strSORT_TPL_ACC = c.checkString("", request.getParameter("SORT_TPL_ACC"), false);
    }

    // ---- Errors ---
    if (c.isError) {
        /*
         * writeText2(c.printErrors()); closeDocument(); return;
         */
        //Il codice sopra commentato dava luogo al bug 1.81
        String err = c.printErrors();
        myOut.print("<script>err=true;alert(\"" + err + "\");</script>");
        return;
    }

    if ((dDAT_PIF_VST_D != null) && (dDAT_PIF_VST_A != null)) {
        if (dDAT_PIF_VST_D.compareTo(dDAT_PIF_VST_A) > 0) {
            /*
             * writeText2(ApplicationConfigurator.LanguageManager.getString("MSG_0079"));
             * closeDocument(); return;
             */
            //Il codice sopra commentato dava luogo al bug 1.81
            myOut.print("<script>alert(\"" + ApplicationConfigurator.LanguageManager.getString("MSG_0079")
                    + "\");close();</script>");
            return;
        }
    }

    if ((dDAT_EFT_VST_D != null) && (dDAT_EFT_VST_A != null)) {
        if (dDAT_EFT_VST_D.compareTo(dDAT_EFT_VST_A) > 0) {
            /*
             * writeText2(ApplicationConfigurator.LanguageManager.getString("MSG_0078"));
             * closeDocument(); return;
             */
            //Il codice sopra commentato dava luogo al bug 1.81
            myOut.print("<script>alert(\"" + ApplicationConfigurator.LanguageManager.getString("MSG_0078")
                    + "\");close();</script>");
            return;
        }
    }

    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    if (bStandAlone) {
        lCOD_AZL = new Long(request.getParameter("COD_AZIENDA")).longValue();
    }
    IAziendaHome azienda_home = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda azienda = azienda_home.findByPrimaryKey(new Long(lCOD_AZL));
    String CA = "";
    if (bStandAlone) {
        CA = azienda.getRAG_SCL_AZL();
    }

    String docTitle = "";
    if (strVISITA.equals("M")) {
        docTitle = ApplicationConfigurator.LanguageManager.getString("Scadenzario.visite.mediche");
    } else if (strVISITA.equals("I")) {
        docTitle = ApplicationConfigurator.LanguageManager.getString("Scadenzario.visite.idoneit");
    }
    initDocument("the doc", null, docTitle, CA, null);
    AddImage();
    writeIndent();
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Azienda/Ente"));
        tbl.addCell(azienda.getRAG_SCL_AZL());
        if (bStandAlone) {
            tbl.addHeaderCellB(docTitle);
        }
        m_document.add(tbl);
    }
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    {
        IGestioneVisiteMedicheHome homeM = (IGestioneVisiteMedicheHome) PseudoContext
                .lookup("GestioneVisiteMedicheBean");
        IGestioneVisiteIdoneitaHome homeI = (IGestioneVisiteIdoneitaHome) PseudoContext
                .lookup("GestioneVisiteIdoneitaBean");
        //--- create table ----
        //-------------------------------------------------------------------------
        java.util.Collection col_nr = null;
        if (strVISITA.equals("M")) {
            col_nr = homeM.getVisiteMediche_foo_SCHVST_View(lCOD_AZL, lCOD_UNI_ORG, strTPL_ACR_VLU_RSO,
                    strSTATO, dDAT_PIF_VST_D, dDAT_PIF_VST_A, strSTA_INT, dDAT_EFT_VST_D, dDAT_EFT_VST_A,
                    strRAGGRUPPATI, strSORT_DAT_PIF, strSORT_DAT_EFT, strSORT_TPL_ACC);
        }
        if (strVISITA.equals("I")) {
            col_nr = homeI.getVisiteIdoneita_for_SCHVST_View(lCOD_AZL, lCOD_UNI_ORG, strTPL_ACR_VLU_RSO,
                    strSTATO, dDAT_PIF_VST_D, dDAT_PIF_VST_A, strSTA_INT, dDAT_EFT_VST_D, dDAT_EFT_VST_A,
                    strRAGGRUPPATI, strSORT_DAT_PIF, strSORT_DAT_EFT, strSORT_TPL_ACC);
        }
        CenterMiddleTable tbl = new CenterMiddleTable(4);
        tbl.toLeft();
        int width[] = { 15, 20, 30, 35 };
        tbl.setWidths(width);
        tbl.setDefaultHorizontalAlignment(Element.ALIGN_CENTER);
        //--- table header ---
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Data.pianif."));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Data.effettuaz."));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Accertamento.medico"));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Dipendente"));
        tbl.endHeaders();
        tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
        //--- table body ---
        java.util.Iterator it_nr = col_nr.iterator();
        while (it_nr.hasNext()) {
            VisiteMediche_foo_SCHVST_View nr;
            if (strVISITA.equals("M")) {
                nr = (VisiteMediche_foo_SCHVST_View) it_nr.next();
            } else {
                VisiteIdoneita_for_SCHVST_View nr1 = (VisiteIdoneita_for_SCHVST_View) it_nr.next();
                nr = new VisiteMediche_foo_SCHVST_View();
                nr.COD_CTL_SAN = nr1.COD_CTL_SAN;
                nr.COD_VST = nr1.COD_VST;
                nr.COD_DPD = nr1.COD_DPD;
                nr.COD_AZL = nr1.COD_AZL;
                nr.DAT_PIF_VST_MED = nr1.DAT_PIF_VST_MED;
                nr.DAT_EFT_VST_MED = nr1.DAT_EFT_VST_MED;
                nr.TPL_ACR_VLU_RSO = nr1.TPL_ACR_VLU_RSO;
                nr.DPD = nr1.DPD;
                nr.RAG_SCL_AZL = nr1.RAG_SCL_AZL;
            }
            tbl.addCell(Formatter.format(nr.DAT_PIF_VST_MED));
            tbl.addCell(Formatter.format(nr.DAT_EFT_VST_MED));
            tbl.addCell(Formatter.format(nr.TPL_ACR_VLU_RSO));
            tbl.addCell(Formatter.format(nr.DPD));
        }
        m_document.add(tbl);
    }
    //---------------------------------------------------------------------------
    closeDocument();
}

From source file:s2s.luna.reports.Report_UNI_ORG.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception {

    SecurityWrapper Security = SecurityWrapper.getInstance();

    IUnitaOrganizzativaHome home_uni = (IUnitaOrganizzativaHome) PseudoContext.lookup("UnitaOrganizzativaBean");
    IUnitaOrganizzativa bean_uni = home_uni.findByPrimaryKey(new Long(lCOD_UNI_ORG));
    lCOD_AZL = bean_uni.getCOD_AZL();//w  w  w.  j  a v a2s .c o  m
    IAziendaHome home = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda bean_az = home.findByPrimaryKey(new Long(lCOD_AZL));

    initDocument("the doc", null, ApplicationConfigurator.LanguageManager.getString("SCHEDA.DI.REPARTO"),
            bean_az.getRAG_SCL_AZL(), bean_uni.getNOM_UNI_ORG());

    if (IncludeLogo) {
        AddImage();
    }
    writeIndent();
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        if (bStandAlone) {
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Azienda/Ente"));
            tbl.addCell(bean_az.getRAG_SCL_AZL());
        }
        if (ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_GSE)) {
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("SCHEDA.DI.SEDE"));
        } else {
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("SCHEDA.DI.REPARTO"));
        }
        tbl.addTitleCell(bean_uni.getNOM_UNI_ORG());
        m_document.add(tbl);
    }
    {

        if (ApplicationConfigurator.isModuleEnabled(MODULES.UNI_SIC_4_DIP) == false) {
            CenterMiddleTable tbl = new CenterMiddleTable(2);
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Ref.Sicurezza"));
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("E-mail"));

            java.util.Iterator it = bean_uni.getReportUnitaOrganizzativa_RefSicurezza_View().iterator();
            while (it.hasNext()) {
                ReportUnitaOrganizzativa_RefSicurezza_View w = (ReportUnitaOrganizzativa_RefSicurezza_View) it
                        .next();
                tbl.addCell(w.strCOG_DPD + " " + w.strNOM_DPD);
                tbl.addCell(Formatter.format(w.strIDZ_PSA_ELT_DPD));
            }

            m_document.add(tbl);
        }
    }
    if (ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_GSE) == false) {
        {
            CenterMiddleTable tbl = new CenterMiddleTable(2);
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Responsabile.uni.org"));
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("E-mail.Unita.Organizzativa"));

            java.util.Iterator it = bean_uni.getReportUnitaOrganizzativa_Resp_UnitSicurezza_View().iterator();
            while (it.hasNext()) {
                ResponsabileView w = (ResponsabileView) it.next();
                tbl.addCell(w.strCOG_DPD + " " + w.strNOM_DPD);
                tbl.addCell(w.strEMAIL);
            }
            m_document.add(tbl);
        }
        {
            CenterMiddleTable tbl = new CenterMiddleTable(2);
            tbl.addHeaderCellB(
                    ApplicationConfigurator.LanguageManager.getString("Elenco.attivit.lavorative.associate"));
            tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Eventuale/i.nominativo/i"));
            tbl.endHeaders();
            tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);

            java.util.Iterator it = bean_uni.getReportUnitaOrganizzativa_AttivitaLavorativa_Eventuale_View()
                    .iterator();
            /*
            long lTemp = -1;
            String strList = "";
            while (it.hasNext()) {
            ReportUnitaOrganizzativa_AttivitaLavorativa_Eventuale_View w = (ReportUnitaOrganizzativa_AttivitaLavorativa_Eventuale_View) it.next();
            if (lTemp != w.lCOD_MAN) {
            if (lTemp != -1) {
            tbl.addCell(strList);
            }
            tbl.addCell(w.strNOM_MAN);
            strList = "";
            lTemp = w.lCOD_MAN;
            }
            w.strNOM_COG_DPD = w.strNOM_COG_DPD == null ? "" : w.strNOM_COG_DPD;
            strList += w.strNOM_COG_DPD + "\n";
            }
            if (strList.length() != 0) {
            tbl.addCell(strList);
            }
             */
            long lCOD_MAN_TEMP = 0;
            while (it.hasNext()) {
                ReportUnitaOrganizzativa_AttivitaLavorativa_Eventuale_View w = (ReportUnitaOrganizzativa_AttivitaLavorativa_Eventuale_View) it
                        .next();
                if (lCOD_MAN_TEMP != w.lCOD_MAN) {
                    tbl.addCellB(w.strNOM_MAN, 14, 1);
                } else {
                    tbl.addCell("");
                }
                tbl.addCell(w.strNOM_COG_DPD == null ? "" : w.strNOM_COG_DPD);
                lCOD_MAN_TEMP = w.lCOD_MAN;
            }
            m_document.add(tbl);
        }
    }
    writeLine();
    {
        if (this.allModuleByProfile.booleanValue()) {
            IRischioFattoreHome home_fr = (IRischioFattoreHome) PseudoContext.lookup("RischioFattoreBean");
            ICategorioRischioHome home_cr = (ICategorioRischioHome) PseudoContext
                    .lookup("CategorioRischioBean");
            IRischioHome home_ris = (IRischioHome) PseudoContext.lookup("RischioBean");

            java.util.Iterator it = home_cr.getCategorioRischio_Name_Address_View().iterator();
            int count = 0;
            int count1 = 0;
            while (it.hasNext()) {// CATEGORIA DEL FATTORE DI RISCHIO
                CategorioRischio_Name_Address_View www = (CategorioRischio_Name_Address_View) it.next();
                java.util.Iterator itt1 = home_fr.getComboView(lCOD_AZL, lCOD_UNI_ORG, www.COD_CAG_FAT_RSO)
                        .iterator();
                if (count1 >= 1) {
                    writePage();
                } else {
                    writeLine();
                }

                {
                    if (itt1.hasNext()) {
                        writeLine();
                        CenterMiddleTable tbll = new CenterMiddleTable(1);
                        tbll.addHeaderCellB(www.NOM_CAG_FAT_RSO);
                        if (count >= 1) {
                            writePage();
                        }
                        m_document.add(tbll);
                    }
                }
                int count2 = 0;
                while (itt1.hasNext()) {// FATTORE DI RISCHIO - INIZIO
                    RischioFattore_ComboView2 ww1 = (RischioFattore_ComboView2) itt1.next();
                    java.util.Iterator it3 = home_fr
                            .getReport_RischioFattore_RischioView_UO(lCOD_AZL, lCOD_UNI_ORG, ww1.lCOD_FAT_RSO)
                            .iterator();
                    if (it3.hasNext()) {
                        CenterMiddleTable tbll = new CenterMiddleTable(1);
                        tbll.toLeft();
                        tbll.addHeaderCell(ww1.strNOM_FAT_RSO);
                        if (ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_GSE) == false) {
                            writeLine();
                        } else if (count2 >= 1) {
                            writePage();
                        } else {
                            writeLine();
                        }
                        m_document.add(tbll);
                        { // RISCHIO - INIZIO
                            writeLine();
                            while (it3.hasNext()) {
                                Report_RischioFattore_RischioView ww = (Report_RischioFattore_RischioView) it3
                                        .next();
                                {
                                    CenterMiddleTable tbl = new CenterMiddleTable(1);
                                    tbl.toLeft();
                                    writeLine();
                                    writeLine();
                                    if (ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_GSE) == true) {
                                        tbl.addHeaderCellMagenta(ww.strNOM_RSO);
                                    } else {
                                        tbl.addHeaderCellB(ww.strNOM_RSO, 1, false);
                                    }
                                    tbl.addCell(ww.strDES_RSO);
                                    m_document.add(tbl);
                                }
                                {// TABELLA DEL RISCHIO - INIZIO
                                    CenterMiddleTable tbl = null;
                                    short sMOD_CLC_RSO = Security.getAziendaModalitaCalcoloRischio();

                                    if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_BASE) {
                                        tbl = new CenterMiddleTable(3);
                                        tbl.setWidth(50);
                                    } else if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
                                        tbl = new CenterMiddleTable(5);
                                        tbl.setWidth(100);
                                    }
                                    tbl.setAlignment(Element.ALIGN_LEFT);
                                    {
                                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                .getString("Probabilit"));
                                        tbl.addHeaderCellI(
                                                ApplicationConfigurator.LanguageManager.getString("Danno"));
                                        if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
                                            tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                    .getString("Frequenza"));
                                            tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                    .getString("Numero"));
                                        }
                                        tbl.addHeaderCellI(
                                                ApplicationConfigurator.LanguageManager.getString("Rischio"));
                                        tbl.endHeaders();
                                        tbl.addCell(ww.lPRB_EVE_LES + "");
                                        tbl.addCell(ww.lENT_DAN + "");
                                        if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
                                            tbl.addCell(ww.lFRQ_RIP_ATT_DAN + "");
                                            tbl.addCell(ww.lNUM_INC_INF + "");
                                        }
                                        tbl.addCell(ww.lSTM_NUM_RSO + "");
                                    }
                                    m_document.add(tbl);
                                } // TABELLA DEL RISCHIO - FINE
                                {// MISURE DI PREVENZIONE E PROTEZIONE - INIZIO
                                    Iterator it4 = home_ris.getMisurePpView(ww.lCOD_RSO, lCOD_AZL).iterator();
                                    if (it4.hasNext()) {
                                        writeLine();
                                        writeParagraph3_2(ApplicationConfigurator.LanguageManager.getString(
                                                "Elenco.misure.prevenzione.e.protezione.associate.al.rischio"));
                                        CenterMiddleTable tbl = new CenterMiddleTable(2);
                                        tbl.setDeafaultOffset();
                                        int width[] = { 30, 70 };
                                        tbl.setWidths(width);
                                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                .getString("Nome.misura"));
                                        tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                .getString("Descrizione"));
                                        tbl.endHeaders();
                                        tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
                                        while (it4.hasNext()) {
                                            RischioMisurePp_Nome_Descrizione_View w1 = (RischioMisurePp_Nome_Descrizione_View) it4
                                                    .next();
                                            tbl.addCell(w1.strNOM_MIS_PET);
                                            tbl.addCell(w1.strDES_MIS_PET);
                                        }
                                        m_document.add(tbl);
                                    }
                                } // MISURE DI PREVENZIONE E PROTEZIONE - FINE
                                  // LUOGHI FISICI - INIZIO
                                if (ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_GSE) == true) {
                                    {
                                        java.util.Iterator itt = home_cr.getCategorioRischio_LuogiFisici_View(
                                                lCOD_AZL, lCOD_UNI_ORG, ww.lCOD_RSO).iterator();
                                        if (itt.hasNext()) {
                                            writeLine();
                                            writeParagraph3_2(ApplicationConfigurator.LanguageManager
                                                    .getString("Elenco.luoghi.fisici.associati.al.rischio"));
                                            CenterMiddleTable tbl = new CenterMiddleTable(2);
                                            tbl.setAlignment(Element.ALIGN_LEFT);
                                            int width[] = { 50, 50 };
                                            tbl.setWidths(width);
                                            tbl.toLeft();
                                            tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                    .getString("Luoghi.fisici"));
                                            tbl.addHeaderCellI(
                                                    ApplicationConfigurator.LanguageManager.getString("Piano"));
                                            tbl.endHeaders();
                                            while (itt.hasNext()) {// LUOGHI FISICI - INIZIO
                                                CategorioRischio_LuogiFisici_View w = (CategorioRischio_LuogiFisici_View) itt
                                                        .next();
                                                tbl.addCell(w.strNOM_LUO_FSC);
                                                tbl.addCell(w.strNOM_PNO);
                                            } // LUOGHI FISICI - FINE
                                            m_document.add(tbl);
                                        }
                                    }
                                } else {
                                    {
                                        java.util.Iterator itt = home_cr.getCategorioRischio_LuogiFisici_View(
                                                lCOD_AZL, lCOD_UNI_ORG, ww.lCOD_RSO).iterator();
                                        if (itt.hasNext()) {
                                            writeLine();
                                            writeParagraph3_2(ApplicationConfigurator.LanguageManager
                                                    .getString("Elenco.luoghi.fisici.associati.al.rischio"));
                                            CenterMiddleTable tbl = new CenterMiddleTable(1);
                                            tbl.setAlignment(Element.ALIGN_LEFT);
                                            tbl.setWidth(50);
                                            tbl.toLeft();
                                            tbl.addHeaderCellI(ApplicationConfigurator.LanguageManager
                                                    .getString("Luoghi.fisici"));
                                            tbl.endHeaders();
                                            while (itt.hasNext()) {// LUOGHI FISICI - INIZIO
                                                CategorioRischio_LuogiFisici_View w = (CategorioRischio_LuogiFisici_View) itt
                                                        .next();
                                                tbl.addCell(w.strNOM_LUO_FSC);
                                            } // LUOGHI FISICI - FINE
                                            m_document.add(tbl);
                                        }
                                    }
                                }
                                // LUOGHI FISICI - FINE
                            }
                        } // RISCHIO - FINE
                        count2 = count2 + 1;
                        count = count + 1;
                    }
                } // FATTORE DI RISCHIO - FINE

            } // CATEGORIA DEL FATTORE DI RISCHIO - FINE
            count1 = count1 + 1;
        }
    }
    {// ALLEGATI
        if (this.allModuleByProfile.booleanValue()) {
            writePage();
            writeBig(ApplicationConfigurator.LanguageManager.getString("Allegato.1"));
            {
                writeParagraph1(ApplicationConfigurator.LanguageManager.getString("D.P.I."));
                writeText2(ApplicationConfigurator.LanguageManager.getString("MSG_REP_0002") + ":");
                writeLine();
                CenterMiddleTable tbl = new CenterMiddleTable(2);
                tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Luogo.fisico"));
                tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Tipologia.D.P.I."));
                tbl.endHeaders();
                tbl.setDefaultHorizontalAlignment(Element.ALIGN_LEFT);
                Iterator it4 = bean_uni.getReportUnitaOrganizzativa_LuogoFisico_DPI_View().iterator();
                if (ApplicationConfigurator.isModuleEnabled(MODULES.MOD_DVR_GSE) && it4.hasNext() == false) {
                    writeParagraph3(ApplicationConfigurator.LanguageManager.getString("MSG_REP_0013"));
                    writeLine();
                }
                while (it4.hasNext()) {
                    ReportUnitaOrganizzativa_LuogoFisico_DPI_View w3 = (ReportUnitaOrganizzativa_LuogoFisico_DPI_View) it4
                            .next();
                    tbl.addCell(w3.strNOM_LUO_FSC);
                    tbl.addCell(w3.strNOM_TPL_DPI);
                }
                m_document.add(tbl);
                writeLine();
                writeText2(ApplicationConfigurator.LanguageManager.getString("MSG_REP_0003") + " "
                        + ApplicationConfigurator.LanguageManager.getString("MSG_REP_0004") + ", "
                        + ApplicationConfigurator.LanguageManager.getString("MSG_REP_0005") + ", "
                        + ApplicationConfigurator.LanguageManager.getString("MSG_REP_0006"));
            }
        }
        //aggiunta riga vuota per modifica DVR>ALLEGATO 1 PER MSR
        writeLine();
    }

    closeDocument();
}