OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 94 Rev 174
Line 92... Line 92...
92
        frame.getPanel().add(datePanel, c);
92
        frame.getPanel().add(datePanel, c);
93
 
93
 
94
        return frame;
94
        return frame;
95
    }
95
    }
96
 
96
 
-
 
97
    private BigDecimal bigDecimal100 = new BigDecimal(100);
-
 
98
 
97
    private BigDecimal getAvancement(SQLRowAccessor r) {
99
    private BigDecimal getAvancement(SQLRowAccessor r) {
98
        Collection<? extends SQLRowAccessor> rows = r.getReferentRows(r.getTable().getTable("TR_BON_RECEPTION"));
100
        Collection<? extends SQLRowAccessor> rows = r.getReferentRows(r.getTable().getTable("TR_BON_RECEPTION"));
99
        long totalFact = 0;
101
        long totalFact = 0;
100
        long total = (r.getObject("TOTAL_HT") == null ? 0 : r.getLong("TOTAL_HT"));
102
        long total = (r.getObject("TOTAL_HT") == null ? 0 : r.getLong("TOTAL_HT"));
101
        for (SQLRowAccessor row : rows) {
103
        for (SQLRowAccessor row : rows) {
Line 104... Line 106...
104
                Long l = rowFact.getLong("T_HT");
106
                Long l = rowFact.getLong("T_HT");
105
                totalFact += l;
107
                totalFact += l;
106
            }
108
            }
107
        }
109
        }
108
        if (total > 0) {
110
        if (total > 0) {
109
            return new BigDecimal(totalFact).divide(new BigDecimal(total), DecimalUtils.HIGH_PRECISION).movePointRight(2).setScale(2, RoundingMode.HALF_UP);
111
            return this.bigDecimal100.min(new BigDecimal(totalFact).divide(new BigDecimal(total), DecimalUtils.HIGH_PRECISION).movePointRight(2).setScale(2, RoundingMode.HALF_UP));
110
        } else {
112
        } else {
111
            return BigDecimal.ONE.movePointRight(2);
113
            return BigDecimal.ONE.movePointRight(2);
112
        }
114
        }
113
    }
115
    }
114
 
116