OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 149 | Rev 177 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 149 Rev 156
Line 19... Line 19...
19
import org.openconcerto.erp.core.common.ui.TotalPanel;
19
import org.openconcerto.erp.core.common.ui.TotalPanel;
20
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter;
20
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter;
21
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
21
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
22
import org.openconcerto.erp.core.sales.product.element.ArticleCodeClientTable;
22
import org.openconcerto.erp.core.sales.product.element.ArticleCodeClientTable;
23
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
23
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
-
 
24
import org.openconcerto.erp.core.sales.product.element.SupplierPriceListTable;
24
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement;
25
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement;
-
 
26
import org.openconcerto.erp.core.sales.product.ui.ArticleCategorieComptableTable;
25
import org.openconcerto.erp.core.sales.product.ui.ArticleDesignationTable;
27
import org.openconcerto.erp.core.sales.product.ui.ArticleDesignationTable;
26
import org.openconcerto.erp.core.sales.product.ui.ArticleTarifTable;
28
import org.openconcerto.erp.core.sales.product.ui.ArticleTarifTable;
27
import org.openconcerto.erp.core.sales.product.ui.ProductItemListTable;
29
import org.openconcerto.erp.core.sales.product.ui.ProductItemListTable;
28
import org.openconcerto.erp.core.sales.product.ui.ProductQtyPriceListTable;
30
import org.openconcerto.erp.core.sales.product.ui.ProductQtyPriceListTable;
29
import org.openconcerto.erp.core.sales.product.ui.RowValuesTableEditionPanel;
31
import org.openconcerto.erp.core.sales.product.ui.RowValuesTableEditionPanel;
-
 
32
import org.openconcerto.erp.core.supplychain.stock.element.ComposedItemStockUpdater;
-
 
33
import org.openconcerto.erp.core.supplychain.stock.element.DepotStockSQLElement;
-
 
34
import org.openconcerto.erp.core.supplychain.stock.element.StockItem;
30
import org.openconcerto.erp.model.ISQLCompteSelector;
35
import org.openconcerto.erp.model.ISQLCompteSelector;
31
import org.openconcerto.erp.preferences.DefaultNXProps;
36
import org.openconcerto.erp.preferences.DefaultNXProps;
32
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
37
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
33
import org.openconcerto.sql.Configuration;
38
import org.openconcerto.sql.Configuration;
34
import org.openconcerto.sql.element.BaseSQLComponent;
39
import org.openconcerto.sql.element.BaseSQLComponent;
Line 36... Line 41...
36
import org.openconcerto.sql.model.SQLRow;
41
import org.openconcerto.sql.model.SQLRow;
37
import org.openconcerto.sql.model.SQLRowAccessor;
42
import org.openconcerto.sql.model.SQLRowAccessor;
38
import org.openconcerto.sql.model.SQLRowListRSH;
43
import org.openconcerto.sql.model.SQLRowListRSH;
39
import org.openconcerto.sql.model.SQLRowValues;
44
import org.openconcerto.sql.model.SQLRowValues;
40
import org.openconcerto.sql.model.SQLSelect;
45
import org.openconcerto.sql.model.SQLSelect;
-
 
46
import org.openconcerto.sql.model.SQLTable;
41
import org.openconcerto.sql.model.Where;
47
import org.openconcerto.sql.model.Where;
42
import org.openconcerto.sql.preferences.SQLPreferences;
48
import org.openconcerto.sql.preferences.SQLPreferences;
43
import org.openconcerto.sql.sqlobject.ElementComboBox;
49
import org.openconcerto.sql.sqlobject.ElementComboBox;
-
 
50
import org.openconcerto.sql.sqlobject.SQLTextCombo;
44
import org.openconcerto.ui.DefaultGridBagConstraints;
51
import org.openconcerto.ui.DefaultGridBagConstraints;
45
import org.openconcerto.ui.FormLayouter;
52
import org.openconcerto.ui.FormLayouter;
46
import org.openconcerto.ui.TitledSeparator;
53
import org.openconcerto.ui.TitledSeparator;
47
import org.openconcerto.ui.component.ITextArea;
54
import org.openconcerto.ui.component.ITextArea;
48
import org.openconcerto.ui.preferences.DefaultProps;
55
import org.openconcerto.ui.preferences.DefaultProps;
49
import org.openconcerto.utils.DecimalUtils;
56
import org.openconcerto.utils.DecimalUtils;
-
 
57
import org.openconcerto.utils.ExceptionHandler;
50
import org.openconcerto.utils.StringUtils;
58
import org.openconcerto.utils.StringUtils;
51
import org.openconcerto.utils.text.SimpleDocumentListener;
59
import org.openconcerto.utils.text.SimpleDocumentListener;
52
 
60
 
53
import java.awt.Component;
61
import java.awt.Component;
54
import java.awt.GridBagConstraints;
62
import java.awt.GridBagConstraints;
Line 59... Line 67...
59
import java.beans.PropertyChangeEvent;
67
import java.beans.PropertyChangeEvent;
60
import java.beans.PropertyChangeListener;
68
import java.beans.PropertyChangeListener;
61
import java.math.BigDecimal;
69
import java.math.BigDecimal;
62
import java.math.RoundingMode;
70
import java.math.RoundingMode;
63
import java.sql.SQLException;
71
import java.sql.SQLException;
-
 
72
import java.util.ArrayList;
64
import java.util.Date;
73
import java.util.Date;
65
import java.util.List;
74
import java.util.List;
66
 
75
 
67
import javax.swing.JButton;
76
import javax.swing.JButton;
68
import javax.swing.JCheckBox;
77
import javax.swing.JCheckBox;
Line 95... Line 104...
95
    private JLabel labelMetriqueVT1 = new JLabel(getLabelFor("PRIX_METRIQUE_VT_1"), SwingConstants.RIGHT);
104
    private JLabel labelMetriqueVT1 = new JLabel(getLabelFor("PRIX_METRIQUE_VT_1"), SwingConstants.RIGHT);
96
 
105
 
97
    private ArticleDesignationTable tableDes = new ArticleDesignationTable();
106
    private ArticleDesignationTable tableDes = new ArticleDesignationTable();
98
    private ArticleCodeClientTable tableCodeClient = new ArticleCodeClientTable();
107
    private ArticleCodeClientTable tableCodeClient = new ArticleCodeClientTable();
99
    private ArticleTarifTable tableTarifVente = new ArticleTarifTable(this);
108
    private ArticleTarifTable tableTarifVente = new ArticleTarifTable(this);
-
 
109
    private ArticleCategorieComptableTable tableCatComptable = new ArticleCategorieComptableTable();
-
 
110
    private SupplierPriceListTable tableFourSec = new SupplierPriceListTable();
-
 
111
 
100
    private ProductQtyPriceListTable tableTarifQteVente = new ProductQtyPriceListTable(this);
112
    private ProductQtyPriceListTable tableTarifQteVente = new ProductQtyPriceListTable(this);
101
    private ProductItemListTable tableBom;
113
    private ProductItemListTable tableBom;
102
    private final JTextField textMarge = new JTextField(15);
114
    private final JTextField textMarge = new JTextField(10);
-
 
115
    private final JLabel labelMarge = new JLabel("%           ");
-
 
116
    private ElementComboBox boxCR;
-
 
117
    private JCheckBox boxMargeWithCR;
103
 
118
 
104
    private DocumentListener pieceHAArticle = new SimpleDocumentListener() {
119
    private DocumentListener pieceHAArticle = new SimpleDocumentListener() {
105
 
120
 
106
        @Override
121
        @Override
107
        public void update(DocumentEvent e) {
122
        public void update(DocumentEvent e) {
Line 137... Line 152...
137
        @Override
152
        @Override
138
        public void update(DocumentEvent e) {
153
        public void update(DocumentEvent e) {
139
            ReferenceArticleSQLComponent.this.textMarge.getDocument().removeDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextMarge);
154
            ReferenceArticleSQLComponent.this.textMarge.getDocument().removeDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextMarge);
140
            if (ReferenceArticleSQLComponent.this.textPVHT.getText().trim().length() > 0 && ReferenceArticleSQLComponent.this.textPAHT.getText().trim().length() > 0) {
155
            if (ReferenceArticleSQLComponent.this.textPVHT.getText().trim().length() > 0 && ReferenceArticleSQLComponent.this.textPAHT.getText().trim().length() > 0) {
141
                final BigDecimal vt = StringUtils.getBigDecimalFromUserText(ReferenceArticleSQLComponent.this.textPVHT.getText());
156
                final BigDecimal vt = StringUtils.getBigDecimalFromUserText(ReferenceArticleSQLComponent.this.textPVHT.getText());
142
                final BigDecimal ha = StringUtils.getBigDecimalFromUserText(ReferenceArticleSQLComponent.this.textPAHT.getText());
157
                BigDecimal ha = StringUtils.getBigDecimalFromUserText(ReferenceArticleSQLComponent.this.textPAHT.getText());
143
 
158
 
144
                if (vt != null && ha != null) {
159
                if (vt != null && ha != null) {
145
                    if (vt.signum() != 0 && ha.signum() != 0) {
160
                    if (vt.signum() != 0 && ha.signum() != 0) {
-
 
161
 
-
 
162
                        if (boxMargeWithCR.isSelected() && boxCR != null) {
-
 
163
                            SQLRow rowCR = boxCR.getSelectedRow();
-
 
164
                            if (rowCR != null && !rowCR.isUndefined()) {
-
 
165
                                BigDecimal cr = rowCR.getBigDecimal("POURCENT");
-
 
166
                                ha = ha.multiply(cr.movePointLeft(2).add(BigDecimal.ONE), DecimalUtils.HIGH_PRECISION);
-
 
167
                            }
-
 
168
                        }
-
 
169
 
146
                        BigDecimal margeHT = vt.subtract(ha);
170
                        BigDecimal margeHT = vt.subtract(ha);
147
 
171
 
148
                        BigDecimal value;
172
                        BigDecimal value;
149
 
173
 
150
                        if (DefaultNXProps.getInstance().getBooleanValue(TotalPanel.MARGE_MARQUE, false)) {
174
                        if (DefaultNXProps.getInstance().getBooleanValue(TotalPanel.MARGE_MARQUE, false)) {
Line 160... Line 184...
160
                        if (value.compareTo(BigDecimal.ZERO) > 0) {
184
                        if (value.compareTo(BigDecimal.ZERO) > 0) {
161
                            ReferenceArticleSQLComponent.this.textMarge.setText(value.setScale(6, RoundingMode.HALF_UP).toString());
185
                            ReferenceArticleSQLComponent.this.textMarge.setText(value.setScale(6, RoundingMode.HALF_UP).toString());
162
                        } else {
186
                        } else {
163
                            ReferenceArticleSQLComponent.this.textMarge.setText("0");
187
                            ReferenceArticleSQLComponent.this.textMarge.setText("0");
164
                        }
188
                        }
-
 
189
                        labelMarge.setText("% (" + StringUtils.leftAlign(margeHT.setScale(2, RoundingMode.HALF_UP).toString(), 9) + ")");
165
                    }
190
                    }
166
                }
191
                }
167
            }
192
            }
168
            ReferenceArticleSQLComponent.this.textMarge.getDocument().addDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextMarge);
193
            ReferenceArticleSQLComponent.this.textMarge.getDocument().addDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextMarge);
169
        }
194
        }
Line 182... Line 207...
182
        if (this.textPAHT.getText().trim().length() > 0) {
207
        if (this.textPAHT.getText().trim().length() > 0) {
183
 
208
 
184
            BigDecimal ha = StringUtils.getBigDecimalFromUserText(this.textPAHT.getText());
209
            BigDecimal ha = StringUtils.getBigDecimalFromUserText(this.textPAHT.getText());
185
            if (ha != null && this.textMarge.getText().trim().length() > 0) {
210
            if (ha != null && this.textMarge.getText().trim().length() > 0) {
186
 
211
 
-
 
212
                if (boxMargeWithCR.isSelected() && boxCR != null) {
-
 
213
                    SQLRow rowCR = this.boxCR.getSelectedRow();
-
 
214
                    if (rowCR != null && !rowCR.isUndefined()) {
-
 
215
                        BigDecimal cr = rowCR.getBigDecimal("POURCENT");
-
 
216
                        ha = ha.multiply(cr.movePointLeft(2).add(BigDecimal.ONE), DecimalUtils.HIGH_PRECISION);
-
 
217
                    }
-
 
218
                }
-
 
219
 
187
                BigDecimal d = StringUtils.getBigDecimalFromUserText(this.textMarge.getText());
220
                BigDecimal d = StringUtils.getBigDecimalFromUserText(this.textMarge.getText());
-
 
221
                if (d == null) {
-
 
222
                    d = BigDecimal.ZERO;
-
 
223
                }
-
 
224
                final BigDecimal vt;
188
                if (DefaultNXProps.getInstance().getBooleanValue(TotalPanel.MARGE_MARQUE, false)) {
225
                if (DefaultNXProps.getInstance().getBooleanValue(TotalPanel.MARGE_MARQUE, false)) {
189
                    final BigDecimal e = BigDecimal.ONE.subtract(d.divide(BigDecimal.valueOf(100), DecimalUtils.HIGH_PRECISION));
226
                    final BigDecimal e = BigDecimal.ONE.subtract(d.divide(BigDecimal.valueOf(100), DecimalUtils.HIGH_PRECISION));
190
                    if (e.signum() == 0) {
227
                    if (e.signum() == 0) {
191
                        this.textPVHT.setText("0");
228
                        vt = BigDecimal.ZERO;
192
                    } else {
229
                    } else {
193
                        this.textPVHT.setText(ha.divide(e, DecimalUtils.HIGH_PRECISION).setScale(getTable().getField("PV_HT").getType().getDecimalDigits(), RoundingMode.HALF_UP).toString());
230
                        vt = ha.divide(e, DecimalUtils.HIGH_PRECISION).setScale(getTable().getField("PV_HT").getType().getDecimalDigits(), RoundingMode.HALF_UP);
194
                    }
231
                    }
195
                } else {
232
                } else {
196
                    BigDecimal result = ha.multiply(d.divide(BigDecimal.valueOf(100), DecimalUtils.HIGH_PRECISION).add(BigDecimal.ONE));
233
                    BigDecimal result = ha.multiply(d.divide(BigDecimal.valueOf(100), DecimalUtils.HIGH_PRECISION).add(BigDecimal.ONE));
197
                    this.textPVHT.setText(result.setScale(getTable().getField("PV_HT").getType().getDecimalDigits(), RoundingMode.HALF_UP).toString());
234
                    vt = result.setScale(getTable().getField("PV_HT").getType().getDecimalDigits(), RoundingMode.HALF_UP);
-
 
235
                    this.textPVHT.setText(vt.toString());
198
                }
236
                }
-
 
237
                this.textPVHT.setText(vt.toString());
-
 
238
                BigDecimal margeHT = vt.subtract(ha);
-
 
239
                labelMarge.setText("% (" + StringUtils.leftAlign(margeHT.setScale(2, RoundingMode.HALF_UP).toString(), 9) + ")");
199
            }
240
            }
200
        }
241
        }
201
    }
242
    }
202
 
243
 
203
    public ReferenceArticleSQLComponent(SQLElement elt) {
244
    public ReferenceArticleSQLComponent(SQLElement elt) {
Line 212... Line 253...
212
        super.select(r);
253
        super.select(r);
213
        if (r != null && r.getID() > getTable().getUndefinedID()) {
254
        if (r != null && r.getID() > getTable().getUndefinedID()) {
214
            this.checkObs.setVisible(true);
255
            this.checkObs.setVisible(true);
215
            this.tableTarifVente.setArticleValues(r);
256
            this.tableTarifVente.setArticleValues(r);
216
            this.tableTarifVente.insertFrom("ID_ARTICLE", r.getID());
257
            this.tableTarifVente.insertFrom("ID_ARTICLE", r.getID());
-
 
258
            this.tableCatComptable.insertFrom("ID_ARTICLE", r.getID());
-
 
259
            this.tableFourSec.insertFrom("ID_ARTICLE", r.getID());
217
            this.tableTarifQteVente.insertFrom("ID_ARTICLE", r.getID());
260
            this.tableTarifQteVente.insertFrom("ID_ARTICLE", r.getID());
218
            if (this.tableBom != null) {
261
            if (this.tableBom != null) {
219
                this.tableBom.insertFrom("ID_ARTICLE_PARENT", r.getID());
262
                this.tableBom.insertFrom("ID_ARTICLE_PARENT", r.getID());
220
            }
263
            }
221
            this.tableDes.insertFrom("ID_ARTICLE", r.getID());
264
            this.tableDes.insertFrom("ID_ARTICLE", r.getID());
Line 304... Line 347...
304
 
347
 
305
        SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
348
        SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
306
        // Gestion des unités de vente
349
        // Gestion des unités de vente
307
        final boolean gestionUV = prefs.getBoolean(GestionArticleGlobalPreferencePanel.UNITE_VENTE, true);
350
        final boolean gestionUV = prefs.getBoolean(GestionArticleGlobalPreferencePanel.UNITE_VENTE, true);
308
        c.gridy++;
351
        c.gridy++;
-
 
352
        final ElementComboBox boxUnite = new ElementComboBox();
309
        if (gestionUV) {
353
        if (gestionUV) {
310
            c.gridx = 0;
354
            c.gridx = 0;
311
            c.weightx = 0;
355
            c.weightx = 0;
312
            this.add(new JLabel(getLabelFor("ID_UNITE_VENTE"), SwingConstants.RIGHT), c);
356
            this.add(new JLabel(getLabelFor("ID_UNITE_VENTE"), SwingConstants.RIGHT), c);
313
            c.gridx++;
357
            c.gridx++;
314
            c.weightx = 1;
358
            c.weightx = 1;
315
            c.fill = GridBagConstraints.NONE;
359
            c.fill = GridBagConstraints.NONE;
316
            ElementComboBox boxUnite = new ElementComboBox();
-
 
317
            DefaultGridBagConstraints.lockMinimumSize(boxUnite);
360
            DefaultGridBagConstraints.lockMinimumSize(boxUnite);
318
            this.add(boxUnite, c);
361
            this.add(boxUnite, c);
319
            this.addView(boxUnite, "ID_UNITE_VENTE");
362
            this.addView(boxUnite, "ID_UNITE_VENTE");
320
            c.fill = GridBagConstraints.HORIZONTAL;
363
            c.fill = GridBagConstraints.HORIZONTAL;
321
        }
364
        }
Line 328... Line 371...
328
        DefaultGridBagConstraints.lockMinimumSize(fieldSKU);
371
        DefaultGridBagConstraints.lockMinimumSize(fieldSKU);
329
        this.add(fieldSKU, c);
372
        this.add(fieldSKU, c);
330
        this.addView(fieldSKU, "SKU");
373
        this.addView(fieldSKU, "SKU");
331
        c.fill = GridBagConstraints.HORIZONTAL;
374
        c.fill = GridBagConstraints.HORIZONTAL;
332
 
375
 
-
 
376
        c.gridy++;
-
 
377
        if (gestionUV) {
-
 
378
            c.gridx = 0;
-
 
379
            c.weightx = 0;
-
 
380
            this.add(new JLabel(getLabelFor("QTE_UNITAIRE"), SwingConstants.RIGHT), c);
-
 
381
            c.gridx++;
-
 
382
            c.weightx = 1;
-
 
383
            c.fill = GridBagConstraints.NONE;
-
 
384
            final JTextField qte = new JTextField(10);
-
 
385
            qte.setEditable(false);
-
 
386
 
-
 
387
            this.add(qte, c);
-
 
388
            this.addView(qte, "QTE_UNITAIRE", REQ);
-
 
389
            boxUnite.addModelListener("wantedID", new PropertyChangeListener() {
-
 
390
 
-
 
391
                @Override
-
 
392
                public void propertyChange(PropertyChangeEvent evt) {
-
 
393
                    if (!boxUnite.isEmpty() && boxUnite.getSelectedId() == UniteVenteArticleSQLElement.A_LA_PIECE) {
-
 
394
                        qte.setText("1");
-
 
395
                        qte.setEditable(false);
-
 
396
                    } else {
-
 
397
                        qte.setEditable(true);
-
 
398
                    }
-
 
399
 
-
 
400
                }
-
 
401
            });
-
 
402
            c.fill = GridBagConstraints.HORIZONTAL;
-
 
403
        }
-
 
404
 
333
        DefaultProps props = DefaultNXProps.getInstance();
405
        DefaultProps props = DefaultNXProps.getInstance();
334
 
406
 
335
        // Article détaillé
407
        // Article détaillé
336
        String modeVente = props.getStringProperty("ArticleModeVenteAvance");
408
        String modeVente = props.getStringProperty("ArticleModeVenteAvance");
337
        Boolean bModeVente = Boolean.valueOf(modeVente);
409
        Boolean bModeVente = Boolean.valueOf(modeVente);
Line 458... Line 530...
458
        c.weightx = 1;
530
        c.weightx = 1;
459
        c.gridx++;
531
        c.gridx++;
460
        ElementComboBox boxTaxeCompl = new ElementComboBox();
532
        ElementComboBox boxTaxeCompl = new ElementComboBox();
461
        panel.add(boxTaxeCompl, c);
533
        panel.add(boxTaxeCompl, c);
462
 
534
 
-
 
535
        c.weightx = 0;
-
 
536
        c.gridy++;
-
 
537
        c.gridx = 0;
-
 
538
        JLabel labelMatiere = new JLabel(getLabelFor("MATIERE"));
-
 
539
        c.fill = GridBagConstraints.BOTH;
-
 
540
        panel.add(labelMatiere, c);
-
 
541
        c.weightx = 1;
-
 
542
        c.gridx++;
-
 
543
        SQLTextCombo comboMatiere = new SQLTextCombo();
-
 
544
        panel.add(comboMatiere, c);
-
 
545
 
463
        c.gridy++;
546
        c.gridy++;
464
        c.gridx = 0;
547
        c.gridx = 0;
465
        c.gridwidth = GridBagConstraints.REMAINDER;
548
        c.gridwidth = GridBagConstraints.REMAINDER;
466
        TitledSeparator sep = new TitledSeparator(getLabelFor("INFOS"));
549
        TitledSeparator sep = new TitledSeparator(getLabelFor("INFOS"));
467
        panel.add(sep, c);
550
        panel.add(sep, c);
Line 470... Line 553...
470
        ITextArea infos = new ITextArea();
553
        ITextArea infos = new ITextArea();
471
        c.fill = GridBagConstraints.BOTH;
554
        c.fill = GridBagConstraints.BOTH;
472
        panel.add(infos, c);
555
        panel.add(infos, c);
473
 
556
 
474
        this.addSQLObject(infos, "INFOS");
557
        this.addSQLObject(infos, "INFOS");
-
 
558
        this.addSQLObject(comboMatiere, "MATIERE");
475
        this.addSQLObject(box, "ID_ECO_CONTRIBUTION");
559
        this.addSQLObject(box, "ID_ECO_CONTRIBUTION");
476
        this.addSQLObject(boxTaxeCompl, "ID_TAXE_COMPLEMENTAIRE");
560
        this.addSQLObject(boxTaxeCompl, "ID_TAXE_COMPLEMENTAIRE");
477
        return panel;
561
        return panel;
478
    }
562
    }
479
 
563
 
Line 638... Line 722...
638
                fieldQteMin.setEnabled(boxStock.isSelected());
722
                fieldQteMin.setEnabled(boxStock.isSelected());
639
                fieldQteAchat.setEnabled(boxStock.isSelected());
723
                fieldQteAchat.setEnabled(boxStock.isSelected());
640
            }
724
            }
641
        });
725
        });
642
 
726
 
643
        c.gridwidth = 1;
-
 
644
        if (gestionStockMin) {
727
        boolean visibleDepot = (prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false));
645
            c.gridx = 0;
728
        c.gridx = 0;
646
            c.gridy++;
729
        c.gridy++;
647
            c.weightx = 0;
730
        c.weightx = 0;
648
            panel.add(new JLabel(getLabelFor("QTE_MIN")), c);
731
        final JLabel labelDepot = new JLabel(getLabelFor("ID_DEPOT_STOCK"));
-
 
732
        panel.add(labelDepot, c);
-
 
733
        labelDepot.setVisible(visibleDepot);
649
            c.gridx++;
734
        c.gridx++;
650
            c.weightx = 1;
735
        c.weightx = 1;
-
 
736
        ElementComboBox boxDepot = new ElementComboBox();
-
 
737
        panel.add(boxDepot, c);
-
 
738
        boxDepot.setVisible(visibleDepot);
-
 
739
        this.addView(boxDepot, "ID_DEPOT_STOCK", REQ);
-
 
740
 
-
 
741
        c.gridwidth = 1;
-
 
742
        if (gestionStockMin) {
-
 
743
            // c.gridx = 0;
-
 
744
            // c.gridy++;
-
 
745
            // c.weightx = 0;
-
 
746
            // panel.add(new JLabel(getLabelFor("QTE_MIN")), c);
-
 
747
            // c.gridx++;
-
 
748
            // c.weightx = 1;
651
            panel.add(fieldQteMin, c);
749
            // panel.add(fieldQteMin, c);
652
            this.addView(fieldQteMin, "QTE_MIN");
750
            // this.addView(fieldQteMin, "QTE_MIN");
653
 
751
 
654
            c.gridx = 0;
752
            c.gridx = 0;
655
            c.gridy++;
753
            c.gridy++;
656
            c.weightx = 0;
754
            c.weightx = 0;
657
            panel.add(new JLabel(getLabelFor("QTE_ACHAT")), c);
755
            panel.add(new JLabel(getLabelFor("QTE_ACHAT")), c);
Line 698... Line 796...
698
        c.weightx = 1;
796
        c.weightx = 1;
699
        panel.add(selAchat, c);
797
        panel.add(selAchat, c);
700
        this.addView(selAchat, "ID_COMPTE_PCE_ACHAT");
798
        this.addView(selAchat, "ID_COMPTE_PCE_ACHAT");
701
 
799
 
702
        c.gridy++;
800
        c.gridy++;
-
 
801
        c.gridx = 0;
703
        c.weighty = 1;
802
        c.weighty = 1;
704
        c.weightx = 1;
803
        c.weightx = 1;
705
        c.fill = GridBagConstraints.BOTH;
804
        c.fill = GridBagConstraints.BOTH;
-
 
805
        c.gridwidth = GridBagConstraints.REMAINDER;
-
 
806
 
-
 
807
        panel.add(createCategorieComptablePanel(), c);
706
        final JPanel spacer = new JPanel();
808
        // final JPanel spacer = new JPanel();
707
        spacer.setOpaque(false);
809
        // spacer.setOpaque(false);
708
        panel.add(spacer, c);
810
        // panel.add(spacer, c);
709
        return panel;
811
        return panel;
710
    }
812
    }
711
 
813
 
712
    private SQLRowValues rowValuesDefaultCodeFournisseur;
814
    private SQLRowValues rowValuesDefaultCodeFournisseur;
713
    private CodeFournisseurItemTable codeFournisseurTable;
815
    private CodeFournisseurItemTable codeFournisseurTable;
Line 750... Line 852...
750
                public void propertyChange(PropertyChangeEvent evt) {
852
                public void propertyChange(PropertyChangeEvent evt) {
751
                    rowValuesDefaultCodeFournisseur.put("ID_FOURNISSEUR", comboSelFournisseur.getSelectedId());
853
                    rowValuesDefaultCodeFournisseur.put("ID_FOURNISSEUR", comboSelFournisseur.getSelectedId());
752
                }
854
                }
753
            });
855
            });
754
        } else {
856
        } else {
-
 
857
 
-
 
858
            // Tarif fournisseur
755
            c.gridy++;
859
            c.gridy++;
-
 
860
            c.gridx = 0;
-
 
861
            c.gridwidth = GridBagConstraints.REMAINDER;
-
 
862
            TitledSeparator sep = new TitledSeparator("Tarifs fournisseurs");
-
 
863
            panel.add(sep, c);
-
 
864
 
-
 
865
            // Ajout fournisseur
-
 
866
            c.gridwidth = 1;
756
            c.weighty = 1;
867
            c.weightx = 0;
-
 
868
            c.gridy++;
-
 
869
            c.gridx = 0;
-
 
870
            panel.add(new JLabel("Ajouter le fournisseur "), c);
-
 
871
 
-
 
872
            final ElementComboBox boxF = new ElementComboBox();
-
 
873
            boxF.init(Configuration.getInstance().getDirectory().getElement("FOURNISSEUR"));
-
 
874
 
-
 
875
            c.gridx++;
-
 
876
            panel.add(boxF, c);
-
 
877
 
-
 
878
            c.fill = GridBagConstraints.NONE;
-
 
879
            c.gridx++;
-
 
880
            JButton buttonAjouter = new JButton("Ajouter");
-
 
881
            buttonAjouter.setOpaque(false);
-
 
882
            panel.add(buttonAjouter, c);
-
 
883
            c.gridx++;
-
 
884
            JButton buttonSupprimer = new JButton("Supprimer");
-
 
885
            buttonSupprimer.setOpaque(false);
-
 
886
            panel.add(buttonSupprimer, c);
-
 
887
 
-
 
888
            c.gridwidth = GridBagConstraints.REMAINDER;
-
 
889
            c.fill = GridBagConstraints.BOTH;
757
            c.weightx = 1;
890
            c.weightx = 1;
-
 
891
            c.weighty = 1;
-
 
892
            c.gridy++;
-
 
893
            c.gridx = 0;
758
            c.fill = GridBagConstraints.BOTH;
894
            c.fill = GridBagConstraints.BOTH;
759
            final JPanel spacer = new JPanel();
895
            this.tableFourSec.setOpaque(false);
760
            spacer.setOpaque(false);
896
            panel.add(this.tableFourSec, c);
-
 
897
 
-
 
898
            // Listeners
-
 
899
            buttonAjouter.addActionListener(new ActionListener() {
-
 
900
 
-
 
901
                @Override
-
 
902
                public void actionPerformed(ActionEvent e) {
-
 
903
 
-
 
904
                    SQLRow rowCat = boxF.getSelectedRow();
-
 
905
                    if (rowCat == null || rowCat.isUndefined()) {
761
            panel.add(spacer, c);
906
                        return;
-
 
907
                    }
-
 
908
                    int nbRows = tableFourSec.getModel().getRowCount();
-
 
909
 
-
 
910
                    // for (int i = 0; i < nbRows; i++) {
-
 
911
                    // SQLRowValues rowVals = tableFourSec.getModel().getRowValuesAt(i);
-
 
912
                    // int idTarif =
-
 
913
                    // Integer.parseInt(rowVals.getObject("ID_FOURNISSEUR").toString());
-
 
914
                    // if (idTarif == rowCat.getID()) {
-
 
915
                    // JOptionPane.showMessageDialog(null, "Impossible d'ajouter.\nLe fournisseur
-
 
916
                    // est déjà présent dans la liste!");
-
 
917
                    // return;
-
 
918
                    // }
-
 
919
                    // }
-
 
920
 
-
 
921
                    SQLRowValues rowVals = new SQLRowValues(Configuration.getInstance().getBase().getTable("ARTICLE_TARIF_FOURNISSEUR"));
-
 
922
                    if (getSelectedID() > 1) {
-
 
923
                        rowVals.put("ID_ARTICLE", getSelectedID());
-
 
924
                    }
-
 
925
                    rowVals.put("ID_FOURNISSEUR", rowCat.getID());
-
 
926
                    tableFourSec.getModel().addRow(rowVals);
-
 
927
                }
-
 
928
            });
-
 
929
            buttonSupprimer.addActionListener(new ActionListener() {
-
 
930
 
-
 
931
                @Override
-
 
932
                public void actionPerformed(ActionEvent e) {
-
 
933
                    tableFourSec.removeSelectedRow();
-
 
934
                }
-
 
935
            });
762
        }
936
        }
763
        return panel;
937
        return panel;
764
    }
938
    }
765
 
939
 
766
    private JPanel createExportationPanel() {
940
    private JPanel createExportationPanel() {
Line 885... Line 1059...
885
            }
1059
            }
886
        });
1060
        });
887
        return panel;
1061
        return panel;
888
    }
1062
    }
889
 
1063
 
-
 
1064
    private JPanel createCategorieComptablePanel() {
-
 
1065
        JPanel panel = new JPanel(new GridBagLayout());
-
 
1066
        panel.setOpaque(false);
-
 
1067
        GridBagConstraints c = new DefaultGridBagConstraints();
-
 
1068
 
-
 
1069
        // Ajout catégorie
-
 
1070
        c.gridwidth = 1;
-
 
1071
        c.weightx = 0;
-
 
1072
        c.gridy++;
-
 
1073
        c.gridx = 0;
-
 
1074
        panel.add(new JLabel("Ajouter la catégorie "), c);
-
 
1075
 
-
 
1076
        final ElementComboBox boxCat = new ElementComboBox();
-
 
1077
        boxCat.init(Configuration.getInstance().getDirectory().getElement("CATEGORIE_COMPTABLE"));
-
 
1078
 
-
 
1079
        c.gridx++;
-
 
1080
        panel.add(boxCat, c);
-
 
1081
 
-
 
1082
        c.fill = GridBagConstraints.NONE;
-
 
1083
        c.gridx++;
-
 
1084
        JButton buttonAjouter = new JButton("Ajouter");
-
 
1085
        buttonAjouter.setOpaque(false);
-
 
1086
        panel.add(buttonAjouter, c);
-
 
1087
        c.gridx++;
-
 
1088
        JButton buttonSupprimer = new JButton("Supprimer");
-
 
1089
        buttonSupprimer.setOpaque(false);
-
 
1090
        panel.add(buttonSupprimer, c);
-
 
1091
 
-
 
1092
        c.gridwidth = GridBagConstraints.REMAINDER;
-
 
1093
        c.fill = GridBagConstraints.BOTH;
-
 
1094
        c.weightx = 1;
-
 
1095
        c.weighty = 1;
-
 
1096
        c.gridy++;
-
 
1097
        c.gridx = 0;
-
 
1098
        c.fill = GridBagConstraints.BOTH;
-
 
1099
        this.tableCatComptable.setOpaque(false);
-
 
1100
        panel.add(this.tableCatComptable, c);
-
 
1101
 
-
 
1102
        // Listeners
-
 
1103
        buttonAjouter.addActionListener(new ActionListener() {
-
 
1104
 
-
 
1105
            @Override
-
 
1106
            public void actionPerformed(ActionEvent e) {
-
 
1107
 
-
 
1108
                SQLRow rowCat = boxCat.getSelectedRow();
-
 
1109
                if (rowCat == null || rowCat.isUndefined()) {
-
 
1110
                    return;
-
 
1111
                }
-
 
1112
                int nbRows = tableCatComptable.getModel().getRowCount();
-
 
1113
 
-
 
1114
                for (int i = 0; i < nbRows; i++) {
-
 
1115
                    SQLRowValues rowVals = tableCatComptable.getModel().getRowValuesAt(i);
-
 
1116
                    int idTarif = Integer.parseInt(rowVals.getObject("ID_CATEGORIE_COMPTABLE").toString());
-
 
1117
                    if (idTarif == rowCat.getID()) {
-
 
1118
                        JOptionPane.showMessageDialog(null, "Impossible d'ajouter.\nLa catégorie est déjà présente dans la liste!");
-
 
1119
                        return;
-
 
1120
                    }
-
 
1121
                }
-
 
1122
 
-
 
1123
                SQLRowValues rowVals = new SQLRowValues(Configuration.getInstance().getBase().getTable("ARTICLE_CATEGORIE_COMPTABLE"));
-
 
1124
                if (getSelectedID() > 1) {
-
 
1125
                    rowVals.put("ID_ARTICLE", getSelectedID());
-
 
1126
                }
-
 
1127
                rowVals.put("ID_CATEGORIE_COMPTABLE", rowCat.getID());
-
 
1128
                tableCatComptable.getModel().addRow(rowVals);
-
 
1129
            }
-
 
1130
        });
-
 
1131
        buttonSupprimer.addActionListener(new ActionListener() {
-
 
1132
 
-
 
1133
            @Override
-
 
1134
            public void actionPerformed(ActionEvent e) {
-
 
1135
                tableCatComptable.removeSelectedRow();
-
 
1136
            }
-
 
1137
        });
-
 
1138
        return panel;
-
 
1139
    }
-
 
1140
 
890
    private JPanel createBOMpanel() {
1141
    private JPanel createBOMpanel() {
891
        JPanel panel = new JPanel(new GridBagLayout());
1142
        JPanel panel = new JPanel(new GridBagLayout());
892
        panel.setOpaque(false);
1143
        panel.setOpaque(false);
893
        GridBagConstraints c = new DefaultGridBagConstraints();
1144
        GridBagConstraints c = new DefaultGridBagConstraints();
894
 
1145
 
Line 995... Line 1246...
995
        cAchat.gridx++;
1246
        cAchat.gridx++;
996
        p.add(this.textMarge, cAchat);
1247
        p.add(this.textMarge, cAchat);
997
        this.textMarge.getDocument().addDocumentListener(this.listenerMargeTextMarge);
1248
        this.textMarge.getDocument().addDocumentListener(this.listenerMargeTextMarge);
998
        cAchat.gridx++;
1249
        cAchat.gridx++;
999
        cAchat.weightx = 0;
1250
        cAchat.weightx = 0;
1000
        p.add(new JLabel("%           "), cAchat);
1251
        p.add(this.labelMarge, cAchat);
1001
 
1252
 
1002
        // Poids
1253
        // Poids
1003
        JLabel labelPds = new JLabel(getLabelFor("POIDS"));
1254
        JLabel labelPds = new JLabel(getLabelFor("POIDS"));
1004
        cAchat.gridx++;
1255
        cAchat.gridx++;
1005
        cAchat.weightx = 0;
1256
        cAchat.weightx = 0;
Line 1024... Line 1275...
1024
        c.anchor = GridBagConstraints.WEST;
1275
        c.anchor = GridBagConstraints.WEST;
1025
        c.weightx = 1;
1276
        c.weightx = 1;
1026
        c.fill = GridBagConstraints.NONE;
1277
        c.fill = GridBagConstraints.NONE;
1027
 
1278
 
1028
        this.add(p, c);
1279
        this.add(p, c);
-
 
1280
        c.gridx = 0;
-
 
1281
        c.gridy++;
-
 
1282
        c.gridwidth = 1;
-
 
1283
 
-
 
1284
        if (getTable().contains("ID_COUT_REVIENT")) {
-
 
1285
            // Cout de revient
-
 
1286
            c.weightx = 0;
-
 
1287
            c.fill = GridBagConstraints.HORIZONTAL;
-
 
1288
            this.add(new JLabel(getLabelFor("ID_COUT_REVIENT"), SwingConstants.RIGHT), c);
-
 
1289
 
-
 
1290
            JPanel pCR = new JPanel(new GridBagLayout());
-
 
1291
            GridBagConstraints cCR = new DefaultGridBagConstraints();
-
 
1292
            cCR.insets = new Insets(0, 0, 0, 4);
-
 
1293
            this.boxCR = new ElementComboBox(true, 15);
-
 
1294
 
-
 
1295
            pCR.add(boxCR, cCR);
-
 
1296
            this.addView(boxCR, "ID_COUT_REVIENT");
-
 
1297
            DefaultGridBagConstraints.lockMinimumSize(boxCR);
-
 
1298
            boxCR.addModelListener("wantedID", new PropertyChangeListener() {
-
 
1299
 
-
 
1300
                @Override
-
 
1301
                public void propertyChange(PropertyChangeEvent evt) {
-
 
1302
                    if (!isFilling()) {
-
 
1303
                        ReferenceArticleSQLComponent.this.textPVHT.getDocument().removeDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextVT);
-
 
1304
                        updateVtFromMarge();
-
 
1305
                        ReferenceArticleSQLComponent.this.textPVHT.getDocument().addDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextVT);
-
 
1306
                    }
-
 
1307
                }
-
 
1308
            });
-
 
1309
            cCR.gridx++;
-
 
1310
            this.boxMargeWithCR = new JCheckBox(getLabelFor("MARGE_WITH_COUT_REVIENT"));
-
 
1311
            pCR.add(boxMargeWithCR, cCR);
-
 
1312
            addView(boxMargeWithCR, "MARGE_WITH_COUT_REVIENT");
-
 
1313
            boxMargeWithCR.addActionListener(new ActionListener() {
-
 
1314
 
-
 
1315
                @Override
-
 
1316
                public void actionPerformed(ActionEvent e) {
-
 
1317
                    if (!isFilling()) {
-
 
1318
                        ReferenceArticleSQLComponent.this.textPVHT.getDocument().removeDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextVT);
-
 
1319
                        updateVtFromMarge();
-
 
1320
                        ReferenceArticleSQLComponent.this.textPVHT.getDocument().addDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextVT);
-
 
1321
                    }
-
 
1322
                }
-
 
1323
            });
-
 
1324
            c.gridx++;
-
 
1325
            c.gridwidth = GridBagConstraints.REMAINDER;
-
 
1326
            c.anchor = GridBagConstraints.WEST;
-
 
1327
            c.weightx = 1;
-
 
1328
            c.fill = GridBagConstraints.NONE;
-
 
1329
            this.add(pCR, c);
-
 
1330
        }
1029
 
1331
 
1030
        // PV HT
1332
        // PV HT
1031
        c.gridx = 0;
1333
        c.gridx = 0;
1032
        c.gridy++;
1334
        c.gridy++;
1033
 
1335
 
Line 1119... Line 1421...
1119
        };
1421
        };
1120
 
1422
 
1121
        this.taxeListener = new PropertyChangeListener() {
1423
        this.taxeListener = new PropertyChangeListener() {
1122
 
1424
 
1123
            public void propertyChange(PropertyChangeEvent evt) {
1425
            public void propertyChange(PropertyChangeEvent evt) {
-
 
1426
                if (!isFilling()) {
1124
                if (ReferenceArticleSQLComponent.this.textPVHT.getText().trim().length() > 0) {
1427
                    if (ReferenceArticleSQLComponent.this.textPVHT.getText().trim().length() > 0) {
1125
                    setTextTTC();
1428
                        setTextTTC();
1126
                } else {
1429
                    } else {
1127
                    setTextHT();
1430
                        setTextHT();
1128
                }
1431
                    }
-
 
1432
                }
1129
                tableTarifVente.fireModification();
1433
                tableTarifVente.fireModification();
1130
            }
1434
            }
1131
        };
1435
        };
1132
        this.textPVHT.getDocument().addDocumentListener(this.htDocListener);
1436
        this.textPVHT.getDocument().addDocumentListener(this.htDocListener);
1133
        this.textPVTTC.getDocument().addDocumentListener(this.ttcDocListener);
1437
        this.textPVTTC.getDocument().addDocumentListener(this.ttcDocListener);
Line 1256... Line 1560...
1256
 
1560
 
1257
    }
1561
    }
1258
 
1562
 
1259
    @Override
1563
    @Override
1260
    public void update() {
1564
    public void update() {
-
 
1565
        SQLRow row = this.getTable().getRow(this.getSelectedID());
1261
            super.update();
1566
            super.update();
1262
        this.tableTarifVente.updateField("ID_ARTICLE", getSelectedID());
1567
        this.tableTarifVente.updateField("ID_ARTICLE", getSelectedID());
-
 
1568
        this.tableCatComptable.updateField("ID_ARTICLE", getSelectedID());
-
 
1569
        this.tableFourSec.updateField("ID_ARTICLE", getSelectedID());
1263
        this.tableTarifQteVente.updateField("ID_ARTICLE", getSelectedID());
1570
        this.tableTarifQteVente.updateField("ID_ARTICLE", getSelectedID());
1264
        if (this.tableBom != null) {
1571
        if (this.tableBom != null) {
1265
            this.tableBom.updateField("ID_ARTICLE_PARENT", getSelectedID());
1572
            this.tableBom.updateField("ID_ARTICLE_PARENT", getSelectedID());
1266
        }
1573
        }
1267
 
1574
 
1268
        this.tableDes.updateField("ID_ARTICLE", getSelectedID());
1575
        this.tableDes.updateField("ID_ARTICLE", getSelectedID());
1269
        this.tableCodeClient.updateField("ID_ARTICLE", getSelectedID());
1576
        this.tableCodeClient.updateField("ID_ARTICLE", getSelectedID());
1270
        if (this.codeFournisseurTable != null) {
1577
        if (this.codeFournisseurTable != null) {
1271
            this.codeFournisseurTable.updateField("ID_ARTICLE", getSelectedID());
1578
            this.codeFournisseurTable.updateField("ID_ARTICLE", getSelectedID());
1272
        }
1579
        }
-
 
1580
 
-
 
1581
        ((ReferenceArticleSQLElement) getElement()).initStock(getSelectedID());
-
 
1582
 
-
 
1583
        SQLSelect sel = new SQLSelect();
-
 
1584
        SQLTable tableStock = getTable().getTable("STOCK");
-
 
1585
        sel.addSelect(tableStock.getKey());
-
 
1586
        Where w = new Where(tableStock.getField("ID_ARTICLE"), "=", getSelectedID()).and(new Where(tableStock.getField("ID_DEPOT_STOCK"), "=", row.getForeignID("ID_DEPOT_STOCK")));
-
 
1587
        sel.setWhere(w);
-
 
1588
 
-
 
1589
        List<SQLRow> stock = SQLRowListRSH.execute(sel);
-
 
1590
        if (stock != null && stock.size() == 1) {
-
 
1591
            try {
-
 
1592
                row.createEmptyUpdateRow().put("ID_STOCK", stock.get(0).getID()).update();
-
 
1593
            } catch (SQLException e) {
-
 
1594
                ExceptionHandler.handle("Erreur lors de la mise à jour du stock principal", e);
-
 
1595
            }
-
 
1596
        }
-
 
1597
 
1273
    }
1598
    }
1274
 
1599
 
1275
    /**
1600
    /**
1276
     * Sélection d'un mode de vente pour l'article. Affiche les prix metriques requis et fixe les
1601
     * Sélection d'un mode de vente pour l'article. Affiche les prix metriques requis et fixe les
1277
     * valeurs.
1602
     * valeurs.
Line 1322... Line 1647...
1322
 
1647
 
1323
    @Override
1648
    @Override
1324
    public int insert(SQLRow order) {
1649
    public int insert(SQLRow order) {
1325
        int id = super.insert(order);
1650
        int id = super.insert(order);
1326
        this.tableTarifVente.updateField("ID_ARTICLE", id);
1651
        this.tableTarifVente.updateField("ID_ARTICLE", id);
-
 
1652
        this.tableCatComptable.updateField("ID_ARTICLE", id);
-
 
1653
        this.tableFourSec.updateField("ID_ARTICLE", id);
1327
        this.tableTarifQteVente.updateField("ID_ARTICLE", id);
1654
        this.tableTarifQteVente.updateField("ID_ARTICLE", id);
1328
        if (this.tableBom != null) {
1655
        if (this.tableBom != null) {
1329
            this.tableBom.updateField("ID_ARTICLE_PARENT", id);
1656
            this.tableBom.updateField("ID_ARTICLE_PARENT", id);
1330
        }
1657
        }
1331
        this.tableDes.updateField("ID_ARTICLE", id);
1658
        this.tableDes.updateField("ID_ARTICLE", id);
1332
        this.tableCodeClient.updateField("ID_ARTICLE", id);
1659
        this.tableCodeClient.updateField("ID_ARTICLE", id);
1333
        if (this.codeFournisseurTable != null) {
1660
        if (this.codeFournisseurTable != null) {
1334
            this.codeFournisseurTable.updateField("ID_ARTICLE", id);
1661
            this.codeFournisseurTable.updateField("ID_ARTICLE", id);
1335
        }
1662
        }
-
 
1663
        ((ReferenceArticleSQLElement) getElement()).initStock(id);
1336
        return id;
1664
        return id;
1337
    }
1665
    }
1338
 
1666
 
1339
    @Override
1667
    @Override
1340
    protected SQLRowValues createDefaults() {
1668
    protected SQLRowValues createDefaults() {
1341
        SQLRowValues rowVals = new SQLRowValues(getTable());
1669
        SQLRowValues rowVals = new SQLRowValues(getTable());
1342
 
1670
 
1343
        rowVals.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());
1671
        rowVals.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());
-
 
1672
        rowVals.put("ID_DEPOT_STOCK", DepotStockSQLElement.DEFAULT_ID);
1344
        rowVals.put("ID_UNITE_VENTE", UniteVenteArticleSQLElement.A_LA_PIECE);
1673
        rowVals.put("ID_UNITE_VENTE", UniteVenteArticleSQLElement.A_LA_PIECE);
-
 
1674
        rowVals.put("QTE_UNITAIRE", BigDecimal.ONE);
1345
        rowVals.put("ID_MODE_VENTE_ARTICLE", ReferenceArticleSQLElement.A_LA_PIECE);
1675
        rowVals.put("ID_MODE_VENTE_ARTICLE", ReferenceArticleSQLElement.A_LA_PIECE);
1346
        selectModeVente(ReferenceArticleSQLElement.A_LA_PIECE);
1676
        selectModeVente(ReferenceArticleSQLElement.A_LA_PIECE);
1347
        rowVals.put("VALEUR_METRIQUE_1", Float.valueOf("1.0"));
1677
        rowVals.put("VALEUR_METRIQUE_1", Float.valueOf("1.0"));
1348
        rowVals.put("PA_HT", BigDecimal.ZERO);
1678
        rowVals.put("PA_HT", BigDecimal.ZERO);
-
 
1679
        rowVals.put("QTE_UNITAIRE", BigDecimal.ONE);
1349
        rowVals.put("POIDS", Float.valueOf(0));
1680
        rowVals.put("POIDS", Float.valueOf(0));
-
 
1681
        rowVals.put("GESTION_STOCK", Boolean.TRUE);
1350
 
1682
 
1351
        return rowVals;
1683
        return rowVals;
1352
    }
1684
    }
1353
 
1685
 
1354
    private void setTextHT() {
1686
    private void setTextHT() {