Skip to content

Commit

Permalink
Merge branch 'Release-8.1-SNAPSHOT' into develop
Browse files Browse the repository at this point in the history
* Release-8.1-SNAPSHOT:
  Test fixed.
  • Loading branch information
kreinhard committed Jan 13, 2025
2 parents c4ffcb1 + ff32fd4 commit b3dfe80
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ package org.projectforge.business.fibu

import com.fasterxml.jackson.annotation.JsonIgnore
import mu.KotlinLogging
import org.projectforge.common.extensions.isZeroOrNull
import org.projectforge.framework.ToStringUtil
import org.projectforge.framework.time.PFDay
import org.projectforge.framework.utils.NumberHelper
Expand Down Expand Up @@ -240,7 +239,6 @@ class ForecastOrderPosInfo(
if (isUnderBudgetWarning(budget = probabilityNetSum, unused = monthEntry.lostBudget)) {
monthEntry.lostBudgetWarning = true
}
difference = monthEntry.lostBudget.negate()
}
}
if (value.abs() > BigDecimal.ONE) { // values < 0 are possible for Abrufaufträge (Sarah fragen, 4273)
Expand All @@ -254,9 +252,7 @@ class ForecastOrderPosInfo(
if (futureInvoicesAmountRest.abs() <= BigDecimal.ONE) { // Only differences greater than 1 Euro
futureInvoicesAmountRest = BigDecimal.ZERO
}
if (difference.isZeroOrNull()) {
difference = futureInvoicesAmountRest.negate()
}
difference = futureInvoicesAmountRest.negate()
}

/**
Expand Down Expand Up @@ -299,7 +295,8 @@ class ForecastOrderPosInfo(

companion object {
const val PERCENTAGE_OF_LOST_BUDGET_WARNING = 10
private val PERCENTAGE_OF_LOST_BUDGET_WARNING_BD = BigDecimal(PERCENTAGE_OF_LOST_BUDGET_WARNING).divide(NumberHelper.HUNDRED)
private val PERCENTAGE_OF_LOST_BUDGET_WARNING_BD =
BigDecimal(PERCENTAGE_OF_LOST_BUDGET_WARNING).divide(NumberHelper.HUNDRED)

/**
* If true, unused budget will be added to the last distributed month.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class ForecastOrderPosInfoTest {
PeriodOfPerformanceType.OWN,
periodOfPerformanceBegin = LocalDate.of(2024, Month.NOVEMBER, 13),
periodOfPerformanceEnd = LocalDate.of(2025, Month.MARCH, 31),
netSum = BigDecimal("69456.24"),
invoicedSum = BigDecimal("6924.95")
netSum = BigDecimal("50000"), // 5 month
invoicedSum = BigDecimal("5000")
).also { pos ->
ForecastOrderPosInfo(orderInfo, pos, baseDate = baseDate).also { fcPosInfo ->
fcPosInfo.calculate()
Expand All @@ -53,15 +53,15 @@ class ForecastOrderPosInfoTest {
}
if (ForecastOrderPosInfo.DISTRIBUTE_UNUSED_BUDGET) {
for (i in 2..4) {
assertSame("13891.25", fcPosInfo.months[i].toBeInvoicedSum)
assertSame("10000", fcPosInfo.months[i].toBeInvoicedSum)
}
assertSame("20857.54", fcPosInfo.months[5].toBeInvoicedSum)
assertSame("15000", fcPosInfo.months[5].toBeInvoicedSum)
Assertions.assertEquals(BigDecimal.ZERO, fcPosInfo.difference)
} else {
for (i in 2..5) {
assertSame("13891.25", fcPosInfo.months[i].toBeInvoicedSum)
assertSame("10000", fcPosInfo.months[i].toBeInvoicedSum)
}
assertSame("-6966.29", fcPosInfo.difference)
assertSame("-5000", fcPosInfo.difference)
}
}
}
Expand Down

0 comments on commit b3dfe80

Please sign in to comment.