* neue Migration für Personaladministration (Aktive Verrechnung) * Verrechnung Anpassungen Black P. * superexpertEnabled Implementation Verrechnung/Personaladministration * Personaladministration (Aktive Verrechnung/Zeiterfassung Enddatum)
173 lines
5.5 KiB
PHP
173 lines
5.5 KiB
PHP
<?php
|
|
|
|
class TimerecordingBillingEmployeeController extends mfBaseController
|
|
{
|
|
|
|
protected function init()
|
|
{
|
|
$this->needlogin = true;
|
|
$me = new User();
|
|
$me->loadMe();
|
|
$this->me = $me;
|
|
$this->layout()->set("me", $me);
|
|
|
|
if (!$me->is(["Admin"])) {
|
|
$this->redirect("Dashboard");
|
|
}
|
|
}
|
|
|
|
protected function indexAction()
|
|
{
|
|
|
|
$this->layout()->setTemplate("TimerecordingBillingEmployee/Index");
|
|
$timerecordingbillingemployees = TimerecordingBillingEmployeeModel::getAll();
|
|
$this->layout()->set("timerecordingbillingemployees", $timerecordingbillingemployees);
|
|
|
|
}
|
|
|
|
protected function addAction()
|
|
{
|
|
$timerecordingBillingEmployees = TimerecordingBillingEmployeeModel::getAll();
|
|
$this->layout()->set("timerecordingBillingEmployees", $timerecordingBillingEmployees);
|
|
$timerecordingEmployees = TimerecordingEmployeeModel::getAll();
|
|
$this->layout()->set("timerecordingEmployees", $timerecordingEmployees);
|
|
|
|
$this->layout()->setTemplate("TimerecordingBillingEmployee/Form");
|
|
|
|
}
|
|
|
|
protected function editAction()
|
|
{
|
|
$id = $this->request->id;
|
|
|
|
if (!is_numeric($id) || !$id) {
|
|
$this->layout()->setFlash("fdfsdf nicht gefunden", "error");
|
|
$this->redirect("TimerecordingBillingEmployee");
|
|
}
|
|
|
|
$timerecordingbillingemployees = new TimerecordingBillingEmployee($id);
|
|
if ($timerecordingbillingemployees->id != $id) {
|
|
$this->layout()->setFlash("fdfsdf nicht gefunden", "error");
|
|
$this->redirect("TimerecordingBillingEmployee");
|
|
}
|
|
|
|
$this->layout()->set("timerecordingbillingemployees", $timerecordingbillingemployees);
|
|
return $this->addAction();
|
|
}
|
|
|
|
protected function saveAction()
|
|
{
|
|
$r = $this->request;
|
|
$id = $r->id;
|
|
//var_dump($r->get());exit;
|
|
if (is_numeric($id) && $id > 0) {
|
|
$mode = "edit";
|
|
$timerecordingbillingemployees = new TimerecordingBillingEmployee($id);
|
|
if (!$timerecordingbillingemployees->id) {
|
|
$this->layout()->setFlash("dfsdfsdfds nicht gefunden", "error");
|
|
$this->redirect("TimerecordingBillingEmployee");
|
|
}
|
|
} else {
|
|
$mode = "add";
|
|
}
|
|
|
|
$data = [];
|
|
$data['timerecordingBillingEmployee_id'] = trim($r->timerecordingBillingEmployee_id);
|
|
$data['timerecordingEmployee_id'] = trim($r->timerecordingEmployee_id);
|
|
$data['type'] = trim($r->type);
|
|
$data['ishours'] = trim($r->ishours);
|
|
$data['overtime25'] = trim($r->overtime25);
|
|
$data['plushours50'] = trim($r->plushours50);
|
|
$data['plushours50free'] = trim($r->plushours50free);
|
|
$data['plushours100'] = trim($r->plushours100);
|
|
$data['plushours100free'] = trim($r->plushours100free);
|
|
$data['homeoffice'] = trim($r->homeoffice);
|
|
$data['diet'] = trim($r->diet);
|
|
$data['nlz'] = trim($r->nlz);
|
|
$data['nlz_detail'] = trim($r->nlz_detail);
|
|
|
|
|
|
if (!$data['timerecordingBillingEmployee_id']) {
|
|
$data['timerecordingBillingEmployee_id'] = NULL;
|
|
}
|
|
if (!$data['timerecordingEmployee_id']) {
|
|
$data['timerecordingEmployee_id'] = NULL;
|
|
}
|
|
if (!$data['type']) {
|
|
$data['type'] = NULL;
|
|
}
|
|
if (!$data['ishours']) {
|
|
$data['ishours'] = NULL;
|
|
}
|
|
if (!$data['overtime25']) {
|
|
$data['overtime25'] = NULL;
|
|
}
|
|
if (!$data['plushours50']) {
|
|
$data['plushours50'] = NULL;
|
|
}
|
|
if (!$data['plushours50free']) {
|
|
$data['plushours50free'] = NULL;
|
|
}
|
|
if (!$data['plushours100']) {
|
|
$data['plushours100'] = NULL;
|
|
}
|
|
if (!$data['plushours100free']) {
|
|
$data['plushours100free'] = NULL;
|
|
}
|
|
if (!$data['homeoffice']) {
|
|
$data['homeoffice'] = NULL;
|
|
}
|
|
if ($data['diet'] == NULL) {
|
|
$data['diet'] = 0;
|
|
}
|
|
if (!$data['nlz']) {
|
|
$data['nlz'] = NULL;
|
|
}
|
|
if (!$data['nlz_detail']) {
|
|
$data['nlz_detail'] = NULL;
|
|
}
|
|
|
|
// var_dump($_FILES);
|
|
// var_dump($upload);
|
|
// exit;
|
|
|
|
|
|
if ($mode == "edit") {
|
|
$timerecordingbillingemployees->update($data);
|
|
|
|
} else {
|
|
$timerecordingbillingemployees = TimerecordingBillingEmployeeModel::create($data);
|
|
}
|
|
// var_dump($filestore);
|
|
// exit;
|
|
$id = $timerecordingbillingemployees->save();
|
|
|
|
if (!$id) {
|
|
$this->layout()->setFlash("fdfsdf konnte nicht angelegt werden", "error");
|
|
$this->redirect("TimerecordingBillingEmployee");
|
|
}
|
|
|
|
if ($mode == "edit") {
|
|
$this->layout()->setFlash("fdfsdf erfolgreich geändert", "success");
|
|
} else if ($mode = "add") {
|
|
$this->layout()->setFlash("fdfsdf erfolgreich angelegt", "success");
|
|
}
|
|
$this->redirect("TimerecordingBillingEmployee");
|
|
}
|
|
|
|
|
|
protected function deleteAction()
|
|
{
|
|
$id = $this->request->id;
|
|
$timerecordingbillingemployees = new TimerecordingBillingEmployee($id);
|
|
if (!$timerecordingbillingemployees->id || $timerecordingbillingemployees->id != $id) {
|
|
$this->layout()->setFlash("fdfsdf nicht gefunden.", "error");
|
|
$this->redirect("TimerecordingBillingEmployee");
|
|
}
|
|
|
|
$timerecordingbillingemployees->delete();
|
|
$this->redirect("TimerecordingBillingEmployee");
|
|
}
|
|
|
|
}
|