OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 174 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 174 Rev 180
Line 14... Line 14...
14
 package org.openconcerto.erp.generationEcritures;
14
 package org.openconcerto.erp.generationEcritures;
15
 
15
 
16
import org.openconcerto.erp.core.common.ui.TotalCalculator;
16
import org.openconcerto.erp.core.common.ui.TotalCalculator;
17
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
17
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
18
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
18
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
-
 
19
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProvider;
-
 
20
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProviderManager;
19
import org.openconcerto.sql.model.SQLRow;
21
import org.openconcerto.sql.model.SQLRow;
20
import org.openconcerto.sql.model.SQLRowAccessor;
22
import org.openconcerto.sql.model.SQLRowAccessor;
21
import org.openconcerto.sql.model.SQLRowValues;
23
import org.openconcerto.sql.model.SQLRowValues;
22
import org.openconcerto.sql.model.SQLTable;
24
import org.openconcerto.sql.model.SQLTable;
23
import org.openconcerto.utils.ExceptionHandler;
25
import org.openconcerto.utils.ExceptionHandler;
Line 27... Line 29...
27
import java.util.Date;
29
import java.util.Date;
28
import java.util.Map;
30
import java.util.Map;
29
 
31
 
30
public class GenerationMvtFactureFournisseur extends GenerationEcritures implements Runnable {
32
public class GenerationMvtFactureFournisseur extends GenerationEcritures implements Runnable {
31
 
33
 
32
    public static final String ID = "accounting.records.supply.order";
34
    public static final String ID = "accounting.records.supplychain.order";
33
 
35
 
34
    private int idFacture;
36
    private int idFacture;
35
    private static final String source = "FACTURE_FOURNISSEUR";
37
    private static final String source = "FACTURE_FOURNISSEUR";
36
    private static final Integer journal = new Integer(JournalSQLElement.ACHATS);
38
    private static final Integer journal = new Integer(JournalSQLElement.ACHATS);
37
    private static final SQLTable tableFacture = base.getTable("FACTURE_FOURNISSEUR");
39
    private static final SQLTable tableFacture = base.getTable("FACTURE_FOURNISSEUR");
Line 63... Line 65...
63
        this.nom = "Achat : " + rowFournisseur.getString("NOM") + " Facture : " + saisieRow.getObject("NUMERO").toString() + " " + saisieRow.getObject("NOM").toString();
65
        this.nom = "Achat : " + rowFournisseur.getString("NOM") + " Facture : " + saisieRow.getObject("NUMERO").toString() + " " + saisieRow.getObject("NOM").toString();
64
        this.putValue("DATE", this.date);
66
        this.putValue("DATE", this.date);
65
        // AccountingRecordsProvider provider = AccountingRecordsProviderManager.get(ID);
67
        // AccountingRecordsProvider provider = AccountingRecordsProviderManager.get(ID);
66
        // provider.putLabel(saisieRow, this.mEcritures);
68
        // provider.putLabel(saisieRow, this.mEcritures);
67
        this.putValue("NOM", nom);
69
        this.putValue("NOM", nom);
-
 
70
        AccountingRecordsProvider provider = AccountingRecordsProviderManager.get(ID);
-
 
71
        if (provider != null) {
-
 
72
            provider.putLabel(saisieRow, this.mEcritures);
-
 
73
        }
-
 
74
 
68
        this.putValue("ID_JOURNAL", GenerationMvtFactureFournisseur.journal);
75
        this.putValue("ID_JOURNAL", GenerationMvtFactureFournisseur.journal);
69
        this.putValue("ID_MOUVEMENT", new Integer(1));
76
        this.putValue("ID_MOUVEMENT", new Integer(1));
70
 
77
 
71
        // on calcule le nouveau numero de mouvement
78
        // on calcule le nouveau numero de mouvement
72
        if (this.idMvt == 1) {
79
        if (this.idMvt == 1) {
73
            SQLRowValues rowValsPiece = new SQLRowValues(pieceTable);
80
            SQLRowValues rowValsPiece = new SQLRowValues(pieceTable);
74
            // provider.putPieceLabel(saisieRow, rowValsPiece);
-
 
75
            rowValsPiece.put("NOM", saisieRow.getObject("NUMERO").toString());
81
            rowValsPiece.put("NOM", saisieRow.getObject("NUMERO").toString());
-
 
82
            if (provider != null) {
-
 
83
                provider.putPieceLabel(saisieRow, rowValsPiece);
-
 
84
            }
76
            getNewMouvement(GenerationMvtFactureFournisseur.source, this.idFacture, 1, rowValsPiece);
85
            getNewMouvement(GenerationMvtFactureFournisseur.source, this.idFacture, 1, rowValsPiece);
77
        } else {
86
        } else {
78
            SQLRowValues rowValsPiece = pieceTable.getTable("MOUVEMENT").getRow(idMvt).getForeign("ID_PIECE").asRowValues();
87
            SQLRowValues rowValsPiece = pieceTable.getTable("MOUVEMENT").getRow(idMvt).getForeign("ID_PIECE").asRowValues();
79
            // provider.putPieceLabel(saisieRow, rowValsPiece);
-
 
80
            rowValsPiece.put("NOM", saisieRow.getObject("NUMERO").toString());
88
            rowValsPiece.put("NOM", saisieRow.getObject("NUMERO").toString());
-
 
89
            if (provider != null) {
-
 
90
                provider.putPieceLabel(saisieRow, rowValsPiece);
-
 
91
            }
81
            rowValsPiece.update();
92
            rowValsPiece.update();
82
 
93
 
83
            this.putValue("ID_MOUVEMENT", new Integer(this.idMvt));
94
            this.putValue("ID_MOUVEMENT", new Integer(this.idMvt));
84
        }
95
        }
85
 
96