OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 156 Rev 174
Line 16... Line 16...
16
import org.openconcerto.erp.action.CreateIListFrameAbstractAction;
16
import org.openconcerto.erp.action.CreateIListFrameAbstractAction;
17
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.config.ComptaPropsConfiguration;
18
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
18
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
19
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
19
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
20
import org.openconcerto.erp.core.sales.order.element.CommandeClientElementSQLElement;
20
import org.openconcerto.erp.core.sales.order.element.CommandeClientElementSQLElement;
-
 
21
import org.openconcerto.erp.core.sales.product.ui.QteAcommanderRenderer;
21
import org.openconcerto.erp.core.supplychain.stock.element.StockSQLElement;
22
import org.openconcerto.erp.core.supplychain.stock.element.StockSQLElement;
22
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
23
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
23
import org.openconcerto.sql.element.SQLElement;
24
import org.openconcerto.sql.element.SQLElement;
24
import org.openconcerto.sql.model.FieldPath;
25
import org.openconcerto.sql.model.FieldPath;
25
import org.openconcerto.sql.model.FieldRef;
26
import org.openconcerto.sql.model.FieldRef;
Line 122... Line 123...
122
 
123
 
123
            @Override
124
            @Override
124
            protected Object show_(SQLRowAccessor r) {
125
            protected Object show_(SQLRowAccessor r) {
125
 
126
 
126
                final SQLRowAccessor foreign = r.getForeign("ID_ARTICLE");
127
                final SQLRowAccessor foreign = r.getForeign("ID_ARTICLE");
-
 
128
 
127
                if (foreign != null && !foreign.isUndefined()) {
129
                if (foreign != null && !foreign.isUndefined()) {
-
 
130
                    if (foreign.getBoolean("GESTION_STOCK")) {
128
                    SQLRowAccessor foreign2 = StockSQLElement.getStockFetched(r);
131
                        SQLRowAccessor foreign2 = StockSQLElement.getStockFetched(r);
129
                    if (foreign2 != null && !foreign2.isUndefined()) {
132
                        if (foreign2 != null && !foreign2.isUndefined()) {
130
                        return foreign2.getFloat("QTE_REEL");
133
                            return foreign2.getFloat("QTE_REEL");
131
                    }
134
                        }
132
                }
135
                    }
-
 
136
                }
133
                return 0F;
137
                return null;
134
            }
138
            }
135
 
139
 
136
            @Override
140
            @Override
137
            public Set<FieldPath> getPaths() {
141
            public Set<FieldPath> getPaths() {
138
                Path p = new Path(eltCmd.getTable());
142
                Path p = new Path(eltCmd.getTable());
Line 148... Line 152...
148
            @Override
152
            @Override
149
            protected Object show_(SQLRowAccessor r) {
153
            protected Object show_(SQLRowAccessor r) {
150
 
154
 
151
                final SQLRowAccessor foreign = r.getForeign("ID_ARTICLE");
155
                final SQLRowAccessor foreign = r.getForeign("ID_ARTICLE");
152
                if (foreign != null && !foreign.isUndefined()) {
156
                if (foreign != null && !foreign.isUndefined()) {
-
 
157
                    if (foreign.getBoolean("GESTION_STOCK")) {
-
 
158
 
153
                    SQLRowAccessor foreign2 = StockSQLElement.getStockFetched(r);
159
                        SQLRowAccessor foreign2 = StockSQLElement.getStockFetched(r);
154
                    if (foreign2 != null && !foreign2.isUndefined()) {
160
                        if (foreign2 != null && !foreign2.isUndefined()) {
155
                        return foreign2.getFloat("QTE_TH");
161
                            return foreign2.getFloat("QTE_TH");
156
                    }
162
                        }
157
                }
163
                    }
-
 
164
                }
158
                return 0F;
165
                return null;
159
            }
166
            }
160
 
167
 
161
            @Override
168
            @Override
162
            public Set<FieldPath> getPaths() {
169
            public Set<FieldPath> getPaths() {
163
                Path p = new Path(eltCmd.getTable());
170
                Path p = new Path(eltCmd.getTable());
Line 173... Line 180...
173
            @Override
180
            @Override
174
            protected Object show_(SQLRowAccessor r) {
181
            protected Object show_(SQLRowAccessor r) {
175
 
182
 
176
                final SQLRowAccessor foreign = r.getForeign("ID_ARTICLE");
183
                final SQLRowAccessor foreign = r.getForeign("ID_ARTICLE");
177
                if (foreign != null && !foreign.isUndefined()) {
184
                if (foreign != null && !foreign.isUndefined()) {
-
 
185
                    if (foreign.getBoolean("GESTION_STOCK")) {
-
 
186
 
178
                    SQLRowAccessor foreign2 = StockSQLElement.getStockFetched(r);
187
                        SQLRowAccessor foreign2 = StockSQLElement.getStockFetched(r);
179
                    if (foreign2 != null && !foreign2.isUndefined()) {
188
                        if (foreign2 != null && !foreign2.isUndefined()) {
180
                        return foreign2.getFloat("QTE_MIN");
189
                            return foreign2.getFloat("QTE_MIN");
181
                    }
190
                        }
182
                }
191
                    }
-
 
192
                }
183
                return 0F;
193
                return null;
184
            }
194
            }
185
 
195
 
186
            @Override
196
            @Override
187
            public Set<FieldPath> getPaths() {
197
            public Set<FieldPath> getPaths() {
188
                Path p = new Path(eltCmd.getTable());
198
                Path p = new Path(eltCmd.getTable());
Line 198... Line 208...
198
            @Override
208
            @Override
199
            protected Object show_(SQLRowAccessor r) {
209
            protected Object show_(SQLRowAccessor r) {
200
 
210
 
201
                final SQLRowAccessor foreign = r.getForeign("ID_ARTICLE");
211
                final SQLRowAccessor foreign = r.getForeign("ID_ARTICLE");
202
                if (foreign != null && !foreign.isUndefined()) {
212
                if (foreign != null && !foreign.isUndefined()) {
-
 
213
                    if (foreign.getBoolean("GESTION_STOCK")) {
-
 
214
 
203
                    SQLRowAccessor foreign2 = StockSQLElement.getStockFetched(r);
215
                        SQLRowAccessor foreign2 = StockSQLElement.getStockFetched(r);
204
                    if (foreign2 != null && !foreign2.isUndefined()) {
216
                        if (foreign2 != null && !foreign2.isUndefined()) {
205
                        float qteMin = foreign2.getFloat("QTE_MIN");
217
                            float qteMin = foreign2.getFloat("QTE_MIN");
206
                        float manque = foreign2.getFloat("QTE_TH") - qteMin;
218
                            float manque = foreign2.getFloat("QTE_TH") - qteMin;
207
                        if (manque < 0) {
219
                            if (manque < 0) {
208
                            return -manque;
220
                                return -manque;
-
 
221
                            } else {
-
 
222
                                return 0f;
-
 
223
                            }
209
                        }
224
                        }
210
                    }
225
                    }
211
                }
226
                }
212
                return 0F;
227
                return r.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(r.getInt("QTE"))).floatValue();
213
 
228
 
214
            }
229
            }
215
 
230
 
216
            @Override
231
            @Override
217
            public Set<FieldPath> getPaths() {
232
            public Set<FieldPath> getPaths() {
Line 220... Line 235...
220
                Path p2 = p.add(p.getLast().getTable("STOCK").getField("ID_ARTICLE"));
235
                Path p2 = p.add(p.getLast().getTable("STOCK").getField("ID_ARTICLE"));
221
                return CollectionUtils.createSet(new FieldPath(p, "ID_DEPOT_STOCK"), new FieldPath(p2, "QTE_TH"), new FieldPath(p2, "QTE_MIN"), new FieldPath(p2, "ID_DEPOT_STOCK"));
236
                return CollectionUtils.createSet(new FieldPath(p, "ID_DEPOT_STOCK"), new FieldPath(p2, "QTE_TH"), new FieldPath(p2, "QTE_MIN"), new FieldPath(p2, "ID_DEPOT_STOCK"));
222
            }
237
            }
223
        };
238
        };
224
        tableSource.getColumns().add(colSug);
239
        tableSource.getColumns().add(colSug);
225
        // colLiv2.setRenderer(new PercentTableCellRenderer());
240
        colSug.setRenderer(new QteAcommanderRenderer());
226
 
241
 
227
        return tableSource;
242
        return tableSource;
228
    }
243
    }
229
 
244
 
230
    private BigDecimal getAvancementLFromBL(SQLRowAccessor r) {
245
    private BigDecimal getAvancementLFromBL(SQLRowAccessor r) {
Line 312... Line 327...
312
                final PredicateRowAction predicateACtion = new PredicateRowAction(new AbstractAction("Passer une commande fournisseur") {
327
                final PredicateRowAction predicateACtion = new PredicateRowAction(new AbstractAction("Passer une commande fournisseur") {
313
 
328
 
314
                    @Override
329
                    @Override
315
                    public void actionPerformed(ActionEvent e) {
330
                    public void actionPerformed(ActionEvent e) {
316
                        List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows();
331
                        List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows();
317
                        eltCmd.createCommandeF(selectedRows);
332
                        eltCmd.transfertCommande(selectedRows);
318
                    }
333
                    }
319
                }, true);
334
                }, true);
320
                predicateACtion.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
335
                predicateACtion.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
321
                listeArt.addIListeAction(predicateACtion);
336
                listeArt.addIListeAction(predicateACtion);
322
                ListeViewPanel p = new ListeViewPanel(artElt, listeArt);
337
                ListeViewPanel p = new ListeViewPanel(artElt, listeArt);