Add the billing material with drafts, combined invoices and billed marks
Management builds the monthly billing material (laskuaineisto) as a draft: done jobs are added as invoices of their own, combined when the customer, billing unit and reference allow it, and their billable hours are set per work type. Creating the material checks the jobs again, marks the approved hours and billable expenses billed, forms invoice lines with price and VAT snapshots and moves the jobs to "Lasku luotu". Fixed price jobs bill their quoted amount once. Billed hours keep their approval and billed expenses can no longer change. The Fennoa export and monthly fee lines come later. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Billing\Application\Contracts;
|
||||
|
||||
use App\Modules\Billing\Application\DTOs\BillableExpense;
|
||||
|
||||
/**
|
||||
* The jobs' billable expenses, from the Expenses module.
|
||||
*/
|
||||
interface BillingExpenses
|
||||
{
|
||||
/**
|
||||
* Billable, unbilled expenses, oldest first.
|
||||
*
|
||||
* @param list<int> $jobIds
|
||||
* @return array<int, list<BillableExpense>> Keyed by job id, every job included.
|
||||
*/
|
||||
public function forJobs(array $jobIds): array;
|
||||
|
||||
/**
|
||||
* Marks the job's billable, unbilled expenses billed.
|
||||
*
|
||||
* @return list<int> Ids of the expenses marked.
|
||||
*/
|
||||
public function markBilled(int $jobId, int $billingExportId): array;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Billing\Application\Contracts;
|
||||
|
||||
use App\Modules\Billing\Application\DTOs\JobHours;
|
||||
|
||||
/**
|
||||
* The jobs' hours for billing, from the TimeTracking module.
|
||||
*/
|
||||
interface BillingHours
|
||||
{
|
||||
/**
|
||||
* @param list<int> $jobIds
|
||||
* @return array<int, JobHours> Keyed by job id, every job included.
|
||||
*/
|
||||
public function forJobs(array $jobIds): array;
|
||||
|
||||
/**
|
||||
* Marks the job's approved, unbilled hours billed.
|
||||
*
|
||||
* @return array<int, int> The quarters marked, keyed by work type id.
|
||||
*/
|
||||
public function markBilled(int $jobId, int $billingExportId): array;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Billing\Application\Contracts;
|
||||
|
||||
use App\Modules\Billing\Application\DTOs\BillableJob;
|
||||
|
||||
/**
|
||||
* Customer jobs for billing, from the Jobs and Customers modules.
|
||||
*/
|
||||
interface BillingJobs
|
||||
{
|
||||
/**
|
||||
* Done jobs, by job number.
|
||||
*
|
||||
* @return list<BillableJob>
|
||||
*/
|
||||
public function done(): array;
|
||||
|
||||
/**
|
||||
* @param list<int> $jobIds
|
||||
* @return array<int, BillableJob> Keyed by id; unknown ids are left out.
|
||||
*/
|
||||
public function find(array $jobIds): array;
|
||||
|
||||
/**
|
||||
* Moves the job to "Lasku luotu", recorded in its history.
|
||||
*/
|
||||
public function markInvoiced(int $jobId, int $actorUserId): void;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Billing\Application\Contracts;
|
||||
|
||||
use App\Modules\Billing\Application\DTOs\HourlyRate;
|
||||
|
||||
/**
|
||||
* Hourly rates and the VAT rate for billing, from the price list.
|
||||
*/
|
||||
interface BillingPrices
|
||||
{
|
||||
/**
|
||||
* @return array<int, HourlyRate> Keyed by work type id, inactive work types included.
|
||||
*/
|
||||
public function hourlyRates(): array;
|
||||
|
||||
/**
|
||||
* The default VAT rate in hundredths of a percent (2550 = 25,5 %).
|
||||
*/
|
||||
public function defaultVatBasisPoints(): int;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Billing\Application\Contracts;
|
||||
|
||||
use App\Modules\Billing\Application\DTOs\ExportSummary;
|
||||
|
||||
/**
|
||||
* Read side of billing materials for lists.
|
||||
*/
|
||||
interface BillingQueries
|
||||
{
|
||||
/**
|
||||
* Every billing material, newest first.
|
||||
*
|
||||
* @return list<ExportSummary>
|
||||
*/
|
||||
public function exports(): array;
|
||||
}
|
||||
Reference in New Issue
Block a user