Files
kimai2/src/Model/TimesheetStatistic.php
Kevin Papst baff2d78d9 prepare release 1.15 (#2707)
* bump version
* fix invisible class on labels
* fail safe removal of foreign key
* check if optional form field exists before accessing it
* silently ignore stopped timesheets
* prevent colliding parameter names
* make sure decimal duration is always rendered with two decimals
* simplify translation
* fix #2751 ANSI_QUOTES
* rename composer task
* fix billable statistic rates
* added missing translation for export
2021-09-17 00:58:25 +02:00

137 lines
3.0 KiB
PHP

<?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\Model;
use DateTime;
/**
* Timesheet statistics for one user.
*/
class TimesheetStatistic
{
/**
* @var \DateTime|null
*/
protected $firstEntry;
protected $durationThisMonth = 0;
protected $durationTotal = 0;
protected $amountThisMonth = 0.0;
protected $amountTotal = 0.0;
protected $amountThisMonthBillable = 0.0;
protected $amountTotalBillable = 0.0;
protected $recordsTotal = 0;
public function getDurationThisMonth(): int
{
return $this->durationThisMonth;
}
public function setDurationThisMonth(int $durationThisMonth): void
{
$this->durationThisMonth = $durationThisMonth;
}
/**
* This is actually the rate, wrong wording...
*
* @return float
*/
public function getAmountTotal(): float
{
return $this->amountTotal;
}
/**
* This is actually the rate, wrong wording...
*
* @param float|int $amountTotal
*/
public function setAmountTotal($amountTotal): void
{
$this->amountTotal = (float) $amountTotal;
}
public function getRateTotalBillable(): float
{
return $this->amountTotalBillable;
}
public function setRateTotalBillable(float $amountTotal): void
{
$this->amountTotalBillable = $amountTotal;
}
public function getDurationTotal(): int
{
return $this->durationTotal;
}
/**
* @param int $durationTotal
*/
public function setDurationTotal($durationTotal): void
{
$this->durationTotal = (int) $durationTotal;
}
/**
* This is actually the rate, wrong wording...
*
* @return float
*/
public function getAmountThisMonth(): float
{
return $this->amountThisMonth;
}
/**
* This is actually the rate, wrong wording...
*
* @param float|int $amountThisMonth
*/
public function setAmountThisMonth($amountThisMonth): void
{
$this->amountThisMonth = (float) $amountThisMonth;
}
public function getRateThisMonthBillable(): float
{
return $this->amountThisMonthBillable;
}
public function setRateThisMonthBillable(float $amountThisMonth): void
{
$this->amountThisMonthBillable = $amountThisMonth;
}
/**
* @deprecated since 1.15 use TimesheetStatisticService::findFirstRecordDate() instead, will be removed with 2.0
*/
public function getFirstEntry(): ?\DateTime
{
return $this->firstEntry;
}
public function setFirstEntry(DateTime $firstEntry): void
{
$this->firstEntry = $firstEntry;
}
public function getRecordsTotal(): int
{
return $this->recordsTotal;
}
public function setRecordsTotal(int $recordsTotal): void
{
$this->recordsTotal = $recordsTotal;
}
}