Clarify stock forecast warning reason
This commit is contained in:
1 parent
b406ad3b10
commit
f00af08ec4
1 file changed
+9
-3
@@ -231,10 +231,16 @@ function auth_render_lager_table(string $title, array $rows, array $columns, str
|
|||||||
if ($forecastDate !== null && $forecastDate !== '') {
|
if ($forecastDate !== null && $forecastDate !== '') {
|
||||||
$forecastDateObject = new DateTimeImmutable((string) $forecastDate);
|
$forecastDateObject = new DateTimeImmutable((string) $forecastDate);
|
||||||
$forecastText = $forecastDateObject->format('d.m.Y');
|
$forecastText = $forecastDateObject->format('d.m.Y');
|
||||||
$forecastWarning = $forecastStatus === 'depleted';
|
if ($forecastStatus === 'depleted') {
|
||||||
if (!$forecastWarning && !empty($row['expiry_date'])) {
|
$forecastWarning = true;
|
||||||
|
$forecastText .= ' (CHARGE ENDE)';
|
||||||
|
} elseif (!empty($row['expiry_date'])) {
|
||||||
$expiryDate = new DateTimeImmutable((string) $row['expiry_date']);
|
$expiryDate = new DateTimeImmutable((string) $row['expiry_date']);
|
||||||
$forecastWarning = $forecastDateObject >= $expiryDate->modify('-3 months');
|
$forecastWarning = $forecastDateObject >= $expiryDate->modify('-3 months')
|
||||||
|
&& $forecastDateObject <= $expiryDate;
|
||||||
|
if ($forecastWarning) {
|
||||||
|
$forecastText .= ' (MHD: ' . $expiryDate->format('d.m.Y') . ')';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$forecastText = 'Keine Prognose';
|
$forecastText = 'Keine Prognose';
|
||||||
|
|||||||
Reference in new issue
Block a user