Add the profitability report and the internal hourly cost

Profitability by job and service unit from a period's hours, expenses
and the created billing materials of its months. Hours are costed at one
internal hourly cost, set on the price list maintenance page; a job of
several service units is shared evenly between them.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-25 08:50:30 +02:00
co-authored by Claude Sonnet 5.5
parent 8079c272d2
commit 8aa62c8e02
31 changed files with 1110 additions and 1 deletions
@@ -182,6 +182,27 @@ it('saves the mileage rate', function () {
->assertHasErrors(['mileageRate']);
});
it('saves and removes the internal hourly cost', function () {
Livewire::test('catalog::prices')
->set('internalHourlyCost', '45')
->call('saveInternalHourlyCost')
->assertHasNoErrors()
->assertSet('statusMessage', "Tuntikustannus 45,00\u{00A0}€ tallennettu.");
expect(app(PriceListQueries::class)->internalHourlyCostCents())->toBe(4500);
Livewire::test('catalog::prices')
->assertSet('internalHourlyCost', '45,00')
->set('internalHourlyCost', 'abc')
->call('saveInternalHourlyCost')
->assertHasErrors(['internalHourlyCost'])
->set('internalHourlyCost', '')
->call('saveInternalHourlyCost')
->assertSet('statusMessage', 'Tuntikustannus poistettu.');
expect(app(PriceListQueries::class)->internalHourlyCostCents())->toBeNull();
});
it('manages VAT rates and keeps one default', function () {
$general = VatRateModel::query()->where('is_default', true)->sole();