OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 142 Rev 156
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.core.humanresources.payroll.element;
14
 package org.openconcerto.erp.core.humanresources.payroll.element;
15
 
15
 
-
 
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
16
import org.openconcerto.erp.core.common.ui.SQLJavaEditor;
17
import org.openconcerto.erp.core.common.ui.SQLJavaEditor;
17
import org.openconcerto.erp.core.humanresources.payroll.component.FormuleTreeNode;
18
import org.openconcerto.erp.core.humanresources.payroll.component.FormuleTreeNode;
18
import org.openconcerto.erp.core.humanresources.payroll.component.RubriqueSQLComponent;
19
import org.openconcerto.erp.core.humanresources.payroll.component.RubriqueSQLComponent;
19
import org.openconcerto.erp.core.humanresources.payroll.component.VariableTree;
20
import org.openconcerto.erp.core.humanresources.payroll.component.VariableTree;
20
import org.openconcerto.sql.element.ConfSQLElement;
-
 
21
import org.openconcerto.sql.element.ElementSQLObject;
21
import org.openconcerto.sql.element.ElementSQLObject;
22
import org.openconcerto.sql.element.SQLComponent;
22
import org.openconcerto.sql.element.SQLComponent;
23
import org.openconcerto.sql.element.SQLElement;
23
import org.openconcerto.sql.element.SQLElement;
-
 
24
import org.openconcerto.sql.model.DBRoot;
-
 
25
import org.openconcerto.sql.model.SQLRowValues;
24
import org.openconcerto.sql.sqlobject.ElementComboBox;
26
import org.openconcerto.sql.sqlobject.ElementComboBox;
-
 
27
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
25
import org.openconcerto.ui.DefaultGridBagConstraints;
28
import org.openconcerto.ui.DefaultGridBagConstraints;
26
import org.openconcerto.utils.ListMap;
29
import org.openconcerto.utils.ListMap;
27
 
30
 
28
import java.awt.GridBagConstraints;
31
import java.awt.GridBagConstraints;
29
import java.awt.GridBagLayout;
32
import java.awt.GridBagLayout;
Line 47... Line 50...
47
import javax.swing.JSplitPane;
50
import javax.swing.JSplitPane;
48
import javax.swing.JTabbedPane;
51
import javax.swing.JTabbedPane;
49
import javax.swing.SwingConstants;
52
import javax.swing.SwingConstants;
50
import javax.swing.tree.TreePath;
53
import javax.swing.tree.TreePath;
51
 
54
 
52
public class RubriqueBrutSQLElement extends ConfSQLElement {
55
public class RubriqueBrutSQLElement extends ComptaSQLConfElement {
53
 
56
 
54
    public RubriqueBrutSQLElement() {
57
    public RubriqueBrutSQLElement(final DBRoot root) {
55
        super("RUBRIQUE_BRUT", "une rubrique de brut", "rubriques de brut");
58
        super(root.getTable("RUBRIQUE_BRUT"), "une rubrique de brut", "rubriques de brut");
56
    }
59
    }
57
 
60
 
58
    protected List<String> getListFields() {
61
    protected List<String> getListFields() {
59
        final List<String> l = new ArrayList<String>();
62
        final List<String> l = new ArrayList<String>();
60
        l.add("CODE");
63
        l.add("CODE");
61
        l.add("NOM");
64
        l.add("NOM");
62
 
65
 
63
        l.add("BASE");
66
        l.add("BASE");
64
        l.add("TAUX");
67
        l.add("TAUX");
65
        l.add("MONTANT");
68
        l.add("MONTANT");
66
        l.add("PART_BRUT");
69
        l.add("COTISABLE");
67
        l.add("PART_CP");
70
        l.add("PART_CP");
68
        l.add("IMPOSABLE");
71
        l.add("TAXABLE_CM");
69
 
72
 
70
        return l;
73
        return l;
71
    }
74
    }
72
 
75
 
73
    protected List<String> getComboFields() {
76
    protected List<String> getComboFields() {
Line 281... Line 284...
281
                cPanel.anchor = GridBagConstraints.WEST;
284
                cPanel.anchor = GridBagConstraints.WEST;
282
                panelProp.add(labelSelTypeRubrique, cPanel);
285
                panelProp.add(labelSelTypeRubrique, cPanel);
283
 
286
 
284
                // SQLElement eltType =
287
                // SQLElement eltType =
285
                // Configuration.getInstance().getDirectory().getElement("TYPE_RUBRIQUE_BRUT");
288
                // Configuration.getInstance().getDirectory().getElement("TYPE_RUBRIQUE_BRUT");
286
                ElementComboBox comboSelTypeRubrique = new ElementComboBox(false);
289
                SQLRequestComboBox comboSelTypeRubrique = new SQLRequestComboBox(false);
287
                cPanel.gridx++;
290
                cPanel.gridx++;
288
                cPanel.weightx = 1;
291
                cPanel.weightx = 1;
289
                panelProp.add(comboSelTypeRubrique, cPanel);
292
                panelProp.add(comboSelTypeRubrique, cPanel);
290
 
293
 
291
                // Impression
294
                // Impression
Line 293... Line 296...
293
                cPanel.gridy++;
296
                cPanel.gridy++;
294
                cPanel.gridx = 1;
297
                cPanel.gridx = 1;
295
                cPanel.weightx = 0;
298
                cPanel.weightx = 0;
296
                panelProp.add(labelSelTypeRubriqueImpression, cPanel);
299
                panelProp.add(labelSelTypeRubriqueImpression, cPanel);
297
 
300
 
298
                ElementComboBox comboSelTypeImpression = new ElementComboBox(false);
301
                SQLRequestComboBox comboSelTypeImpression = new SQLRequestComboBox(false);
299
                cPanel.gridx++;
302
                cPanel.gridx++;
300
                cPanel.weightx = 1;
303
                cPanel.weightx = 1;
301
                panelProp.add(comboSelTypeImpression, cPanel);
304
                panelProp.add(comboSelTypeImpression, cPanel);
302
 
305
 
303
                // Imposable
306
                // Imposable
304
                cPanel.gridx = 1;
307
                cPanel.gridx = 1;
305
                cPanel.weightx = 1;
308
                cPanel.weightx = 1;
306
                cPanel.gridy++;
309
                cPanel.gridy++;
307
                c.fill = GridBagConstraints.HORIZONTAL;
310
                c.fill = GridBagConstraints.HORIZONTAL;
308
                cPanel.gridwidth = GridBagConstraints.REMAINDER;
311
                cPanel.gridwidth = GridBagConstraints.REMAINDER;
309
                JCheckBox checkImpo = new JCheckBox(getLabelFor("IMPOSABLE"));
312
                JCheckBox checkImpo = new JCheckBox(getLabelFor("TAXABLE_CM"));
310
                panelProp.add(checkImpo, cPanel);
313
                panelProp.add(checkImpo, cPanel);
311
 
314
 
-
 
315
                // Participation à la base cotisable
-
 
316
                cPanel.gridx = 1;
-
 
317
                cPanel.weightx = 1;
-
 
318
                cPanel.gridy++;
-
 
319
                c.fill = GridBagConstraints.HORIZONTAL;
-
 
320
                cPanel.gridwidth = GridBagConstraints.REMAINDER;
-
 
321
                JCheckBox checkCotis = new JCheckBox(getLabelFor("COTISABLE"));
-
 
322
                panelProp.add(checkCotis, cPanel);
-
 
323
 
312
                // Participation à la base brute
324
                // Participation à la base brute
313
                cPanel.gridx = 1;
325
                cPanel.gridx = 1;
314
                cPanel.weightx = 1;
326
                cPanel.weightx = 1;
315
                cPanel.gridy++;
327
                cPanel.gridy++;
316
                c.fill = GridBagConstraints.HORIZONTAL;
328
                c.fill = GridBagConstraints.HORIZONTAL;
Line 360... Line 372...
360
                this.addSQLObject(this.formuleTaux, "TAUX");
372
                this.addSQLObject(this.formuleTaux, "TAUX");
361
                this.addSQLObject(this.formuleMontant, "MONTANT");
373
                this.addSQLObject(this.formuleMontant, "MONTANT");
362
                this.addRequiredSQLObject(comboSelTypeRubrique, "ID_TYPE_RUBRIQUE_BRUT");
374
                this.addRequiredSQLObject(comboSelTypeRubrique, "ID_TYPE_RUBRIQUE_BRUT");
363
                this.addRequiredSQLObject(comboSelTypeImpression, "ID_IMPRESSION_RUBRIQUE");
375
                this.addRequiredSQLObject(comboSelTypeImpression, "ID_IMPRESSION_RUBRIQUE");
364
                this.addSQLObject(checkBrut, "PART_BRUT");
376
                this.addSQLObject(checkBrut, "PART_BRUT");
-
 
377
                this.addSQLObject(checkCotis, "COTISABLE");
365
                this.addSQLObject(checkCP, "PART_CP");
378
                this.addSQLObject(checkCP, "PART_CP");
366
                this.addSQLObject(checkImpo, "IMPOSABLE");
379
                this.addSQLObject(checkImpo, "TAXABLE_CM");
367
 
380
 
368
                selSalarie.addValueListener(new PropertyChangeListener() {
381
                selSalarie.addValueListener(new PropertyChangeListener() {
369
 
382
 
370
                    public void propertyChange(PropertyChangeEvent evt) {
383
                    public void propertyChange(PropertyChangeEvent evt) {
371
                        formuleBase.setSalarieID(selSalarie.getSelectedId());
384
                        formuleBase.setSalarieID(selSalarie.getSelectedId());
372
                        formuleTaux.setSalarieID(selSalarie.getSelectedId());
385
                        formuleTaux.setSalarieID(selSalarie.getSelectedId());
373
                        formuleMontant.setSalarieID(selSalarie.getSelectedId());
386
                        formuleMontant.setSalarieID(selSalarie.getSelectedId());
374
                    }
387
                    }
375
                });
388
                });
376
            }
389
            }
-
 
390
 
-
 
391
            @Override
-
 
392
            protected SQLRowValues createDefaults() {
-
 
393
                SQLRowValues rowVals = new SQLRowValues(getTable());
-
 
394
                rowVals.put("TAXABLE_CM", Boolean.TRUE);
-
 
395
                rowVals.put("COTISABLE", Boolean.TRUE);
-
 
396
                rowVals.put("PART_BRUT", Boolean.TRUE);
-
 
397
 
-
 
398
                return rowVals;
-
 
399
            }
377
        };
400
        };
378
    }
401
    }
379
 
402
 
380
    @Override
403
    @Override
381
    protected String createCode() {
404
    protected String createCode() {