OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 177 Rev 180
Line 87... Line 87...
87
import javax.swing.event.TableModelEvent;
87
import javax.swing.event.TableModelEvent;
88
import javax.swing.event.TableModelListener;
88
import javax.swing.event.TableModelListener;
89
 
89
 
90
public class ReferenceArticleSQLComponent extends BaseSQLComponent {
90
public class ReferenceArticleSQLComponent extends BaseSQLComponent {
91
 
91
 
92
    private JTextField textPVHT, textPVTTC, textPAHT;
92
    protected JTextField textPVHT, textPVTTC, textPAHT;
93
    private JTextField textMetrique1VT, textMetrique1HA;
93
    protected JTextField textMetrique1VT, textMetrique1HA;
94
 
94
 
95
    private final JCheckBox boxService = new JCheckBox(getLabelFor("SERVICE"));
95
    protected final JCheckBox boxService = new JCheckBox(getLabelFor("SERVICE"));
96
    private final JCheckBox checkObs = new JCheckBox(getLabelFor("OBSOLETE"));
96
    protected final JCheckBox checkObs = new JCheckBox(getLabelFor("OBSOLETE"));
97
    private JTextField textNom, textCode;
97
    protected JTextField textNom, textCode;
98
    private JTextField textPoids;
98
    protected JTextField textPoids;
99
    private JTextField textValMetrique1, textValMetrique2, textValMetrique3;
99
    protected JTextField textValMetrique1, textValMetrique2, textValMetrique3;
100
    private DocumentListener htDocListener, ttcDocListener, detailsListener;
100
    protected DocumentListener htDocListener, ttcDocListener, detailsListener;
101
    private PropertyChangeListener propertyChangeListener;
101
    protected PropertyChangeListener propertyChangeListener;
102
    private PropertyChangeListener taxeListener;
102
    protected PropertyChangeListener taxeListener;
103
    private final ElementComboBox comboSelTaxe = new ElementComboBox(false, 10);
103
    protected final ElementComboBox comboSelTaxe = new ElementComboBox(false, 10);
104
    private final ElementComboBox comboSelModeVente = new ElementComboBox(false, 25);
104
    protected final ElementComboBox comboSelModeVente = new ElementComboBox(false, 25);
105
    private JLabel labelMetriqueHA1 = new JLabel(getLabelFor("PRIX_METRIQUE_HA_1"), SwingConstants.RIGHT);
105
    protected JLabel labelMetriqueHA1 = new JLabel(getLabelFor("PRIX_METRIQUE_HA_1"), SwingConstants.RIGHT);
106
    private JLabel labelMetriqueVT1 = new JLabel(getLabelFor("PRIX_METRIQUE_VT_1"), SwingConstants.RIGHT);
106
    protected JLabel labelMetriqueVT1 = new JLabel(getLabelFor("PRIX_METRIQUE_VT_1"), SwingConstants.RIGHT);
107
 
107
 
108
    private ArticleDesignationTable tableDes = new ArticleDesignationTable();
108
    protected ArticleDesignationTable tableDes = new ArticleDesignationTable();
109
    private ArticleCodeClientTable tableCodeClient = new ArticleCodeClientTable();
109
    protected ArticleCodeClientTable tableCodeClient = new ArticleCodeClientTable();
110
    private ArticleTarifTable tableTarifVente = new ArticleTarifTable(this);
110
    protected ArticleTarifTable tableTarifVente = new ArticleTarifTable(this);
111
    private ArticleCategorieComptableTable tableCatComptable = new ArticleCategorieComptableTable();
111
    protected ArticleCategorieComptableTable tableCatComptable = new ArticleCategorieComptableTable();
112
    private SupplierPriceListTable tableFourSec = new SupplierPriceListTable();
112
    protected SupplierPriceListTable tableFourSec = new SupplierPriceListTable();
113
 
113
 
114
    private ProductQtyPriceListTable tableTarifQteVente = new ProductQtyPriceListTable(this);
114
    protected ProductQtyPriceListTable tableTarifQteVente = new ProductQtyPriceListTable(this);
115
    private ProductItemListTable tableBom;
115
    protected ProductItemListTable tableBom;
116
    private final JTextField textMarge = new JTextField(10);
116
    protected final JTextField textMarge = new JTextField(10);
117
    private final JLabel labelMarge = new JLabel("%           ");
117
    protected final JLabel labelMarge = new JLabel("%           ");
118
    private ElementComboBox boxCR;
118
    protected ElementComboBox boxCR;
119
    private JCheckBox boxMargeWithCR;
119
    protected JCheckBox boxMargeWithCR;
120
 
120
 
121
    private DocumentListener pieceHAArticle = new SimpleDocumentListener() {
121
    protected DocumentListener pieceHAArticle = new SimpleDocumentListener() {
122
 
122
 
123
        @Override
123
        @Override
124
        public void update(DocumentEvent e) {
124
        public void update(DocumentEvent e) {
125
 
125
 
126
            if (!ReferenceArticleSQLComponent.this.textPAHT.getText().equalsIgnoreCase(ReferenceArticleSQLComponent.this.textMetrique1HA.getText())) {
126
            if (!ReferenceArticleSQLComponent.this.textPAHT.getText().equalsIgnoreCase(ReferenceArticleSQLComponent.this.textMetrique1HA.getText())) {
127
                ReferenceArticleSQLComponent.this.textMetrique1HA.setText(ReferenceArticleSQLComponent.this.textPAHT.getText());
127
                ReferenceArticleSQLComponent.this.textMetrique1HA.setText(ReferenceArticleSQLComponent.this.textPAHT.getText());
128
            }
128
            }
129
        }
129
        }
130
 
130
 
131
    };
131
    };
132
    private DocumentListener pieceVTArticle = new SimpleDocumentListener() {
132
    protected DocumentListener pieceVTArticle = new SimpleDocumentListener() {
133
 
133
 
134
        @Override
134
        @Override
135
        public void update(DocumentEvent e) {
135
        public void update(DocumentEvent e) {
136
            if (!ReferenceArticleSQLComponent.this.textPVHT.getText().equalsIgnoreCase(ReferenceArticleSQLComponent.this.textMetrique1VT.getText())) {
136
            if (!ReferenceArticleSQLComponent.this.textPVHT.getText().equalsIgnoreCase(ReferenceArticleSQLComponent.this.textMetrique1VT.getText())) {
137
                ReferenceArticleSQLComponent.this.textMetrique1VT.setText(ReferenceArticleSQLComponent.this.textPVHT.getText());
137
                ReferenceArticleSQLComponent.this.textMetrique1VT.setText(ReferenceArticleSQLComponent.this.textPVHT.getText());
138
            }
138
            }
139
        }
139
        }
140
 
140
 
141
    };
141
    };
142
 
142
 
143
    private DocumentListener listenerMargeTextMarge = new SimpleDocumentListener() {
143
    protected DocumentListener listenerMargeTextMarge = new SimpleDocumentListener() {
144
        @Override
144
        @Override
145
        public void update(DocumentEvent e) {
145
        public void update(DocumentEvent e) {
146
            ReferenceArticleSQLComponent.this.textPVHT.getDocument().removeDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextVT);
146
            ReferenceArticleSQLComponent.this.textPVHT.getDocument().removeDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextVT);
147
            updateVtFromMarge();
147
            updateVtFromMarge();
148
            ReferenceArticleSQLComponent.this.textPVHT.getDocument().addDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextVT);
148
            ReferenceArticleSQLComponent.this.textPVHT.getDocument().addDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextVT);
149
        }
149
        }
150
 
150
 
151
    };
151
    };
152
 
152
 
153
    private DocumentListener listenerMargeTextVT = new SimpleDocumentListener() {
153
    protected DocumentListener listenerMargeTextVT = new SimpleDocumentListener() {
154
        @Override
154
        @Override
155
        public void update(DocumentEvent e) {
155
        public void update(DocumentEvent e) {
156
            ReferenceArticleSQLComponent.this.textMarge.getDocument().removeDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextMarge);
156
            ReferenceArticleSQLComponent.this.textMarge.getDocument().removeDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextMarge);
157
            if (ReferenceArticleSQLComponent.this.textPVHT.getText().trim().length() > 0 && ReferenceArticleSQLComponent.this.textPAHT.getText().trim().length() > 0) {
157
            if (ReferenceArticleSQLComponent.this.textPVHT.getText().trim().length() > 0 && ReferenceArticleSQLComponent.this.textPAHT.getText().trim().length() > 0) {
158
                final BigDecimal vt = StringUtils.getBigDecimalFromUserText(ReferenceArticleSQLComponent.this.textPVHT.getText());
158
                final BigDecimal vt = StringUtils.getBigDecimalFromUserText(ReferenceArticleSQLComponent.this.textPVHT.getText());
Line 194... Line 194...
194
            }
194
            }
195
            ReferenceArticleSQLComponent.this.textMarge.getDocument().addDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextMarge);
195
            ReferenceArticleSQLComponent.this.textMarge.getDocument().addDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextMarge);
196
        }
196
        }
197
    };
197
    };
198
 
198
 
199
    private DocumentListener listenerMargeTextHA = new SimpleDocumentListener() {
199
    protected DocumentListener listenerMargeTextHA = new SimpleDocumentListener() {
200
        @Override
200
        @Override
201
        public void update(DocumentEvent e) {
201
        public void update(DocumentEvent e) {
202
            ReferenceArticleSQLComponent.this.textPVHT.getDocument().removeDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextVT);
202
            ReferenceArticleSQLComponent.this.textPVHT.getDocument().removeDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextVT);
203
            updateVtFromMarge();
203
            updateVtFromMarge();
204
            ReferenceArticleSQLComponent.this.textPVHT.getDocument().addDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextVT);
204
            ReferenceArticleSQLComponent.this.textPVHT.getDocument().addDocumentListener(ReferenceArticleSQLComponent.this.listenerMargeTextVT);
205
        }
205
        }
206
    };
206
    };
207
 
207
 
208
    private void updateVtFromMarge() {
208
    public void updateVtFromMarge() {
209
        if (this.textPAHT.getText().trim().length() > 0) {
209
        if (this.textPAHT.getText().trim().length() > 0) {
210
 
210
 
211
            BigDecimal ha = StringUtils.getBigDecimalFromUserText(this.textPAHT.getText());
211
            BigDecimal ha = StringUtils.getBigDecimalFromUserText(this.textPAHT.getText());
212
            if (ha != null && this.textMarge.getText().trim().length() > 0) {
212
            if (ha != null && this.textMarge.getText().trim().length() > 0) {
213
 
213
 
Line 472... Line 472...
472
        };
472
        };
473
        setListenerModeVenteActive(true);
473
        setListenerModeVenteActive(true);
474
        this.comboSelModeVente.setValue(ReferenceArticleSQLElement.A_LA_PIECE);
474
        this.comboSelModeVente.setValue(ReferenceArticleSQLElement.A_LA_PIECE);
475
    }
475
    }
476
 
476
 
477
    private Component createInfosPanel() {
477
    protected Component createInfosPanel() {
478
        JPanel panel = new JPanel(new GridBagLayout());
478
        JPanel panel = new JPanel(new GridBagLayout());
479
        panel.setOpaque(false);
479
        panel.setOpaque(false);
480
        GridBagConstraints c = new DefaultGridBagConstraints();
480
        GridBagConstraints c = new DefaultGridBagConstraints();
481
        c.weightx = 0;
481
        c.weightx = 0;
482
        c.gridy++;
482
        c.gridy++;
Line 584... Line 584...
584
        this.addSQLObject(box, "ID_ECO_CONTRIBUTION");
584
        this.addSQLObject(box, "ID_ECO_CONTRIBUTION");
585
        this.addSQLObject(boxTaxeCompl, "ID_TAXE_COMPLEMENTAIRE");
585
        this.addSQLObject(boxTaxeCompl, "ID_TAXE_COMPLEMENTAIRE");
586
        return panel;
586
        return panel;
587
    }
587
    }
588
 
588
 
589
    private Component createDescriptifPanel() {
589
    protected Component createDescriptifPanel() {
590
        JPanel panel = new JPanel(new GridBagLayout());
590
        JPanel panel = new JPanel(new GridBagLayout());
591
        panel.setOpaque(false);
591
        panel.setOpaque(false);
592
        GridBagConstraints c = new DefaultGridBagConstraints();
592
        GridBagConstraints c = new DefaultGridBagConstraints();
593
 
593
 
594
        // Obsolete
594
        // Obsolete
Line 664... Line 664...
664
        panel.add(area, c);
664
        panel.add(area, c);
665
        this.addView(area, "DESCRIPTIF");
665
        this.addView(area, "DESCRIPTIF");
666
        return panel;
666
        return panel;
667
    }
667
    }
668
 
668
 
669
    private Component createDesignationPanel() {
669
    protected Component createDesignationPanel() {
670
        JPanel panel = new JPanel(new GridBagLayout());
670
        JPanel panel = new JPanel(new GridBagLayout());
671
        panel.setOpaque(false);
671
        panel.setOpaque(false);
672
        GridBagConstraints c = new DefaultGridBagConstraints();
672
        GridBagConstraints c = new DefaultGridBagConstraints();
673
 
673
 
674
        // Ajout des
674
        // Ajout des
Line 742... Line 742...
742
        });
742
        });
743
 
743
 
744
        return panel;
744
        return panel;
745
    }
745
    }
746
 
746
 
747
    private Component createCodeClientPanel() {
747
    protected Component createCodeClientPanel() {
748
        JPanel panel = new JPanel(new GridBagLayout());
748
        JPanel panel = new JPanel(new GridBagLayout());
749
        panel.setOpaque(false);
749
        panel.setOpaque(false);
750
        GridBagConstraints c = new DefaultGridBagConstraints();
750
        GridBagConstraints c = new DefaultGridBagConstraints();
751
 
751
 
752
        c.gridx = 0;
752
        c.gridx = 0;
Line 758... Line 758...
758
        panel.add(this.tableCodeClient, c);
758
        panel.add(this.tableCodeClient, c);
759
 
759
 
760
        return panel;
760
        return panel;
761
    }
761
    }
762
 
762
 
763
    private Component createStockPanel() {
763
    protected Component createStockPanel() {
764
        JPanel panel = new JPanel(new GridBagLayout());
764
        JPanel panel = new JPanel(new GridBagLayout());
765
        panel.setOpaque(false);
765
        panel.setOpaque(false);
766
        GridBagConstraints c = new DefaultGridBagConstraints();
766
        GridBagConstraints c = new DefaultGridBagConstraints();
767
        SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
767
        SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
768
        boolean gestionStockMin = prefs.getBoolean(GestionArticleGlobalPreferencePanel.WARNING_STOCK_MIN, true);
768
        boolean gestionStockMin = prefs.getBoolean(GestionArticleGlobalPreferencePanel.WARNING_STOCK_MIN, true);
Line 828... Line 828...
828
        spacer.setOpaque(false);
828
        spacer.setOpaque(false);
829
        panel.add(spacer, c);
829
        panel.add(spacer, c);
830
        return panel;
830
        return panel;
831
    }
831
    }
832
 
832
 
833
    private Component createComptaPanel() {
833
    protected Component createComptaPanel() {
834
        JPanel panel = new JPanel(new GridBagLayout());
834
        JPanel panel = new JPanel(new GridBagLayout());
835
        panel.setOpaque(false);
835
        panel.setOpaque(false);
836
        GridBagConstraints c = new DefaultGridBagConstraints();
836
        GridBagConstraints c = new DefaultGridBagConstraints();
837
        c.gridwidth = 1;
837
        c.gridwidth = 1;
838
        c.weighty = 0;
838
        c.weighty = 0;
Line 870... Line 870...
870
        // spacer.setOpaque(false);
870
        // spacer.setOpaque(false);
871
        // panel.add(spacer, c);
871
        // panel.add(spacer, c);
872
        return panel;
872
        return panel;
873
    }
873
    }
874
 
874
 
875
    private SQLRowValues rowValuesDefaultCodeFournisseur;
875
    protected SQLRowValues rowValuesDefaultCodeFournisseur;
876
    private CodeFournisseurItemTable codeFournisseurTable;
876
    protected CodeFournisseurItemTable codeFournisseurTable;
877
 
877
 
878
    private Component createAchatPanel() {
878
    protected Component createAchatPanel() {
879
        JPanel panel = new JPanel(new GridBagLayout());
879
        JPanel panel = new JPanel(new GridBagLayout());
880
        panel.setOpaque(false);
880
        panel.setOpaque(false);
881
        GridBagConstraints c = new DefaultGridBagConstraints();
881
        GridBagConstraints c = new DefaultGridBagConstraints();
882
        // Fournisseur
882
        // Fournisseur
883
        c.gridy++;
883
        c.gridy++;
Line 1001... Line 1001...
1001
        }
1001
        }
1002
        return panel;
1002
        return panel;
1003
 
1003
 
1004
    }
1004
    }
1005
 
1005
 
1006
    private JPanel createExportationPanel() {
1006
    protected JPanel createExportationPanel() {
1007
        JPanel panel = new JPanel(new GridBagLayout());
1007
        JPanel panel = new JPanel(new GridBagLayout());
1008
        panel.setOpaque(false);
1008
        panel.setOpaque(false);
1009
        GridBagConstraints c = new DefaultGridBagConstraints();
1009
        GridBagConstraints c = new DefaultGridBagConstraints();
1010
        // Code douanier
1010
        // Code douanier
1011
        c.gridx = 0;
1011
        c.gridx = 0;
Line 1041... Line 1041...
1041
        spacer.setOpaque(false);
1041
        spacer.setOpaque(false);
1042
        panel.add(spacer, c);
1042
        panel.add(spacer, c);
1043
        return panel;
1043
        return panel;
1044
    }
1044
    }
1045
 
1045
 
1046
    private JPanel createTarifPanel() {
1046
    protected JPanel createTarifPanel() {
1047
        JPanel panel = new JPanel(new GridBagLayout());
1047
        JPanel panel = new JPanel(new GridBagLayout());
1048
        panel.setOpaque(false);
1048
        panel.setOpaque(false);
1049
        GridBagConstraints c = new DefaultGridBagConstraints();
1049
        GridBagConstraints c = new DefaultGridBagConstraints();
1050
 
1050
 
1051
        // Ajout tarif
1051
        // Ajout tarif
Line 1125... Line 1125...
1125
            }
1125
            }
1126
        });
1126
        });
1127
        return panel;
1127
        return panel;
1128
    }
1128
    }
1129
 
1129
 
1130
    private JPanel createCategorieComptablePanel() {
1130
    protected JPanel createCategorieComptablePanel() {
1131
        JPanel panel = new JPanel(new GridBagLayout());
1131
        JPanel panel = new JPanel(new GridBagLayout());
1132
        panel.setOpaque(false);
1132
        panel.setOpaque(false);
1133
        GridBagConstraints c = new DefaultGridBagConstraints();
1133
        GridBagConstraints c = new DefaultGridBagConstraints();
1134
 
1134
 
1135
        // Ajout catégorie
1135
        // Ajout catégorie
Line 1202... Line 1202...
1202
            }
1202
            }
1203
        });
1203
        });
1204
        return panel;
1204
        return panel;
1205
    }
1205
    }
1206
 
1206
 
1207
    private JPanel createBOMpanel() {
1207
    protected JPanel createBOMpanel() {
1208
        JPanel panel = new JPanel(new GridBagLayout());
1208
        JPanel panel = new JPanel(new GridBagLayout());
1209
        panel.setOpaque(false);
1209
        panel.setOpaque(false);
1210
        GridBagConstraints c = new DefaultGridBagConstraints();
1210
        GridBagConstraints c = new DefaultGridBagConstraints();
1211
 
1211
 
1212
        final JCheckBox checkAutoPrice = new JCheckBox(getLabelFor("AUTO_PRIX_MIN_VENTE_NOMENCLATURE"));
1212
        final JCheckBox checkAutoPrice = new JCheckBox(getLabelFor("AUTO_PRIX_MIN_VENTE_NOMENCLATURE"));
Line 1253... Line 1253...
1253
        });
1253
        });
1254
        return panel;
1254
        return panel;
1255
 
1255
 
1256
    }
1256
    }
1257
 
1257
 
1258
    private void updatePricesNomenclature(final JCheckBox checkAutoPrice, final JCheckBox checkAutoPriceHA) {
1258
    protected void updatePricesNomenclature(final JCheckBox checkAutoPrice, final JCheckBox checkAutoPriceHA) {
1259
        final Boolean vtAuto = checkAutoPrice.isSelected();
1259
        final Boolean vtAuto = checkAutoPrice.isSelected();
1260
        final Boolean haAuto = checkAutoPriceHA.isSelected();
1260
        final Boolean haAuto = checkAutoPriceHA.isSelected();
1261
        if (vtAuto || haAuto) {
1261
        if (vtAuto || haAuto) {
1262
            ProductHelper helper = new ProductHelper(getTable().getDBRoot());
1262
            ProductHelper helper = new ProductHelper(getTable().getDBRoot());
1263
 
1263
 
Line 1269... Line 1269...
1269
                textPVHT.setText(p.get1().toString());
1269
                textPVHT.setText(p.get1().toString());
1270
            }
1270
            }
1271
        }
1271
        }
1272
    }
1272
    }
1273
 
1273
 
1274
    private JPanel createTarifQtePanel() {
1274
    protected JPanel createTarifQtePanel() {
1275
        JPanel panel = new JPanel(new GridBagLayout());
1275
        JPanel panel = new JPanel(new GridBagLayout());
1276
        panel.setOpaque(false);
1276
        panel.setOpaque(false);
1277
        GridBagConstraints c = new DefaultGridBagConstraints();
1277
        GridBagConstraints c = new DefaultGridBagConstraints();
1278
 
1278
 
1279
        c.gridwidth = GridBagConstraints.REMAINDER;
1279
        c.gridwidth = GridBagConstraints.REMAINDER;
Line 1561... Line 1561...
1561
        this.textValMetrique2.getDocument().addDocumentListener(this.detailsListener);
1561
        this.textValMetrique2.getDocument().addDocumentListener(this.detailsListener);
1562
        this.textValMetrique3.getDocument().addDocumentListener(this.detailsListener);
1562
        this.textValMetrique3.getDocument().addDocumentListener(this.detailsListener);
1563
 
1563
 
1564
    }
1564
    }
1565
 
1565
 
1566
    private void setListenerModeVenteActive(boolean b) {
1566
    protected void setListenerModeVenteActive(boolean b) {
1567
        if (b) {
1567
        if (b) {
1568
            this.comboSelModeVente.addValueListener(this.propertyChangeListener);
1568
            this.comboSelModeVente.addValueListener(this.propertyChangeListener);
1569
        } else {
1569
        } else {
1570
            this.comboSelModeVente.removePropertyChangeListener(this.propertyChangeListener);
1570
            this.comboSelModeVente.removePropertyChangeListener(this.propertyChangeListener);
1571
        }
1571
        }
Line 1573... Line 1573...
1573
 
1573
 
1574
    /**
1574
    /**
1575
     * @param c
1575
     * @param c
1576
     * @param props
1576
     * @param props
1577
     */
1577
     */
1578
    private void addModeVenteAvance(GridBagConstraints c) {
1578
    protected void addModeVenteAvance(GridBagConstraints c) {
1579
        DefaultProps props = DefaultNXProps.getInstance();
1579
        DefaultProps props = DefaultNXProps.getInstance();
1580
        JSeparator sep = new JSeparator();
1580
        JSeparator sep = new JSeparator();
1581
        JLabel labelDetails = new JLabel("Article détaillé", SwingConstants.RIGHT);
1581
        JLabel labelDetails = new JLabel("Article détaillé", SwingConstants.RIGHT);
1582
        c.gridx = 0;
1582
        c.gridx = 0;
1583
        c.gridy++;
1583
        c.gridy++;
Line 1767... Line 1767...
1767
     * Sélection d'un mode de vente pour l'article. Affiche les prix metriques requis et fixe les
1767
     * Sélection d'un mode de vente pour l'article. Affiche les prix metriques requis et fixe les
1768
     * valeurs.
1768
     * valeurs.
1769
     * 
1769
     * 
1770
     * @param id id du mode de vente
1770
     * @param id id du mode de vente
1771
     */
1771
     */
1772
    private void selectModeVente(int id) {
1772
    protected void selectModeVente(int id) {
1773
 
1773
 
1774
        this.labelMetriqueHA1.setEnabled(true);
1774
        this.labelMetriqueHA1.setEnabled(true);
1775
        this.labelMetriqueVT1.setEnabled(true);
1775
        this.labelMetriqueVT1.setEnabled(true);
1776
        this.textMetrique1HA.setEnabled(true);
1776
        this.textMetrique1HA.setEnabled(true);
1777
        this.textMetrique1VT.setEnabled(true);
1777
        this.textMetrique1VT.setEnabled(true);
Line 1848... Line 1848...
1848
        rowVals.put("GESTION_STOCK", Boolean.TRUE);
1848
        rowVals.put("GESTION_STOCK", Boolean.TRUE);
1849
 
1849
 
1850
        return rowVals;
1850
        return rowVals;
1851
    }
1851
    }
1852
 
1852
 
1853
    private void setTextHT() {
1853
    protected void setTextHT() {
1854
        if (!isFilling()) {
1854
        if (!isFilling()) {
1855
            this.textPVHT.getDocument().removeDocumentListener(this.htDocListener);
1855
            this.textPVHT.getDocument().removeDocumentListener(this.htDocListener);
1856
            final BigDecimal ttc = StringUtils.getBigDecimalFromUserText(this.textPVTTC.getText());
1856
            final BigDecimal ttc = StringUtils.getBigDecimalFromUserText(this.textPVTTC.getText());
1857
            if (ttc != null) {
1857
            if (ttc != null) {
1858
                int id = this.comboSelTaxe.getSelectedId();
1858
                int id = this.comboSelTaxe.getSelectedId();
Line 1865... Line 1865...
1865
            }
1865
            }
1866
            this.textPVHT.getDocument().addDocumentListener(this.htDocListener);
1866
            this.textPVHT.getDocument().addDocumentListener(this.htDocListener);
1867
        }
1867
        }
1868
    }
1868
    }
1869
 
1869
 
1870
    private void setTextTTC() {
1870
    protected void setTextTTC() {
1871
        if (!isFilling()) {
1871
        if (!isFilling()) {
1872
            this.textPVTTC.getDocument().removeDocumentListener(this.ttcDocListener);
1872
            this.textPVTTC.getDocument().removeDocumentListener(this.ttcDocListener);
1873
            final BigDecimal ht = StringUtils.getBigDecimalFromUserText(this.textPVHT.getText());
1873
            final BigDecimal ht = StringUtils.getBigDecimalFromUserText(this.textPVHT.getText());
1874
            if (ht != null) {
1874
            if (ht != null) {
1875
                int id = this.comboSelTaxe.getSelectedId();
1875
                int id = this.comboSelTaxe.getSelectedId();
Line 1885... Line 1885...
1885
    }
1885
    }
1886
 
1886
 
1887
    /**
1887
    /**
1888
     * calcul du prix achat et vente ainsi que le poids total pour la piece
1888
     * calcul du prix achat et vente ainsi que le poids total pour la piece
1889
     */
1889
     */
1890
    private void updatePiece() {
1890
    protected void updatePiece() {
1891
        if (this.comboSelModeVente.getSelectedId() > 1 && this.comboSelModeVente.getSelectedId() != ReferenceArticleSQLElement.A_LA_PIECE) {
1891
        if (this.comboSelModeVente.getSelectedId() > 1 && this.comboSelModeVente.getSelectedId() != ReferenceArticleSQLElement.A_LA_PIECE) {
1892
            SQLRowValues rowVals = getDetailsRowValues();
1892
            SQLRowValues rowVals = getDetailsRowValues();
1893
            float poidsTot = ReferenceArticleSQLElement.getPoidsFromDetails(rowVals);
1893
            float poidsTot = ReferenceArticleSQLElement.getPoidsFromDetails(rowVals);
1894
            this.textPoids.setText(String.valueOf(poidsTot));
1894
            this.textPoids.setText(String.valueOf(poidsTot));
1895
            this.textPAHT.setText(ReferenceArticleSQLElement.getPrixHAFromDetails(rowVals).setScale(getTable().getField("PA_HT").getType().getDecimalDigits(), RoundingMode.HALF_UP).toString());
1895
            this.textPAHT.setText(ReferenceArticleSQLElement.getPrixHAFromDetails(rowVals).setScale(getTable().getField("PA_HT").getType().getDecimalDigits(), RoundingMode.HALF_UP).toString());
Line 1922... Line 1922...
1922
        rowVals.put("ID_MODE_VENTE_ARTICLE", this.comboSelModeVente.getSelectedId());
1922
        rowVals.put("ID_MODE_VENTE_ARTICLE", this.comboSelModeVente.getSelectedId());
1923
 
1923
 
1924
        return rowVals;
1924
        return rowVals;
1925
    }
1925
    }
1926
 
1926
 
1927
    private void put(SQLRowValues rowVals, JTextField comp) {
1927
    protected void put(SQLRowValues rowVals, JTextField comp) {
1928
        Float f = (comp.getText() == null || comp.getText().trim().length() == 0) ? 0.0F : Float.valueOf(comp.getText());
1928
        Float f = (comp.getText() == null || comp.getText().trim().length() == 0) ? 0.0F : Float.valueOf(comp.getText());
1929
        rowVals.put(this.getView(comp).getField().getName(), f);
1929
        rowVals.put(this.getView(comp).getField().getName(), f);
1930
    }
1930
    }
1931
 
1931
 
1932
}
1932
}