added function to get chart data

This commit is contained in:
Werner Masik
2023-07-04 18:07:09 +02:00
parent 51d8a18565
commit 800b490c62
2 changed files with 21 additions and 2 deletions
@@ -1,6 +1,8 @@
<?php
namespace vertragsbestandteil;
use DateTimeImmutable;
/**
* Salary always depends on employment (Dienstverhältnis) and optionally on part of contract (Vetragsbestandteil)
*/
@@ -84,6 +86,21 @@ class Gehaltsbestandteil implements IValidation, \JsonSerializable
return $this->bis;
}
public function getVonDateTime()
{
return $this->toDateTime($this->von);
}
public function getBisDateTime()
{
return $this->toDateTime($this->bis);
}
protected function toDateTime($d) {
if ($d == null) return null;
return new DateTimeImmutable($d);
}
public function getAnmerkung()
{
return $this->anmerkung;
@@ -71,13 +71,14 @@ class Gehaltsbestandteil_model extends DB_Model implements IEncryption
$this->getEncryptedColumns());
}
public function getGBTChartDataByDV($dienstverhaeltnis_id)
public function getGBTChartDataByDV_old($dienstverhaeltnis_id)
{
$qry = "
WITH gbt as
(select von,bis,grundbetrag as grund_betrag_decrypted from hr.tbl_gehaltsbestandteil where dienstverhaeltnis_id=?)
select von,bis, (select sum(gbt.grund_betrag_decrypted) as sum_betrag from gbt where gbt.von<=gbtmeta.von and (gbt.bis is null or gbt.bis>=gbtmeta.von)
select von,bis, (select sum(gbt.grund_betrag_decrypted) as sum_betrag
from gbt where gbt.von<=gbtmeta.von and (gbt.bis is null or gbt.bis>=gbtmeta.von)
) as summe from gbt as gbtmeta order by von,bis
";
@@ -85,6 +86,7 @@ class Gehaltsbestandteil_model extends DB_Model implements IEncryption
array($dienstverhaeltnis_id),
$this->getEncryptedColumns());
}
public function getGehaltsbestandteile($dienstverhaeltnis_id, $stichtag=null, $includefuture=false)
{