Report stock usage and value, add material cost to profitability, document phase 5

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-26 17:24:07 +02:00
co-authored by Claude Sonnet 5.5
parent 38b8075a9c
commit 3207d0064a
34 changed files with 1145 additions and 24 deletions
@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace App\Modules\Reports\Application\DTOs;
/**
* The stock usage report: by item, group, machine and job, and in total.
*/
final readonly class StockUsageReportData
{
/**
* @param list<StockUsageRow> $items
* @param list<StockUsageRow> $groups
* @param list<StockUsageRow> $machines
* @param list<StockUsageRow> $jobs
*/
public function __construct(
public array $items,
public array $groups,
public array $machines,
public array $jobs,
public StockUsageRow $total,
) {}
}
@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace App\Modules\Reports\Application\DTOs;
/**
* Stock taken out in a period for one item, or a sum for a group, machine
* or job ($unit null for sums of different items): quantities in
* thousandths, values in cents, use, write-offs and stock count
* corrections apart.
*/
final readonly class StockUsageRow
{
public function __construct(
public string $label,
public ?string $group,
public ?string $unit,
public int $usedMilli,
public int $usedCents,
public int $writtenOffMilli,
public int $writtenOffCents,
public int $adjustedMilli,
public int $adjustedCents,
) {}
public function totalCents(): int
{
return $this->usedCents + $this->writtenOffCents + $this->adjustedCents;
}
}
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace App\Modules\Reports\Application\DTOs;
use App\Modules\Inventory\Application\DTOs\StockValueEntry;
/**
* The stock value report of a day: the items, their total value in cents
* and those to order.
*/
final readonly class StockValueReportData
{
/**
* @param list<StockValueEntry> $items
* @param list<StockValueEntry> $toOrder
*/
public function __construct(
public array $items,
public int $totalCents,
public array $toOrder,
) {}
}