29 lines
742 B
PHP
29 lines
742 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Inventory\Application\DTOs;
|
|
|
|
/**
|
|
* An item's balance (in thousandths) and book value (in cents) at the end
|
|
* of a day: the sums of its movements up to the day, each at its own cost.
|
|
*/
|
|
final readonly class StockValueEntry
|
|
{
|
|
public function __construct(
|
|
public int $itemId,
|
|
public string $itemName,
|
|
public string $groupName,
|
|
public string $unit,
|
|
public int $balanceMilli,
|
|
public int $valueCents,
|
|
public ?int $reorderLevelMilli,
|
|
public bool $isActive,
|
|
) {}
|
|
|
|
public function needsReorder(): bool
|
|
{
|
|
return $this->reorderLevelMilli !== null && $this->balanceMilli <= $this->reorderLevelMilli;
|
|
}
|
|
}
|