OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 177 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 36... Line 36...
36
import java.util.HashMap;
36
import java.util.HashMap;
37
import java.util.List;
37
import java.util.List;
38
import java.util.Map;
38
import java.util.Map;
39
 
39
 
40
// FIXME mettre toute les generations dans des threads à part
40
// FIXME mettre toute les generations dans des threads à part
41
public final class GenerationMvtReglementFactureFournisseur extends GenerationEcritures implements Runnable {
41
public final class GenerationMvtReglementFactureFournisseur extends GenerationEcritures  {
42
 
42
 
43
    private int idfacture;
43
    private int idfacture;
44
 
44
 
45
    // Journal Caisse
45
    // Journal Caisse
46
    private static final Integer journalCaisse = Integer.valueOf(JournalSQLElement.CAISSES);
46
    private static final Integer journalCaisse = Integer.valueOf(JournalSQLElement.CAISSES);
Line 48... Line 48...
48
    private static final SQLTable tablePrefCompte = base.getTable("PREFS_COMPTE");
48
    private static final SQLTable tablePrefCompte = base.getTable("PREFS_COMPTE");
49
    private static final SQLTable tableMouvement = base.getTable("MOUVEMENT");
49
    private static final SQLTable tableMouvement = base.getTable("MOUVEMENT");
50
    private static final SQLRow rowPrefsCompte = tablePrefCompte.getRow(2);
50
    private static final SQLRow rowPrefsCompte = tablePrefCompte.getRow(2);
51
    private int idPere = 1; // Id du mouvement pere
51
    private int idPere = 1; // Id du mouvement pere
52
 
52
 
53
    public GenerationMvtReglementFactureFournisseur(int idFacture, int idMvt) {
53
    public GenerationMvtReglementFactureFournisseur(int idFacture, int idMvt) throws SQLException {
54
        this.idfacture = idFacture;
54
        this.idfacture = idFacture;
55
        this.idPere = idMvt;
55
        this.idPere = idMvt;
56
        new Thread(GenerationMvtReglementFactureFournisseur.this).start();
56
        genereReglement();
57
    }
57
    }
58
 
58
 
59
    private void genereReglement() throws Exception {
59
    private void genereReglement() throws SQLException {
60
 
60
 
61
        System.out.println("Génération des ecritures du reglement du mouvement " + this.idMvt);
61
        System.out.println("Génération des ecritures du reglement du mouvement " + this.idMvt);
62
 
62
 
63
        SQLRow saisieRow = base.getTable("FACTURE_FOURNISSEUR").getRow(this.idfacture);
63
        SQLRow saisieRow = base.getTable("FACTURE_FOURNISSEUR").getRow(this.idfacture);
64
        SQLRow modeRegRow = base.getTable("MODE_REGLEMENT").getRow(saisieRow.getInt("ID_MODE_REGLEMENT"));
64
        SQLRow modeRegRow = base.getTable("MODE_REGLEMENT").getRow(saisieRow.getInt("ID_MODE_REGLEMENT"));
Line 247... Line 247...
247
 
247
 
248
    }
248
    }
249
 
249
 
250
    public void run() {
250
    public void run() {
251
        try {
251
        try {
252
            genereReglement();
-
 
-
 
252
          
253
        } catch (Exception e) {
253
        } catch (Exception e) {
254
            ExceptionHandler.handle("Erreur pendant la générations des écritures comptables", e);
254
            ExceptionHandler.handle("Erreur pendant la générations des écritures comptables", e);
255
            e.printStackTrace();
255
            e.printStackTrace();
256
        }
256
        }
257
    }
257
    }