36 lines
955 B
PHP
36 lines
955 B
PHP
<?php
|
|
|
|
|
|
namespace TorstenHettstedt\TimekeepingApi\Repositories;
|
|
|
|
|
|
use DateTime;
|
|
use DateTimeInterface;
|
|
use PDO;
|
|
use TorstenHettstedt\TimekeepingApi\Models\PeriodDesignationEnum;
|
|
|
|
class WorkingHoursMonthlyViewRepository extends AbstractWorkingHoursViewRepository
|
|
{
|
|
|
|
protected const string SQL_SELECT = <<<SQL
|
|
select
|
|
"Monat" as "period",
|
|
"Gesamtarbeitszeit" as "totalHours",
|
|
"Arbeitstage" as "workingDays",
|
|
"Home-Office-Tage" as "homeOfficeDays",
|
|
"Überstunden" as "overtime"
|
|
from "Arbeitszeiten - Monat"
|
|
SQL;
|
|
protected const string SQL_WHERE = ' where "Monat" = ?';
|
|
|
|
public function __construct(PDO $database)
|
|
{
|
|
parent::__construct($database);
|
|
$this->periodDesignation = PeriodDesignationEnum::MONTHLY;
|
|
}
|
|
|
|
protected function buildDateFromPeriod(string $period): DateTimeInterface
|
|
{
|
|
return new DateTime($period . '-01');
|
|
}
|
|
} |