OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 174 Rev 177
Line 370... Line 370...
370
 
370
 
371
                while (index > 0) {
371
                while (index > 0) {
372
 
372
 
373
                    BigDecimal prixUnitHT = BigDecimal.ZERO;
373
                    BigDecimal prixUnitHT = BigDecimal.ZERO;
374
                    BigDecimal prixUnitHA = BigDecimal.ZERO;
374
                    BigDecimal prixUnitHA = BigDecimal.ZERO;
-
 
375
                    BigDecimal prixUnitEco = BigDecimal.ZERO;
375
 
376
 
376
                    boolean update = false;
377
                    boolean update = false;
377
                    int indexToUpdate = index;
378
                    int indexToUpdate = index;
378
                    // Calcul du sous total
379
                    // Calcul du sous total
379
                    for (int i = index; i >= 0; i--) {
380
                    for (int i = index; i >= 0; i--) {
Line 389... Line 390...
389
                            } else if (niveauCourant == niveau) {
390
                            } else if (niveauCourant == niveau) {
390
                                update = true;
391
                                update = true;
391
                                // Cumul des valeurs
392
                                // Cumul des valeurs
392
                                prixUnitHT = prixUnitHT.add(rowVals.getBigDecimal("PV_HT").multiply(new BigDecimal(rowVals.getInt("QTE"))).multiply(rowVals.getBigDecimal("QTE_UNITAIRE")));
393
                                prixUnitHT = prixUnitHT.add(rowVals.getBigDecimal("PV_HT").multiply(new BigDecimal(rowVals.getInt("QTE"))).multiply(rowVals.getBigDecimal("QTE_UNITAIRE")));
393
                                prixUnitHA = prixUnitHA.add(rowVals.getBigDecimal("PA_HT").multiply(new BigDecimal(rowVals.getInt("QTE"))).multiply(rowVals.getBigDecimal("QTE_UNITAIRE")));
394
                                prixUnitHA = prixUnitHA.add(rowVals.getBigDecimal("PA_HT").multiply(new BigDecimal(rowVals.getInt("QTE"))).multiply(rowVals.getBigDecimal("QTE_UNITAIRE")));
-
 
395
                                BigDecimal eco = rowVals.getBigDecimal("ECO_CONTRIBUTION");
-
 
396
                                if (eco != null) {
-
 
397
                                    prixUnitEco = prixUnitEco.add(eco.multiply(new BigDecimal(rowVals.getInt("QTE"))).multiply(rowVals.getBigDecimal("QTE_UNITAIRE")));
-
 
398
                                }
394
                            }
399
                            }
395
                        }
400
                        }
396
                    }
401
                    }
397
                    if (update) {
402
                    if (update) {
398
                        final int columnForFieldHA = this.model.getColumnForField("PRIX_METRIQUE_HA_1");
403
                        final int columnForFieldHA = this.model.getColumnForField("PRIX_METRIQUE_HA_1");
Line 402... Line 407...
402
 
407
 
403
                        final int columnForFieldPVht1 = this.model.getColumnForField("PRIX_METRIQUE_VT_1");
408
                        final int columnForFieldPVht1 = this.model.getColumnForField("PRIX_METRIQUE_VT_1");
404
                        if (columnForFieldPVht1 >= 0) {
409
                        if (columnForFieldPVht1 >= 0) {
405
                            this.model.setValueAt(prixUnitHT, indexToUpdate, columnForFieldPVht1);
410
                            this.model.setValueAt(prixUnitHT, indexToUpdate, columnForFieldPVht1);
406
                        }
411
                        }
-
 
412
                        final int columnForFieldEco = this.model.getColumnForField("ECO_CONTRIBUTION");
-
 
413
                        if (columnForFieldEco >= 0) {
-
 
414
                            this.model.setValueAt(prixUnitEco, indexToUpdate, columnForFieldEco);
-
 
415
                        }
407
                    }
416
                    }
408
                    index = indexToUpdate - 1;
417
                    index = indexToUpdate - 1;
409
                }
418
                }
410
            }
419
            }
411
        }
420
        }