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:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use App\Modules\Catalog\Infrastructure\Persistence\Eloquent\ServiceUnitModel;
|
||||
use App\Modules\Inventory\Infrastructure\Persistence\Eloquent\StockItemModel;
|
||||
use App\Modules\Inventory\Infrastructure\Persistence\Eloquent\StockMovementModel;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
$this->user = User::factory()->management()->create();
|
||||
$this->actingAs($this->user);
|
||||
ServiceUnitModel::query()->where('name', 'Painotuotanto')->update(['uses_stock' => true]);
|
||||
|
||||
$item = StockItemModel::factory()->create(['name' => 'Valokuvapaperi', 'unit' => 'sheet', 'reorder_level_milli' => 200_000]);
|
||||
foreach ([['purchase', 100_000, 5_000], ['consumption', -20_000, -1_000]] as [$kind, $milli, $value]) {
|
||||
StockMovementModel::query()->create([
|
||||
'stock_item_id' => $item->id, 'kind' => $kind, 'quantity_milli' => $milli, 'unit_cost_hundredths' => 5_000,
|
||||
'value_cents' => $value, 'occurred_on' => now()->toDateString(), 'recorded_at' => now(), 'user_id' => $this->user->id, 'reason' => 'Koeajo',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
it('has no accessibility issues on the stock reports', function (string $page, string $device, string $colorScheme) {
|
||||
$visit = visit(route('reports.'.$page));
|
||||
$visit = $device === 'mobile' ? $visit->on()->mobile() : $visit->on()->desktop();
|
||||
$visit = $colorScheme === 'dark' ? $visit->inDarkMode() : $visit->inLightMode();
|
||||
|
||||
$visit->assertSee('Valokuvapaperi')
|
||||
->assertNoJavaScriptErrors()
|
||||
->assertNoAccessibilityIssues(level: 2);
|
||||
})->with(['stock-usage', 'stock-value'])->with([
|
||||
'desktop, light' => ['desktop', 'light'],
|
||||
'desktop, dark' => ['desktop', 'dark'],
|
||||
'mobile, light' => ['mobile', 'light'],
|
||||
'mobile, dark' => ['mobile', 'dark'],
|
||||
]);
|
||||
Reference in New Issue
Block a user