OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 132 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 132 Rev 156
Line 16... Line 16...
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.DeviseField;
17
import org.openconcerto.erp.core.common.ui.DeviseField;
18
import org.openconcerto.erp.model.PrixHT;
18
import org.openconcerto.erp.model.PrixHT;
19
import org.openconcerto.erp.model.PrixTTC;
19
import org.openconcerto.erp.model.PrixTTC;
20
import org.openconcerto.erp.preferences.DefaultNXProps;
20
import org.openconcerto.erp.preferences.DefaultNXProps;
-
 
21
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
21
import org.openconcerto.sql.element.BaseSQLComponent;
22
import org.openconcerto.sql.element.BaseSQLComponent;
22
import org.openconcerto.sql.element.ElementSQLObject;
23
import org.openconcerto.sql.element.ElementSQLObject;
23
import org.openconcerto.sql.element.SQLComponent;
24
import org.openconcerto.sql.element.SQLComponent;
24
import org.openconcerto.sql.model.SQLRow;
25
import org.openconcerto.sql.model.SQLRow;
25
import org.openconcerto.sql.model.SQLRowValues;
26
import org.openconcerto.sql.model.SQLRowValues;
-
 
27
import org.openconcerto.sql.preferences.SQLPreferences;
26
import org.openconcerto.sql.sqlobject.ElementComboBox;
28
import org.openconcerto.sql.sqlobject.ElementComboBox;
27
import org.openconcerto.ui.DefaultGridBagConstraints;
29
import org.openconcerto.ui.DefaultGridBagConstraints;
28
import org.openconcerto.utils.GestionDevise;
30
import org.openconcerto.utils.GestionDevise;
29
 
31
 
30
import java.awt.GridBagConstraints;
32
import java.awt.GridBagConstraints;
Line 48... Line 50...
48
 
50
 
49
    public ArticleSQLElement() {
51
    public ArticleSQLElement() {
50
        super("ARTICLE", "un article", "articles");
52
        super("ARTICLE", "un article", "articles");
51
    }
53
    }
52
 
54
 
-
 
55
    @Override
53
    protected List<String> getListFields() {
56
    protected List<String> getListFields() {
54
        final List<String> l = new ArrayList<String>();
57
        final List<String> l = new ArrayList<>();
55
 
58
 
56
        l.add("CODE");
59
        l.add("CODE");
57
        l.add("NOM");
60
        l.add("NOM");
58
        l.add("POIDS");
61
        l.add("POIDS");
59
        l.add("PA_HT");
62
        l.add("PA_HT");
Line 63... Line 66...
63
        l.add("VALEUR_METRIQUE_1");
66
        l.add("VALEUR_METRIQUE_1");
64
        l.add("VALEUR_METRIQUE_2");
67
        l.add("VALEUR_METRIQUE_2");
65
        l.add("VALEUR_METRIQUE_3");
68
        l.add("VALEUR_METRIQUE_3");
66
        l.add("PRIX_METRIQUE_HA_1");
69
        l.add("PRIX_METRIQUE_HA_1");
67
        l.add("PRIX_METRIQUE_VT_1");
70
        l.add("PRIX_METRIQUE_VT_1");
-
 
71
        SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
-
 
72
 
-
 
73
        if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false)) {
68
        l.add("ID_STOCK");
74
            l.add("ID_STOCK");
-
 
75
        }
69
 
76
 
70
        String val = DefaultNXProps.getInstance().getStringProperty("ArticleService");
77
        String val = DefaultNXProps.getInstance().getStringProperty("ArticleService");
71
        Boolean b = Boolean.valueOf(val);
78
        Boolean b = Boolean.valueOf(val);
72
        if (b != null && b.booleanValue()) {
79
        if (b != null && b.booleanValue()) {
73
            l.add("SERVICE");
80
            l.add("SERVICE");
74
        }
81
        }
75
        return l;
82
        return l;
76
    }
83
    }
77
 
84
 
-
 
85
    @Override
78
    protected List<String> getComboFields() {
86
    protected List<String> getComboFields() {
79
        final List<String> l = new ArrayList<String>();
87
        final List<String> l = new ArrayList<>(2);
80
        l.add("CODE");
88
        l.add("CODE");
81
        l.add("NOM");
89
        l.add("NOM");
82
        return l;
90
        return l;
83
    }
91
    }
84
 
92
 
Line 93... Line 101...
93
 
101
 
94
            private DeviseField textPVHT, textPVTTC, textPAHT;
102
            private DeviseField textPVHT, textPVTTC, textPAHT;
95
            private JTextField textNom, textCode;
103
            private JTextField textNom, textCode;
96
            private JTextField textPoids;
104
            private JTextField textPoids;
97
            private DocumentListener htDocListener, ttcDocListener;
105
            private DocumentListener htDocListener, ttcDocListener;
98
            private PropertyChangeListener taxeListener;
-
 
99
            final ElementComboBox comboSelTaxe = new ElementComboBox(false);
106
            private final ElementComboBox comboSelTaxe = new ElementComboBox(false);
100
 
107
 
101
            public void addViews() {
108
            public void addViews() {
102
 
109
 
103
                this.textPVHT = new DeviseField();
110
                this.textPVHT = new DeviseField();
104
                this.textPVTTC = new DeviseField();
111
                this.textPVTTC = new DeviseField();
Line 134... Line 141...
134
                        setTextTTC();
141
                        setTextTTC();
135
                    }
142
                    }
136
 
143
 
137
                };
144
                };
138
 
145
 
139
                this.taxeListener = new PropertyChangeListener() {
146
                PropertyChangeListener taxeListener = new PropertyChangeListener() {
140
 
147
 
141
                    public void propertyChange(PropertyChangeEvent evt) {
148
                    public void propertyChange(PropertyChangeEvent evt) {
142
 
149
 
143
                        if (textPVHT.getText().trim().length() > 0) {
150
                        if (textPVHT.getText().trim().length() > 0) {
144
                            setTextTTC();
151
                            setTextTTC();
Line 227... Line 234...
227
                this.addRequiredSQLObject(this.comboSelTaxe, "ID_TAXE");
234
                this.addRequiredSQLObject(this.comboSelTaxe, "ID_TAXE");
228
                this.addRequiredSQLObject(this.textPVTTC, "PV_TTC");
235
                this.addRequiredSQLObject(this.textPVTTC, "PV_TTC");
229
 
236
 
230
                this.textPVHT.getDocument().addDocumentListener(this.htDocListener);
237
                this.textPVHT.getDocument().addDocumentListener(this.htDocListener);
231
                this.textPVTTC.getDocument().addDocumentListener(this.ttcDocListener);
238
                this.textPVTTC.getDocument().addDocumentListener(this.ttcDocListener);
232
                this.comboSelTaxe.addValueListener(this.taxeListener);
239
                this.comboSelTaxe.addValueListener(taxeListener);
233
            }
240
            }
234
 
241
 
235
            private void setTextHT() {
242
            private void setTextHT() {
236
                this.textPVHT.getDocument().removeDocumentListener(this.htDocListener);
243
                this.textPVHT.getDocument().removeDocumentListener(this.htDocListener);
237
 
244
 
Line 266... Line 273...
266
                rowVals.put("ID_MODE_VENTE_ARTICLE", ReferenceArticleSQLElement.A_LA_PIECE);
273
                rowVals.put("ID_MODE_VENTE_ARTICLE", ReferenceArticleSQLElement.A_LA_PIECE);
267
                return rowVals;
274
                return rowVals;
268
            }
275
            }
269
        };
276
        };
270
    }
277
    }
-
 
278
 
-
 
279
    @Override
-
 
280
    protected String createCode() {
-
 
281
        return "sales.product";
-
 
282
    }
271
}
283
}