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,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Inventory\Application\DTOs;
|
||||
|
||||
use App\Modules\Inventory\Domain\Enums\StockMovementKind;
|
||||
|
||||
/**
|
||||
* A stock movement in an item's history: signed quantity and the balance
|
||||
* after it (in thousandths), its value in cents, when and by whom, and
|
||||
* what it was for. $recordedAt is "Y-m-d H:i" in the company's time zone.
|
||||
*/
|
||||
final readonly class StockMovementSummary
|
||||
{
|
||||
public function __construct(
|
||||
public int $id,
|
||||
public int $itemId,
|
||||
public StockMovementKind $kind,
|
||||
public int $quantityMilli,
|
||||
public int $balanceAfterMilli,
|
||||
public int $valueCents,
|
||||
public string $occurredOn,
|
||||
public string $recordedAt,
|
||||
public int $userId,
|
||||
public string $userName,
|
||||
public ?int $taskId,
|
||||
public ?int $jobId,
|
||||
public ?int $machineId,
|
||||
public ?int $orderLineId,
|
||||
public ?int $maintenanceRecordId,
|
||||
public ?int $inventoryCountId,
|
||||
public ?string $reason,
|
||||
public ?string $supplier,
|
||||
public ?string $documentNumber,
|
||||
public ?int $reversesMovementId,
|
||||
public ?int $reversedByMovementId,
|
||||
) {}
|
||||
|
||||
public function canBeReversed(): bool
|
||||
{
|
||||
return $this->reversedByMovementId === null
|
||||
&& $this->kind !== StockMovementKind::Reversal
|
||||
&& $this->kind !== StockMovementKind::Adjustment;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user