OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
156 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
182 ilm 4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
156 ilm 5
 *
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
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.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.erp.core.common.element;
15
 
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.core.common.ui.PanelFrame;
18
import org.openconcerto.erp.panel.ChargementCreationSocietePanel;
19
import org.openconcerto.sql.Configuration;
20
import org.openconcerto.sql.element.BaseSQLComponent;
21
import org.openconcerto.sql.element.ElementSQLObject;
22
import org.openconcerto.sql.element.SQLComponent;
23
import org.openconcerto.sql.model.DBRoot;
24
import org.openconcerto.sql.model.DBSystemRoot;
25
import org.openconcerto.sql.model.SQLRow;
26
import org.openconcerto.sql.model.SQLRowAccessor;
27
import org.openconcerto.sql.model.SQLRowValues;
28
import org.openconcerto.sql.model.SQLTable;
29
import org.openconcerto.sql.model.graph.TablesMap;
30
import org.openconcerto.sql.sqlobject.ElementComboBox;
182 ilm 31
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
156 ilm 32
import org.openconcerto.sql.sqlobject.SQLTextCombo;
33
import org.openconcerto.ui.DefaultGridBagConstraints;
34
import org.openconcerto.ui.FormLayouter;
35
import org.openconcerto.ui.TitledSeparator;
36
import org.openconcerto.ui.component.InteractionMode;
37
import org.openconcerto.utils.ListMap;
38
 
39
import java.awt.GridBagConstraints;
40
import java.awt.GridBagLayout;
41
import java.awt.Insets;
42
import java.sql.SQLException;
43
import java.util.ArrayList;
44
import java.util.Collections;
45
import java.util.Date;
46
import java.util.List;
47
 
48
import javax.swing.BorderFactory;
182 ilm 49
import javax.swing.JCheckBox;
156 ilm 50
import javax.swing.JComboBox;
51
import javax.swing.JLabel;
52
import javax.swing.JPanel;
53
import javax.swing.JTextField;
54
import javax.swing.SwingConstants;
55
 
56
/**
57
 * Sociétés existantes avec le nom de la base associée
58
 */
59
public class SocieteCommonSQLElement extends ComptaSQLConfElement {
60
 
61
    private static final String TABLE_NAME = "SOCIETE_COMMON";
62
 
63
    static public final DBRoot getRoot(final SQLRow company) {
64
        try {
65
            return getRoot(company, false);
66
        } catch (SQLException e) {
67
            // shouldn't happen since we don't allow refresh
68
            throw new IllegalStateException(e);
69
        }
70
    }
71
 
72
    static public final DBRoot getRoot(final SQLRow company, final boolean allowRefresh) throws SQLException {
73
        final String rootName = company.getString("DATABASE_NAME");
74
        final DBSystemRoot sysRoot = company.getTable().getDBSystemRoot();
75
        if (allowRefresh && !sysRoot.contains(rootName)) {
76
            sysRoot.addRootToMap(rootName);
77
            sysRoot.refresh(TablesMap.createFromTables(rootName, Collections.singleton(TABLE_NAME)), true);
78
        }
79
        return sysRoot.getRoot(rootName);
80
    }
81
 
82
    public SocieteCommonSQLElement(DBRoot root) {
83
        super(root.getTable(TABLE_NAME), "une société", "sociétés");
84
    }
85
 
86
    @Override
87
    public ListMap<String, String> getShowAs() {
88
        return ListMap.singleton(null, getListFields());
89
    }
90
 
91
    protected List<String> getListFields() {
92
        final List<String> l = new ArrayList<String>();
93
        l.add("NOM");
94
        return l;
95
    }
96
 
97
    protected List<String> getComboFields() {
98
        final List<String> l = new ArrayList<String>();
99
        l.add("NOM");
100
        return l;
101
    }
102
 
103
    public final static Date getDateDebutExercice() {
104
 
105
        SQLTable tableExercice = Configuration.getInstance().getBase().getTable("EXERCICE_COMMON");
106
 
107
        SQLRow societeRow = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete();
108
        return (Date) tableExercice.getRow(societeRow.getInt("ID_EXERCICE_COMMON")).getObject("DATE_DEB");
109
    }
110
 
111
    /*
112
     * (non-Javadoc)
113
     *
114
     * @see org.openconcerto.devis.SQLElement#getComponent()
115
     */
116
    public SQLComponent createComponent() {
117
        return new BaseSQLComponent(this) {
118
 
119
            private JTextField textNom, textNumSiret, textNumNII, textNumAPE;
120
            private JTextField textNumTel, textNumFax, textEmail, textNumUrssaff;
121
            // private ITextArea textAdresse;
122
            private JComboBox combo;
123
            private JLabel labelPlan;
124
            private ElementSQLObject eltExercice;
125
            private TitledSeparator sep, sepPlan;
126
            private SQLTextCombo textType;
127
 
128
            public void addViews() {
129
                this.setLayout(new GridBagLayout());
130
                final GridBagConstraints c = new DefaultGridBagConstraints();
131
 
132
                this.textNom = new JTextField();
133
                this.textNumAPE = new JTextField();
134
                this.textNumNII = new JTextField();
135
                this.textNumSiret = new JTextField();
136
                this.textNumTel = new JTextField();
137
                this.textNumFax = new JTextField();
138
                this.textEmail = new JTextField();
139
                this.textType = new SQLTextCombo();
140
                this.textNumUrssaff = new JTextField();
141
 
142
                /***********************************************************************************
143
                 * Informations générales
144
                 **********************************************************************************/
145
                TitledSeparator sepInfos = new TitledSeparator("Informations générales");
146
                c.gridwidth = 4;
147
                c.gridx = 0;
148
                c.gridy++;
149
                this.add(sepInfos, c);
150
 
151
                // Type
152
                c.gridy++;
153
                c.gridwidth = 1;
154
                c.weightx = 0;
155
                JLabel labelType = new JLabel(getLabelFor("TYPE"));
156
                labelType.setHorizontalAlignment(SwingConstants.RIGHT);
157
                this.add(labelType, c);
158
 
159
                c.gridx++;
160
                c.gridwidth = 1;
161
                c.weightx = 1;
162
                this.add(this.textType, c);
163
 
164
                // Nom
165
                c.gridx++;
166
                c.gridwidth = 1;
167
                c.weightx = 0;
168
                JLabel labelNom = new JLabel(getLabelFor("NOM"));
169
                labelNom.setHorizontalAlignment(SwingConstants.RIGHT);
170
                this.add(labelNom, c);
171
 
172
                c.gridx++;
173
                c.gridwidth = 1;
174
                c.weightx = 1;
175
                this.add(this.textNom, c);
176
 
177
                // Numero Siret
178
                c.gridy++;
179
                c.gridx = 0;
180
                c.weightx = 0;
181
                JLabel labelNumSiret = new JLabel(getLabelFor("NUM_SIRET"));
182
                labelNumSiret.setHorizontalAlignment(SwingConstants.RIGHT);
183
                this.add(labelNumSiret, c);
184
 
185
                c.gridx++;
186
                c.weightx = 1;
187
                this.add(this.textNumSiret, c);
188
 
189
                // Numero NII
190
                c.gridx++;
191
                c.weightx = 0;
192
                JLabel labelNumNII = new JLabel(getLabelFor("NUM_NII"));
193
                labelNumNII.setHorizontalAlignment(SwingConstants.RIGHT);
194
                this.add(labelNumNII, c);
195
 
196
                c.gridx++;
197
                c.weightx = 1;
198
                this.add(this.textNumNII, c);
199
 
200
                // Numero URSSAF
201
                c.gridy++;
202
                c.gridx = 0;
203
                c.weightx = 0;
204
                JLabel labelNumUrs = new JLabel(getLabelFor("NUMERO_URSSAF"));
205
                labelNumUrs.setHorizontalAlignment(SwingConstants.RIGHT);
206
                this.add(labelNumUrs, c);
207
 
208
                c.gridx++;
209
                c.weightx = 1;
210
                this.add(this.textNumUrssaff, c);
211
 
212
                // Numero APE
213
                c.gridx++;
214
                c.weightx = 0;
215
                JLabel labelNumAPE = new JLabel(getLabelFor("NUM_APE"));
216
                labelNumAPE.setHorizontalAlignment(SwingConstants.RIGHT);
217
                this.add(labelNumAPE, c);
218
 
219
                c.gridx++;
220
                c.weightx = 1;
221
                this.add(this.textNumAPE, c);
222
 
223
                // Org social
224
                c.gridy++;
225
                c.gridx = 0;
226
                c.weightx = 0;
227
                JLabel labelIDSoc = new JLabel(getLabelFor("ORG_PROTECTION_SOCIAL_ID"));
228
                labelIDSoc.setHorizontalAlignment(SwingConstants.RIGHT);
229
                this.add(labelIDSoc, c);
230
 
231
                c.gridx++;
232
                c.weightx = 1;
233
                JTextField fieldIDSoc = new JTextField();
234
                this.add(fieldIDSoc, c);
235
                this.addView(fieldIDSoc, "ORG_PROTECTION_SOCIAL_ID");
236
 
182 ilm 237
                c.gridx++;
238
                c.weightx = 0;
239
                JLabel labelIDCC = new JLabel(getLabelFor("ID_IDCC"));
240
                labelIDCC.setHorizontalAlignment(SwingConstants.RIGHT);
241
                this.add(labelIDCC, c);
242
 
243
                c.gridx++;
244
                c.weightx = 1;
245
                final SQLRequestComboBox comboIDCC = new SQLRequestComboBox();
246
                this.add(comboIDCC, c);
247
                this.addView(comboIDCC, "ID_IDCC");
248
 
156 ilm 249
                // RCS
250
                c.gridy++;
251
                c.gridx = 0;
252
                c.weightx = 0;
253
                JLabel labelRCS = new JLabel(getLabelFor("RCS"));
254
                labelRCS.setHorizontalAlignment(SwingConstants.RIGHT);
255
                this.add(labelRCS, c);
256
 
257
                c.gridx++;
258
                c.weightx = 1;
259
                JTextField fieldRCS = new JTextField();
260
                this.add(fieldRCS, c);
261
                this.addView(fieldRCS, "RCS");
262
 
263
                // Capital
264
                c.gridx++;
265
                c.weightx = 0;
266
                JLabel labelCapital = new JLabel(getLabelFor("CAPITAL"));
267
                labelCapital.setHorizontalAlignment(SwingConstants.RIGHT);
268
                this.add(labelCapital, c);
269
 
270
                c.gridx++;
271
                c.weightx = 1;
272
                JTextField fieldCapital = new JTextField();
273
                this.add(fieldCapital, c);
274
                this.addView(fieldCapital, "CAPITAL");
275
 
276
                // IBAN
277
                c.gridy++;
278
                c.gridx = 0;
279
                c.weightx = 0;
280
                JLabel labelIban = new JLabel(getLabelFor("IBAN"));
281
                labelIban.setHorizontalAlignment(SwingConstants.RIGHT);
282
                this.add(labelIban, c);
283
 
284
                c.gridx++;
285
                c.weightx = 1;
286
                JTextField fieldIban = new JTextField();
287
                this.add(fieldIban, c);
288
                this.addView(fieldIban, "IBAN");
289
 
290
                // BIC
291
                c.gridx++;
292
                c.weightx = 0;
293
                JLabel labelBIC = new JLabel(getLabelFor("BIC"));
294
                labelBIC.setHorizontalAlignment(SwingConstants.RIGHT);
295
                this.add(labelBIC, c);
296
 
297
                c.gridx++;
298
                c.weightx = 1;
299
                JTextField fieldBIC = new JTextField();
300
                this.add(fieldBIC, c);
301
                this.addView(fieldBIC, "BIC");
302
 
303
                // SEPA creditor
304
                c.gridx = 0;
305
                c.gridy++;
306
                c.weightx = 0;
307
                JLabel labelICS = new JLabel(getLabelFor("SEPA_CREDITOR_ID"));
308
                labelICS.setHorizontalAlignment(SwingConstants.RIGHT);
309
                this.add(labelICS, c);
310
 
311
                c.gridx++;
312
                c.weightx = 1;
313
                JTextField fieldICS = new JTextField();
314
                this.add(fieldICS, c);
315
                this.addView(fieldICS, "SEPA_CREDITOR_ID");
316
 
317
                // Assurance
318
                if (getTable().contains("NUMERO_POLICE")) {
319
                    c.gridy++;
320
                    c.gridx = 0;
321
                    c.weightx = 0;
322
                    JLabel labelPolice = new JLabel(getLabelFor("NUMERO_POLICE"));
323
                    labelPolice.setHorizontalAlignment(SwingConstants.RIGHT);
324
                    this.add(labelPolice, c);
325
 
326
                    c.gridx++;
327
                    c.weightx = 1;
328
                    JTextField fieldPolice = new JTextField();
329
                    this.add(fieldPolice, c);
330
                    this.addView(fieldPolice, "NUMERO_POLICE");
331
                }
332
 
182 ilm 333
                // ccode congés payés
334
                JPanel panelAssuj = new JPanel();
335
 
336
                JCheckBox boxAssujCFP = new JCheckBox(getLabelFor("ASSUJETTISSEMENT_CFP"));
337
                panelAssuj.add(boxAssujCFP);
338
                this.addView(boxAssujCFP, "ASSUJETTISSEMENT_CFP");
339
 
340
                JCheckBox boxAssujCFPCDD = new JCheckBox(getLabelFor("ASSUJETTISSEMENT_CFP_CDD"));
341
                panelAssuj.add(boxAssujCFPCDD);
342
                this.addView(boxAssujCFPCDD, "ASSUJETTISSEMENT_CFP_CDD");
343
 
344
                JCheckBox boxAssujTA = new JCheckBox(getLabelFor("ASSUJETTISSEMENT_TA"));
345
                panelAssuj.add(boxAssujTA, c);
346
                this.addView(boxAssujTA, "ASSUJETTISSEMENT_TA");
347
                c.gridy++;
348
                c.gridx = 0;
349
                c.weightx = 0;
350
                c.gridwidth = 2;
351
                this.add(panelAssuj, c);
352
 
353
                JLabel labelMotifTA = new JLabel(getLabelFor("ID_MOTIF_NON_ASSUJETIS_TA"));
354
                labelMotifTA.setHorizontalAlignment(SwingConstants.RIGHT);
355
                c.gridx += 2;
356
                c.gridwidth = 1;
357
                c.weightx = 0;
358
                this.add(labelMotifTA, c);
359
                c.gridx++;
360
                c.weightx = 1;
361
                ElementComboBox boxMotifTA = new ElementComboBox(true);
362
                this.add(boxMotifTA, c);
363
                this.addView(boxMotifTA, "ID_MOTIF_NON_ASSUJETIS_TA");
364
 
156 ilm 365
                // Adresse
366
                final TitledSeparator sepAdresse = new TitledSeparator(getLabelFor("ID_ADRESSE_COMMON"));
367
                c.gridx = 0;
368
                c.gridy++;
369
                c.gridwidth = 4;
370
                c.gridheight = 1;
371
                c.weightx = 1;
372
                c.weighty = 0;
373
                c.fill = GridBagConstraints.BOTH;
374
                this.add(sepAdresse, c);
375
                this.addView("ID_ADRESSE_COMMON", REQ + ";" + DEC + ";" + SEP);
376
                ElementSQLObject eltAdr = (ElementSQLObject) this.getView("ID_ADRESSE_COMMON");
377
                c.gridy++;
378
                this.add(eltAdr, c);
379
                // Contact
380
                JPanel panelContact = new JPanel();
381
                panelContact.setLayout(new GridBagLayout());
382
                panelContact.setBorder(BorderFactory.createTitledBorder("Contacts"));
383
                final GridBagConstraints cc = new DefaultGridBagConstraints();
384
 
385
                // Numero de telephone
386
                JLabel labelNumTel = new JLabel(getLabelFor("NUM_TEL"));
387
                labelNumTel.setHorizontalAlignment(SwingConstants.RIGHT);
388
                cc.weightx = 0;
389
                panelContact.add(labelNumTel, cc);
390
 
391
                cc.gridx++;
392
                cc.weightx = 1;
393
                panelContact.add(this.textNumTel, cc);
394
 
395
                // Numero de fax
396
                cc.gridy++;
397
                cc.gridx = 0;
398
                cc.weightx = 0;
399
                JLabel labelNumFax = new JLabel(getLabelFor("NUM_FAX"));
400
                labelNumFax.setHorizontalAlignment(SwingConstants.RIGHT);
401
                panelContact.add(labelNumFax, cc);
402
 
403
                cc.gridx++;
404
                cc.weightx = 1;
405
                panelContact.add(this.textNumFax, cc);
406
 
407
                // EMail
408
                cc.gridx = 0;
409
                cc.gridy++;
410
                cc.weightx = 0;
411
                JLabel labelEMail = new JLabel(getLabelFor("MAIL"));
412
                labelEMail.setHorizontalAlignment(SwingConstants.RIGHT);
413
                panelContact.add(labelEMail, cc);
414
 
415
                cc.gridx++;
416
                cc.weightx = 1;
417
                panelContact.add(this.textEmail, cc);
418
 
419
                c.gridy++;
420
                c.gridwidth = GridBagConstraints.REMAINDER;
421
                c.fill = GridBagConstraints.BOTH;
422
                this.add(panelContact, c);
423
                c.fill = GridBagConstraints.HORIZONTAL;
424
                c.gridwidth = 1;
425
 
426
                // Devise
427
                if (getTable().contains("ID_DEVISE")) {
428
                    c.gridy++;
429
                    c.gridx = 0;
430
                    c.weightx = 0;
431
                    c.gridwidth = 1;
432
                    JLabel labelDevise = new JLabel(getLabelFor("ID_DEVISE"));
433
                    labelDevise.setHorizontalAlignment(SwingConstants.RIGHT);
434
                    this.add(labelDevise, c);
435
 
436
                    c.gridx++;
437
                    c.gridwidth = 3;
438
                    c.fill = GridBagConstraints.NONE;
439
                    ElementComboBox boxDevise = new ElementComboBox();
440
                    this.add(boxDevise, c);
441
                    this.addView(boxDevise, "ID_DEVISE");
442
                }
443
 
444
                /***********************************************************************************
445
                 * DATE D'EXERCICE
446
                 **********************************************************************************/
447
                this.sep = new TitledSeparator("Date de l'exercice");
448
                c.gridwidth = GridBagConstraints.REMAINDER;
449
                c.gridx = 0;
450
                c.gridy++;
451
                c.insets = new Insets(10, 2, 1, 2);
452
                c.fill = GridBagConstraints.HORIZONTAL;
453
                this.add(this.sep, c);
454
 
455
                c.gridx = 0;
456
                c.gridy++;
457
                c.weightx = 0;
458
                c.weighty = 1;
459
                c.anchor = GridBagConstraints.NORTHWEST;
460
                c.insets = new Insets(2, 2, 1, 2);
461
 
462
                this.addView("ID_EXERCICE_COMMON", REQ + ";" + DEC + ";" + SEP);
463
                this.eltExercice = (ElementSQLObject) this.getView("ID_EXERCICE_COMMON");
464
                c.gridwidth = GridBagConstraints.REMAINDER;
465
                this.add(this.eltExercice, c);
466
 
467
                // Regime fiscale
468
                /*
469
                 * c.gridx = 0; c.gridy++; c.gridwidth = 1; c.weightx = 0; JLabel labelRegime = new
470
                 * JLabel("Régime fiscale ");
471
                 * labelRegime.setHorizontalAlignment(SwingConstants.RIGHT); this.add(labelRegime,
472
                 * c);
473
                 */
474
 
475
                /***********************************************************************************
476
                 * Choix du plan comptable
477
                 **********************************************************************************/
478
                this.sepPlan = new TitledSeparator("Plan comptable de l'entreprise");
479
                c.gridwidth = GridBagConstraints.REMAINDER;
480
                c.gridx = 0;
481
                c.gridy++;
482
                c.insets = new Insets(10, 2, 1, 2);
483
                this.add(this.sepPlan, c);
484
                JPanel panelPlan = new JPanel();
485
                this.labelPlan = new JLabel("Choix du plan comptable", SwingConstants.RIGHT);
486
                this.combo = new JComboBox();
487
                this.combo.addItem("Base");
488
                this.combo.addItem("Abrégé");
489
                this.combo.addItem("Développé");
490
                panelPlan.add(this.labelPlan);
491
                panelPlan.add(this.combo);
492
 
493
                c.gridx = 0;
494
                c.gridy++;
495
                c.gridwidth = GridBagConstraints.REMAINDER;
496
                c.insets = new Insets(2, 2, 1, 2);
497
                c.fill = GridBagConstraints.NONE;
498
                this.add(panelPlan, c);
499
 
500
                c.gridy++;
501
                final JPanel additionalPanel = new JPanel();
502
                this.add(additionalPanel, c);
503
                this.setAdditionalFieldsPanel(new FormLayouter(additionalPanel, 2, 1));
504
 
505
                this.addRequiredSQLObject(this.textNom, "NOM");
506
                // this.addSQLObject(this.textAdresse, "ADRESSE");
507
                this.addRequiredSQLObject(this.textNumAPE, "NUM_APE");
508
                this.addRequiredSQLObject(this.textNumNII, "NUM_NII");
509
                this.addRequiredSQLObject(this.textNumSiret, "NUM_SIRET");
510
                this.addSQLObject(this.textEmail, "MAIL");
511
                this.addSQLObject(this.textNumTel, "NUM_TEL");
512
                this.addSQLObject(this.textNumFax, "NUM_FAX");
513
                this.addSQLObject(this.textNumUrssaff, "NUMERO_URSSAF");
514
                this.addSQLObject(this.textType, "TYPE");
515
            }
516
 
517
            public int insert(SQLRow order) {
518
                int id = super.insert(order);
519
                SQLRow row = getTable().getRow(id);
520
                SQLRowValues rowVals = row.getForeignRow("ID_EXERCICE_COMMON").createEmptyUpdateRow();
521
                rowVals.put("ID_SOCIETE_COMMON", id);
522
                try {
523
                    rowVals.update();
524
                } catch (SQLException e) {
525
                    // TODO Auto-generated catch block
526
                    e.printStackTrace();
527
                }
528
                creationBase(id, this.combo.getSelectedIndex());
529
                return id;
530
            }
531
 
532
            /*
533
             * public int insert() {
534
             *
535
             * int id = super.insert(); creationBase(id); return id; }
536
             */
537
 
538
            private void creationBase(int id, int typePCG) {
539
 
540
                System.err.println("display chargement societe panel");
541
 
542
                PanelFrame frameChargement = new PanelFrame(new ChargementCreationSocietePanel(id, typePCG), "Création d'une société");
543
                frameChargement.setVisible(true);
544
 
545
                /*
546
                 * System.err.println("Création de la base");
547
                 * ActionDB.dupliqueMySQLDB("Default", "OpenConcerto" + id); SQLRowValues
548
                 * rowVals = new SQLRowValues(getTable()); rowVals.put("DATABASE_NAME", "OpenConcerto"
549
                 * + id); try { rowVals.update(id); } catch (SQLException e) {
550
                 *
551
                 * e.printStackTrace(); }
552
                 */
553
                /*
554
                 * SQLTable comptePCETable = ((ComptaPropsConfiguration)
555
                 * Configuration.getInstance()).getSQLBaseSociete().getTable("COMPTE_PCE"); SQLTable
556
                 * comptePCGTable = ((ComptaPropsConfiguration)
557
                 * Configuration.getInstance()).getSQLBaseSociete().getTable("COMPTE_PCG"); // MAYBE
558
                 * Vérifier qu'aucun n'est deja créé???? // On crée le PCE à partir du PCG
559
                 * selectionné; SQLSelect selCompte = new SQLSelect(getTable().getBase());
560
                 * selCompte.addSelect(comptePCGTable.getField("NUMERO"));
561
                 * selCompte.addSelect(comptePCGTable.getField("NOM"));
562
                 * selCompte.addSelect(comptePCGTable.getField("INFOS"));
563
                 *
564
                 * if (this.combo.getSelectedIndex() == 0) {
565
                 * selCompte.setWhere("ID_TYPE_COMPTE_PCG_BASE", "!=", 1); } else { if
566
                 * (this.combo.getSelectedIndex() == 1) {
567
                 * selCompte.setWhere("ID_TYPE_COMPTE_PCG_AB", "!=", 1); } }
568
                 *
569
                 * String reqCompte = selCompte.asString(); Object obRep =
570
                 * getTable().getBase().getDataSource().execute(reqCompte, new ArrayListHandler());
571
                 *
572
                 * List tmpCpt = (List) obRep;
573
                 *
574
                 * for (int i = 0; i < tmpCpt.size(); i++) { Object[] tmp = (Object[])
575
                 * tmpCpt.get(i);
576
                 *
577
                 * SQLRowValues vals = new SQLRowValues(comptePCETable); vals.put("NUMERO", tmp[0]);
578
                 * vals.put("NOM", tmp[1]); vals.put("INFOS", tmp[2]);
579
                 *
580
                 * try { vals.insert(); } catch (SQLException e) { e.printStackTrace(); } }
581
                 */
582
            }
583
 
584
            @Override
585
            public void select(SQLRowAccessor r) {
586
                super.select(r);
587
                if (r != null) {
588
                    disableEdition();
589
                }
590
            }
591
 
592
            @Override
593
            public void update() {
594
                // TODO Auto-generated method stub
595
                super.update();
596
                ComptaPropsConfiguration.getInstanceCompta().getRowSociete().fetchValues();
597
            }
598
 
599
            public void disableEdition() {
600
                this.combo.setVisible(false);
601
                this.labelPlan.setVisible(false);
602
                this.eltExercice.setEditable(InteractionMode.DISABLED);
603
                this.sepPlan.setVisible(false);
604
            }
605
        };
606
    }
607
}