ItEr59S04ValidacionEProbasFuncionaisItEr58S04 : Fixing bug.
Fixes the rounding mode of the division to calculate the percentage of a advance.
This commit is contained in:
parent
3fb6c09763
commit
07482dd72d
2 changed files with 21 additions and 16 deletions
|
|
@ -868,23 +868,26 @@ public class ManageOrderElementAdvancesController extends
|
|||
Listitem listItem = (Listitem) editAdvances.getChildren().get(i);
|
||||
AdvanceAssignment advance = (AdvanceAssignment) listItem
|
||||
.getValue();
|
||||
if (advance.getAdvanceType() == null) {
|
||||
throw new WrongValueException(getComboboxTypeBy(listItem),
|
||||
if (advance != null) {
|
||||
if (advance.getAdvanceType() == null) {
|
||||
throw new WrongValueException(
|
||||
getComboboxTypeBy(listItem),
|
||||
_("Value is not valid, the type must be not empty"));
|
||||
}
|
||||
}
|
||||
|
||||
DirectAdvanceAssignment directAdvanceAssignment;
|
||||
if (advance instanceof IndirectAdvanceAssignment) {
|
||||
directAdvanceAssignment = manageOrderElementAdvancesModel
|
||||
DirectAdvanceAssignment directAdvanceAssignment;
|
||||
if (advance instanceof IndirectAdvanceAssignment) {
|
||||
directAdvanceAssignment = manageOrderElementAdvancesModel
|
||||
.calculateFakeDirectAdvanceAssignment((IndirectAdvanceAssignment) advance);
|
||||
} else {
|
||||
directAdvanceAssignment = (DirectAdvanceAssignment) advance;
|
||||
}
|
||||
if (directAdvanceAssignment != null
|
||||
} else {
|
||||
directAdvanceAssignment = (DirectAdvanceAssignment) advance;
|
||||
}
|
||||
if (directAdvanceAssignment != null
|
||||
&& directAdvanceAssignment.getMaxValue() == null) {
|
||||
throw new WrongValueException(
|
||||
getDecimalboxMaxValueBy(listItem),
|
||||
_("Value is not valid, the current value must be not empty"));
|
||||
throw new WrongValueException(
|
||||
getDecimalboxMaxValueBy(listItem),
|
||||
_("Value is not valid, the current value must be not empty"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -942,7 +945,8 @@ public class ManageOrderElementAdvancesController extends
|
|||
AdvanceAssignment advanceAssignment = (AdvanceAssignment) listItem
|
||||
.getValue();
|
||||
existItems = true;
|
||||
if (advanceAssignment.getReportGlobalAdvance()) {
|
||||
if ((advanceAssignment != null)
|
||||
&& (advanceAssignment.getReportGlobalAdvance())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -601,8 +601,9 @@ public class ManageOrderElementAdvancesModel implements
|
|||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
return value.setScale(2).divide(maxValue, RoundingMode.DOWN).multiply(
|
||||
new BigDecimal(100));
|
||||
BigDecimal division = value.divide(maxValue, 2, RoundingMode.DOWN);
|
||||
return (division.multiply(new BigDecimal(100))).setScale(0,
|
||||
RoundingMode.DOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue