OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 73 Rev 83
Line 11... Line 11...
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.generationEcritures;
14
 package org.openconcerto.erp.generationEcritures;
15
 
15
 
-
 
16
import org.openconcerto.erp.core.common.element.BanqueSQLElement;
16
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
17
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
17
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
18
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
18
import org.openconcerto.erp.core.finance.payment.element.ChequeAEncaisserSQLElement;
19
import org.openconcerto.erp.core.finance.payment.element.ChequeAEncaisserSQLElement;
19
import org.openconcerto.erp.core.finance.payment.element.ModeDeReglementSQLElement;
20
import org.openconcerto.erp.core.finance.payment.element.ModeDeReglementSQLElement;
-
 
21
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement;
20
import org.openconcerto.erp.model.PrixTTC;
22
import org.openconcerto.erp.model.PrixTTC;
21
import org.openconcerto.sql.Configuration;
23
import org.openconcerto.sql.Configuration;
22
import org.openconcerto.sql.model.SQLRow;
24
import org.openconcerto.sql.model.SQLRow;
23
import org.openconcerto.sql.model.SQLRowValues;
25
import org.openconcerto.sql.model.SQLRowValues;
24
import org.openconcerto.sql.model.SQLTable;
26
import org.openconcerto.sql.model.SQLTable;
Line 82... Line 84...
82
                    this.mEcritures.put("ID_MOUVEMENT", new Integer(this.idMvt));
84
                    this.mEcritures.put("ID_MOUVEMENT", new Integer(this.idMvt));
83
 
85
 
84
                    if (typeRegRow.getID() == 4) {
86
                    if (typeRegRow.getID() == 4) {
85
                        this.mEcritures.put("ID_JOURNAL", GenerationMvtReglementVenteComptoir.journalCaisse);
87
                        this.mEcritures.put("ID_JOURNAL", GenerationMvtReglementVenteComptoir.journalCaisse);
86
                    } else {
88
                    } else {
87
                        this.mEcritures.put("ID_JOURNAL", JournalSQLElement.BANQUES);
89
                        fillJournalBanqueFromRow(modeRegRow);
88
                    }
90
                    }
89
 
91
 
90
                    // compte Clients
92
                    // compte Clients
91
                    int idCompteClient = clientRow.getInt("ID_COMPTE_PCE");
93
                    int idCompteClient = clientRow.getInt("ID_COMPTE_PCE");
92
                    if (idCompteClient <= 1) {
94
                    if (idCompteClient <= 1) {
Line 100... Line 102...
100
                    this.mEcritures.put("DEBIT", new Long(0));
102
                    this.mEcritures.put("DEBIT", new Long(0));
101
                    this.mEcritures.put("CREDIT", new Long(prixTTC.getLongValue()));
103
                    this.mEcritures.put("CREDIT", new Long(prixTTC.getLongValue()));
102
                    ajoutEcriture();
104
                    ajoutEcriture();
103
 
105
 
104
                    // compte de reglement
106
                    // compte de reglement
-
 
107
                    if (typeRegRow.getID() == TypeReglementSQLElement.ESPECE) {
105
                    int idCompteRegl = typeRegRow.getInt("ID_COMPTE_PCE_CLIENT");
108
                        int idCompteRegl = typeRegRow.getInt("ID_COMPTE_PCE_CLIENT");
106
                    if (idCompteRegl <= 1) {
109
                        if (idCompteRegl <= 1) {
107
                        idCompteRegl = ComptePCESQLElement.getIdComptePceDefault("VenteCB");
110
                            idCompteRegl = ComptePCESQLElement.getIdComptePceDefault("VenteEspece");
-
 
111
                        }
-
 
112
 
-
 
113
                        this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
-
 
114
                    } else {
-
 
115
                        fillCompteBanqueFromRow(modeRegRow, "VenteCB", false);
108
                    }
116
                    }
109
                    this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteRegl));
-
 
110
                    this.mEcritures.put("DEBIT", new Long(prixTTC.getLongValue()));
117
                    this.mEcritures.put("DEBIT", new Long(prixTTC.getLongValue()));
111
                    this.mEcritures.put("CREDIT", new Long(0));
118
                    this.mEcritures.put("CREDIT", new Long(0));
112
                    ajoutEcriture();
119
                    ajoutEcriture();
113
 
120
 
114
                }
121
                }
Line 170... Line 177...
170
        valEncaisse.put("ID_CLIENT", new Integer(saisieRow.getInt("ID_CLIENT")));
177
        valEncaisse.put("ID_CLIENT", new Integer(saisieRow.getInt("ID_CLIENT")));
171
        valEncaisse.put("DATE_VENTE", new java.sql.Date(this.date.getTime()));
178
        valEncaisse.put("DATE_VENTE", new java.sql.Date(this.date.getTime()));
172
        valEncaisse.put("DATE_MIN_DEPOT", new java.sql.Date(dateEch.getTime()));
179
        valEncaisse.put("DATE_MIN_DEPOT", new java.sql.Date(dateEch.getTime()));
173
        valEncaisse.put("DATE_DEPOT", new java.sql.Date(this.date.getTime()));
180
        valEncaisse.put("DATE_DEPOT", new java.sql.Date(this.date.getTime()));
174
        valEncaisse.put("MONTANT", new Long(prixTTC.getLongValue()));
181
        valEncaisse.put("MONTANT", new Long(prixTTC.getLongValue()));
-
 
182
 
-
 
183
        if (!saisieRow.isForeignEmpty("ID_MODE_REGLEMENT")) {
-
 
184
            SQLRow rowModeRegl = saisieRow.getForeignRow("ID_MODE_REGLEMENT");
-
 
185
            valEncaisse.put("ID_" + BanqueSQLElement.TABLENAME, rowModeRegl.getInt("ID_" + BanqueSQLElement.TABLENAME));
-
 
186
        }
175
        // on crée un nouveau mouvement pour l'encaissement futur du cheque
187
        // on crée un nouveau mouvement pour l'encaissement futur du cheque
176
        SQLRow rowMvtPere = tableMouvement.getRow(idPere);
188
        SQLRow rowMvtPere = tableMouvement.getRow(idPere);
177
        this.idMvt = getNewMouvement("CHEQUE_A_ENCAISSER", 1, idPere, rowMvtPere.getInt("ID_PIECE"));
189
        this.idMvt = getNewMouvement("CHEQUE_A_ENCAISSER", 1, idPere, rowMvtPere.getInt("ID_PIECE"));
178
 
190
 
179
        valEncaisse.put("ID_MOUVEMENT", new Integer(this.idMvt));
191
        valEncaisse.put("ID_MOUVEMENT", new Integer(this.idMvt));