OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 180
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
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
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
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.
9
 * language governing permissions and limitations under the License.
10
 * 
10
 * 
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.sales.order.element;
14
 package org.openconcerto.erp.core.sales.order.element;
15
 
15
 
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
17
import org.openconcerto.erp.core.common.ui.DeviseTableCellRenderer;
17
import org.openconcerto.erp.core.common.ui.DeviseTableCellRenderer;
18
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet;
18
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet;
19
import org.openconcerto.erp.core.sales.order.ui.TypeFactureCommandeCellRenderer;
19
import org.openconcerto.erp.core.sales.order.ui.TypeFactureCommandeCellRenderer;
20
import org.openconcerto.erp.core.sales.order.ui.TypeFactureCommandeClient;
20
import org.openconcerto.erp.core.sales.order.ui.TypeFactureCommandeClient;
21
import org.openconcerto.erp.core.sales.order.ui.TypeFactureCommandeClientComboBox;
21
import org.openconcerto.erp.core.sales.order.ui.TypeFactureCommandeClientComboBox;
22
import org.openconcerto.erp.core.sales.order.ui.TypeFactureCommandeRowItemView;
22
import org.openconcerto.erp.core.sales.order.ui.TypeFactureCommandeRowItemView;
23
import org.openconcerto.sql.element.BaseSQLComponent;
23
import org.openconcerto.sql.element.BaseSQLComponent;
24
import org.openconcerto.sql.element.SQLComponent;
24
import org.openconcerto.sql.element.SQLComponent;
25
import org.openconcerto.sql.element.UISQLComponent;
25
import org.openconcerto.sql.element.UISQLComponent;
26
import org.openconcerto.sql.model.FieldPath;
26
import org.openconcerto.sql.model.FieldPath;
27
import org.openconcerto.sql.model.SQLRow;
27
import org.openconcerto.sql.model.SQLRow;
28
import org.openconcerto.sql.model.SQLRowAccessor;
28
import org.openconcerto.sql.model.SQLRowAccessor;
29
import org.openconcerto.sql.model.SQLRowValues;
29
import org.openconcerto.sql.model.SQLRowValues;
-
 
30
import org.openconcerto.sql.model.SQLTable;
30
import org.openconcerto.sql.model.graph.Path;
31
import org.openconcerto.sql.model.graph.Path;
31
import org.openconcerto.sql.view.EditFrame;
32
import org.openconcerto.sql.view.EditFrame;
32
import org.openconcerto.sql.view.EditPanelListener;
33
import org.openconcerto.sql.view.EditPanelListener;
33
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
34
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
34
import org.openconcerto.sql.view.list.IListe;
35
import org.openconcerto.sql.view.list.IListe;
35
import org.openconcerto.sql.view.list.RowAction;
36
import org.openconcerto.sql.view.list.RowAction;
36
import org.openconcerto.sql.view.list.SQLTableModelSource;
37
import org.openconcerto.sql.view.list.SQLTableModelSource;
37
import org.openconcerto.utils.CollectionUtils;
38
import org.openconcerto.utils.CollectionUtils;
38
import org.openconcerto.utils.DecimalUtils;
39
import org.openconcerto.utils.DecimalUtils;
39
import org.openconcerto.utils.ExceptionHandler;
40
import org.openconcerto.utils.ExceptionHandler;
40
 
41
 
41
import java.awt.event.ActionEvent;
42
import java.awt.event.ActionEvent;
42
import java.math.BigDecimal;
43
import java.math.BigDecimal;
43
import java.sql.SQLException;
44
import java.sql.SQLException;
44
import java.util.ArrayList;
45
import java.util.ArrayList;
45
import java.util.Arrays;
46
import java.util.Arrays;
-
 
47
import java.util.Collection;
46
import java.util.HashSet;
48
import java.util.HashSet;
47
import java.util.List;
49
import java.util.List;
48
import java.util.Set;
50
import java.util.Set;
49
 
51
 
50
import javax.swing.AbstractAction;
52
import javax.swing.AbstractAction;
51
 
53
 
52
public class FacturationCommandeClientSQLElement extends ComptaSQLConfElement {
54
public class FacturationCommandeClientSQLElement extends ComptaSQLConfElement {
53
 
55
 
54
    public static final String TABLENAME = "FACTURATION_COMMANDE_CLIENT";
56
    public static final String TABLENAME = "FACTURATION_COMMANDE_CLIENT";
55
 
57
 
56
    public FacturationCommandeClientSQLElement() {
58
    public FacturationCommandeClientSQLElement() {
57
        super(TABLENAME, "un terme de facturation de commande client", "termes de facturation commandes clients");
59
        super(TABLENAME, "un terme de facturation de commande client", "termes de facturation commandes clients");
58
        {
60
        {
59
            RowAction action = new RowAction(new AbstractAction("Facturer") {
61
            RowAction action = new RowAction(new AbstractAction("Facturer") {
60
 
62
 
61
                @Override
63
                @Override
62
                public void actionPerformed(ActionEvent e) {
64
                public void actionPerformed(ActionEvent e) {
63
                    final SQLRow sel = IListe.get(e).getSelectedRow().asRow();
65
                    final SQLRow sel = IListe.get(e).getSelectedRow().asRow();
64
                    sel.fetchValues();
66
                    sel.fetchValues();
65
                    CommandeClientSQLElement eltCmd = (CommandeClientSQLElement) getForeignElement("ID_COMMANDE_CLIENT");
67
                    CommandeClientSQLElement eltCmd = (CommandeClientSQLElement) getForeignElement("ID_COMMANDE_CLIENT");
66
                    int typeFacture = sel.getInt("TYPE_FACTURE");
68
                    int typeFacture = sel.getInt("TYPE_FACTURE");
67
                    final SQLRow asRow = sel.getForeign("ID_COMMANDE_CLIENT").asRow();
69
                    final SQLRow asRow = sel.getForeign("ID_COMMANDE_CLIENT").asRow();
68
                    asRow.fetchValues();
70
                    asRow.fetchValues();
69
                    List<SQLRowValues> l = Arrays.asList(asRow.asRowValues());
71
                    List<SQLRowValues> l = Arrays.asList(asRow.asRowValues());
70
                    final EditFrame f;
72
                    final EditFrame f;
71
                    if (typeFacture == TypeFactureCommandeClient.SITUATION.getId()) {
73
                    if (typeFacture == TypeFactureCommandeClient.SITUATION.getId()) {
72
                        f = eltCmd.transfertAcompteClient(l);
74
                        f = eltCmd.transfertAcompteClient(l);
73
                        SQLRowValues rowValues = new SQLRowValues(getForeignElement("ID_SAISIE_VENTE_FACTURE").getTable());
75
                        SQLRowValues rowValues = new SQLRowValues(getForeignElement("ID_SAISIE_VENTE_FACTURE").getTable());
74
                        rowValues.put("POURCENT_FACTURABLE", sel.getObject("POURCENT"));
76
                        rowValues.put("POURCENT_FACTURABLE", sel.getObject("POURCENT"));
75
                        rowValues.put("MONTANT_FACTURABLE", null);
77
                        rowValues.put("MONTANT_FACTURABLE", null);
76
                        ((BaseSQLComponent) f.getSQLComponent()).getView("MONTANT_FACTURABLE,POURCENT_FACTURABLE").show(rowValues);
78
                        ((BaseSQLComponent) f.getSQLComponent()).getView("MONTANT_FACTURABLE,POURCENT_FACTURABLE").show(rowValues);
77
                        ;
79
                        ;
78
 
80
 
79
                    } else if (typeFacture == TypeFactureCommandeClient.SOLDE.getId()) {
81
                    } else if (typeFacture == TypeFactureCommandeClient.SOLDE.getId()) {
80
                        f = eltCmd.transfertSoldeClient(l);
82
                        f = eltCmd.transfertSoldeClient(l);
81
 
83
 
82
                    } else {
84
                    } else {
83
                        f = eltCmd.transfertFactureClient(l);
85
                        f = eltCmd.transfertFactureClient(l);
84
                    }
86
                    }
85
 
87
 
86
                    SQLRowValues rowValues = new SQLRowValues(eltCmd.getTable().getTable("MODE_REGLEMENT").getTable());
88
                    SQLRowValues rowValues = new SQLRowValues(eltCmd.getTable().getTable("MODE_REGLEMENT").getTable());
87
                    rowValues.put("ID_TYPE_REGLEMENT", sel.getForeignID("ID_TYPE_REGLEMENT"));
89
                    rowValues.put("ID_TYPE_REGLEMENT", sel.getForeignID("ID_TYPE_REGLEMENT"));
88
                    rowValues.put("FIN_MOIS", Boolean.FALSE);
90
                    rowValues.put("FIN_MOIS", Boolean.FALSE);
89
                    if (sel.getBoolean("COMPTANT")) {
91
                    if (sel.getBoolean("COMPTANT")) {
90
                        rowValues.put("AJOURS", 0);
92
                        rowValues.put("AJOURS", 0);
91
                        rowValues.put("LENJOUR", 0);
93
                        rowValues.put("LENJOUR", 0);
92
                        rowValues.put("DATE_FACTURE", Boolean.TRUE);
94
                        rowValues.put("DATE_FACTURE", Boolean.TRUE);
93
                        rowValues.put("COMPTANT", Boolean.TRUE);
95
                        rowValues.put("COMPTANT", Boolean.TRUE);
94
                    } else {
96
                    } else {
95
                        rowValues.put("AJOURS", sel.getObject("AJOURS"));
97
                        rowValues.put("AJOURS", sel.getObject("AJOURS"));
96
                        int lenjour = sel.getInt("LENJOUR");
98
                        int lenjour = sel.getInt("LENJOUR");
97
                        if (sel.getBoolean("FIN_MOIS")) {
99
                        if (sel.getBoolean("FIN_MOIS")) {
98
                            lenjour = 31;
100
                            lenjour = 31;
99
                        }
101
                        }
100
                        rowValues.put("LENJOUR", lenjour);
102
                        rowValues.put("LENJOUR", lenjour);
101
                        rowValues.put("COMPTANT", Boolean.FALSE);
103
                        rowValues.put("COMPTANT", Boolean.FALSE);
102
                        rowValues.put("FIN_MOIS", lenjour == 31);
104
                        rowValues.put("FIN_MOIS", lenjour == 31);
103
                        rowValues.put("DATE_FACTURE", lenjour == 0);
105
                        rowValues.put("DATE_FACTURE", lenjour == 0);
104
                    }
106
                    }
105
 
107
 
106
                    ((BaseSQLComponent) f.getSQLComponent()).getView("ID_MODE_REGLEMENT").show(rowValues);
108
                    ((BaseSQLComponent) f.getSQLComponent()).getView("ID_MODE_REGLEMENT").show(rowValues);
107
                    ;
109
                    ;
108
 
110
 
109
                    f.addEditPanelListener(new EditPanelListener() {
111
                    f.addEditPanelListener(new EditPanelListener() {
110
 
112
 
111
                        @Override
113
                        @Override
112
                        public void modified() {
114
                        public void modified() {
113
 
115
 
114
                        }
116
                        }
115
 
117
 
116
                        @Override
118
                        @Override
117
                        public void inserted(int id) {
119
                        public void inserted(int id) {
118
                            try {
120
                            try {
119
                                sel.createEmptyUpdateRow().put("ID_SAISIE_VENTE_FACTURE", id).commit();
121
                                sel.createEmptyUpdateRow().put("ID_SAISIE_VENTE_FACTURE", id).commit();
-
 
122
                                SQLTable tableFacture = getForeignElement("ID_SAISIE_VENTE_FACTURE").getTable();
-
 
123
                                SQLRowValues rowValsFact = new SQLRowValues(tableFacture);
-
 
124
                                rowValsFact.put(tableFacture.getKey().getName(), id);
-
 
125
                                rowValsFact.put("ID_FACTURATION_COMMANDE_CLIENT", sel.getID());
-
 
126
                                rowValsFact.commit();
120
                            } catch (SQLException e) {
127
                            } catch (SQLException e) {
121
                                ExceptionHandler.handle("Erreur lors de l'affectation de la facture", e);
128
                                ExceptionHandler.handle("Erreur lors de l'affectation de la facture", e);
122
                            }
129
                            }
123
                        }
130
                        }
124
 
131
 
125
                        @Override
132
                        @Override
126
                        public void deleted() {
133
                        public void deleted() {
127
                        }
134
                        }
128
 
135
 
129
                        @Override
136
                        @Override
130
                        public void cancelled() {
137
                        public void cancelled() {
131
 
138
 
132
                        }
139
                        }
133
                    });
140
                    });
134
                }
141
                }
135
            }, true) {
142
            }, true) {
136
                @Override
143
                @Override
137
                public boolean enabledFor(List<SQLRowValues> selection) {
144
                public boolean enabledFor(List<SQLRowValues> selection) {
138
 
145
 
139
                    if (selection != null && selection.size() == 1) {
146
                    if (selection != null && selection.size() == 1) {
140
                        SQLRowAccessor sel = selection.get(0);
147
                        SQLRowAccessor sel = selection.get(0);
141
                        return sel.isForeignEmpty("ID_SAISIE_VENTE_FACTURE");
148
                        return sel.isForeignEmpty("ID_SAISIE_VENTE_FACTURE");
142
                    }
149
                    }
143
                    return false;
150
                    return false;
144
                }
151
                }
145
            };
152
            };
146
 
153
 
147
            getRowActions().add(action);
154
            getRowActions().add(action);
148
        }
155
        }
149
 
156
 
150
        {
157
        {
151
            RowAction action = new RowAction(new AbstractAction("Voir la facture") {
158
            RowAction action = new RowAction(new AbstractAction("Voir la facture") {
152
 
159
 
153
                @Override
160
                @Override
154
                public void actionPerformed(ActionEvent e) {
161
                public void actionPerformed(ActionEvent e) {
155
                    final SQLRowAccessor sel = IListe.get(e).getSelectedRow();
162
                    final SQLRowAccessor sel = IListe.get(e).getSelectedRow();
156
                    SQLRowAccessor fact = sel.getForeign("ID_SAISIE_VENTE_FACTURE");
163
                    SQLRowAccessor fact = sel.getForeign("ID_SAISIE_VENTE_FACTURE");
157
                    VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(fact.asRow());
164
                    VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(fact.asRow());
158
                    try {
165
                    try {
159
                        sheet.showPreviewDocument();
166
                        sheet.showPreviewDocument();
160
                    } catch (Exception e1) {
167
                    } catch (Exception e1) {
161
                        // TODO Auto-generated catch block
168
                        // TODO Auto-generated catch block
162
                        e1.printStackTrace();
169
                        e1.printStackTrace();
163
                    }
170
                    }
164
                }
171
                }
165
            }, true) {
172
            }, true) {
166
                @Override
173
                @Override
167
                public boolean enabledFor(List<SQLRowValues> selection) {
174
                public boolean enabledFor(List<SQLRowValues> selection) {
168
 
175
 
169
                    if (selection != null && selection.size() == 1) {
176
                    if (selection != null && selection.size() == 1) {
170
                        SQLRowAccessor sel = selection.get(0);
177
                        SQLRowAccessor sel = selection.get(0);
171
                        return !sel.isForeignEmpty("ID_SAISIE_VENTE_FACTURE");
178
                        return !sel.isForeignEmpty("ID_SAISIE_VENTE_FACTURE");
172
                    }
179
                    }
173
                    return false;
180
                    return false;
174
                }
181
                }
175
            };
182
            };
176
 
183
 
177
            getRowActions().add(action);
184
            getRowActions().add(action);
178
        }
185
        }
179
    }
186
    }
180
 
187
 
181
    /*
188
    /*
182
     * (non-Javadoc)
189
     * (non-Javadoc)
183
     * 
190
     * 
184
     * @see org.openconcerto.devis.BaseSQLElement#getComboFields()
191
     * @see org.openconcerto.devis.BaseSQLElement#getComboFields()
185
     */
192
     */
186
    protected List<String> getComboFields() {
193
    protected List<String> getComboFields() {
187
        final List<String> l = new ArrayList<>(1);
194
        final List<String> l = new ArrayList<>(1);
188
        l.add("NOM");
195
        l.add("NOM");
189
        return l;
196
        return l;
190
    }
197
    }
191
 
198
 
192
    @Override
199
    @Override
193
    public Set<String> getReadOnlyFields() {
200
    public Set<String> getReadOnlyFields() {
194
        Set<String> s = new HashSet<>(1);
201
        Set<String> s = new HashSet<>(1);
195
        s.add("CHOICE");
202
        s.add("CHOICE");
196
        return s;
203
        return s;
197
    }
204
    }
198
 
205
 
199
    @Override
206
    @Override
200
    protected String getParentFFName() {
207
    protected String getParentFFName() {
201
        return "ID_COMMANDE_CLIENT";
208
        return "ID_COMMANDE_CLIENT";
202
    }
209
    }
203
 
210
 
204
    /*
211
    /*
205
     * (non-Javadoc)
212
     * (non-Javadoc)
206
     * 
213
     * 
207
     * @see org.openconcerto.devis.BaseSQLElement#getListFields()
214
     * @see org.openconcerto.devis.BaseSQLElement#getListFields()
208
     */
215
     */
209
    protected List<String> getListFields() {
216
    protected List<String> getListFields() {
210
        final List<String> l = new ArrayList<>(7);
217
        final List<String> l = new ArrayList<>(7);
211
        l.add("NOM");
218
        l.add("NOM");
212
        l.add("TYPE_FACTURE");
219
        l.add("TYPE_FACTURE");
213
        l.add("ID_TYPE_REGLEMENT");
220
        l.add("ID_TYPE_REGLEMENT");
214
        l.add("POURCENT");
221
        l.add("POURCENT");
215
        l.add("DATE_PREVISIONNELLE");
222
        l.add("DATE_PREVISIONNELLE");
216
        l.add("ID_COMMANDE_CLIENT");
223
        l.add("ID_COMMANDE_CLIENT");
217
        l.add("ID_SAISIE_VENTE_FACTURE");
224
        l.add("ID_SAISIE_VENTE_FACTURE");
218
        return l;
225
        return l;
219
    }
226
    }
220
 
227
 
221
    @Override
228
    @Override
222
    protected void _initTableSource(SQLTableModelSource res) {
229
    protected void _initTableSource(SQLTableModelSource res) {
223
        res.init();
230
        res.init();
224
        res.getColumn(getTable().getField("POURCENT")).setRenderer(new DeviseTableCellRenderer());
231
        res.getColumn(getTable().getField("POURCENT")).setRenderer(new DeviseTableCellRenderer());
225
        res.getColumn(getTable().getField("TYPE_FACTURE")).setRenderer(new TypeFactureCommandeCellRenderer());
232
        res.getColumn(getTable().getField("TYPE_FACTURE")).setRenderer(new TypeFactureCommandeCellRenderer());
226
        final BaseSQLTableModelColumn pourcentFact = new BaseSQLTableModelColumn("Montant facturé", BigDecimal.class) {
233
        final BaseSQLTableModelColumn pourcentFact = new BaseSQLTableModelColumn("Montant à facturer", BigDecimal.class) {
227
 
234
 
228
            @Override
235
            @Override
229
            protected Object show_(SQLRowAccessor r) {
236
            protected Object show_(SQLRowAccessor r) {
230
                long ht = r.getForeign("ID_COMMANDE_CLIENT").getLong("T_TTC");
237
                long ht = r.getForeign("ID_COMMANDE_CLIENT").getLong("T_TTC");
231
                BigDecimal percent = r.getBigDecimal("POURCENT");
238
                BigDecimal percent = r.getBigDecimal("POURCENT");
232
                return percent.movePointLeft(2).multiply(new BigDecimal(ht).movePointLeft(2), DecimalUtils.HIGH_PRECISION);
239
                return percent.movePointLeft(2).multiply(new BigDecimal(ht).movePointLeft(2), DecimalUtils.HIGH_PRECISION);
233
            }
240
            }
234
 
241
 
235
            @Override
242
            @Override
236
            public Set<FieldPath> getPaths() {
243
            public Set<FieldPath> getPaths() {
237
                Path p = new Path(getTable());
244
                Path p = new Path(getTable());
238
                Path p2 = p.add(p.getFirst().getField("ID_COMMANDE_CLIENT"));
245
                Path p2 = p.add(p.getFirst().getField("ID_COMMANDE_CLIENT"));
239
                return CollectionUtils.createSet(new FieldPath(p, "POURCENT"), new FieldPath(p2, "T_TTC"));
246
                return CollectionUtils.createSet(new FieldPath(p, "POURCENT"), new FieldPath(p2, "T_TTC"));
240
            }
247
            }
241
        };
248
        };
242
        pourcentFact.setRenderer(new DeviseTableCellRenderer());
249
        pourcentFact.setRenderer(new DeviseTableCellRenderer());
243
        res.getColumns().add(pourcentFact);
250
        res.getColumns().add(pourcentFact);
-
 
251
 
-
 
252
        final BaseSQLTableModelColumn montantFact = new BaseSQLTableModelColumn("Montant facturé", BigDecimal.class) {
-
 
253
 
-
 
254
            @Override
-
 
255
            protected Object show_(SQLRowAccessor r) {
-
 
256
                Collection<? extends SQLRowAccessor> rows = r.getReferentRows(getForeignElement("ID_SAISIE_VENTE_FACTURE").getTable());
-
 
257
                long ht = 0;
-
 
258
                for (SQLRowAccessor sqlRowAccessor : rows) {
-
 
259
                    ht += sqlRowAccessor.getLong("T_TTC");
-
 
260
                }
-
 
261
 
-
 
262
                return new BigDecimal(ht).movePointLeft(2);
-
 
263
            }
-
 
264
 
-
 
265
            @Override
-
 
266
            public Set<FieldPath> getPaths() {
-
 
267
                Path p = new Path(getTable());
-
 
268
                Path p2 = p.add(p.getFirst().getField("ID_COMMANDE_CLIENT"));
-
 
269
                Path p3 = new Path(getTable());
-
 
270
                p3 = p3.add(getTable().getForeignTable("ID_SAISIE_VENTE_FACTURE").getField("ID_FACTURATION_COMMANDE_CLIENT"));
-
 
271
                return CollectionUtils.createSet(new FieldPath(p, "POURCENT"), new FieldPath(p2, "T_TTC"), new FieldPath(p3, "T_TTC"), new FieldPath(p2, "T_HT"), new FieldPath(p3, "T_HT"));
-
 
272
            }
-
 
273
        };
-
 
274
        montantFact.setRenderer(new DeviseTableCellRenderer());
-
 
275
        res.getColumns().add(montantFact);
244
        super._initTableSource(res);
276
        super._initTableSource(res);
245
    }
277
    }
246
 
278
 
247
    /*
279
    /*
248
     * (non-Javadoc)
280
     * (non-Javadoc)
249
     * 
281
     * 
250
     * @see org.openconcerto.devis.SQLElement#getComponent()
282
     * @see org.openconcerto.devis.SQLElement#getComponent()
251
     */
283
     */
252
    public SQLComponent createComponent() {
284
    public SQLComponent createComponent() {
253
        return new UISQLComponent(this) {
285
        return new UISQLComponent(this) {
254
            public void addViews() {
286
            public void addViews() {
255
                this.addView("NOM");
287
                this.addView("NOM");
256
                this.addView("POURCENT");
288
                this.addView("POURCENT");
257
                this.addView("ID_TYPE_REGLEMENT");
289
                this.addView("ID_TYPE_REGLEMENT");
258
                this.addView("AJOURS");
290
                this.addView("AJOURS");
259
                this.addView("COMPTANT");
291
                this.addView("COMPTANT");
260
                this.addView("CHOICE");
292
                this.addView("CHOICE");
261
 
293
 
262
                TypeFactureCommandeClientComboBox box = new TypeFactureCommandeClientComboBox();
294
                TypeFactureCommandeClientComboBox box = new TypeFactureCommandeClientComboBox();
263
 
295
 
264
                this.addView(new TypeFactureCommandeRowItemView(box), "TYPE_FACTURE", REQ);
296
                this.addView(new TypeFactureCommandeRowItemView(box), "TYPE_FACTURE", REQ);
265
                this.addView("ID_MODELE");
297
                this.addView("ID_MODELE");
266
            }
298
            }
267
 
299
 
268
            @Override
300
            @Override
269
            protected SQLRowValues createDefaults() {
301
            protected SQLRowValues createDefaults() {
270
                SQLRowValues rowVals = new SQLRowValues(getTable());
302
                SQLRowValues rowVals = new SQLRowValues(getTable());
271
                rowVals.put("CHOICE", Boolean.TRUE);
303
                rowVals.put("CHOICE", Boolean.TRUE);
272
                return rowVals;
304
                return rowVals;
273
            }
305
            }
274
        };
306
        };
275
    }
307
    }
276
 
308
 
277
    @Override
309
    @Override
278
    protected String createCode() {
310
    protected String createCode() {
279
        return createCodeOfPackage() + ".facturation";
311
        return createCodeOfPackage() + ".facturation";
280
    }
312
    }
281
 
313
 
282
}
314
}