OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 149 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 149 Rev 185
Line 1... Line 1...
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
Line 16... Line 16...
16
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
16
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
17
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
17
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
18
import org.openconcerto.sql.model.SQLRow;
18
import org.openconcerto.sql.model.SQLRow;
19
import org.openconcerto.sql.model.SQLRowValues;
19
import org.openconcerto.sql.model.SQLRowValues;
20
import org.openconcerto.sql.model.SQLTable;
20
import org.openconcerto.sql.model.SQLTable;
21
import org.openconcerto.utils.ExceptionHandler;
-
 
22
import org.openconcerto.utils.GestionDevise;
21
import org.openconcerto.utils.GestionDevise;
23
 
22
 
24
import java.sql.SQLException;
23
import java.sql.SQLException;
25
import java.util.Date;
24
import java.util.Date;
26
 
25
 
27
public final class GenerationMvtAcompte extends GenerationEcritures implements Runnable {
26
public final class GenerationMvtAcompte extends GenerationEcritures {
28
 
27
 
29
    private int idSalarie;
28
    private int idSalarie;
30
    private long montant;
29
    private long montant;
31
    private int idAcompte;
30
    private int idAcompte;
32
 
31
 
Line 42... Line 41...
42
        setRowAnalytiqueSource(rowAcompte);
41
        setRowAnalytiqueSource(rowAcompte);
43
        this.idSalarie = rowAcompte.getInt("ID_SALARIE");
42
        this.idSalarie = rowAcompte.getInt("ID_SALARIE");
44
        this.montant = GestionDevise.parseLongCurrency(String.valueOf(rowAcompte.getFloat("MONTANT")));
43
        this.montant = GestionDevise.parseLongCurrency(String.valueOf(rowAcompte.getFloat("MONTANT")));
45
        SQLRow rowSal = tableSalarie.getRow(this.idSalarie);
44
        SQLRow rowSal = tableSalarie.getRow(this.idSalarie);
46
        this.idMvt = getNewMouvement("ACOMPTE", this.idAcompte, 1, "Acompte " + rowSal.getString("NOM"));
45
        this.idMvt = getNewMouvement("ACOMPTE", this.idAcompte, 1, "Acompte " + rowSal.getString("NOM"));
47
        new Thread(GenerationMvtAcompte.this).start();
46
        genereComptaAcompte();
48
    }
47
    }
49
 
48
 
50
    private void genereComptaAcompte() throws Exception {
49
    private void genereComptaAcompte() throws SQLException {
51
 
50
 
52
        System.out.println("Génération des ecritures du mouvement " + this.idMvt);
51
        System.out.println("Génération des ecritures du mouvement " + this.idMvt);
53
 
52
 
54
        SQLRow rowSal = tableSalarie.getRow(this.idSalarie);
53
        SQLRow rowSal = tableSalarie.getRow(this.idSalarie);
55
        // iniatilisation des valeurs de la map
54
        // iniatilisation des valeurs de la map
Line 97... Line 96...
97
 
96
 
98
        rowVals.update(this.idAcompte);
97
        rowVals.update(this.idAcompte);
99
 
98
 
100
    }
99
    }
101
 
100
 
102
    public void run() {
-
 
103
 
-
 
104
        try {
-
 
105
            genereComptaAcompte();
-
 
106
        } catch (Exception e) {
-
 
107
            ExceptionHandler.handle("Erreur lors de la génération des mouvements", e);
-
 
108
        }
-
 
109
    }
-
 
110
}
101
}