OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
182 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
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.humanresources.payroll.element;
15
 
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
17
import org.openconcerto.sql.element.BaseSQLComponent;
18
import org.openconcerto.sql.element.SQLComponent;
19
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
20
import org.openconcerto.ui.DefaultGridBagConstraints;
21
import org.openconcerto.ui.JDate;
22
import org.openconcerto.utils.ListMap;
23
 
24
import java.awt.GridBagConstraints;
25
import java.awt.GridBagLayout;
26
import java.util.ArrayList;
27
import java.util.List;
28
 
29
import javax.swing.BorderFactory;
30
import javax.swing.JLabel;
31
import javax.swing.JPanel;
32
 
33
public class ArretChomageIntemperieSQLElement extends ComptaSQLConfElement {
34
 
35
    public ArretChomageIntemperieSQLElement() {
36
        super("ARRET_CHOMAGE_INTEMPERIE", "un arrêt chômage ou intempéries", "arrêts chômages ou intempéries");
37
    }
38
 
39
    protected List<String> getListFields() {
40
        final List<String> l = new ArrayList<String>();
41
        l.add("ID_INFOS_SALARIE_PAYE");
42
        l.add("ID_CODE_AMENAGEMENT_PARTIEL");
43
        l.add("DATE_DEBUT_SUSPENSION");
44
        l.add("DATE_FIN_SUSPENSION");
45
        return l;
46
    }
47
 
48
    protected List<String> getComboFields() {
49
        final List<String> l = new ArrayList<String>();
50
        l.add("ID_INFOS_SALARIE_PAYE");
51
        l.add("ID_CODE_AMENAGEMENT_PARTIEL");
52
        l.add("DATE_DEBUT_SUSPENSION");
53
        l.add("DATE_FIN_SUSPENSION");
54
        return l;
55
    }
56
 
57
    @Override
58
    public ListMap<String, String> getShowAs() {
59
 
60
        ListMap<String, String> map = new ListMap<String, String>();
61
        map.addAll(null, "ID_INFOS_SALARIE_PAYE", "ID_CODE_AMENAGEMENT_PARTIEL", "DATE_DEBUT_SUSPENSION", "DATE_FIN_SUSPENSION");
62
        map.addAll("ID_INFOS_SALARIE_PAYE", "ID_CONTRAT_SALARIE");
63
        map.addAll("ID_CODE_AMENAGEMENT_PARTIEL", "CODE");
64
 
65
        return map;
66
    }
67
 
68
    /*
69
     * (non-Javadoc)
70
     *
71
     * @see org.openconcerto.devis.SQLElement#getComponent()
72
     */
73
    public SQLComponent createComponent() {
74
        return new BaseSQLComponent(this) {
75
 
76
            public void addViews() {
77
 
78
                this.setLayout(new GridBagLayout());
79
                final GridBagConstraints c = new DefaultGridBagConstraints();
80
 
81
                /***********************************************************************************
82
                 * Renseignements
83
                 **********************************************************************************/
84
                JPanel panelInfos = new JPanel();
85
                panelInfos.setBorder(BorderFactory.createTitledBorder("Renseignements (S21.G00.65)"));
86
                panelInfos.setLayout(new GridBagLayout());
87
 
88
                // Nom
89
                JLabel labelContratSalarie = new JLabel(getLabelFor("ID_INFOS_SALARIE_PAYE"));
90
                SQLRequestComboBox textContratSalarie = new SQLRequestComboBox();
91
                // c.gridx++;
92
                c.weightx = 0;
93
                panelInfos.add(labelContratSalarie, c);
94
                c.gridx++;
95
                c.weightx = 1;
96
                panelInfos.add(textContratSalarie, c);
97
                this.addView(textContratSalarie, "ID_INFOS_SALARIE_PAYE", REQ);
98
                c.weightx = 0;
99
 
100
                // Ref
101
                JLabel labelMotif = new JLabel(getLabelFor("ID_CODE_AMENAGEMENT_PARTIEL"));
102
                SQLRequestComboBox comboMotif = new SQLRequestComboBox();
103
                c.gridx = 0;
104
                c.gridy++;
105
                panelInfos.add(labelMotif, c);
106
                c.gridx++;
107
                c.weightx = 1;
108
                panelInfos.add(comboMotif, c);
109
                this.addView(comboMotif, "ID_CODE_AMENAGEMENT_PARTIEL", REQ);
110
                c.weightx = 0;
111
 
112
                // Nom
113
                JLabel labelCodeSuspension = new JLabel(getLabelFor("ID_CODE_SUSPENSION"));
114
                SQLRequestComboBox textCodeSupension = new SQLRequestComboBox();
115
                c.gridx++;
116
                c.weightx = 0;
117
                panelInfos.add(labelCodeSuspension, c);
118
                c.gridx++;
119
                c.weightx = 1;
120
                panelInfos.add(textCodeSupension, c);
121
                this.addView(textCodeSupension, "ID_CODE_SUSPENSION", REQ);
122
 
123
                // Deb
124
                JLabel labelDateDeb = new JLabel(getLabelFor("DATE_DEBUT_SUSPENSION"));
125
                JDate dateDeb = new JDate();
126
                c.gridx = 0;
127
                c.gridy++;
128
                c.weightx = 0;
129
                panelInfos.add(labelDateDeb, c);
130
                c.gridx++;
131
                c.weightx = 1;
132
                panelInfos.add(dateDeb, c);
133
                this.addSQLObject(dateDeb, "DATE_DEBUT_SUSPENSION", REQ);
134
                c.weightx = 0;
135
                // Fin
136
                JLabel labelDateFin = new JLabel(getLabelFor("DATE_FIN_SUSPENSION"));
137
                JDate dateFin = new JDate();
138
                c.gridx++;
139
                panelInfos.add(labelDateFin, c);
140
                c.gridx++;
141
                c.weightx = 1;
142
                panelInfos.add(dateFin, c);
143
                this.addSQLObject(dateFin, "DATE_FIN_SUSPENSION", REQ);
144
 
145
                c.gridx = 0;
146
                c.gridy++;
147
                c.fill = GridBagConstraints.BOTH;
148
                c.weightx = 1;
149
                c.weighty = 1;
150
                this.add(panelInfos, c);
151
 
152
            }
153
 
154
        };
155
    }
156
 
157
    @Override
158
    protected String createCodeSuffix() {
159
        return ".suspension.contract";
160
    }
161
 
162
}