diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php index 878f438..05fb10c 100644 --- a/application/core/MY_Controller.php +++ b/application/core/MY_Controller.php @@ -101,7 +101,8 @@ class MY_Controller extends CI_Controller{ // public $version = '1.21.00L'; //2factor -twee // public $version = '1.21.01M'; //verbeteringen compact sop // public $version = '1.21.02M '; //monfin, geen rode cijfers - public $version = '1.21.03M '; //mondiv ondersteuningsvorm archiveren per groep +// public $version = '1.21.03M '; //mondiv ondersteuningsvorm archiveren per groep + public $version = '1.21.04M '; //mondiv ondersteuningsvorm archiveren per groep foutem hersteld diff --git a/application/models/monpas/Aantalxondersteuningsvorm_model.php b/application/models/monpas/Aantalxondersteuningsvorm_model.php index 7198ace..56f91ae 100644 --- a/application/models/monpas/Aantalxondersteuningsvorm_model.php +++ b/application/models/monpas/Aantalxondersteuningsvorm_model.php @@ -37,13 +37,14 @@ class Aantalxondersteuningsvorm_model extends MY_Model{ return $this->get_query_row('aantal'); } - function getaantallen($vormid, $orgid){ + function getaantallen($vormid, $orgid, $schooljaarnr, $groepsids){ $this->sql ="SELECT G.id, G.naam, IF(AOS.id,aantal,0) AS aantal FROM tb_groepen G LEFT JOIN tb_aantalxondersteuningsvorm AOS ON ( G.id = AOS.groep_id AND AOS.ondersteuningsvorm_id = {$vormid}) WHERE G.organisatie_id = {$orgid} - + AND G.schooljaarnr = {$schooljaarnr} + AND G.id IN ({$groepsids}) ORDER BY G.niveau, G.naam, G.id"; return $this->get_query_result(); } diff --git a/application/models/monpas/Groepen_model.php b/application/models/monpas/Groepen_model.php index 6928465..a0481ef 100644 --- a/application/models/monpas/Groepen_model.php +++ b/application/models/monpas/Groepen_model.php @@ -13,23 +13,32 @@ class Groepen_model extends MY_Model{ $this->load->model($models); } - function getgroep($groepid){ - $this->sql = "SELECT GR.id, - GR.naam, - GR.totaantal, - SUM(IF( nivo = 2, AX.aantal, 0)) AS som2, - SUM(IF( nivo = 3, AX.aantal, 0)) AS som3, - SUM(IF( nivo = 4, AX.aantal, 0)) AS som4, - (totaantal - SUM(AX.aantal) ) AS som1 - FROM tb_groepen GR - LEFT JOIN tb_aantalxondersteuningsvorm AX - ON GR.id = AX.groep_id - LEFT JOIN tb_ondersteuningsvormen OV - ON OV.id = AX.ondersteuningsvorm_id - WHERE GR.id = {$groepid} - GROUP BY GR.id"; - return $this->get_query_row(); - } + function getgroep($groepid){ + $this->sql = "SELECT GR.id, + GR.naam, + GR.totaantal, + + COALESCE(SUM(IF(OV.nivo = 2 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) AS som2, + COALESCE(SUM(IF(OV.nivo = 3 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) AS som3, + COALESCE(SUM(IF(OV.nivo = 4 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) AS som4, + + ( GR.totaantal - ( + COALESCE(SUM(IF(OV.nivo = 2 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) + + COALESCE(SUM(IF(OV.nivo = 3 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) + + COALESCE(SUM(IF(OV.nivo = 4 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) + ) + ) AS som1 + FROM tb_groepen GR + LEFT JOIN tb_aantalxondersteuningsvorm AX + ON GR.id = AX.groep_id + LEFT JOIN tb_ondersteuningsvormen OV + ON OV.id = AX.ondersteuningsvorm_id + WHERE GR.id = {$groepid} + GROUP BY GR.id"; + return $this->get_query_row(); + } + + function getgroepenlist($orgid, $schooljaarnr, $module){ $this->sql = "SELECT id, naam, ondersteuning FROM tb_groepen @@ -81,55 +90,67 @@ class Groepen_model extends MY_Model{ return $this->get_query_row('aantallln'); } - - - function getgroepen($orgid, $schooljaarnr, $module){ - $this->sql = "SELECT GR.id, - GR.naam, - GR.niveau, - GR.totaantal, - GR.ondersteuning, - SUM(IF( nivo = 2, AX.aantal, 0)) AS som2, - SUM(IF( nivo = 3, AX.aantal, 0)) AS som3, - SUM(IF( nivo = 4, AX.aantal, 0)) AS som4, - (GR.totaantal - IF(SUM(AX.aantal) , SUM(AX.aantal),0) ) AS som1 - FROM tb_groepen GR - LEFT JOIN tb_aantalxondersteuningsvorm AX - ON GR.id = AX.groep_id - LEFT JOIN tb_ondersteuningsvormen OV - ON OV.id = AX.ondersteuningsvorm_id - WHERE GR.organisatie_id = {$orgid} - AND GR.schooljaarnr = {$schooljaarnr} - AND GR.schooltype = 'R' - AND GR.module = {$module} - GROUP BY GR.id - ORDER BY niveau, naam, GR.id "; - return $this->get_query_result(); - } - function getgekopieerdegroepen($orgid, $schooljaarnr, $module){ - $this->sql = "SELECT GR.id, - GR.naam, - GR.niveau, - GR.totaantal, - - SUM(IF( nivo = 2, AX.aantal, 0)) AS som2, - SUM(IF( nivo = 3, AX.aantal, 0)) AS som3, - SUM(IF( nivo = 4, AX.aantal, 0)) AS som4, - (GR.totaantal - IF(SUM(AX.aantal) , SUM(AX.aantal),0) ) AS som1 - FROM tb_groepen GR - LEFT JOIN tb_aantalxondersteuningsvorm AX - ON GR.id = AX.groep_id - LEFT JOIN tb_ondersteuningsvormen OV - ON OV.id = AX.ondersteuningsvorm_id - WHERE GR.organisatie_id = {$orgid} - AND GR.schooljaarnr = {$schooljaarnr} - AND GR.schooltype = 'R' - AND GR.module = {$module} - GROUP BY GR.id - ORDER BY niveau, naam, GR.id "; + function getgroepen($orgid, $schooljaarnr, $module){ + $this->sql = "SELECT GR.id, + GR.naam, + GR.niveau, + GR.totaantal, + GR.ondersteuning, + + COALESCE(SUM(IF(OV.nivo = 2 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) AS som2, + COALESCE(SUM(IF(OV.nivo = 3 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) AS som3, + COALESCE(SUM(IF(OV.nivo = 4 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) AS som4, + + ( GR.totaantal - ( + COALESCE(SUM(IF(OV.nivo = 2 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) + + COALESCE(SUM(IF(OV.nivo = 3 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) + + COALESCE(SUM(IF(OV.nivo = 4 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) + ) + ) AS som1 + FROM tb_groepen GR + LEFT JOIN tb_aantalxondersteuningsvorm AX + ON GR.id = AX.groep_id + LEFT JOIN tb_ondersteuningsvormen OV + ON OV.id = AX.ondersteuningsvorm_id + WHERE GR.organisatie_id = {$orgid} + AND GR.schooljaarnr = {$schooljaarnr} + AND GR.schooltype = 'R' + AND GR.module = {$module} + GROUP BY GR.id + ORDER BY niveau, naam, GR.id "; return $this->get_query_result(); } + function getgekopieerdegroepen($orgid, $schooljaarnr, $module){ + $this->sql = "SELECT GR.id, + GR.naam, + GR.niveau, + GR.totaantal, + + COALESCE(SUM(IF(OV.nivo = 2 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) AS som2, + COALESCE(SUM(IF(OV.nivo = 3 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) AS som3, + COALESCE(SUM(IF(OV.nivo = 4 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) AS som4, + + ( GR.totaantal - ( + COALESCE(SUM(IF(OV.nivo = 2 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) + + COALESCE(SUM(IF(OV.nivo = 3 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) + + COALESCE(SUM(IF(OV.nivo = 4 AND (AX.archief IS NULL OR AX.archief <> 'T'), AX.aantal, 0)),0) + ) + ) AS som1 + FROM tb_groepen GR + LEFT JOIN tb_aantalxondersteuningsvorm AX + ON GR.id = AX.groep_id + LEFT JOIN tb_ondersteuningsvormen OV + ON OV.id = AX.ondersteuningsvorm_id + WHERE GR.organisatie_id = {$orgid} + AND GR.schooljaarnr = {$schooljaarnr} + AND GR.schooltype = 'R' + AND GR.module = {$module} + GROUP BY GR.id + ORDER BY niveau, naam, GR.id "; + return $this->get_query_result(); + } + function getGroepenSboSo($orgid, $schooljaarnr){ $this->sql = "SELECT GR.id, diff --git a/application/views/monpas/pages/mondiv/groepen.php b/application/views/monpas/pages/mondiv/groepen.php index 77c4309..2941960 100644 --- a/application/views/monpas/pages/mondiv/groepen.php +++ b/application/views/monpas/pages/mondiv/groepen.php @@ -30,10 +30,10 @@ data-bind="click: $parent.fDeleteGroep, visible: $parent.writer()"> - - - - + + + +
@@ -83,7 +83,7 @@ -

+

0) waarschuwing = waarschuwing + "
De leerlingen in deze groep die toegewezen zijn aan deze" + + if(parseInt(dit.aantal()) > 0) waarschuwing = waarschuwing + "
De leerlingen in deze groep die toegewezen zijn aan deze" + " ondersteuningsvorm worden ingedeeld in de basisondersteuning." let sd ={ @@ -591,9 +582,12 @@ $(function(){ var self = ls.GroepenModel; var dit = this; let waarschuwing ="Weet u zeker dat u " + dit.naam() + " wilt verwijderen?"; - if(dit.aantal > 0) "
De leerlingen die toegewezen zijn aan deze ondersteuningsvorm worden ingedeeld in de basisondersteuning."; - apprise(waarschuwing, {verify: true, textYes: 'ja', textNo:'nee'}, function(ans){ + if(parseInt(dit.aantal(), 10) > 0)waarschuwing = waarschuwing + "
De leerlingen die toegewezen zijn aan deze ondersteuningsvorm worden ingedeeld in de basisondersteuning."; + + console.log(dit, 'dit') + console.log(waarschuwing, 'waarschuwing') + apprise(waarschuwing, {verify: true, textYes: 'ja', textNo:'nee'}, function(ans){ if (ans){ $.post("index.php/monpas/groepen/deleteOS/" + dit.id, function(){ self.editGroep().ondersteuningsvormen.remove(dit);