mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-09 18:04:33 +02:00
Show expired lot sum in parts table in parenthesis
This commit is contained in:
parent
1f6f39172f
commit
bd12185b44
2 changed files with 32 additions and 1 deletions
|
@ -193,6 +193,26 @@ trait InstockTrait
|
|||
return round($sum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the summed amount of all part lots that are expired. If no part lots are expired 0 is returned.
|
||||
* @return float
|
||||
*/
|
||||
public function getExpiredAmountSum(): float
|
||||
{
|
||||
$sum = 0.0;
|
||||
foreach ($this->getPartLots() as $lot) {
|
||||
if ($lot->isExpired() && !$lot->isInstockUnknown()) {
|
||||
$sum += $lot->getAmount();
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->useFloatAmount()) {
|
||||
return $sum;
|
||||
}
|
||||
|
||||
return round($sum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the minimum amount of parts that have to be instock.
|
||||
* See getPartUnit() for the associated unit.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue