From 800b490c620315da87ed8cb2d050f0c11526192d Mon Sep 17 00:00:00 2001 From: Werner Masik Date: Tue, 4 Jul 2023 18:07:09 +0200 Subject: [PATCH] added function to get chart data --- .../vertragsbestandteil/Gehaltsbestandteil.php | 17 +++++++++++++++++ .../Gehaltsbestandteil_model.php | 6 ++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php b/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php index f48a969c8..6964907f3 100644 --- a/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php +++ b/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php @@ -1,6 +1,8 @@ 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; diff --git a/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php b/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php index bb00345f2..f640e25d0 100644 --- a/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php +++ b/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php @@ -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) {