From c3aa0428017ae80a71dd8f0727407e466768d074 Mon Sep 17 00:00:00 2001 From: Monique Hansma Date: Sun, 3 Mar 2024 20:02:18 +0100 Subject: [PATCH] tussenopslag --- .../controllers/monfin2/Monfin2overzicht.php | 27 ++++++++++++++++--- .../models/monfin2/Finbestemmingen_model.php | 15 +++++++++++ .../models/monpas/Toewijzingen_model.php | 3 ++- .../views/monpas/pages/monfin/overzicht.php | 8 +++--- .../views/monpas/pages/monfin2/overorgs.php | 14 +++++----- .../views/monpas/pages/monfin2/overzicht.php | 2 +- .../js/monpas/models/monfin2/bestemmingen.js | 2 +- .../monpas/models/monfin2/monfinoverzicht2.js | 14 ++++------ 8 files changed, 59 insertions(+), 26 deletions(-) diff --git a/application/controllers/monfin2/Monfin2overzicht.php b/application/controllers/monfin2/Monfin2overzicht.php index b00816b..0dab3fa 100644 --- a/application/controllers/monfin2/Monfin2overzicht.php +++ b/application/controllers/monfin2/Monfin2overzicht.php @@ -399,20 +399,21 @@ class Monfin2overzicht extends MY_Controller{ $regelsom2 = 0; $regelsom3 = 0; foreach($uitgavetypes as $uitgavetype){ - $somasarray[$index ] = new stdClass; + $somasarray[$index] = new stdClass; $somasarray[$index]->code = $uitgavetype->code; $somasarray[$index]->naam = $sombasis[$uitgavetype->code]->naam; $somasarray[$index ]->som = round($sombasis[$uitgavetype->code]->som,0); $somasarray[$index ]->budgetsom = round($sombasis[$uitgavetype->code]->budgetsom,0); if($index != 0) { $regelsom += $somasarray[$index]->som; - $regelsom2 += $somasarray[$index ]->budgetsom; + $regelsom2 += $somasarray[$index]->budgetsom; } $index += 1; }; $somasarray[0]->som = $regelsom; - $somasarray[0]->budgetrestant = $somasarray[0]->budgetsom - $regelsom2; + $somasarray[0]->budgetsom = $regelsom2; + $somasarray[0]->budgetrestant = $regelsom - $regelsom2; return $somasarray; } @@ -426,14 +427,18 @@ class Monfin2overzicht extends MY_Controller{ $subtot->extra =0; $subtot->som =0; $subtot->budget =0; + $subtot->gebudget = 0; $subtot->verschil =0; + $subtot->verschilGeb =0; $grandtot = new stdClass; $grandtot->basis =0; $grandtot->extra =0; $grandtot->som =0; $grandtot->budget =0; + $grandtot->gebudget =0; $grandtot->verschil =0; + $grandtot->verschilGeb =0; $targetorg = $this->Organisaties_model->get_record_by_id($targetorgid); $targetorg->bestemmingen = $this->get_bestuur_bestemmingen($targetorgid, $kalenderjaarnr); @@ -457,19 +462,28 @@ class Monfin2overzicht extends MY_Controller{ $others[$index]->naam = $organisatie->brin.'-'.$organisatie->naamkort; $others[$index]->id = $organisatie->id; $others[$index]->budget = $this->get_budgetten_inclusief($orgids, $kalenderjaarnr); + $others[$index]->gebudget = $this->Finbestemmingen_model->get_gebudgeteerd_totbedrag_over_orgs($orgids, $kalenderjaarnr); + $others[$index]->gebudgetForm = number_format($others[$index]->gebudget,0 , ',' , '.'); $others[$index]->bestemmingen = $this->get_bestemmingen_inclusief($orgids, $kalenderjaarnr); $others[$index]->verschil = $others[$index]->budget->totaal - $others[$index]->bestemmingen->som; + $others[$index]->verschilGeb = $others[$index]->gebudget - $others[$index]->bestemmingen->som; $others[$index]->formVerschil = number_format($others[$index]->verschil, 0 ,',' , '.' ); + $others[$index]->verschilGebForm = number_format($others[$index]->verschilGeb,0 , ',' , '.'); + $subtot->basis += $others[$index]->bestemmingen->basis; $subtot->extra += $others[$index]->bestemmingen->extra; $subtot->som += $others[$index]->bestemmingen->som; $subtot->budget += $others[$index]->budget->totaal; + $subtot->gebudget += $others[$index]->gebudget; $subtot->verschil += $others[$index]->verschil; + $subtot->verschilGeb += $others[$index]->verschilGeb; $grandtot->basis += $others[$index]->bestemmingen->basis; $grandtot->extra += $others[$index]->bestemmingen->extra; $grandtot->som += $others[$index]->bestemmingen->som; $grandtot->budget += $others[$index]->budget->totaal; + $grandtot->gebudget += $others[$index]->gebudget; $grandtot->verschil += $others[$index]->verschil; + $grandtot->verschilGeb += $others[$index]->verschilGeb; $index += 1; } } @@ -482,13 +496,17 @@ class Monfin2overzicht extends MY_Controller{ $subtot->extra = number_format($subtot->extra,0 , ',' , '.'); $subtot->som = number_format($subtot->som,0 , ',' , '.'); $subtot->budget = number_format($subtot->budget,0 , ',' , '.'); + $subtot->gebudget = number_format($subtot->gebudget,0 , ',' , '.'); $subtot->verschil = number_format($subtot->verschil,0 , ',' , '.'); + $subtot->verschilGeb = number_format($subtot->verschilGeb,0 , ',' , '.'); $grandtot->basis = number_format($grandtot->basis,0 , ',' , '.'); $grandtot->extra = number_format($grandtot->extra,0 , ',' , '.'); $grandtot->som = number_format($grandtot->som,0 , ',' , '.'); $grandtot->budget = number_format($grandtot->budget,0 , ',' , '.'); + $grandtot->gebudget = number_format($grandtot->gebudget,0 , ',' , '.'); $grandtot->verschil = number_format($grandtot->verschil,0 , ',' , '.'); + $grandtot->verschilGeb = number_format($grandtot->verschilGeb,0 , ',' , '.'); // $result = $this->get_orgs_bestemmingen($orgids, $kalenderjaarnr); echo json_encode(['targetorg' =>$targetorg, @@ -522,6 +540,9 @@ class Monfin2overzicht extends MY_Controller{ return $budgetten; } + + + private function getorgids($orgid){ $organisaties = array(); $level2 = array(); diff --git a/application/models/monfin2/Finbestemmingen_model.php b/application/models/monfin2/Finbestemmingen_model.php index 27bd0cb..0a254c8 100644 --- a/application/models/monfin2/Finbestemmingen_model.php +++ b/application/models/monfin2/Finbestemmingen_model.php @@ -233,6 +233,21 @@ class Finbestemmingen_model extends MY_Model{ return $row; } + function get_gebudgeteerd_totbedrag_over_orgs($orglist, $jaarnr){ + $this->sql = " SELECT FORMAT(sum(B.budget) / 100,2) as budget + FROM finbestemmingen B + WHERE B.organisatie_id in ({$orglist}) + AND B.kalenderjaar = {$jaarnr } + AND B.uitgavetype = 'TOTAAL' "; + $row= $this->get_query_row(); + if ($row) $row->budget = str_replace(',' , '' , $row->budget); + return $row->budget; + + + + } + + function getTotaalSchoolBestedingen($orgid, $jaarnr){ $this->sql = "SELECT SUM(bedrag) AS totaal FROM finbestemmingen diff --git a/application/models/monpas/Toewijzingen_model.php b/application/models/monpas/Toewijzingen_model.php index 13c5649..ce13641 100644 --- a/application/models/monpas/Toewijzingen_model.php +++ b/application/models/monpas/Toewijzingen_model.php @@ -32,7 +32,8 @@ class Toewijzingen_model extends MY_Model{ $this->sql = " SELECT id, round(sum(basis) /100) as basis, round(sum(extra) /100 ) as extra, - round(sum(basis + extra) /100) as totaal + round(sum(basis + extra) /100) as totaal, + kalenderjaarnr FROM tb_toewijzingen WHERE orgid in ({$orgids}) AND kalenderjaarnr = {$jaarnr} diff --git a/application/views/monpas/pages/monfin/overzicht.php b/application/views/monpas/pages/monfin/overzicht.php index a2363c3..9a84a66 100644 --- a/application/views/monpas/pages/monfin/overzicht.php +++ b/application/views/monpas/pages/monfin/overzicht.php @@ -133,7 +133,7 @@ Overig Totaal bestemd Totaal budget - Verschil + is het deze? @@ -144,7 +144,7 @@ - + @@ -156,7 +156,7 @@ - + @@ -180,7 +180,7 @@ - + diff --git a/application/views/monpas/pages/monfin2/overorgs.php b/application/views/monpas/pages/monfin2/overorgs.php index a092a90..ab8318b 100644 --- a/application/views/monpas/pages/monfin2/overorgs.php +++ b/application/views/monpas/pages/monfin2/overorgs.php @@ -15,8 +15,8 @@ - - + + @@ -25,8 +25,8 @@ - - + + @@ -35,7 +35,7 @@ - + @@ -49,8 +49,8 @@ - - + + diff --git a/application/views/monpas/pages/monfin2/overzicht.php b/application/views/monpas/pages/monfin2/overzicht.php index 8be1ef1..857aa4e 100644 --- a/application/views/monpas/pages/monfin2/overzicht.php +++ b/application/views/monpas/pages/monfin2/overzicht.php @@ -93,7 +93,7 @@ - verschil + verschil>? diff --git a/public/js/monpas/models/monfin2/bestemmingen.js b/public/js/monpas/models/monfin2/bestemmingen.js index 51ac7d5..cdc2f61 100644 --- a/public/js/monpas/models/monfin2/bestemmingen.js +++ b/public/js/monpas/models/monfin2/bestemmingen.js @@ -241,7 +241,7 @@ ls.initBestemmingenModel = function(){ var self = ls.BestemmingenModel; var budget = 0; var bedrag = 0; - var totbudget = self.jaartoewijzing() ? self.jaartoewijzing().basis: 0; + var totbudget = self.jaartoewijzing() ? self.jaartoewijzing().basis: '0'; totbudget = totbudget.replace(/[.| ,]/g, ''); var totbasispct = ''; var gebudgetbasispct = ''; diff --git a/public/js/monpas/models/monfin2/monfinoverzicht2.js b/public/js/monpas/models/monfin2/monfinoverzicht2.js index 85e06a7..b93830b 100644 --- a/public/js/monpas/models/monfin2/monfinoverzicht2.js +++ b/public/js/monpas/models/monfin2/monfinoverzicht2.js @@ -120,6 +120,7 @@ ls.initMonfinOverzicht2Model = function(){ var sd={orgid : self.selectedOrg().id, jaarnr : self.selectedKalenderjaar().jaarnr} $.post("index.php/monfin2/monfin2overzicht/getschoolbedragen", sd, function(result){ + console.log(result, 'result janee = 1') self.schooltotaal( result.schooltotaal) ; self.uitgavetypes(result.uitgavetypes); @@ -153,7 +154,7 @@ ls.initMonfinOverzicht2Model = function(){ var sd={orgid : self.selectedOrg().id, jaarnr : self.selectedKalenderjaar().jaarnr} $.post("index.php/monfin2/monfin2overzicht/getbestuursbedragen", sd, function(result){ - + console.log(result, 'result janee = 0') self.otherOrgs.removeAll(); self.otherOrgs(result.others); self.subTot(result.subtot); @@ -161,13 +162,6 @@ ls.initMonfinOverzicht2Model = function(){ self.targetOrg(result.targetorg); - $.post("index.php/monfin2/monfin2overzicht/getschoolbedragenNieuw", sd, function(result){ - - self.schooltotaal( result.schooltotaal) ; - - - },'json'); - },'json'); @@ -176,6 +170,7 @@ ls.initMonfinOverzicht2Model = function(){ jaarnr : self.selectedKalenderjaar().jaarnr, zelfjanee : self.zelfjanee()} $.post("index.php/monfin2/monfin2overzicht/getschoolbedragenNieuw", sd, function(result){ + console.log(result, 'result janee = 3') self.schooltotaal( result.schooltotaal) ; self.uitgavetypes(result.uitgavetypes); @@ -202,7 +197,8 @@ ls.initMonfinOverzicht2Model = function(){ } else { var sd={orgid : self.selectedOrg().id, jaarnr : self.selectedKalenderjaar().jaarnr} - $.post("index.php/monfin2/monfin2overzicht/getbestuurperuitgavetype", sd, function(result){ + $.post("index.php/monfin2/monfin2overzicht/getbestuurperuitgavetype", sd, function(result){ + console.log(result, 'result janee = anders') self.pmsTargetOrg(result.targetorg); self.otherPMSOrgs(result.otherorgs); self.sumotherPMS(result.sumother);