OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 151 Rev 156
Line 251... Line 251...
251
                        columnDateEnvoi.setCellRenderer(new DateEnvoiRenderer());
251
                        columnDateEnvoi.setCellRenderer(new DateEnvoiRenderer());
252
                    }
252
                    }
253
                });
253
                });
254
 
254
 
255
                dateEnvoiCol.setEditable(true);
255
                dateEnvoiCol.setEditable(true);
-
 
256
 
-
 
257
                final BaseSQLTableModelColumn colAvancementLiv = new BaseSQLTableModelColumn("Livraison", BigDecimal.class) {
-
 
258
 
-
 
259
                    @Override
-
 
260
                    protected Object show_(SQLRowAccessor r) {
-
 
261
 
-
 
262
                        return getAvancementLFromBL(r);
-
 
263
                    }
-
 
264
 
-
 
265
                    @Override
-
 
266
                    public Set<FieldPath> getPaths() {
-
 
267
                        final Path p = new PathBuilder(eltDevis.getTable()).addTable("DEVIS_ELEMENT").build();
-
 
268
                        return CollectionUtils.createSet(new FieldPath(p, "ID_ARTICLE"), new FieldPath(p, "PV_HT"), new FieldPath(p, "QTE_LIVREE"), new FieldPath(p, "QTE"),
-
 
269
                                new FieldPath(p, "QTE_UNITAIRE"), new FieldPath(p, "LIVRE_FORCED"), new FieldPath(p, "LIVRE"));
-
 
270
                    }
-
 
271
                };
-
 
272
                lAttente.getColumns().add(colAvancementLiv);
-
 
273
                colAvancementLiv.setRenderer(new PercentTableCellRenderer());
-
 
274
 
256
                final BaseSQLTableModelColumn colAvancementCmd = new BaseSQLTableModelColumn("Commande", BigDecimal.class) {
275
                final BaseSQLTableModelColumn colAvancementCmd = new BaseSQLTableModelColumn("Commande", BigDecimal.class) {
257
 
276
 
258
                    @Override
277
                    @Override
259
                    protected Object show_(SQLRowAccessor r) {
278
                    protected Object show_(SQLRowAccessor r) {
260
 
279
 
Line 418... Line 437...
418
 
437
 
419
        pane.setOpaque(false);
438
        pane.setOpaque(false);
420
        return pane;
439
        return pane;
421
    }
440
    }
422
 
441
 
-
 
442
    private BigDecimal getAvancementLFromBL(SQLRowAccessor r) {
-
 
443
        Collection<? extends SQLRowAccessor> rows = r.getReferentRows(r.getTable().getTable("DEVIS_ELEMENT"));
-
 
444
        BigDecimal totalQte = BigDecimal.ZERO;
-
 
445
        BigDecimal totalQteL = BigDecimal.ZERO;
-
 
446
        for (SQLRowAccessor row : rows) {
-
 
447
            BigDecimal qte = row.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(row.getInt("QTE")));
-
 
448
            // On ne prend en compte que les articles ou les lignes différentes de 0
-
 
449
            if (!row.isForeignEmpty("ID_ARTICLE") || row.getBigDecimal("PV_HT").signum() != 0) {
-
 
450
                totalQte = totalQte.add(qte);
-
 
451
                if (row.getBoolean("LIVRE_FORCED") || row.getBoolean("LIVRE")) {
-
 
452
                    totalQteL = totalQteL.add(qte);
-
 
453
                } else if (row.getBigDecimal("QTE_LIVREE") != null) {
-
 
454
                    final BigDecimal qteLivree = row.getBigDecimal("QTE_LIVREE");
-
 
455
                    if (qteLivree != null) {
-
 
456
                        totalQteL = totalQteL.add(qteLivree);
-
 
457
                    }
-
 
458
                }
-
 
459
            }
-
 
460
        }
-
 
461
        if (totalQte.signum() != 0) {
-
 
462
            return totalQteL.divide(totalQte, DecimalUtils.HIGH_PRECISION).movePointRight(2).setScale(2, RoundingMode.HALF_UP);
-
 
463
        } else {
-
 
464
            return BigDecimal.ONE.movePointRight(2);
-
 
465
        }
-
 
466
    }
-
 
467
 
423
    public Map<Integer, ListeAddPanel> getListePanel() {
468
    public Map<Integer, ListeAddPanel> getListePanel() {
424
        return this.map;
469
        return this.map;
425
    }
470
    }
426
}
471
}