Count stock and correct the differences on confirmation
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Inventory\Application\DTOs;
|
||||
|
||||
use App\Modules\Inventory\Domain\Enums\StockUnit;
|
||||
|
||||
/**
|
||||
* An item on a stock count's list: its current balance and, once counted,
|
||||
* the counted quantity and the book balance at the moment of counting.
|
||||
* The unit cost is the one stored at confirmation, or the current average
|
||||
* cost while the count is open.
|
||||
*/
|
||||
final readonly class InventoryCountLine
|
||||
{
|
||||
public function __construct(
|
||||
public int $itemId,
|
||||
public string $itemName,
|
||||
public ?string $code,
|
||||
public int $groupId,
|
||||
public string $groupName,
|
||||
public StockUnit $unit,
|
||||
public int $currentBalanceMilli,
|
||||
public ?int $bookMilli,
|
||||
public ?int $countedMilli,
|
||||
public int $unitCostHundredths,
|
||||
public ?string $countedByName,
|
||||
public ?string $countedAt,
|
||||
) {}
|
||||
|
||||
public function isCounted(): bool
|
||||
{
|
||||
return $this->countedMilli !== null;
|
||||
}
|
||||
|
||||
public function differenceMilli(): ?int
|
||||
{
|
||||
return $this->countedMilli === null || $this->bookMilli === null ? null : $this->countedMilli - $this->bookMilli;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user