added support for weekly invoices (#1780)
This commit is contained in:
32
src/Invoice/Calculator/WeeklyInvoiceCalculator.php
Normal file
32
src/Invoice/Calculator/WeeklyInvoiceCalculator.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Invoice\Calculator;
|
||||
|
||||
use App\Invoice\CalculatorInterface;
|
||||
use App\Invoice\InvoiceItemInterface;
|
||||
|
||||
/**
|
||||
* A calculator that sums up the invoice item records per week.
|
||||
*/
|
||||
class WeeklyInvoiceCalculator extends AbstractSumInvoiceCalculator implements CalculatorInterface
|
||||
{
|
||||
protected function calculateSumIdentifier(InvoiceItemInterface $invoiceItem): string
|
||||
{
|
||||
return $invoiceItem->getBegin()->format('W');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getId(): string
|
||||
{
|
||||
return 'weekly';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user