model classes for contract parts (Vertragsbestandteile)

This commit is contained in:
Werner Masik
2023-01-21 13:51:59 +01:00
parent fd5ce62b0e
commit f7d315d4cc
18 changed files with 1117 additions and 18 deletions
@@ -0,0 +1,89 @@
<?php
namespace vertragsbestandteil;
use vertragsbestandteil\Vertragsbestandteil;
use vertragsbestandteil\VertragsbestandteilFactory;
class VertragsbestandteilBefristung extends Vertragsbestandteil
{
protected $befristet;
protected $befristet_bis;
public function __construct()
{
$this->setVertragsbestandteiltyp_kurzbz(
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_BEFRISTUNG);
}
public function hydrateByStdClass($data)
{
parent::hydrateByStdClass($data);
isset($data->befristet) && $this->setBefristet($data->befristet);
isset($data->befristet_bis) && $this->setBefristetBis($data->befristet_bis);
}
/**
* Get the value of befristet
*/
public function getBefristet()
{
return $this->befristet;
}
/**
* Set the value of befristet
*/
public function setBefristet($befristet): self
{
$this->befristet = $befristet;
return $this;
}
/**
* Get the value of befristet_bis
*/
public function getBefristetBis()
{
return $this->befristet_bis;
}
/**
* Set the value of befristet_bis
*/
public function setBefristetBis($befristet_bis): self
{
$this->befristet_bis = $befristet_bis;
return $this;
}
public function toStdClass(): \stdClass
{
$tmp = array(
'vertragsbestandteil_id' => $this->getVertragsbestandteil_id(),
'befristet' => $this->getBefristet(),
'befristet_bis' => $this->getBefristetBis()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
return (object) $tmp;
}
public function __toString()
{
$txt = <<<EOTXT
befristet: {$this->getBefristet()}
befristet_bis: {$this->getBefristetBis()}
EOTXT;
return parent::__toString() . $txt;
}
}
@@ -13,6 +13,15 @@ class VertragsbestandteilFactory
{
const VERTRAGSBESTANDTEIL_STUNDEN = 'stunden';
const VERTRAGSBESTANDTEIL_FUNKTION = 'funktion';
const VERTRAGSBESTANDTEIL_GEHALT = 'gehalt';
const VERTRAGSBESTANDTEIL_FREITEXT = 'freitext';
const VERTRAGSBESTANDTEIL_KARENZ = 'karenz';
const VERTRAGSBESTANDTEIL_BEFRISTUNG = 'befristung';
const VERTRAGSBESTANDTEIL_KUENDIGUNGSFRIST = 'kuendigungsfrist';
const VERTRAGSBESTANDTEIL_KV = 'kv';
const VERTRAGSBESTANDTEIL_URLAUBSANSPRUCH = 'urlaubsanspruch';
const VERTRAGSBESTANDTEIL_ZEITAUFZEICHNUNG = 'zeitaufzeichnung';
const VERTRAGSBESTANDTEIL_LEHRE = 'lehre';
public static function getVertragsbestandteil($data)
{
@@ -36,7 +45,12 @@ class VertragsbestandteilFactory
$vertragsbestandteil = new VertragsbestandteilFunktion();
$vertragsbestandteil->hydrateByStdClass($data);
break;
case self::VERTRAGSBESTANDTEIL_GEHALT:
$vertragsbestandteil = new VertragsbestandteilGehalt();
$vertragsbestandteil->hydrateByStdClass($data);
break;
default:
throw new Exception('Unknown vertragsbestandteiltyp_kurzbz '
. $vertragsbestandteiltyp_kurzbz);
@@ -63,6 +77,12 @@ class VertragsbestandteilFactory
'VertragsbestandteilFunktion_model');
$vertragsbestandteildbmodel = $CI->VertragsbestandteilFunktion_model;
break;
case self::VERTRAGSBESTANDTEIL_GEHALT:
$CI->load->model('vertragsbestandteil/VertragsbestandteilGehalt_model',
'VertragsbestandteilGehalt_model');
$vertragsbestandteildbmodel = $CI->VertragsbestandteilGehalt_model;
break;
default:
throw new Exception('Unknown vertragsbestandteil_kurzbz '
@@ -0,0 +1,107 @@
<?php
namespace vertragsbestandteil;
use vertragsbestandteil\Vertragsbestandteil;
use vertragsbestandteil\VertragsbestandteilFactory;
class VertragsbestandteilFreitext extends Vertragsbestandteil
{
protected $anmerkung;
protected $kuendigungrelevant;
protected $freitexttyp_kurzbz;
public function __construct()
{
$this->setVertragsbestandteiltyp_kurzbz(
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_FREITEXT);
}
public function hydrateByStdClass($data)
{
parent::hydrateByStdClass($data);
isset($data->anmerkung) && $this->setAnmerkung($data->anmerkung);
isset($data->kuendigungrelevant) && $this->setKuendigungrelevant($data->kuendigungrelevant);
isset($data->freitexttyp_kurzbz) && $this->setFreitexttypKurzbz($data->freitexttyp_kurzbz);
}
public function toStdClass(): \stdClass
{
$tmp = array(
'vertragsbestandteil_id' => $this->getVertragsbestandteil_id(),
'anmerkung' => $this->getAnmerkung(),
'kuendigungrelevant' => $this->getKuendigungrelevant(),
'freitexttyp_kurzbz' => $this->getFreitexttypKurzbz()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
return (object) $tmp;
}
public function __toString()
{
$txt = <<<EOTXT
anmerkung: {$this->getAnmerkung()}
kuendigungrelevant: {$this->getKuendigungrelevant()}
freitexttyp_kurzbz: {$this->getFreitexttypKurzbz()}
EOTXT;
return parent::__toString() . $txt;
}
/**
* Get the value of anmerkung
*/
public function getAnmerkung()
{
return $this->anmerkung;
}
/**
* Set the value of anmerkung
*/
public function setAnmerkung($anmerkung): self
{
$this->anmerkung = $anmerkung;
return $this;
}
/**
* Get the value of kuendigungrelevant
*/
public function getKuendigungrelevant()
{
return $this->kuendigungrelevant;
}
/**
* Set the value of kuendigungrelevant
*/
public function setKuendigungrelevant($kuendigungrelevant): self
{
$this->kuendigungrelevant = $kuendigungrelevant;
return $this;
}
/**
* Get the value of freitexttyp_kurzbz
*/
public function getFreitexttypKurzbz()
{
return $this->freitexttyp_kurzbz;
}
/**
* Set the value of freitexttyp_kurzbz
*/
public function setFreitexttypKurzbz($freitexttyp_kurzbz): self
{
$this->freitexttyp_kurzbz = $freitexttyp_kurzbz;
return $this;
}
}
@@ -0,0 +1,245 @@
<?php
namespace vertragsbestandteil;
use vertragsbestandteil\Vertragsbestandteil;
use vertragsbestandteil\VertragsbestandteilFactory;
/**
* Salary always depends on employment (Dienstverhältnis) and optionally on part of contract (Vetragsbestandteil)
*/
class VertragsbestandteilGehalt extends Vertragsbestandteil
{
protected $gehaltsbestandteil_id;
protected $gehalt_von;
protected $gehalt_bis;
protected $anmerkung;
protected $grundbetrag;
protected $betrag_valorisiert;
protected $valorisieren;
protected $gehalt_dienstverhaeltnis_id;
protected $gehaltstyp_kurzbz;
protected $valorisierungssperre;
public function __construct()
{
$this->setVertragsbestandteiltyp_kurzbz(
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_GEHALT);
}
public function hydrateByStdClass($data)
{
parent::hydrateByStdClass($data);
isset($data->gehalt_von) && $this->setGehaltVon($data->gehalt_von);
isset($data->gehalt_bis) && $this->setGehaltBis($data->gehalt_bis);
isset($data->anmerkung) && $this->setAnmerkung($data->anmerkung);
isset($data->gehalt_dienstverhaeltnis_id) && $this->setGehaltDienstverhaeltnisID($data->gehalt_dienstverhaeltnis_id);
isset($data->gehaltstyp_kurzbz) && $this->setGehaltstypKurzbz($data->gehaltstyp_kurzbz);
isset($data->valorisierungssperre) && $this->setValorisierungssperre($data->valorisierungssperre);
}
public function getGehaltVon()
{
return $this->gehalt_von;
}
public function getGehaltBis()
{
return $this->gehalt_bis;
}
public function setGehaltVon($von)
{
$this->gehalt_von = $von;
return $this;
}
public function setGehaltBis($bis)
{
$this->gehalt_bis = $bis;
return $this;
}
/**
* Get the value of gehaltsbestandteil_id
*/
public function getGehaltsbestandteilId()
{
return $this->gehaltsbestandteil_id;
}
/**
* Set the value of gehaltsbestandteil_id
*/
public function setGehaltsbestandteilId($gehaltsbestandteil_id): self
{
$this->gehaltsbestandteil_id = $gehaltsbestandteil_id;
return $this;
}
/**
* Get the value of anmerkung
*/
public function getAnmerkung()
{
return $this->anmerkung;
}
/**
* Set the value of anmerkung
*/
public function setAnmerkung($anmerkung): self
{
$this->anmerkung = $anmerkung;
return $this;
}
/**
* Get the value of grundbetrag
*/
public function getGrundbetrag()
{
return $this->grundbetrag;
}
/**
* Set the value of grundbetrag
*/
public function setGrundbetrag($grundbetrag): self
{
$this->grundbetrag = $grundbetrag;
return $this;
}
/**
* Get the value of betrag_valorisiert
*/
public function getBetragValorisiert()
{
return $this->betrag_valorisiert;
}
/**
* Set the value of betrag_valorisiert
*/
public function setBetragValorisiert($betrag_valorisiert): self
{
$this->betrag_valorisiert = $betrag_valorisiert;
return $this;
}
/**
* Get the value of valorisieren
*/
public function getValorisieren()
{
return $this->valorisieren;
}
/**
* Set the value of valorisieren
*/
public function setValorisieren($valorisieren): self
{
$this->valorisieren = $valorisieren;
return $this;
}
/**
* Get the value of dienstverhaeltnis_id
*/
public function getGehaltDienstverhaeltnisID()
{
return $this->gehalt_dienstverhaeltnis_id;
}
/**
* Set the value of dienstverhaeltnis_id
*/
public function setGehaltDienstverhaeltnisID($dienstverhaeltnis_id): self
{
$this->gehalt_dienstverhaeltnis_id = $dienstverhaeltnis_id;
return $this;
}
/**
* Get the value of gehaltstyp_kurzbz
*/
public function getGehaltstypKurzbz()
{
return $this->gehaltstyp_kurzbz;
}
/**
* Set the value of gehaltstyp_kurzbz
*/
public function setGehaltstypKurzbz($gehaltstyp_kurzbz): self
{
$this->gehaltstyp_kurzbz = $gehaltstyp_kurzbz;
return $this;
}
/**
* Get the value of valorisierungssperre
*/
public function getValorisierungssperre()
{
return $this->valorisierungssperre;
}
/**
* Set the value of valorisierungssperre
*/
public function setValorisierungssperre($valorisierungssperre): self
{
$this->valorisierungssperre = $valorisierungssperre;
return $this;
}
public function toStdClass(): \stdClass
{
$tmp = array(
'von' => $this->getVon(),
'bis' => $this->getBis(),
'gehalt_von' => $this->getGehaltVon(),
'gehalt_bis' => $this->getGehaltBis(),
'gehalt_dienstverhaeltnis_id' => $this->getGehaltDienstverhaeltnisID(),
'grundbetrag' => $this->getGrundbetrag(),
'betrag_valorisiert' => $this->getBetragValorisiert(),
'valorisieren' => $this->getValorisieren(),
'gehaltstyp_kurzbz' => $this->getGehaltstypKurzbz(),
'valorisierungssperre' => $this->getValorisierungssperre(),
'anmerkung' => $this->getAnmerkung()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
return (object) $tmp;
}
public function __toString()
{
$txt = <<<EOTXT
von: {$this->getVon()}
bis: {$this->getBis()}
grundbetrag: {$this->getGrundbetrag()}
valorisieren: {$this->getValorisieren()}
EOTXT;
return parent::__toString() . $txt;
}
}
@@ -0,0 +1,108 @@
<?php
namespace vertragsbestandteil;
use vertragsbestandteil\Vertragsbestandteil;
use vertragsbestandteil\VertragsbestandteilFactory;
class VertragsbestandteilKarenz extends Vertragsbestandteil
{
protected $karenztyp_kurzbz;
protected $geburtstermin;
protected $geburtstermin_geplant;
public function __construct()
{
$this->setVertragsbestandteiltyp_kurzbz(
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_KARENZ);
}
public function hydrateByStdClass($data)
{
parent::hydrateByStdClass($data);
isset($data->karenztyp_kurzbz) && $this->setKarenztypKurzbz($data->karenztyp_kurzbz);
isset($data->geburtstermin_geplant) && $this->setGeburtsterminGeplant($data->geburtstermin_geplant);
isset($data->geburtstermin) && $this->setGeburtstermin($data->geburtstermin);
}
/**
* Get the value of karenztyp_kurzbz
*/
public function getKarenztypKurzbz()
{
return $this->karenztyp_kurzbz;
}
/**
* Set the value of karenztyp_kurzbz
*/
public function setKarenztypKurzbz($karenztyp_kurzbz): self
{
$this->karenztyp_kurzbz = $karenztyp_kurzbz;
return $this;
}
/**
* Get the value of geburtstermin
*/
public function getGeburtstermin()
{
return $this->geburtstermin;
}
/**
* Set the value of geburtstermin
*/
public function setGeburtstermin($geburtstermin): self
{
$this->geburtstermin = $geburtstermin;
return $this;
}
/**
* Get the value of geburtstermin_geplant
*/
public function getGeburtsterminGeplant()
{
return $this->geburtstermin_geplant;
}
/**
* Set the value of geburtstermin_geplant
*/
public function setGeburtsterminGeplant($geburtstermin_geplant): self
{
$this->geburtstermin_geplant = $geburtstermin_geplant;
return $this;
}
public function toStdClass(): \stdClass
{
$tmp = array(
'karenztyp_kurzbz' => $this->getKarenztypKurzbz(),
'geburtstermin' => $this->getGeburtstermin(),
'geburtstermin_geplant' => $this->getGeburtsterminGeplant()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
return (object) $tmp;
}
public function __toString()
{
$txt = <<<EOTXT
karenztyp_kurzbz: {$this->getKarenztypKurzbz()}
geburtstermin: {$this->getGeburtstermin()}
geburtstermin_geplant: {$this->getGeburtsterminGeplant()}
EOTXT;
return parent::__toString() . $txt;
}
}
@@ -0,0 +1,87 @@
<?php
namespace vertragsbestandteil;
use vertragsbestandteil\Vertragsbestandteil;
use vertragsbestandteil\VertragsbestandteilFactory;
class VertragsbestandteilKuendigungsfrist extends Vertragsbestandteil
{
protected $arbeitgeber_frist;
protected $arbeitnehmer_frist;
public function __construct()
{
$this->setVertragsbestandteiltyp_kurzbz(
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_KUENDIGUNGSFRIST);
}
public function hydrateByStdClass($data)
{
parent::hydrateByStdClass($data);
isset($data->arbeitgeber_frist) && $this->setArbeitgeberFrist($data->arbeitgeber_frist);
isset($data->arbeitnehmer_frist) && $this->setArbeitnehmerFrist($data->arbeitnehmer_frist);
}
/**
* Get the value of arbeitgeber_frist
*/
public function getArbeitgeberFrist()
{
return $this->arbeitgeber_frist;
}
/**
* Set the value of arbeitgeber_frist
*/
public function setArbeitgeberFrist($arbeitgeber_frist): self
{
$this->arbeitgeber_frist = $arbeitgeber_frist;
return $this;
}
/**
* Get the value of arbeitnehmer_frist
*/
public function getArbeitnehmerFrist()
{
return $this->arbeitnehmer_frist;
}
/**
* Set the value of arbeitnehmer_frist
*/
public function setArbeitnehmerFrist($arbeitnehmer_frist): self
{
$this->arbeitnehmer_frist = $arbeitnehmer_frist;
return $this;
}
public function toStdClass(): \stdClass
{
$tmp = array(
'vertragsbestandteil_id' => $this->getVertragsbestandteil_id(),
'arbeitgeber_frist' => $this->getArbeitgeberFrist(),
'arbeitnehmer_frist' => $this->getArbeitnehmerFrist()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
return (object) $tmp;
}
public function __toString()
{
$txt = <<<EOTXT
arbeitgeber_frist: {$this->getArbeitgeberFrist()}
arbeitnehmer_frist: {$this->getArbeitnehmerFrist()}
EOTXT;
return parent::__toString() . $txt;
}
}
@@ -0,0 +1,65 @@
<?php
namespace vertragsbestandteil;
use vertragsbestandteil\Vertragsbestandteil;
use vertragsbestandteil\VertragsbestandteilFactory;
class VertragsbestandteilLehre extends Vertragsbestandteil
{
protected $inkludierte_lehre;
public function __construct()
{
$this->setVertragsbestandteiltyp_kurzbz(
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_LEHRE);
}
public function hydrateByStdClass($data)
{
parent::hydrateByStdClass($data);
isset($data->inkludierte_lehre) && $this->setInkludierteLehre($data->inkludierte_lehre);
}
/**
* Get the value of inkludierte_lehre
*/
public function getInkludierteLehre()
{
return $this->inkludierte_lehre;
}
/**
* Set the value of inkludierte_lehre
*/
public function setInkludierteLehre($inkludierte_lehre): self
{
$this->inkludierte_lehre = $inkludierte_lehre;
return $this;
}
public function toStdClass(): \stdClass
{
$tmp = array(
'vertragsbestandteil_id' => $this->getVertragsbestandteil_id(),
'inkludierte_lehre' => $this->getInkludierteLehre(),
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
return (object) $tmp;
}
public function __toString()
{
$txt = <<<EOTXT
inkludierte_lehre: {$this->getInkludierteLehre()}
EOTXT;
return parent::__toString() . $txt;
}
}
@@ -0,0 +1,65 @@
<?php
namespace vertragsbestandteil;
use vertragsbestandteil\Vertragsbestandteil;
use vertragsbestandteil\VertragsbestandteilFactory;
class VertragsbestandteilUrlaubsanspruch extends Vertragsbestandteil
{
protected $tage;
public function __construct()
{
$this->setVertragsbestandteiltyp_kurzbz(
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_URLAUBSANSPRUCH);
}
public function hydrateByStdClass($data)
{
parent::hydrateByStdClass($data);
isset($data->tage) && $this->setTage($data->tage);
}
/**
* Get the value of tage
*/
public function getTage()
{
return $this->tage;
}
/**
* Set the value of tage
*/
public function setTage($tage): self
{
$this->tage = $tage;
return $this;
}
public function toStdClass(): \stdClass
{
$tmp = array(
'vertragsbestandteil_id' => $this->getVertragsbestandteil_id(),
'tage' => $this->getTage(),
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
return (object) $tmp;
}
public function __toString()
{
$txt = <<<EOTXT
tage: {$this->getTage()}
EOTXT;
return parent::__toString() . $txt;
}
}
@@ -0,0 +1,109 @@
<?php
namespace vertragsbestandteil;
use vertragsbestandteil\Vertragsbestandteil;
use vertragsbestandteil\VertragsbestandteilFactory;
class VertragsbestandteilZeitaufzeichnung extends Vertragsbestandteil
{
protected $zeitaufzeichnung;
protected $azgrelevant;
protected $homeoffice;
public function __construct()
{
$this->setVertragsbestandteiltyp_kurzbz(
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_ZEITAUFZEICHNUNG);
}
public function hydrateByStdClass($data)
{
parent::hydrateByStdClass($data);
isset($data->zeitaufzeichnung) && $this->setZeitaufzeichnung($data->zeitaufzeichnung);
isset($data->azgrelevant) && $this->setAzgrelevant($data->azgrelevant);
isset($data->homeoffice) && $this->setHomeoffice($data->homeoffice);
}
/**
* Get the value of zeitaufzeichnung
*/
public function getZeitaufzeichnung()
{
return $this->zeitaufzeichnung;
}
/**
* Set the value of zeitaufzeichnung
*/
public function setZeitaufzeichnung($zeitaufzeichnung): self
{
$this->zeitaufzeichnung = $zeitaufzeichnung;
return $this;
}
/**
* Get the value of azgrelevant
*/
public function getAzgrelevant()
{
return $this->azgrelevant;
}
/**
* Set the value of azgrelevant
*/
public function setAzgrelevant($azgrelevant): self
{
$this->azgrelevant = $azgrelevant;
return $this;
}
/**
* Get the value of homeoffice
*/
public function getHomeoffice()
{
return $this->homeoffice;
}
/**
* Set the value of homeoffice
*/
public function setHomeoffice($homeoffice): self
{
$this->homeoffice = $homeoffice;
return $this;
}
public function toStdClass(): \stdClass
{
$tmp = array(
'vertragsbestandteil_id' => $this->getVertragsbestandteil_id(),
'zeitaufzeichnung' => $this->getZeitaufzeichnung(),
'azgrelevant' => $this->getAzgrelevant(),
'homeoffice' => $this->getHomeoffice()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
return (object) $tmp;
}
public function __toString()
{
$txt = <<<EOTXT
zeitaufzeichnung: {$this->getZeitaufzeichnung()}
azgrelevant: {$this->getAzgrelevant()}
homeoffice: {$this->getHomeoffice()}
EOTXT;
return parent::__toString() . $txt;
}
}
@@ -0,0 +1,76 @@
<?php
class Dienstverhaeltnis_model extends DB_Model
{
public function __construct()
{
parent::__construct();
$this->dbTable = 'hr.tbl_dienstverhaeltnis';
$this->pk = 'dienstverhaeltnis_id';
}
/**
* @return list of DV
*/
public function getDVByPersonUID($uid)
{
$result = null;
$qry = "
SELECT
dv.dienstverhaeltnis_id,
tbl_benutzer.uid,
tbl_mitarbeiter.personalnummer,
tbl_mitarbeiter.kurzbz,
tbl_mitarbeiter.lektor,
tbl_mitarbeiter.fixangestellt,
tbl_person.person_id,
tbl_benutzer.alias,
dv.von,
dv.bis,
dv.vertragsart_kurzbz,
dv.updateamum,
dv.updatevon
FROM tbl_mitarbeiter
JOIN tbl_benutzer ON tbl_mitarbeiter.mitarbeiter_uid::text = tbl_benutzer.uid::text
JOIN tbl_person USING (person_id)
JOIN hr.tbl_dienstverhaeltnis dv ON(tbl_benutzer.uid::text = dv.mitarbeiter_uid::text)
WHERE tbl_benutzer.uid=?
ORDER BY dv.von desc
";
return $this->execQuery($qry, array($uid));
}
public function getCurrentDVByPersonUID($uid)
{
$qry = "
SELECT
dv.dienstverhaeltnis_id,
tbl_benutzer.uid,
tbl_mitarbeiter.personalnummer,
tbl_mitarbeiter.kurzbz,
tbl_mitarbeiter.lektor,
tbl_mitarbeiter.fixangestellt,
tbl_person.person_id,
tbl_benutzer.alias,
dv.von,
dv.bis,
dv.vertragsart_kurzbz,
dv.updateamum,
dv.updatevon
FROM tbl_mitarbeiter
JOIN tbl_benutzer ON tbl_mitarbeiter.mitarbeiter_uid::text = tbl_benutzer.uid::text
JOIN tbl_person USING (person_id)
JOIN hr.tbl_dienstverhaeltnis dv ON(tbl_benutzer.uid::text = dv.mitarbeiter_uid::text)
WHERE tbl_benutzer.uid=? and (dv.von<=CURRENT_DATE::text::date and (dv.bis is null OR dv.bis>=CURRENT_DATE::text::date))
ORDER BY dv.von desc
";
return $this->execQuery($qry, array($uid));
}
}
@@ -0,0 +1,44 @@
<?php
class Gehaltsbestandteil_model extends DB_Model
{
public function __construct()
{
parent::__construct();
$this->dbTable = 'hr.tbl_gehaltsbestandteil';
$this->pk = 'gehaltsbestandteil_id';
$encryptionkey_filename = APPPATH.'config/extensions/FHC-Core-Personalverwaltung/keys.config.inc.php';
require($encryptionkey_filename);
}
public function getCurrentGBTByDV($dienstverhaeltnis_id)
{
$result = null;
$qry = "
SELECT
gehaltsbestandteil_id,
von,
bis,
anmerkung,
dienstverhaeltnis_id,
gehaltstyp_kurzbz,
valorisierungssperre,
valorisieren,
pgp_sym_decrypt(grundbetrag,?) grundbetrag,
pgp_sym_decrypt(betrag_valorisiert,?) betrag_valorisiert,
gt.bezeichnung as gehaltstyp_bezeichnung
FROM hr.tbl_gehaltsbestandteil gbt JOIN hr.tbl_gehaltstyp gt using(gehaltstyp_kurzbz)
WHERE gbt.dienstverhaeltnis_id=? AND
(gbt.von<=CURRENT_DATE::text::date and (gbt.bis is null OR gbt.bis>=CURRENT_DATE::text::date))
ORDER BY gt.sort
";
return $this->execQuery($qry, array(ENCRYPTIONKEY, ENCRYPTIONKEY, $dienstverhaeltnis_id));
}
}
@@ -0,0 +1,14 @@
<?php
class VertragsbestandteilBefristung_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'hr.tbl_vertragsbestandteil_befristung';
$this->pk = 'vertragsbestandteil_id';
}
}
@@ -0,0 +1,12 @@
<?php
class VertragsbestandteilFreitet_model extends DB_Model
{
public function __construct()
{
parent::__construct();
$this->dbTable = 'hr.tbl_vertragsbestandteil_freitext';
$this->pk = 'vertragsbestandteil_id';
}
}
@@ -0,0 +1,12 @@
<?php
class VertragsbestandteilKV_model extends DB_Model
{
public function __construct()
{
parent::__construct();
$this->dbTable = 'hr.tbl_vertragsbestandteil_kv';
$this->pk = 'vertragsbestandteil_id';
}
}
@@ -0,0 +1,14 @@
<?php
class VertragsbestandteilKarenz_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'hr.tbl_vertragsbestandteil_karenz';
$this->pk = 'vertragsbestandteil_id';
}
}
@@ -0,0 +1,11 @@
<?php
class VertragsbestandteilUrlaubsanspruch_model extends DB_Model
{
public function __construct()
{
parent::__construct();
$this->dbTable = 'hr.tbl_vertragsbestandteil_urlaubsanspruch';
$this->pk = 'vertragsbestandteil_id';
}
}
@@ -0,0 +1,12 @@
<?php
class VertragsbestandteilStunden_model extends DB_Model
{
public function __construct()
{
parent::__construct();
$this->dbTable = 'hr.tbl_vertragsbestandteil_zeitaufzeichnung';
$this->pk = 'vertragsbestandteil_id';
}
}
@@ -6,7 +6,7 @@ use vertragsbestandteil\VertragsbestandteilFactory;
* @author bambi
*/
class Vertragsbestandteil_model extends DB_Model
{
{
/**
* Constructor
*/
@@ -16,39 +16,48 @@ class Vertragsbestandteil_model extends DB_Model
$this->dbTable = 'hr.tbl_vertragsbestandteil';
$this->pk = 'vertragsbestandteil_id';
}
public function getVertragsbestandteile($dienstverhaeltnis_id=1, $stichtag=null)
{
$stichtagclause = '';
if( !is_null($stichtag) )
if( !is_null($stichtag) )
{
$date = strftime('%Y-%m-%d', strtotime($stichtag));
$stichtagclause = 'AND ' . $this->escape($date)
$stichtagclause = 'AND ' . $this->escape($date)
. ' BETWEEN COALESCE(v.von, \'1970-01-01\'::date)'
. ' AND COALESCE(v.bis, \'2170-01-01\'::date)';
}
$sql = <<<EOSQL
SELECT
v.*, s.wochenstunden, s.karenz, f.benutzerfunktion_id, f.anmerkung, f. kuendigungsrelevant
FROM
hr.tbl_vertragsbestandteil v
LEFT JOIN
hr.tbl_vertragsbestandteil_stunden s USING(vertragsbestandteil_id)
LEFT JOIN
SELECT
v.*,
s.wochenstunden, s.karenz,
f.benutzerfunktion_id, f.anmerkung, f. kuendigungsrelevant,
g.von as gehalt_von, g.bis as gehalt_bis, g.dienstverhaeltnis_id as gehalt_dienstverhaeltnis_id, g.grundbetrag,
g.betrag_valorisiert,g.valorisieren,gehaltstyp_kurzbz,valorisierungssperre
FROM
hr.tbl_vertragsbestandteil v
LEFT JOIN
hr.tbl_vertragsbestandteil_stunden s USING(vertragsbestandteil_id)
LEFT JOIN
hr.tbl_vertragsbestandteil_funktion f USING(vertragsbestandteil_id)
LEFT JOIN
hr.tbl_gehaltsbestandteil g USING(vertragsbestandteil_id)
WHERE
v.dienstverhaeltnis_id = {$this->escape($dienstverhaeltnis_id)}
{$stichtagclause}
;
EOSQL;
echo $sql . "\n\n";
// echo $sql . "\n\n";
$query = $this->db->query($sql);
$vertragsbestandteile = array();
foreach( $query->result() as $row ) {
try
try
{
$vertragsbestandteile[] = VertragsbestandteilFactory::getVertragsbestandteil($row);
}
@@ -57,7 +66,7 @@ EOSQL;
echo $ex->getMessage() . "\n";
}
}
return $vertragsbestandteile;
}
}