OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 180 Rev 182
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 15... Line 15...
15
 
15
 
16
import org.openconcerto.erp.core.common.element.BanqueSQLElement;
16
import org.openconcerto.erp.core.common.element.BanqueSQLElement;
17
import org.openconcerto.erp.core.common.ui.DeviseField;
17
import org.openconcerto.erp.core.common.ui.DeviseField;
18
import org.openconcerto.erp.core.finance.accounting.element.MouvementSQLElement;
18
import org.openconcerto.erp.core.finance.accounting.element.MouvementSQLElement;
19
import org.openconcerto.erp.core.finance.payment.element.EncaisserMontantSQLElement;
19
import org.openconcerto.erp.core.finance.payment.element.EncaisserMontantSQLElement;
-
 
20
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement;
20
import org.openconcerto.erp.core.finance.payment.ui.EncaisseMontantTable;
21
import org.openconcerto.erp.core.finance.payment.ui.EncaisseMontantTable;
21
import org.openconcerto.erp.preferences.ModeReglementDefautPrefPanel;
22
import org.openconcerto.erp.preferences.ModeReglementDefautPrefPanel;
22
import org.openconcerto.sql.Configuration;
23
import org.openconcerto.sql.Configuration;
23
import org.openconcerto.sql.element.BaseSQLComponent;
24
import org.openconcerto.sql.element.BaseSQLComponent;
24
import org.openconcerto.sql.element.ElementSQLObject;
25
import org.openconcerto.sql.element.ElementSQLObject;
Line 92... Line 93...
92
                if (getMode() == SQLComponent.Mode.INSERTION) {
93
                if (getMode() == SQLComponent.Mode.INSERTION) {
93
                    if (rowCount >= 1) {
94
                    if (rowCount >= 1) {
94
 
95
 
95
                        MouvementSQLElement element = getElement().getDirectory().getElement(MouvementSQLElement.class);
96
                        MouvementSQLElement element = getElement().getDirectory().getElement(MouvementSQLElement.class);
96
                        SQLRowValues row1 = model.getRowValuesAt(0);
97
                        SQLRowValues row1 = model.getRowValuesAt(0);
-
 
98
 
97
                        if (row1.getObject("ID_MOUVEMENT_ECHEANCE") != null && !row1.isForeignEmpty("ID_MOUVEMENT_ECHEANCE")) {
99
                        if (row1.getObject("ID_MOUVEMENT_ECHEANCE") != null && !row1.isForeignEmpty("ID_MOUVEMENT_ECHEANCE")) {
98
                            final int idScr = element.getSourceId(row1.getForeignID("ID_MOUVEMENT_ECHEANCE"));
100
                            final int idScr = element.getSourceId(row1.getForeignID("ID_MOUVEMENT_ECHEANCE"));
99
                            SQLTable tableMvt = element.getTable();
101
                            SQLTable tableMvt = element.getTable();
100
                            if (idScr > 1) {
102
                            if (idScr > 1) {
101
                                SQLRow rowMvt = tableMvt.getRow(idScr);
103
                                SQLRow rowMvt = tableMvt.getRow(idScr);
Line 108... Line 110...
108
                                    if (rowSource != null) {
110
                                    if (rowSource != null) {
109
                                        SQLRow rowModeRegl = rowSource.getForeignRow("ID_MODE_REGLEMENT");
111
                                        SQLRow rowModeRegl = rowSource.getForeignRow("ID_MODE_REGLEMENT");
110
                                        if (rowModeRegl != null) {
112
                                        if (rowModeRegl != null) {
111
                                            System.err.println("Set mode de règlement");
113
                                            System.err.println("Set mode de règlement");
112
                                            int idTypeRegl = rowModeRegl.getInt("ID_TYPE_REGLEMENT");
114
                                            int idTypeRegl = rowModeRegl.getInt("ID_TYPE_REGLEMENT");
-
 
115
                                            SQLRowValues rowVals = new SQLRowValues(rowModeRegl.getTable());
113
                                            SQLTable tableModeRegl = Configuration.getInstance().getDirectory().getElement("MODE_REGLEMENT").getTable();
116
                                            if (idTypeRegl == TypeReglementSQLElement.VIREMENT || rowModeRegl.getForeign("ID_TYPE_REGLEMENT").getBoolean("ECHEANCE")) {
114
                                            SQLRowValues rowVals = new SQLRowValues(tableModeRegl);
117
                                                idTypeRegl = TypeReglementSQLElement.VIREMENT;
-
 
118
                                            }
115
                                            rowVals.put("ID_TYPE_REGLEMENT", idTypeRegl);
119
                                            rowVals.put("ID_TYPE_REGLEMENT", idTypeRegl);
116
                                            rowVals.put("COMPTANT", Boolean.TRUE);
120
                                            rowVals.put("COMPTANT", Boolean.TRUE);
117
                                            rowVals.put("AJOURS", 0);
121
                                            rowVals.put("AJOURS", 0);
118
                                            rowVals.put("LENJOUR", 0);
122
                                            rowVals.put("LENJOUR", 0);
119
                                            rowVals.put("ID_" + BanqueSQLElement.TABLENAME, rowModeRegl.getInt("ID_" + BanqueSQLElement.TABLENAME));
123
                                            rowVals.put("ID_" + BanqueSQLElement.TABLENAME, rowModeRegl.getInt("ID_" + BanqueSQLElement.TABLENAME));
Line 194... Line 198...
194
        this.addSQLObject(comboClient, "ID_CLIENT");
198
        this.addSQLObject(comboClient, "ID_CLIENT");
195
 
199
 
196
        final ElementComboBox comboD = new ElementComboBox();
200
        final ElementComboBox comboD = new ElementComboBox();
197
        this.addSQLObject(comboD, "ID_DEVIS");
201
        this.addSQLObject(comboD, "ID_DEVIS");
198
 
202
 
-
 
203
        final ElementComboBox comboc = new ElementComboBox();
-
 
204
        this.addSQLObject(comboc, "ID_COMMANDE_CLIENT");
-
 
205
 
199
        // Nom
206
        // Nom
200
        c.gridy++;
207
        c.gridy++;
201
        c.gridx = 0;
208
        c.gridx = 0;
202
        final JLabel label = new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT);
209
        final JLabel label = new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT);
203
        c.weightx = 0;
210
        c.weightx = 0;