OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 57 | 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.finance.accounting.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;
21
import org.openconcerto.ui.component.ITextArea;
22
 
23
import java.awt.GridBagConstraints;
24
import java.awt.GridBagLayout;
25
import java.util.ArrayList;
26
import java.util.List;
27
 
28
import javax.swing.JLabel;
29
import javax.swing.JTextField;
30
import javax.swing.SwingConstants;
31
 
32
// Saisie MySQL compte 2186 Emballages recuperables
33
// 75 gestion type compte
34
 
35
public class ComptePCGSQLElement extends ComptaSQLConfElement {
36
 
37
    public ComptePCGSQLElement() {
38
        super("COMPTE_PCG", "un compte", "comptes");
39
 
40
    }
41
 
42
    protected List<String> getListFields() {
43
        final List<String> l = new ArrayList<String>();
44
        l.add("NUMERO");
45
        l.add("NOM");
46
        l.add("INFOS");
47
        l.add("ID_TYPE_COMPTE_PCG_BASE");
48
        // l.add("ID_TYPE_COMPTE_PCG_AB");
49
        // l.add("ID_TYPE_COMPTE_PCG_DEV");
50
        l.add("ID_NATURE_COMPTE");
51
        return l;
52
    }
53
 
54
    protected List<String> getComboFields() {
55
        final List<String> l = new ArrayList<String>();
56
        l.add("NUMERO");
57
        l.add("NOM");
58
        return l;
59
    }
60
 
61
    public SQLComponent createComponent() {
62
        return new BaseSQLComponent(this) {
63
            public void addViews() {
64
                this.setLayout(new GridBagLayout());
65
 
66
                final GridBagConstraints c = new DefaultGridBagConstraints();
67
                c.anchor = GridBagConstraints.NORTHEAST;
68
                c.gridwidth = 1;
69
 
70
                // Numero
71
                JLabel labelNumero = new JLabel("Numéro ");
72
                this.add(labelNumero, c);
73
 
74
                JTextField textNumero = new JTextField();
75
                c.gridx++;
76
                c.weightx = 1;
77
                this.add(textNumero, c);
78
 
79
                // Libellé
80
                JLabel labelNom = new JLabel("Libellé ");
81
                c.gridx++;
82
                c.weightx = 0;
83
                this.add(labelNom, c);
84
 
85
                JTextField textNom = new JTextField();
86
                c.gridx++;
87
                c.weightx = 1;
88
                this.add(textNom, c);
89
 
90
                // Type de compte Base
91
                JLabel labelTypeCompteBase = new JLabel("Type Compte Base");
92
                c.gridy++;
93
                c.gridx = 0;
94
                c.weightx = 0;
95
                labelTypeCompteBase.setHorizontalAlignment(SwingConstants.RIGHT);
96
                this.add(labelTypeCompteBase, c);
97
 
98
                ElementComboBox ComboTypeBase = new ElementComboBox();
99
                c.gridx++;
100
                c.weightx = 1;
101
                this.add(ComboTypeBase, c);
102
 
103
                // Nature du compte
104
                JLabel labelNature = new JLabel("Nature  du compte");
105
                c.gridx++;
106
                c.weightx = 0;
107
                labelNature.setHorizontalAlignment(SwingConstants.RIGHT);
108
                this.add(labelNature, c);
109
 
110
                ElementComboBox ComboNature = new ElementComboBox();
111
                c.gridx++;
112
                c.weightx = 1;
113
                this.add(ComboNature, c);
114
 
115
                // Type compte Abrege
116
                JLabel labelTypeCompteAb = new JLabel("Type Compte Abrégé");
117
                c.gridy++;
118
                c.gridx = 0;
119
                c.weightx = 0;
120
                labelTypeCompteAb.setHorizontalAlignment(SwingConstants.RIGHT);
121
                this.add(labelTypeCompteAb, c);
122
 
123
                ElementComboBox ComboTypeAb = new ElementComboBox();
124
                c.gridx++;
125
                c.weightx = 1;
126
                this.add(ComboTypeAb, c);
127
 
128
                // Type compte developpe
129
                JLabel labelTypeCompteDev = new JLabel("Type Compte Développé");
130
                c.gridy++;
131
                c.gridx = 0;
132
                c.weightx = 0;
133
                labelTypeCompteDev.setHorizontalAlignment(SwingConstants.RIGHT);
134
                this.add(labelTypeCompteDev, c);
135
 
136
                ElementComboBox ComboTypeDev = new ElementComboBox();
137
                c.gridx++;
138
                c.weightx = 1;
139
                this.add(ComboTypeDev, c);
140
 
141
                // Infos
142
                JLabel labelInfos = new JLabel(getLabelFor("INFOS"));
143
                c.gridy++;
144
                c.gridx = 0;
145
                c.weightx = 0;
146
                this.add(labelInfos, c);
147
 
148
                ITextArea textInfos = new ITextArea();
149
                c.gridx++;
150
                c.weightx = 1;
151
                c.weighty = 1;
152
                c.gridwidth = GridBagConstraints.REMAINDER;
153
                c.gridheight = GridBagConstraints.REMAINDER;
154
                c.fill = GridBagConstraints.BOTH;
155
                this.add(textInfos, c);
156
 
157
                this.addRequiredSQLObject(textNumero, "NUMERO");
158
                this.addSQLObject(textNom, "NOM");
159
                this.addSQLObject(textInfos, "INFOS");
160
                this.addSQLObject(ComboTypeBase, "ID_TYPE_COMPTE_PCG_BASE");
161
                this.addSQLObject(ComboTypeAb, "ID_TYPE_COMPTE_PCG_AB");
162
                this.addSQLObject(ComboTypeDev, "ID_TYPE_COMPTE_PCG_DEV");
163
                this.addSQLObject(ComboNature, "ID_NATURE_COMPTE");
164
            }
165
        };
166
    }
167
 
57 ilm 168
    @Override
169
    protected String createCode() {
156 ilm 170
        return createCodeOfPackage() + ".code.national";
57 ilm 171
    }
18 ilm 172
}