Add stock items, groups and movements at a moving average cost
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Inventory\Application\DTOs;
|
||||
|
||||
use App\Modules\Inventory\Domain\Enums\StockUnit;
|
||||
|
||||
/**
|
||||
* A stock item with its balance (in thousandths), moving average cost (in
|
||||
* hundredths of a cent per unit) and stock value (in cents). Costs and
|
||||
* values are shown only to those who may see them.
|
||||
*/
|
||||
final readonly class StockItemSummary
|
||||
{
|
||||
public function __construct(
|
||||
public int $id,
|
||||
public int $groupId,
|
||||
public string $groupName,
|
||||
public string $name,
|
||||
public StockUnit $unit,
|
||||
public ?string $code,
|
||||
public ?string $supplier,
|
||||
public ?int $reorderLevelMilli,
|
||||
public int $balanceMilli,
|
||||
public int $averageCostHundredths,
|
||||
public int $valueCents,
|
||||
public bool $hasImage,
|
||||
public bool $isActive,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* At or below the reorder level: to be ordered (tilattava).
|
||||
*/
|
||||
public function needsReorder(): bool
|
||||
{
|
||||
return $this->reorderLevelMilli !== null && $this->balanceMilli <= $this->reorderLevelMilli;
|
||||
}
|
||||
|
||||
public function isNegative(): bool
|
||||
{
|
||||
return $this->balanceMilli < 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user