OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev Author Line No. Line
18 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 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.ElementComboBox;
20
import org.openconcerto.ui.DefaultGridBagConstraints;
132 ilm 21
import org.openconcerto.ui.JDate;
18 ilm 22
 
23
import java.awt.GridBagConstraints;
24
import java.awt.GridBagLayout;
25
import java.util.ArrayList;
132 ilm 26
import java.util.Arrays;
142 ilm 27
import java.util.HashSet;
18 ilm 28
import java.util.List;
142 ilm 29
import java.util.Set;
18 ilm 30
 
31
import javax.swing.JLabel;
32
import javax.swing.JTextField;
33
import javax.swing.SwingConstants;
34
 
35
public class ContratSalarieSQLElement extends ComptaSQLConfElement {
36
 
37
    public ContratSalarieSQLElement() {
38
        super("CONTRAT_SALARIE", "un contrat salarié", "contrats salariés");
39
    }
40
 
41
    protected List<String> getListFields() {
42
        final List<String> l = new ArrayList<String>();
43
        l.add("NATURE");
44
        return l;
45
    }
46
 
142 ilm 47
    @Override
48
    public Set<String> getInsertOnlyFields() {
49
        Set<String> s = new HashSet<String>();
50
        s.add("DATE_MODIFICATION");
51
        return s;
52
    }
53
 
18 ilm 54
    protected List<String> getComboFields() {
55
        final List<String> l = new ArrayList<String>();
142 ilm 56
        l.add("NUMERO");
57
        l.add("DATE_DEBUT");
18 ilm 58
        return l;
59
    }
60
 
132 ilm 61
    @Override
62
    public boolean isPrivate() {
63
        return true;
64
    }
65
 
18 ilm 66
    /*
67
     * (non-Javadoc)
68
     *
69
     * @see org.openconcerto.devis.SQLElement#getComponent()
70
     */
71
    public SQLComponent createComponent() {
72
        return new BaseSQLComponent(this) {
73
 
74
            public void addViews() {
75
 
76
                this.setLayout(new GridBagLayout());
142 ilm 77
 
18 ilm 78
                GridBagConstraints c = new DefaultGridBagConstraints();
79
 
142 ilm 80
                // Numero
81
                JLabel labelNumero = new JLabel(getLabelFor("NUMERO"));
82
                labelNumero.setHorizontalAlignment(SwingConstants.RIGHT);
83
                JTextField textNumero = new JTextField();
84
 
85
                this.add(labelNumero, c);
86
                c.gridx++;
87
                c.weightx = 1;
88
                this.add(textNumero, c);
89
                this.addRequiredSQLObject(textNumero, "NUMERO");
90
 
91
                c.gridy++;
92
                c.gridx = 0;
18 ilm 93
                // Nature
94
                JLabel labelNature = new JLabel(getLabelFor("NATURE"));
95
                labelNature.setHorizontalAlignment(SwingConstants.RIGHT);
96
                JTextField textNature = new JTextField();
97
 
98
                this.add(labelNature, c);
99
                c.gridx++;
100
                c.weightx = 1;
101
                this.add(textNature, c);
102
 
103
                // Catégorie socioprofessionnelle
104
                JLabel labelCatSocio = new JLabel(getLabelFor("ID_CODE_EMPLOI"));
105
                labelCatSocio.setHorizontalAlignment(SwingConstants.RIGHT);
106
                ElementComboBox selCodeCatSocio = new ElementComboBox();
107
                selCodeCatSocio.setInfoIconVisible(false);
108
                c.gridy++;
109
                c.gridx = 0;
110
                c.weightx = 0;
111
                this.add(labelCatSocio, c);
112
                c.gridx++;
113
                c.weightx = 1;
114
                this.add(selCodeCatSocio, c);
174 ilm 115
 
116
 
117
 
118
                JLabel complPCSLabel = new JLabel(getLabelFor("COMPLEMENT_PCS"));
119
                complPCSLabel.setHorizontalAlignment(SwingConstants.RIGHT);
120
                JTextField complPCS = new JTextField();
121
                c.gridy++;
122
                c.gridx = 0;
123
                c.weightx = 0;
124
                this.add(complPCSLabel, c);
125
                c.gridx++;
126
                c.weightx = 1;
127
                this.add(complPCS, c);
128
                addView(complPCS,"COMPLEMENT_PCS");
18 ilm 129
 
130
                // Contrat de travail
131
                JLabel labelContratTravail = new JLabel(getLabelFor("ID_CODE_CONTRAT_TRAVAIL"));
132
                labelContratTravail.setHorizontalAlignment(SwingConstants.RIGHT);
133
                ElementComboBox selContratTravail = new ElementComboBox();
134
                selContratTravail.setInfoIconVisible(false);
135
                c.gridy++;
136
                c.gridx = 0;
137
                c.weightx = 0;
138
                this.add(labelContratTravail, c);
139
                c.gridx++;
140
                c.weightx = 1;
141
                this.add(selContratTravail, c);
142
 
143
                // Droit Contrat de travail
144
                JLabel labelDroitContrat = new JLabel(getLabelFor("ID_CODE_DROIT_CONTRAT"));
145
                labelDroitContrat.setHorizontalAlignment(SwingConstants.RIGHT);
146
                ElementComboBox selDroitContrat = new ElementComboBox();
147
                selDroitContrat.setInfoIconVisible(false);
148
                c.gridy++;
149
                c.gridx = 0;
150
                c.weightx = 0;
151
                this.add(labelDroitContrat, c);
152
                c.gridx++;
153
                c.weightx = 1;
154
                this.add(selDroitContrat, c);
155
 
156
                // caracteristiques activité
157
                JLabel labelCaractActivite = new JLabel(getLabelFor("ID_CODE_CARACT_ACTIVITE"));
158
                labelCaractActivite.setHorizontalAlignment(SwingConstants.RIGHT);
159
                ElementComboBox selCaractActivite = new ElementComboBox();
160
                selCaractActivite.setInfoIconVisible(false);
161
                c.gridy++;
162
                c.gridx = 0;
163
                c.weightx = 0;
164
                this.add(labelCaractActivite, c);
165
                c.gridx++;
166
                c.weightx = 1;
167
                this.add(selCaractActivite, c);
168
 
169
                // Statut profesionnel
170
                JLabel labelStatutProf = new JLabel(getLabelFor("ID_CODE_STATUT_PROF"));
171
                labelStatutProf.setHorizontalAlignment(SwingConstants.RIGHT);
172
                ElementComboBox selStatutProf = new ElementComboBox();
173
                selStatutProf.setInfoIconVisible(false);
174
                c.gridy++;
175
                c.gridx = 0;
176
                c.weightx = 0;
177
                this.add(labelStatutProf, c);
178
                c.gridx++;
179
                c.weightx = 1;
180
                this.add(selStatutProf, c);
181
 
182
                // Statut categoriel
183
                JLabel labelStatutCat = new JLabel(getLabelFor("ID_CODE_STATUT_CATEGORIEL"));
184
                labelStatutCat.setHorizontalAlignment(SwingConstants.RIGHT);
185
                ElementComboBox selStatutCat = new ElementComboBox();
186
                selStatutCat.setInfoIconVisible(false);
187
                c.gridy++;
188
                c.gridx = 0;
189
                c.weightx = 0;
190
                this.add(labelStatutCat, c);
191
                c.gridx++;
192
                c.weighty = 1;
193
                c.weightx = 1;
194
                this.add(selStatutCat, c);
195
 
41 ilm 196
                // Statut categoriel
197
                JLabel labelStatutCatConv = new JLabel(getLabelFor("ID_CODE_STATUT_CAT_CONV"));
198
                labelStatutCatConv.setHorizontalAlignment(SwingConstants.RIGHT);
199
                ElementComboBox selStatutCatConv = new ElementComboBox();
200
                selStatutCatConv.setInfoIconVisible(false);
201
                c.gridy++;
202
                c.gridx = 0;
203
                c.weightx = 0;
204
                this.add(labelStatutCatConv, c);
205
                c.gridx++;
206
                c.weighty = 1;
207
                c.weightx = 1;
208
                this.add(selStatutCatConv, c);
209
 
132 ilm 210
                List<String> dsnFF = Arrays.asList("ID_CONTRAT_MODALITE_TEMPS", "ID_CONTRAT_REGIME_MALADIE", "ID_CONTRAT_REGIME_VIEILLESSE", "ID_CONTRAT_DETACHE_EXPATRIE",
211
                        "ID_CONTRAT_DISPOSITIF_POLITIQUE");
212
 
213
                for (String ffName : dsnFF) {
214
                    JLabel labelFF = new JLabel(getLabelFor(ffName));
215
                    labelFF.setHorizontalAlignment(SwingConstants.RIGHT);
216
                    ElementComboBox selFF = new ElementComboBox();
217
                    selFF.setInfoIconVisible(false);
218
                    c.gridy++;
219
                    c.gridx = 0;
220
                    c.weightx = 0;
221
                    this.add(labelFF, c);
222
                    c.gridx++;
223
                    c.weighty = 1;
224
                    c.weightx = 1;
225
                    this.add(selFF, c);
226
                    this.addRequiredSQLObject(selFF, ffName);
227
                }
228
                JLabel labelFF = new JLabel(getLabelFor("ID_CONTRAT_MOTIF_RECOURS"));
229
                labelFF.setHorizontalAlignment(SwingConstants.RIGHT);
230
                ElementComboBox selFF = new ElementComboBox();
231
                selFF.setInfoIconVisible(false);
232
                c.gridy++;
233
                c.gridx = 0;
234
                c.weightx = 0;
235
                this.add(labelFF, c);
236
                c.gridx++;
237
                c.weighty = 1;
238
                c.weightx = 1;
239
                this.add(selFF, c);
240
                this.addSQLObject(selFF, "ID_CONTRAT_MOTIF_RECOURS");
241
 
174 ilm 242
                // Code Arrco, agirc retirés du contrat et ajoutés dans les caisses de cotisations
243
 
41 ilm 244
                // Code UGRR
245
 
174 ilm 246
                // JLabel labelCodeUGRR = new JLabel(getLabelFor("CODE_IRC_UGRR"));
247
                // labelCodeUGRR.setHorizontalAlignment(SwingConstants.RIGHT);
248
                // JTextField textCodeUGRR = new JTextField();
249
                // c.gridy++;
250
                // c.gridx = 0;
251
                // c.weightx = 0;
252
                // this.add(labelCodeUGRR, c);
253
                // c.gridx++;
254
                // c.weighty = 1;
255
                // c.weightx = 1;
256
                // this.add(textCodeUGRR, c);
257
                // addView(textCodeUGRR, "CODE_IRC_UGRR");
258
                //
259
                // JLabel labelNumUGRR = new JLabel(getLabelFor("NUMERO_RATTACHEMENT_UGRR"));
260
                // labelNumUGRR.setHorizontalAlignment(SwingConstants.RIGHT);
261
                // JTextField textNumUGRR = new JTextField();
262
                // c.gridy++;
263
                // c.gridx = 0;
264
                // c.weightx = 0;
265
                // this.add(labelNumUGRR, c);
266
                // c.gridx++;
267
                // c.weighty = 1;
268
                // c.weightx = 1;
269
                // this.add(textNumUGRR, c);
270
                // addView(textNumUGRR, "NUMERO_RATTACHEMENT_UGRR");
271
                //
272
                // // Code UGRC
273
                // JLabel labelCodeUGRC = new JLabel(getLabelFor("CODE_IRC_UGRC"));
274
                // labelCodeUGRC.setHorizontalAlignment(SwingConstants.RIGHT);
275
                // JTextField textCodeUGRC = new JTextField();
276
                // c.gridy++;
277
                // c.gridx = 0;
278
                // c.weightx = 0;
279
                // this.add(labelCodeUGRC, c);
280
                // c.gridx++;
281
                // c.weighty = 1;
282
                // c.weightx = 1;
283
                // this.add(textCodeUGRC, c);
284
                // addView(textCodeUGRC, "CODE_IRC_UGRC");
285
                //
286
                // JLabel labelNumUGRC = new JLabel(getLabelFor("NUMERO_RATTACHEMENT_UGRC"));
287
                // labelNumUGRC.setHorizontalAlignment(SwingConstants.RIGHT);
288
                // JTextField textNumUGRC = new JTextField();
289
                // c.gridy++;
290
                // c.gridx = 0;
291
                // c.weightx = 0;
292
                // this.add(labelNumUGRC, c);
293
                // c.gridx++;
294
                // c.weighty = 1;
295
                // c.weightx = 1;
296
                // this.add(textNumUGRC, c);
297
                // addView(textNumUGRC, "NUMERO_RATTACHEMENT_UGRC");
298
                //
299
                // // Retraite
300
                // JLabel labelCodeRetraite = new JLabel(getLabelFor("CODE_IRC_RETRAITE"));
301
                // labelCodeRetraite.setHorizontalAlignment(SwingConstants.RIGHT);
302
                // JTextField textCodeRetraite = new JTextField();
303
                // c.gridy++;
304
                // c.gridx = 0;
305
                // c.weightx = 0;
306
                // this.add(labelCodeRetraite, c);
307
                // c.gridx++;
308
                // c.weighty = 1;
309
                // c.weightx = 1;
310
                // this.add(textCodeRetraite, c);
311
                // addView(textCodeRetraite, "CODE_IRC_RETRAITE");
312
                //
313
                // JLabel labelNumRetraite = new
314
                // JLabel(getLabelFor("NUMERO_RATTACHEMENT_RETRAITE"));
315
                // labelNumRetraite.setHorizontalAlignment(SwingConstants.RIGHT);
316
                // JTextField textNumRetraite = new JTextField();
317
                // c.gridy++;
318
                // c.gridx = 0;
319
                // c.weightx = 0;
320
                // this.add(labelNumRetraite, c);
321
                // c.gridx++;
322
                // c.weighty = 1;
323
                // c.weightx = 1;
324
                // this.add(textNumRetraite, c);
325
                // addView(textNumRetraite, "NUMERO_RATTACHEMENT_RETRAITE");
41 ilm 326
 
132 ilm 327
                // JLabel labelCodeRegimeRetraite = new
328
                // JLabel(getLabelFor("CODE_REGIME_RETRAITE_DSN"));
329
                // labelCodeRegimeRetraite.setHorizontalAlignment(SwingConstants.RIGHT);
330
                // JTextField textCodeRegimeRetraite = new JTextField();
331
                // c.gridy++;
332
                // c.gridx = 0;
333
                // c.weightx = 0;
334
                // this.add(labelCodeRegimeRetraite, c);
335
                // c.gridx++;
336
                // c.weighty = 1;
337
                // c.weightx = 1;
338
                // this.add(textCodeRegimeRetraite, c);
339
                // addRequiredSQLObject(textCodeRegimeRetraite, "CODE_REGIME_RETRAITE_DSN");
340
 
142 ilm 341
                JLabel labelDateModif = new JLabel(getLabelFor("DATE_MODIFICATION"));
342
                labelDateModif.setHorizontalAlignment(SwingConstants.RIGHT);
343
                JDate textDateModif = new JDate();
344
                c.gridy++;
345
                c.gridx = 0;
346
                c.weightx = 0;
347
                this.add(textDateModif, c);
348
                c.gridx++;
349
                c.weighty = 1;
350
                c.weightx = 1;
351
                this.add(textDateModif, c);
352
                addSQLObject(textDateModif, "DATE_MODIFICATION");
353
 
354
                // JLabel labelCM = new JLabel(getLabelFor("ID_INFOS_SALARIE_PAYE_MODIFIE"));
355
                // labelCM.setHorizontalAlignment(SwingConstants.RIGHT);
356
                // ElementComboBox selCM = new ElementComboBox();
357
                // final SQLElement elementInfosPaye =
358
                // getDirectory().getElement("INFOS_SALARIE_PAYE");
359
                // selCM.init(elementInfosPaye, elementInfosPaye.createComboRequest());
360
                // selCM.setInfoIconVisible(false);
361
                // c.gridy++;
362
                // c.gridx = 0;
363
                // c.weightx = 0;
364
                // this.add(labelCM, c);
365
                // c.gridx++;
366
                // c.weighty = 1;
367
                // c.weightx = 1;
368
                // this.add(selCM, c);
369
                // this.addSQLObject(selCM, "ID_INFOS_SALARIE_PAYE_MODIFIE");
370
 
371
                JLabel labelDateDebut = new JLabel(getLabelFor("DATE_DEBUT"));
372
                labelDateDebut.setHorizontalAlignment(SwingConstants.RIGHT);
373
                JDate textDateDebut = new JDate();
374
                c.gridy++;
375
                c.gridx = 0;
376
                c.weightx = 0;
377
                this.add(labelDateDebut, c);
378
                c.gridx++;
379
                c.weighty = 1;
380
                c.weightx = 1;
381
                this.add(textDateDebut, c);
382
                addSQLObject(textDateDebut, "DATE_DEBUT", REQ);
383
 
132 ilm 384
                JLabel labelDateFin = new JLabel(getLabelFor("DATE_PREV_FIN"));
385
                labelDateFin.setHorizontalAlignment(SwingConstants.RIGHT);
386
                JDate textDateFin = new JDate();
387
                c.gridy++;
388
                c.gridx = 0;
389
                c.weightx = 0;
390
                this.add(labelDateFin, c);
391
                c.gridx++;
392
                c.weighty = 1;
393
                c.weightx = 1;
394
                this.add(textDateFin, c);
395
                addSQLObject(textDateFin, "DATE_PREV_FIN");
396
 
397
                this.addRequiredSQLObject(selCodeCatSocio, "ID_CODE_EMPLOI");
151 ilm 398
                this.addRequiredSQLObject(selContratTravail, "ID_CODE_CONTRAT_TRAVAIL");
399
                this.addRequiredSQLObject(selCaractActivite, "ID_CODE_CARACT_ACTIVITE");
400
                this.addRequiredSQLObject(selDroitContrat, "ID_CODE_DROIT_CONTRAT");
401
                this.addRequiredSQLObject(selStatutProf, "ID_CODE_STATUT_PROF");
402
                this.addRequiredSQLObject(selStatutCat, "ID_CODE_STATUT_CATEGORIEL");
403
                this.addRequiredSQLObject(selStatutCatConv, "ID_CODE_STATUT_CAT_CONV");
18 ilm 404
                this.addRequiredSQLObject(textNature, "NATURE");
405
            }
406
        };
407
    }
57 ilm 408
 
409
    @Override
410
    protected String createCode() {
156 ilm 411
        return createCodeOfPackage() + ".contract.employe";
57 ilm 412
    }
18 ilm 413
}