Skip to content

Commit

Permalink
[26486] billing change amount validated also add fractions
Browse files Browse the repository at this point in the history
  • Loading branch information
huthomas committed Jan 15, 2025
1 parent f4e6e85 commit e85ae54
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,9 @@ public IStatus changeAmountValidated(IBilled billed, double newAmount) {
double difference = newAmount - oldAmount;
if (difference > 0) {
IBillable billable = billed.getBillable();
for (int i = 0; i < difference; i++) {
double fractions = difference % 1;
int differenceInt = (int) difference;
for (int i = 0; i < differenceInt; i++) {
Result<IBilled> result = bill(billable, encounter, 1.0);
if (bAllowOverrideStrict) {
if (ret.isOK() && !result.isOK()) {
Expand All @@ -336,6 +338,20 @@ public IStatus changeAmountValidated(IBilled billed, double newAmount) {
return new Status(Status.ERROR, "ch.elexis.core.services", message);
}
}
if (fractions > 0.0) {
Result<IBilled> result = bill(billable, encounter, fractions);
if (bAllowOverrideStrict) {
if (ret.isOK() && !result.isOK()) {
String message = result.getMessages().stream().map(m -> m.getText())
.collect(Collectors.joining(", "));
ret = new Status(Status.WARNING, "ch.elexis.core.services", message);
}
} else if (!result.isOK()) {
String message = result.getMessages().stream().map(m -> m.getText())
.collect(Collectors.joining(", "));
return new Status(Status.ERROR, "ch.elexis.core.services", message);
}
}
} else if (difference < 0) {
changeAmount(billed, newAmount);
}
Expand Down

0 comments on commit e85ae54

Please sign in to comment.