Example usage for org.apache.commons.dbutils.handlers ArrayListHandler ArrayListHandler

List of usage examples for org.apache.commons.dbutils.handlers ArrayListHandler ArrayListHandler

Introduction

In this page you can find the example usage for org.apache.commons.dbutils.handlers ArrayListHandler ArrayListHandler.

Prototype

public ArrayListHandler() 

Source Link

Document

Creates a new instance of ArrayListHandler using a BasicRowProcessor for conversions.

Usage

From source file:org.openconcerto.erp.core.finance.accounting.ui.GrandLivrePanel.java

/**
 * Cre le panel d'un onglet associ  une classe
 * //from  ww  w. j  av a  2s  . co  m
 * @param cc ClasseCompte la classe des comptes
 * @return JPanel le JPanel associ
 */
private JPanel initClassePanel(ClasseCompte cc) {

    final JPanel panelTmp = new JPanel();
    long totalDebitClasse = 0;
    long totalCreditClasse = 0;

    panelTmp.setLayout(new GridBagLayout());
    panelTmp.setOpaque(false);
    final GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(2, 2, 1, 2);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 1;
    c.weighty = 0;

    // Rcupration des comptes de la classe avec le total
    SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
    SQLTable compteTable = base.getTable("COMPTE_PCE");
    SQLTable ecritureTable = base.getTable("ECRITURE");

    SQLSelect sel = new SQLSelect(base);
    sel.addSelect(compteTable.getKey());
    sel.addSelect(compteTable.getField("NUMERO"));
    sel.addSelect(compteTable.getField("NOM"));
    sel.addSelect(ecritureTable.getField("DEBIT"), "SUM");
    sel.addSelect(ecritureTable.getField("CREDIT"), "SUM");

    String function = "REGEXP";
    String match = cc.getTypeNumeroCompte();
    if (Configuration.getInstance().getBase().getServer().getSQLSystem() == SQLSystem.POSTGRESQL) {
        // function = "SIMILAR TO";
        function = "~";
        // match = cc.getTypeNumeroCompte().replace(".*", "%");
    }

    Where w = new Where(compteTable.getField("NUMERO"), function, match);
    Where w2 = new Where(ecritureTable.getField("ID_COMPTE_PCE"), "=", compteTable.getKey());

    if (!UserManager.getInstance().getCurrentUser().getRights()
            .haveRight(ComptaUserRight.ACCES_NOT_RESCTRICTED_TO_411)) {
        // TODO Show Restricted acces in UI
        w = w.and(new Where(ecritureTable.getField("COMPTE_NUMERO"), "LIKE", "411%"));
    }

    sel.setWhere(w.and(w2));

    String req = sel.asString()
            + " GROUP BY \"COMPTE_PCE\".\"ID\",\"COMPTE_PCE\".\"NUMERO\",\"COMPTE_PCE\".\"NOM\" ORDER BY \"COMPTE_PCE\".\"NUMERO\"";
    System.out.println(req);

    Object ob = base.getDataSource().execute(req, new ArrayListHandler());

    List myList = (List) ob;

    JLabel labelTotalClasse = new JLabel();
    labelTotalClasse.setOpaque(false);
    if (myList.size() != 0) {

        /***************************************************************************************
         * Cration des Panels de chaque compte
         **************************************************************************************/
        // c.weighty = 1;
        for (int i = 0; i < myList.size(); i++) {

            Object[] objTmp = (Object[]) myList.get(i);

            final Compte compteTmp = new Compte(((Number) objTmp[0]).intValue(), objTmp[1].toString(),
                    objTmp[2].toString(), "", ((Number) objTmp[3]).longValue(),
                    ((Number) objTmp[4]).longValue());

            c.fill = GridBagConstraints.HORIZONTAL;
            c.weightx = 1;
            c.weighty = 0;
            c.gridx = 0;
            c.gridy++;
            panelTmp.add(creerComptePanel(compteTmp), c);

            // calcul du total de la classe
            totalDebitClasse += compteTmp.getTotalDebit();
            totalCreditClasse += compteTmp.getTotalCredit();
        }

        // Total de la classe
        labelTotalClasse.setText(
                "Total Classe " + cc.getNom() + " Dbit : " + GestionDevise.currencyToString(totalDebitClasse)
                        + " Crdit : " + GestionDevise.currencyToString(totalCreditClasse));

    } else {
        labelTotalClasse.setHorizontalAlignment(SwingConstants.CENTER);
        labelTotalClasse.setText("Aucune criture pour la classe " + cc.getNom());
    }
    c.gridy++;
    c.weighty = 1;
    panelTmp.add(labelTotalClasse, c);

    return panelTmp;
}

From source file:org.openconcerto.erp.core.finance.accounting.ui.PlanComptableGPanel.java

private void uiInit() {
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();

    this.setOpaque(false);
    this.panelCompte.setOpaque(false);
    this.panelInfosCompte.setOpaque(false);
    this.panelDetails.setOpaque(false);

    this.panelCompte.setLayout(new GridBagLayout());
    this.panelInfosCompte.setLayout(new GridBagLayout());
    this.panelDetails.setLayout(new GridBagLayout());

    /*******************************************************************************************
     * * RadioButton Selection du mode d'affichage du PCG abrege, base ou developp Panel
     * Details/*w  w  w.  java 2 s  . com*/
     ******************************************************************************************/
    this.panelDetails.add(this.radioCompteBase, c);
    this.radioCompteBase.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCompteTable();
        }
    });

    c.gridy++;
    this.panelDetails.add(this.radioCompteAbrege, c);
    this.radioCompteAbrege.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCompteTable();
        }
    });

    c.gridy++;
    this.panelDetails.add(this.radioCompteDeveloppe, c);
    this.radioCompteDeveloppe.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCompteTable();
        }

    });

    ButtonGroup grp1 = new ButtonGroup();
    grp1.add(this.radioCompteBase);
    grp1.add(this.radioCompteAbrege);
    grp1.add(this.radioCompteDeveloppe);

    this.radioCompteBase.setSelected(true);

    /*******************************************************************************************
     * ** Panel Compte
     ******************************************************************************************/
    c.insets = new Insets(2, 2, 1, 2);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0;
    c.weighty = 0;
    this.panelDetails.setBorder(BorderFactory.createTitledBorder("Dtails"));
    this.panelCompte.add(this.panelDetails, c);

    /*******************************************************************************************
     * * Affichage du plan comptable
     ******************************************************************************************/
    SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
    SQLTable classeCompteTable = base.getTable("CLASSE_COMPTE");

    SQLSelect selClasse = new SQLSelect(base);

    selClasse.addSelect(classeCompteTable.getField("ID"));
    selClasse.addSelect(classeCompteTable.getField("NOM"));
    selClasse.addSelect(classeCompteTable.getField("TYPE_NUMERO_COMPTE"));

    selClasse.addRawOrder("\"CLASSE_COMPTE\".\"TYPE_NUMERO_COMPTE\"");

    String reqClasse = selClasse.asString();
    Object obClasse = base.getDataSource().execute(reqClasse, new ArrayListHandler());

    List myListClasse = (List) obClasse;

    if (myListClasse.size() != 0) {
        for (int k = 0; k < myListClasse.size(); k++) {
            Object[] objTmp = (Object[]) myListClasse.get(k);
            ClasseCompte ccTmp = new ClasseCompte(Integer.parseInt(objTmp[0].toString()), objTmp[1].toString(),
                    objTmp[2].toString());
            this.classeComptes.add(ccTmp);

            JTable tab = creerJTable(ccTmp);
            this.tables.add(tab);
            this.tabbedClasse.add(ccTmp.getNom(), new JScrollPane(tab));
        }
    }
    c.gridwidth = 4;
    c.gridheight = 6;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.weighty = 1;
    c.gridx++;
    c.gridy = 0;
    this.panelCompte.add(this.tabbedClasse, c);

    /*******************************************************************************************
     * * Informations sur le compte selectionn Panel Infos Compte
     ******************************************************************************************/
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridheight = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1;
    c.weighty = 0;
    c.gridy = 0;
    c.gridx = 0;
    TitledSeparator sep = new TitledSeparator("Informations sur le compte");
    this.panelInfosCompte.add(sep, c);

    GridBagConstraints cInfos = new GridBagConstraints();
    cInfos.insets = new Insets(0, 0, 0, 0);
    cInfos.fill = GridBagConstraints.BOTH;
    cInfos.anchor = GridBagConstraints.NORTHWEST;
    cInfos.gridx = 0;
    cInfos.gridy = 0;
    cInfos.gridwidth = 1;
    cInfos.gridheight = 1;
    cInfos.weightx = 1;
    cInfos.weighty = 1;
    this.textInfos.setFont(this.getFont());
    this.textInfos.setEditable(false);
    JPanel infos = new JPanel(new GridBagLayout());
    infos.add(this.textInfos, cInfos);

    JScrollPane scrollInfos = new JScrollPane(infos);
    c.insets = new Insets(0, 0, 0, 0);
    c.gridx = 0;
    c.gridy++;
    c.weightx = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = GridBagConstraints.REMAINDER;

    this.panelInfosCompte.add(scrollInfos, c);
    this.panelInfosCompte.setMinimumSize(new Dimension(100, 80));

    JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, this.panelCompte, this.panelInfosCompte);
    split.setBorder(null);
    this.add(split, c);
}

From source file:org.openconcerto.erp.core.finance.accounting.ui.ResultatPanel.java

public static long getResultatValue() {

    long soldeVente = 0;
    long soldeAchat = 0;

    /*******************************************************************************************
     * CALCUL DU RESULTAT PRODUITS - CHARGES
     ******************************************************************************************/

    // Rcupration des ecritures du journal avec le total
    final SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
    final SQLTable compteTable = base.getTable("COMPTE_PCE");
    final SQLTable ecritureTable = base.getTable("ECRITURE");

    final SQLSelect selAchat = new SQLSelect(base);
    final SQLSelect selVente = new SQLSelect(base);

    selAchat.addSelect(ecritureTable.getField("DEBIT"), "SUM");
    selAchat.addSelect(ecritureTable.getField("CREDIT"), "SUM");

    selVente.addSelect(ecritureTable.getField("DEBIT"), "SUM");
    selVente.addSelect(ecritureTable.getField("CREDIT"), "SUM");

    final Where where = new Where(ecritureTable.getField("ID_COMPTE_PCE"), "=", compteTable.getField("ID"));
    final Where wVente = new Where(compteTable.getField("NUMERO"), "LIKE", "7%");
    final Where wAchat = new Where(compteTable.getField("NUMERO"), "LIKE", "6%");

    selAchat.setWhere(where.and(wAchat));
    selVente.setWhere(where.and(wVente));

    final String reqAchat = selAchat.asString();
    final String reqVente = selVente.asString();

    final Object obAchat = base.getDataSource().execute(reqAchat, new ArrayListHandler());
    final Object obVente = base.getDataSource().execute(reqVente, new ArrayListHandler());

    // FIXME supprimer la boucle une seule ligne retourne
    final List<Object[]> myListAchat = (List<Object[]>) obAchat;
    final int achatsCount = myListAchat.size();
    for (int i = 0; i < achatsCount; i++) {
        final Object[] objTmp = myListAchat.get(i);
        soldeAchat += ((Long) objTmp[0]).longValue() - ((Long) objTmp[1]).longValue();
    }//w  w  w .j  a  va 2s  .c o m

    final List<Object[]> myListVente = (List<Object[]>) obVente;
    final int ventesCount = myListVente.size();
    for (int i = 0; i < ventesCount; i++) {
        final Object[] objTmp = myListVente.get(i);
        soldeVente += ((Long) objTmp[1]).longValue() - ((Long) objTmp[0]).longValue();
    }

    return (soldeVente - soldeAchat);
}

From source file:org.openconcerto.erp.core.finance.accounting.ui.SuppressionEcrituresPanel.java

private int[] getMouvement(int idPiece) {

    int[] idS = null;

    SQLBase b = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
    SQLTable tableMvt = b.getTable("MOUVEMENT");

    SQLSelect sel = new SQLSelect(b);
    sel.addSelect(tableMvt.getField("NUMERO"));
    sel.setWhere(tableMvt.getField("ID_PIECE"), "=", idPiece);

    List l = (List) b.getDataSource().execute(sel.asString(), new ArrayListHandler());

    if (l.size() > 0) {
        idS = new int[l.size()];
    }/*w  w  w.j a  v  a  2 s  .  c o  m*/

    for (int i = 0; i < l.size(); i++) {
        Object[] tmp = (Object[]) l.get(i);
        idS[i] = Integer.parseInt(tmp[0].toString());
    }

    return idS;
}

From source file:org.openconcerto.erp.core.finance.tax.model.TaxeCache.java

public Integer getFirstTaxe() {
    if (this.firstIdTaxe == null) {
        final SQLBase table = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
        final SQLSelect sel = new SQLSelect(table);
        sel.addSelect("TAXE.ID_TAXE");
        sel.addSelect("TAXE.TAUX");
        final String req = sel.asString();
        final List<Object[]> list = (List<Object[]>) table.getDataSource().execute(req, new ArrayListHandler());
        if (list != null && !list.isEmpty()) {
            final Object[] tmp = list.get(0);
            this.firstIdTaxe = Integer.parseInt(tmp[0].toString());
        }/*from ww  w.  java  2s.c om*/
    }
    return this.firstIdTaxe;

}

From source file:org.openconcerto.erp.core.humanresources.payroll.element.FichePayeSQLElement.java

/**
 * Validation de la fiche de paye en cours pour un salari
 * // w  w w .  j ava 2  s .  co m
 * @param id id de la fiche  valider
 */
public static synchronized void validationFiche(int id) {
    final int oldID = id;

    SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
    SQLTable tableSal = base.getTable("SALARIE");
    SQLTable tableCumulConge = base.getTable("CUMULS_CONGES");
    SQLTable tableVariableSal = base.getTable("VARIABLE_SALARIE");
    SQLTable tableFiche = base.getTable("FICHE_PAYE");
    SQLTable tableFicheElt = base.getTable("FICHE_PAYE_ELEMENT");
    SQLTable tableCumuls = base.getTable("CUMULS_PAYE");

    final SQLRowValues rowValsSal = new SQLRowValues(tableSal);

    final SQLRow rowFiche = tableFiche.getRow(oldID);
    final SQLRow rowSal = tableSal.getRow(rowFiche.getInt("ID_SALARIE"));

    // On teste que la fiche est entre dans une priode non cloture
    if (!checkDateValid(id)) {
        String msg = "Impossible de crer la fiche de paye de " + rowSal.getString("NOM") + " "
                + rowSal.getString("PRENOM") + ".\n La priode est cloture.";
        JOptionPane.showMessageDialog(null, msg, "Cration paye impossible", JOptionPane.INFORMATION_MESSAGE);
        return;
    }

    // valider les elements de la fiche
    validElements(id);

    // Sauvegarde des valeurs de la fiche (cumuls, conges, ...)
    stockValidValues(oldID);

    // creer et associer une nouvelle fiche au salarie
    final SQLRowValues rowValsNewFiche = new SQLRowValues(tableFiche);

    try {
        SQLRow r = rowValsNewFiche.insert();
        rowValsNewFiche.put("ID", r.getID());
        // System.err.println("rowValsNewFiche -----> " + r.getID());
    } catch (SQLException e) {
        e.printStackTrace();
    }

    // mis a jour de la periode
    int mois = rowFiche.getInt("ID_MOIS");
    int annee = rowFiche.getInt("ANNEE");
    rowValsNewFiche.put("ID_MOIS", mois);
    rowValsNewFiche.put("ANNEE", annee);
    rowValsNewFiche.put("DU", rowFiche.getObject("DU"));
    rowValsNewFiche.put("AU", rowFiche.getObject("AU"));
    rowValsNewFiche.put("ID_PROFIL_PAYE", rowFiche.getInt("ID_PROFIL_PAYE"));

    /*
     * int ancMois = rowFiche.getInt("ID_MOIS"); int ancAnnee = rowFiche.getInt("ANNEE");
     * 
     * rowValsSal.put("DERNIER_MOIS", ancMois); rowValsSal.put("DERNIERE_ANNEE", ancAnnee);
     * 
     * try { rowValsSal.update(rowFiche.getInt("ID_SALARIE")); } catch (SQLException e1) {
     * e1.printStackTrace(); }
     * 
     * int mois = ancMois - 2; mois = (mois + 1) % 12; mois += 2; int annee = ancAnnee; if (mois
     * == 2) { annee++; } rowValsNewFiche.put("ID_MOIS", mois); rowValsNewFiche.put("ANNEE",
     * annee); rowValsNewFiche.put("ID_PROFIL_PAYE", rowFiche.getInt("ID_PROFIL_PAYE"));
     * 
     * try { rowValsNewFiche.update(); } catch (SQLException e) { e.printStackTrace(); }
     */

    rowValsNewFiche.put("ID_SALARIE", rowSal.getID());
    rowValsSal.put("ID_FICHE_PAYE", rowValsNewFiche.getID());

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            try {
                // System.err.println("Update Salarie");
                rowValsSal.update(rowSal.getID());

                rowValsNewFiche.update();
            } catch (SQLException e1) {
                e1.printStackTrace();
            }
        }
    });
    // On recupere la liste des elements de la fiche de paye
    SQLSelect selAllElt = new SQLSelect(tableFiche.getBase());
    selAllElt.addSelect(tableFicheElt.getField("ID"));
    selAllElt.addSelect(tableFicheElt.getField("POSITION"));
    selAllElt.setWhere("FICHE_PAYE_ELEMENT.ID_FICHE_PAYE", "=", oldID);
    // selAllElt.setArchivedPolicy(SQLSelect.BOTH);
    selAllElt.setDistinct(true);
    selAllElt.addRawOrder("\"FICHE_PAYE_ELEMENT\".\"POSITION\"");
    String req = selAllElt.asString();
    // System.err.println(req);
    Object[] ob = ((ArrayList) base.getDataSource().execute(req, new ArrayListHandler())).toArray();

    // System.err.println("Copie de " + ob.length + " lments");
    for (int i = 0; i < ob.length; i++) {
        Object[] tmp = (Object[]) ob[i];

        SQLRow rowTmpElt = tableFicheElt.getRow(Integer.parseInt(tmp[0].toString()));

        String source = rowTmpElt.getString("SOURCE");
        int idSource = rowTmpElt.getInt("IDSOURCE");
        int pos = rowTmpElt.getInt("POSITION");

        SQLRowValues rowValsTmp = new SQLRowValues(tableFicheElt);
        rowValsTmp.put("SOURCE", source);
        rowValsTmp.put("IDSOURCE", idSource);
        rowValsTmp.put("POSITION", pos);
        rowValsTmp.put("ID_FICHE_PAYE", rowValsNewFiche.getID());

        try {
            rowValsTmp.commit();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    // on effectue le cumul
    // System.err.println("Calcul des cumuls");
    int idCumuls = rowSal.getInt("ID_CUMULS_PAYE");
    SQLRow rowCumuls = tableCumuls.getRow(idCumuls);

    float salBrut = rowCumuls.getFloat("SAL_BRUT_C") + rowFiche.getFloat("SAL_BRUT");
    float cgs = rowCumuls.getFloat("CSG_C") + rowFiche.getFloat("CSG");
    float cotSal = rowCumuls.getFloat("COT_SAL_C") + rowFiche.getFloat("COT_SAL");
    float cotPat = rowCumuls.getFloat("COT_PAT_C") + rowFiche.getFloat("COT_PAT");
    float netImp = rowCumuls.getFloat("NET_IMP_C") + rowFiche.getFloat("NET_IMP");
    float netAPayer = rowCumuls.getFloat("NET_A_PAYER_C") + rowFiche.getFloat("NET_A_PAYER")
            + rowFiche.getFloat("ACOMPTE");

    SQLRowValues rowValsCumul = new SQLRowValues(tableCumuls);
    rowValsCumul.put("SAL_BRUT_C", new Float(salBrut));
    rowValsCumul.put("COT_SAL_C", new Float(cotSal));
    rowValsCumul.put("COT_PAT_C", new Float(cotPat));
    rowValsCumul.put("NET_IMP_C", new Float(netImp));
    rowValsCumul.put("NET_A_PAYER_C", new Float(netAPayer));
    rowValsCumul.put("CSG_C", new Float(cgs));

    try {
        SQLRow r = rowValsCumul.insert();
        rowValsCumul.put("ID", r.getID());
    } catch (SQLException e) {
        e.printStackTrace();
    }

    // System.err.println("Mis a jour de la fiche de paye");
    rowValsSal.put("ID_CUMULS_PAYE", rowValsCumul.getID());

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            try {
                rowValsSal.update(rowFiche.getInt("ID_SALARIE"));
            } catch (SQLException e1) {
                e1.printStackTrace();
            }
        }
    });
    // Calcul des congs
    final SQLRow rowCumulConge = tableCumulConge.getRow(rowSal.getInt("ID_CUMULS_CONGES"));
    final SQLRow rowVarSal = tableVariableSal.getRow(rowSal.getInt("ID_VARIABLE_SALARIE"));
    float congeCumule = rowCumulConge.getFloat("ACQUIS");
    float congeRestant = rowCumulConge.getFloat("RESTANT");

    float prisPeriode = rowVarSal.getFloat("CONGES_PRIS");
    congeRestant -= prisPeriode;

    SQLTable tableInfosSalPaye = base.getTable("INFOS_SALARIE_PAYE");
    final SQLRow rowSalInfosPaye = tableInfosSalPaye.getRow(rowSal.getInt("ID_INFOS_SALARIE_PAYE"));

    congeCumule += rowFiche.getFloat("CONGES_ACQUIS");

    final SQLRowValues rowValsCumulsConges = new SQLRowValues(tableCumulConge);

    // Si on passe le 1 juin
    // FIXME est ce que les conges nonpris sont  indemniser
    /*
     * if (mois == 7) { congeRestant = congeCumule; congeCumule = 0; }
     */

    rowValsCumulsConges.put("ACQUIS", new Float(congeCumule));
    rowValsCumulsConges.put("RESTANT", new Float(congeRestant));

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            try {
                rowValsCumulsConges.update(rowCumulConge.getID());
                rowValsNewFiche.put("CONGES_ACQUIS", new Float(rowSalInfosPaye.getFloat("CONGES_PAYES")));
                rowValsNewFiche.update();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    });
    final SQLRowValues rowValsOldFiche = new SQLRowValues(tableFiche);
    rowValsOldFiche.put("VALIDE", Boolean.TRUE);

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            try {
                rowValsOldFiche.update(rowFiche.getID());
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    });
    // Remise  0 des variables sal
    final SQLRowValues rowVals = new SQLRowValues(tableVariableSal);

    for (Iterator i = tableVariableSal.getContentFields().iterator(); i.hasNext();) {

        String field = i.next().toString().trim();
        field = field.substring(field.indexOf('.') + 1, field.length() - 1);
        rowVals.put(field, new Float(0));
    }
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            try {
                rowVals.update(rowVarSal.getID());
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:org.openconcerto.erp.core.humanresources.payroll.element.VariablePayeSQLElement.java

public static final Map<String, List<?>> getMapTree() {

    SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
    SQLBase baseCommon = Configuration.getInstance().getBase();
    SQLTable tableVar = baseCommon.getTable("VARIABLE_PAYE");
    SQLTable tableCumulsConges = base.getTable("CUMULS_CONGES");
    SQLTable tableCumulsPaye = base.getTable("CUMULS_PAYE");

    Map<String, List<?>> mapTree = new HashMap<String, List<?>>();

    // Variables propre au salari
    List<SQLField> varSal = new ArrayList<SQLField>();

    for (SQLField field : getTableVarSal().getContentFields()) {

        varSal.add(field);/*from   ww  w. j a va 2 s  .  c o m*/
    }
    for (SQLField field : tableCumulsConges.getContentFields()) {

        varSal.add(field);
    }

    for (SQLField field : tableCumulsPaye.getContentFields()) {

        varSal.add(field);
    }

    mapTree.put("Infos priode", varSal);

    List<SQLField> l = new ArrayList<SQLField>();
    SQLTable tableInfos = base.getTable("INFOS_SALARIE_PAYE");
    l.add(tableInfos.getField("DUREE_HEBDO"));
    l.add(tableInfos.getField("DUREE_MOIS"));
    l.add(tableInfos.getField("SALAIRE_MOIS"));
    l.add(tableInfos.getField("TAUX_AT"));
    l.add(tableInfos.getField("CONGES_PAYES"));
    mapTree.put("Contrat salari", l);

    List<SQLField> l2 = new ArrayList<SQLField>();
    SQLTable tableFichePaye = base.getTable("FICHE_PAYE");
    l2.add(tableFichePaye.getField("CONGES_ACQUIS"));
    l2.add(tableFichePaye.getField("ACOMPTE"));
    l2.add(tableFichePaye.getField("SAL_BRUT"));
    l2.add(tableFichePaye.getField("COT_PAT"));
    l2.add(tableFichePaye.getField("COT_SAL"));
    l2.add(tableFichePaye.getField("NET_IMP"));
    l2.add(tableFichePaye.getField("NET_A_PAYER"));
    l2.add(tableFichePaye.getField("CSG"));
    mapTree.put("Contenu paye", l2);

    /*
     * List lEtat = new ArrayList(); SQLTable tableEtat =
     * Configuration.getInstance().getBase().getTable("ETAT_CIVIL");
     * lEtat.add(tableEtat.getField("NB_ENFANTS"));
     * lEtat.add(tableEtat.getField("NB_PERS_A_CHARGE")); mapTree.put("Salarie.etat_civil",
     * lEtat);
     */

    SQLSelect selAllVarID = new SQLSelect(tableVar.getBase());

    selAllVarID.addSelect(tableVar.getField("ID"));
    selAllVarID.addRawOrder("LENGTH(\"VARIABLE_PAYE\".\"NOM\") DESC");

    String reqAllVarID = selAllVarID.asString();
    Object[] objKeysRowVar = ((List) tableVar.getBase().getDataSource().execute(reqAllVarID,
            new ArrayListHandler())).toArray();

    List<SQLRow> lVar = new ArrayList<SQLRow>();
    for (int i = 0; i < objKeysRowVar.length; i++) {
        Object[] tmp = (Object[]) objKeysRowVar[i];
        lVar.add(tableVar.getRow(Integer.parseInt(tmp[0].toString())));
    }

    if (lVar.size() > 0) {
        mapTree.put("Variables", lVar);
    }

    List<Map<String, String>> fonction = new ArrayList<Map<String, String>>();
    Map<String, String> listFonction = new HashMap<String, String>();
    listFonction.put("Minimum", "Math.min()");
    listFonction.put("Maximum", "Math.max()");
    listFonction.put("Valeur absolue", "Math.abs()");
    listFonction.put("Arrondi", "Math.round()");

    fonction.add(listFonction);

    mapTree.put("Fonctions", fonction);
    // Chargement des variables dans l'diteur
    // System.out.println(mapTree);

    return mapTree;
}

From source file:org.openconcerto.erp.core.humanresources.payroll.element.VariablePayeSQLElement.java

public SQLComponent createComponent() {

    return new BaseSQLComponent(this) {

        private ValidState validVarName;
        private JRadioButton radioVal = new JRadioButton("Valeur");
        private JRadioButton radioFormule = new JRadioButton("Formule");

        private final JTextField textValeur = new JTextField();
        // private final ITextArea textFormule = new ITextArea();
        private final VariableTree treeVariable = new VariableTree();
        private final JTextField textNom = new JTextField();
        private final JLabel labelWarningBadVar = new JLabelWarning();
        private ElementComboBox comboSelSal;
        private EditFrame edit = null;
        private final SQLJavaEditor textFormule = new SQLJavaEditor(getMapTree());

        public void addViews() {
            this.setLayout(new GridBagLayout());
            final GridBagConstraints c = new DefaultGridBagConstraints();

            this.validVarName = null;
            this.textFormule.setEditable(false);

            // Arbre des variables
            JScrollPane sc = new JScrollPane(this.treeVariable);
            sc.setPreferredSize(new Dimension(150, sc.getPreferredSize().height));

            this.treeVariable.addMouseListener(new MouseAdapter() {
                public void mousePressed(final MouseEvent mE) {
                    if (mE.getButton() == MouseEvent.BUTTON3) {
                        JPopupMenu menuDroit = new JPopupMenu();

                        TreePath path = treeVariable.getClosestPathForLocation(mE.getPoint().x,
                                mE.getPoint().y);

                        final Object obj = path.getLastPathComponent();

                        if ((obj == null) || !(obj instanceof VariableRowTreeNode)) {
                            return;
                        }// w w w  .  ja va  2s .  c  om

                        menuDroit.add(new AbstractAction("Editer") {
                            public void actionPerformed(ActionEvent e) {
                                if (edit == null) {
                                    edit = new EditFrame(getElement(), EditFrame.MODIFICATION);
                                }

                                System.err.println("Action performed");

                                if (obj != null) {
                                    System.err.println("Object not null --> " + obj.toString());
                                    if (obj instanceof VariableRowTreeNode) {
                                        System.err.println("Object VariableRowTreeNode");
                                        VariableRowTreeNode varNode = (VariableRowTreeNode) obj;

                                        edit.selectionId(varNode.getID(), 1);
                                        edit.setVisible(true);
                                    }
                                }
                            }
                        });
                        menuDroit.show((Component) mE.getSource(), mE.getPoint().x, mE.getPoint().y);
                    } else {
                        if (mE.getClickCount() == 2) {
                            TreePath path = treeVariable.getClosestPathForLocation(mE.getPoint().x,
                                    mE.getPoint().y);
                            Object obj = path.getLastPathComponent();

                            if (obj != null) {
                                if (obj instanceof FormuleTreeNode) {
                                    final FormuleTreeNode n = (FormuleTreeNode) obj;

                                    int start = textFormule.getSelectionStart();
                                    String tmp = textFormule.getText();
                                    textFormule.setText(tmp.substring(0, start) + n.getTextValue()
                                            + tmp.substring(start, tmp.length()));
                                }
                            }
                        }
                    }
                }
            });

            JPanel panelDroite = new JPanel();
            panelDroite.setLayout(new GridBagLayout());

            // Categorie
            JTextField textCategorie = new JTextField();
            c.fill = GridBagConstraints.HORIZONTAL;
            c.gridheight = 1;
            c.gridx = 1;
            c.gridy = 0;
            JLabel labelCategorie = new JLabel("Catgorie");
            panelDroite.add(labelCategorie, c);
            c.gridx++;
            c.gridwidth = GridBagConstraints.REMAINDER;
            panelDroite.add(textCategorie, c);
            c.gridwidth = 1;

            // Nom
            c.fill = GridBagConstraints.HORIZONTAL;
            c.gridheight = 1;
            c.gridx = 1;
            c.gridy++;
            JLabel labelNom = new JLabel("Nom");
            panelDroite.add(labelNom, c);

            c.gridx++;
            c.weightx = 1;
            panelDroite.add(this.textNom, c);

            this.textNom.getDocument().addDocumentListener(new SimpleDocumentListener() {
                @Override
                public void update(DocumentEvent e) {
                    updateValidVarName();
                }
            });

            c.gridx++;
            c.weightx = 0;
            panelDroite.add(this.labelWarningBadVar, c);

            // Description
            JLabel labelInfos = new JLabel(getLabelFor("INFOS"));
            ITextArea textInfos = new ITextArea();
            c.gridy++;
            c.gridx = 1;
            c.gridwidth = 1;
            c.weightx = 0;
            panelDroite.add(labelInfos, c);
            c.gridx++;
            c.gridwidth = GridBagConstraints.REMAINDER;
            c.weightx = 1;
            c.weighty = 0;
            panelDroite.add(textInfos, c);

            // Valeur
            c.gridx = 1;
            c.gridy++;
            c.gridwidth = 1;
            c.weightx = 0;
            panelDroite.add(this.radioVal, c);

            c.gridx++;
            c.weightx = 1;
            c.gridwidth = GridBagConstraints.REMAINDER;
            panelDroite.add(this.textValeur, c);

            c.gridwidth = 1;
            c.gridx = 1;
            c.gridy++;
            panelDroite.add(this.radioFormule, c);

            c.gridx++;
            c.weightx = 1;
            c.weighty = 1;
            c.fill = GridBagConstraints.BOTH;
            c.gridwidth = GridBagConstraints.REMAINDER;
            panelDroite.add(this.textFormule, c);
            c.gridwidth = 1;

            ButtonGroup group = new ButtonGroup();
            group.add(this.radioVal);
            group.add(this.radioFormule);

            this.radioVal.setSelected(true);
            setFormuleEnabled(false);

            this.radioVal.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {

                    setFormuleEnabled(false);
                }
            });
            this.radioFormule.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {

                    setFormuleEnabled(true);
                }
            });

            c.gridy++;
            c.gridx = 1;
            c.weighty = 0;
            c.weightx = 0;
            c.fill = GridBagConstraints.HORIZONTAL;

            this.comboSelSal = new ElementComboBox(false);
            this.comboSelSal.init(getDirectory().getElement(SalarieSQLElement.class));

            c.gridx++;
            c.gridwidth = GridBagConstraints.REMAINDER;
            c.weightx = 0;
            panelDroite.add(this.comboSelSal, c);
            c.gridwidth = 1;

            JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sc, panelDroite);

            c.fill = GridBagConstraints.BOTH;
            c.gridx = 0;
            c.gridy = 0;
            c.weightx = 1;
            c.weighty = 1;
            this.add(split, c);

            this.addRequiredSQLObject(this.textNom, "NOM");
            this.addSQLObject(this.textValeur, "VALEUR");
            this.addSQLObject(this.textFormule, "FORMULE");
            this.addSQLObject(textCategorie, "CATEGORIE");
            this.addSQLObject(textInfos, "INFOS");

            this.comboSelSal.addValueListener(new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    // TODO Auto-generated method stub
                    textFormule.setSalarieID(comboSelSal.getSelectedId());
                }
            });
        }

        @Override
        public synchronized ValidState getValidState() {
            return super.getValidState().and(this.validVarName);
        }

        private void setFormuleEnabled(boolean b) {

            if (b) {
                this.textValeur.setText("");
            } else {
                this.textFormule.setText("");
            }

            this.textValeur.setEditable(!b);
            this.textValeur.setEnabled(!b);
            this.textFormule.setEditable(b);
            this.textFormule.setEnabled(b);
            this.treeVariable.setEnabled(b);
            this.treeVariable.setEditable(b);
        }

        private void setValidVarName(ValidState s) {
            if (!s.equals(this.validVarName)) {
                this.validVarName = s;
                final boolean warningVisible = !s.isValid();
                if (warningVisible)
                    this.labelWarningBadVar.setText(s.getValidationText());
                this.labelWarningBadVar.setVisible(warningVisible);
                this.fireValidChange();
            }
        }

        private void updateValidVarName() {
            this.setValidVarName(this.computeValidVarName());
        }

        private ValidState computeValidVarName() {
            // on vrifie si la syntaxe de la variable est correct (chiffre lettre et _)
            final String varName = this.textNom.getText().trim();

            System.err.println("Verification de la validit du nom de la variable.");

            if (varName.length() == 0) {
                return VAR_NO_NAME;
            }

            // ne contient que des chiffre lettre et _ et ne commence pas par un chiffre
            if (!isJavaVar(varName)) {
                return VAR_NAME_NOT_CORRECT;
            }

            // on vrifie que la variable n'existe pas dja
            SQLSelect selAllVarName = new SQLSelect(getTable().getBase());

            selAllVarName.addSelect(VariablePayeSQLElement.this.getTable().getField("ID"));
            Where w = new Where(VariablePayeSQLElement.this.getTable().getField("NOM"), "=", varName);
            w = w.and(new Where(VariablePayeSQLElement.this.getTable().getKey(), "!=", getSelectedID()));
            selAllVarName.setWhere(w);

            String reqAllVarName = selAllVarName.asString();// + " AND '" + varName.trim() + "'
            // REGEXP VARIABLE_PAYE.NOM";
            Object[] objKeysRowName = ((List) getTable().getBase().getDataSource().execute(reqAllVarName,
                    new ArrayListHandler())).toArray();

            if (objKeysRowName.length > 0) {
                return VAR_ALREADY_EXIST;
            } else {

                // Impossible de crer une variable du meme nom qu'un champ du salarie
                if (isForbidden(varName))
                    return VAR_ALREADY_EXIST;

                this.textFormule.setVarAssign(varName);
                return ValidState.getTrueInstance();
            }
        }

        private boolean isJavaVar(String s) {
            if ((s.charAt(0) >= '0') && ((s.charAt(0) <= '9'))) {
                System.err.println("Erreur la variable commence par un chiffre!!");
                return false;
            } else {
                for (int i = 0; i < s.length(); i++) {

                    if (!(((s.charAt(i) >= '0') && (s.charAt(i) <= '9'))
                            || (s.charAt(i) >= 'a') && (s.charAt(i) <= 'z')
                            || (s.charAt(i) >= 'A') && (s.charAt(i) <= 'Z') || (s.charAt(i) == '_'))) {
                        System.err.println("Erreur la variable contient un caractere incorrect!!");
                        return false;
                    }
                }

                return (!CTokenMarker.getKeywords().isExisting(s));
            }
        }

        @Override
        public void select(SQLRowAccessor r) {

            super.select(r);
            // System.err.println("Select RowAccess -------> " + r.getID() + " For Object " +
            // this.hashCode());
            if (r != null) {
                if (r.getString("FORMULE").trim().length() == 0) {
                    this.radioVal.setSelected(true);
                    setFormuleEnabled(false);
                } else {
                    this.radioFormule.setSelected(true);
                    setFormuleEnabled(true);
                }

                this.textFormule.setVarAssign(r.getString("NOM"));
            }

            this.updateValidVarName();
        }
    };
}

From source file:org.openconcerto.erp.core.humanresources.payroll.element.VariablePayeSQLElement.java

private void secureArchiveVariable(int id) throws SQLException {
    SQLRow row = getTable().getRow(id);/*from w w w .  j av  a  2s  .  co  m*/

    // FIXME verifier que la variable n'est pas utilise dans une rubrique
    if (row != null) {
        SQLSelect sel = new SQLSelect(getTable().getBase());
        sel.addSelect(getTable().getField("ID"));
        System.err.println("Check variable");
        sel.setWhere(new Where(getTable().getField("FORMULE"), "LIKE", "%" + row.getString("NOM") + "%"));
        sel.andWhere(new Where(getTable().getField("ID"), "!=", id));

        String req = sel.asString();
        List l = (List) getTable().getBase().getDataSource().execute(req, new ArrayListHandler());
        if (l.size() == 0) {
            super.archive(getTable().getRow(id));
        } else {
            System.err.println("Suppression impossible, cette variable est rfrence par une autre.");
            ExceptionHandler.handle("Suppression impossible, cette variable est rfrence par une autre.");
        }

    } else {
        super.archive(getTable().getRow(id), true);
    }
}

From source file:org.openconcerto.erp.core.humanresources.payroll.report.EtatChargesPayeSheet.java

protected void createMap() {

    this.mapReplace = new HashMap();
    this.mCell = new HashMap();
    this.mapStyleRow = new HashMap();

    SQLSelect sel = new SQLSelect(base);
    sel.addSelect(tableFichePaye.getField("ID"));
    sel.addSelect(tableFichePayeElement.getField("ID"));
    // sel.addSelect(tableSalarie.getField("ID"));

    Where w = (new Where(tableFichePayeElement.getField("ID_FICHE_PAYE"), "=", tableFichePaye.getField("ID")));
    Where w6 = (new Where(tableFichePayeElement.getField("SOURCE"), "=", "RUBRIQUE_COTISATION"));
    // Where w2 = (new Where(tableFichePaye.getField("ID_SALARIE"), "=",
    // tableSalarie.getField("ID")));
    Where w3 = (new Where(tableFichePaye.getField("ID_MOIS"), new Integer(this.moisDu),
            new Integer(this.moisAu)));
    Where w4 = (new Where(tableFichePaye.getField("ANNEE"), "=", new Integer(this.annee)));
    Where w5 = (new Where(tableFichePaye.getField("VALIDE"), "=", Boolean.TRUE));

    sel.setWhere(w);/*from   w  ww .  j  a  v a 2s.c o m*/
    // sel.andWhere(w2);
    sel.andWhere(w3);
    sel.andWhere(w4);
    sel.andWhere(w5);
    sel.andWhere(w6);
    sel.setDistinct(true);
    String req = sel.asString();

    System.err.println(req);

    // Liste des rubriques de chaque salaries
    List l = (List) base.getDataSource().execute(req, new ArrayListHandler());

    // Association idCaisse, Map rowValsRubCotCumul
    Map mapCaisse = new HashMap();
    Map mapFiche = new HashMap();

    // Cumuls des rubriques de cotisations par caisse
    for (int i = 0; i < l.size(); i++) {
        Object[] tmp = (Object[]) l.get(i);
        mapFiche.put(tmp[0], "");
        int idFicheElt = Integer.parseInt(tmp[1].toString());

        SQLRow rowFicheElt = tableFichePayeElement.getRow(idFicheElt);
        SQLRow rowRub = tableRubCot.getRow(rowFicheElt.getInt("IDSOURCE"));

        // On recupere la map de la caisse
        Map mapValueRub;
        if (mapCaisse.containsKey(new Integer(rowRub.getInt("ID_CAISSE_COTISATION")))) {
            mapValueRub = (Map) mapCaisse.get(new Integer(rowRub.getInt("ID_CAISSE_COTISATION")));
        } else {
            mapValueRub = new HashMap();
            mapCaisse.put(new Integer(rowRub.getInt("ID_CAISSE_COTISATION")), mapValueRub);
        }

        // on recupere la rowvalues de la rubrique
        SQLRowValues rowVals;
        if (mapValueRub.containsKey(rowFicheElt.getObject("IDSOURCE"))) {
            rowVals = (SQLRowValues) mapValueRub.get(rowFicheElt.getObject("IDSOURCE"));
            // on cumule les donnes
            if (rowFicheElt.getObject("NB_BASE") != null) {
                Object o = rowVals.getObject("NB_BASE");
                float base = (o == null) ? 0.0F : ((Float) o).floatValue();
                base += rowFicheElt.getFloat("NB_BASE");
                rowVals.put("NB_BASE", new Float(base));
            }
            if (rowFicheElt.getObject("MONTANT_PAT") != null) {
                Object o = rowVals.getObject("MONTANT_PAT");
                float montant = (o == null) ? 0.0F : ((Float) o).floatValue();
                montant += rowFicheElt.getFloat("MONTANT_PAT");
                rowVals.put("MONTANT_PAT", new Float(montant));
            }
            if (rowFicheElt.getObject("MONTANT_SAL_DED") != null) {
                Object o = rowVals.getObject("MONTANT_SAL_DED");
                float montant = (o == null) ? 0.0F : ((Float) o).floatValue();
                montant += rowFicheElt.getFloat("MONTANT_SAL_DED");
                rowVals.put("MONTANT_SAL_DED", new Float(montant));
            }
        } else {
            rowVals = new SQLRowValues(tableFichePayeElement);
            Configuration.getInstance().getDirectory().getElement(tableFichePayeElement).loadAllSafe(rowVals,
                    rowFicheElt);
            float montantPat, montantSal;

            Object o = rowVals.getObject("MONTANT_PAT");
            montantPat = (o == null) ? 0.0F : ((Float) o).floatValue();

            o = rowVals.getObject("MONTANT_SAL_DED");
            montantSal = (o == null) ? 0.0F : ((Float) o).floatValue();

            if (montantPat != 0 || montantSal != 0) {
                mapValueRub.put(rowFicheElt.getObject("IDSOURCE"), rowVals);
            }
        }

    }

    // Fill
    int posLine = 1;
    int firstLine = 1;

    System.err.println("Dump fiche " + mapFiche);
    System.err.println("NB Pages = " + mapCaisse.keySet().size());

    for (int n = 0; n < mapCaisse.keySet().size(); n++) {

        // entete
        makeEntete(posLine);
        posLine += (debutFill - 1);

        Map mapValue = (Map) mapCaisse.get(mapCaisse.keySet().toArray()[n]);
        float totalMontantSal = 0.0F;
        float totalMontantPat = 0.0F;

        SQLRow rowCaisse = tableCaisse.getRow(Integer.parseInt(mapCaisse.keySet().toArray()[n].toString()));
        this.mCell.put("A" + posLine, "Caisse " + rowCaisse.getObject("NOM"));
        this.mCell.put("B" + posLine, "");
        this.mCell.put("C" + posLine, "");
        this.mCell.put("D" + posLine, "");
        this.mCell.put("E" + posLine, "");
        this.mCell.put("F" + posLine, "");
        this.mapStyleRow.put(new Integer(posLine), "Titre 1");

        posLine++;

        for (int i = 0; i < mapValue.keySet().size(); i++) {
            SQLRowValues rowVals = (SQLRowValues) mapValue.get(mapValue.keySet().toArray()[i]);

            this.mCell.put("A" + posLine, rowVals.getObject("NOM"));
            this.mCell.put("B" + posLine, rowVals.getObject("NB_BASE"));

            Float oTxSal = (Float) rowVals.getObject("TAUX_SAL");
            float txSal = (oTxSal == null) ? 0.0F : oTxSal.floatValue();
            Float oTxPat = (Float) rowVals.getObject("TAUX_PAT");
            float txPat = (oTxPat == null) ? 0.0F : oTxPat.floatValue();
            this.mCell.put("C" + posLine, new Float(txSal + txPat));

            System.err.println(rowVals.getObject("MONTANT_SAL_DED").getClass());
            Float oMontantSal = (Float) rowVals.getObject("MONTANT_SAL_DED");
            float montantSal = (oMontantSal == null) ? 0.0F : oMontantSal.floatValue();
            Float oMontantPat = (Float) rowVals.getObject("MONTANT_PAT");
            float montantPat = (oMontantPat == null) ? 0.0F : oMontantPat.floatValue();
            this.mCell.put("D" + posLine, new Float(montantPat));
            this.mCell.put("E" + posLine, new Float(montantSal));
            this.mCell.put("F" + posLine, new Float(montantSal + montantPat));
            totalMontantPat += montantPat;
            totalMontantSal += montantSal;

            this.mapStyleRow.put(new Integer(posLine), "Normal");
            posLine++;
        }

        this.mCell.put("A" + posLine, "Total");
        this.mCell.put("B" + posLine, "");
        this.mCell.put("C" + posLine, "");
        this.mCell.put("D" + posLine, new Float(totalMontantPat));
        this.mCell.put("E" + posLine, new Float(totalMontantSal));
        this.mCell.put("F" + posLine, new Float(totalMontantPat + totalMontantSal));
        this.mapStyleRow.put(new Integer(posLine), "Titre 1");

        // pied de page
        posLine = firstLine + endFill - 1;
        posLine += 2;
        makeBasPage(posLine);

        posLine++;
        firstLine = posLine;
    }

    this.nbPage = mapCaisse.size();

    System.err.println("Nombre de page " + this.nbPage);

    // on conserve la page d'origine du model

    if (this.nbPage > 0) {
        this.nbPage--;
    }
}