per jaartal te bepalen in in MonFin in bestemmingen geen deelbudgetten als het is uitgezet en dan uitgaven niet in rode kleur foutmeldingen ivm order by en group by kolommen die niet in select stonden tooltips bij archieveren, activeren en verwijderen onddersteuningsvormen in mondiv
203 lines
6.9 KiB
PHP
203 lines
6.9 KiB
PHP
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
class Monfinbeheer extends MY_Controller{
|
|
|
|
function __construct(){
|
|
parent::__construct();
|
|
$models = array("monpas/Toewijzingen_model" );
|
|
$this->load->model($models);
|
|
if ( ! $this->check_online_status() ) {
|
|
echo json_encode( array('offline' => TRUE) );
|
|
die;
|
|
};// if
|
|
}
|
|
function getorgs(){
|
|
if (!$this->userid) die;
|
|
$orgstructuur = $this->Organisaties_model->getorgstructuur($this->globorgid , true);
|
|
$org = $this->Organisaties_model->getorg($this->globorgid);
|
|
$magwijzig = false;
|
|
if ($this->Autorisaties_model->check_autorisatie($this->userrole, 23)) $magwijzig =true;
|
|
echo json_encode(array('structuur' =>$orgstructuur , 'org' =>$org, 'magwijzig'=>$magwijzig));
|
|
}
|
|
function getbedragen(){
|
|
if (!$this->userid) die;
|
|
$orgid = $this->uri->segment(4);
|
|
$bedragen = $this->Toewijzingen_model->gettoewijzingen($orgid);
|
|
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) <=0) {$bedragen = array('');};
|
|
echo json_encode($bedragen);
|
|
}
|
|
|
|
function savedeelbudget(){
|
|
if (!$this->userid) die;
|
|
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) >= 1) {
|
|
$id = $this->clean_input('id');
|
|
$orgID = $this->clean_input('orgid');
|
|
$jaar = $this->clean_input('jaarnr');
|
|
$deelbudgetten = $this->clean_input('deelbudgetten');
|
|
if ($id == null || $id <= 0){
|
|
$data = array(
|
|
'orgid' =>$orgID,
|
|
'kalenderjaarnr'=> $jaar,
|
|
'deelbudgetten' => $deelbudgetten
|
|
);
|
|
$newid = $this->Toewijzingen_model->insert_record($data);
|
|
}
|
|
else{
|
|
$data = array("deelbudgetten" => $deelbudgetten);
|
|
$this->Toewijzingen_model->update_record($data, $id);
|
|
$newid = $id;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
else {$newid = false;}; // geen schrijfrechten
|
|
echo json_encode(intval($newid));
|
|
|
|
}
|
|
|
|
function legvast(){
|
|
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) >= 1) {
|
|
$id = $this->input->post('id');
|
|
$orgid = $this->input->post("orgid");
|
|
$jaarnr = $this->input->post("jaarnr");
|
|
$basis = $this->input->post("basis");
|
|
$extra = $this->input->post("extra");
|
|
$som = $this->input->post("som");
|
|
$overig = $this->input->post("overig");
|
|
$vastgelegd = 1;
|
|
if ($id == null || $id <= 0){
|
|
$data = array( 'orgid' =>$orgid,
|
|
'kalenderjaarnr' => $jaarnr,
|
|
'basis' => $basis,
|
|
'extra' => $extra,
|
|
'som' => $som,
|
|
'overig' => $overig,
|
|
'vastgelegd' => $vastgelegd);
|
|
$newid = $this->Toewijzingen_model->insert_record($data);
|
|
}
|
|
else{
|
|
$data = array("vastgelegd" => $vastgelegd);
|
|
$this->Toewijzingen_model->update_record($data, $id);
|
|
$newid = $id;
|
|
}
|
|
}
|
|
else {$newid = false;}; // geen schrijfrechten
|
|
echo json_encode(intval($newid));
|
|
}
|
|
|
|
function legbasisextravast(){
|
|
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) >=1) {
|
|
$id = $this->input->post('id');
|
|
$orgid = $this->input->post("orgid");
|
|
$jaarnr = $this->input->post("jaarnr");
|
|
$basis = $this->input->post("basis");
|
|
$extra = $this->input->post("extra");
|
|
$som = $this->input->post("som");
|
|
$overig = $this->input->post("overig");
|
|
$basisextra = $this->input->post("basisextra");
|
|
if ($id == null || $id <= 0){
|
|
$data = array('orgid' =>$orgid,
|
|
'kalenderjaarnr' => $jaarnr,
|
|
'basis' => $basis,
|
|
'extra' => $extra,
|
|
'som' => $som,
|
|
'overig' => $overig,
|
|
'basisextra' => $basisextra,
|
|
'basisextravast' => 1);
|
|
$newid = $this->Toewijzingen_model->insert_record($data);
|
|
}
|
|
else{
|
|
$newid= $id;
|
|
$data = array("basisextravast" => 1);
|
|
$this->Toewijzingen_model->update_record($data, $id);
|
|
}
|
|
}
|
|
else {$newid = false;}; // geen write rechten
|
|
echo json_encode(intval($newid));
|
|
}
|
|
function savebasisextra(){
|
|
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) >0 ) {
|
|
$id = $this->clean_input('id');
|
|
$orgid = $this->clean_input("orgid");
|
|
$jaarnr = $this->clean_input("jaarnr");
|
|
$basis = $this->clean_input("basis");
|
|
$extra = $this->clean_input("extra");
|
|
$som = $this->clean_input("som");
|
|
$overig = $this->clean_input("overig");
|
|
$basisextra = $this->clean_input("basisextra");
|
|
if (!$id ||$id == null || $id <= 0){
|
|
$data = array('orgid' =>$orgid,
|
|
'kalenderjaarnr' => $jaarnr,
|
|
'basis' => $basis,
|
|
'extra' => $extra,
|
|
'som' => $som,
|
|
'overig' => $overig,
|
|
'basisextra' => $basisextra,
|
|
'basisextravast' => 0);
|
|
$newid = $this->Toewijzingen_model->insert_record($data);
|
|
}
|
|
else{
|
|
$newid= $id;
|
|
$data = array("basisextra" => $basisextra);
|
|
$this->Toewijzingen_model->update_record($data, $id);
|
|
}
|
|
}
|
|
else {$newid= false;}; // geen write rechten
|
|
echo json_encode(intval($newid));
|
|
}
|
|
function updateorinsert(){
|
|
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) >0) {
|
|
$id = $this->input->post('id');
|
|
$orgid = $this->input->post("orgid");
|
|
$jaarnr = $this->input->post("jaarnr");
|
|
$basis = $this->input->post("basis");
|
|
$extra = $this->input->post("extra");
|
|
$som = $this->input->post("som");
|
|
$overig = $this->input->post("overig");
|
|
|
|
if ($id == null || $id <= 0){
|
|
$data = array( 'orgid' =>$orgid,
|
|
'kalenderjaarnr' => $jaarnr,
|
|
'basis' => $basis,
|
|
'extra' => $extra,
|
|
'som' => $som,
|
|
'overig' => $overig);
|
|
$newid = $this->Toewijzingen_model->insert_record($data);
|
|
}
|
|
else{
|
|
$newid= $id;
|
|
$data = array( 'basis' => $basis,
|
|
'extra' => $extra,
|
|
'som' => $som,
|
|
'overig' => $overig);
|
|
$this->Toewijzingen_model->update_record($data, $id);
|
|
}
|
|
}
|
|
else {$newid = false;};// geen write rechten
|
|
echo json_encode(intval($newid));
|
|
}
|
|
function sluitjaaraf(){
|
|
$swvid = $this->clean_input('swv');
|
|
$jaarnr = $this->clean_input("jaarnr");
|
|
$orgstructuur = $this->Organisaties_model->getorgstructuur($swvid);
|
|
if ($orgstructuur){
|
|
$this->Toewijzingen_model->UpdateToewijzingen($orgstructuur->id, $jaarnr);
|
|
if ($orgstructuur->kamers){
|
|
$this->sluitjaarafrecursief($orgstructuur->kamers, $jaarnr);
|
|
}
|
|
}
|
|
echo json_encode('ok');
|
|
}
|
|
|
|
private function sluitjaarafrecursief($orgs, $jaarnr){
|
|
if ($orgs){
|
|
|
|
foreach($orgs as $org){
|
|
$this->Toewijzingen_model->UpdateToewijzingen($org->id, $jaarnr);
|
|
if (isset($org->kamers)) $this->sluitjaarafrecursief($org->kamers, $jaarnr);
|
|
if (isset($org->bgs)) $this->sluitjaarafrecursief($org->bgs, $jaarnr);
|
|
if (isset($org->scholen)) $this->sluitjaarafrecursief($org->scholen, $jaarnr);
|
|
}
|
|
}
|
|
}
|
|
} |