summaryrefslogtreecommitdiff
path: root/allocation.php
diff options
context:
space:
mode:
authorNiklas Olmes <niklas@olmes.de>2026-04-24 19:30:00 +0200
committerNiklas Olmes <niklas@olmes.de>2026-04-24 19:30:00 +0200
commitcdea8caa5617f0cb77bcbc9803759abd2df50644 (patch)
tree2f7f1bd3af3b2396baf5403ad1a7ad00bcb7fae9 /allocation.php
stipcrmHEADmain
Diffstat (limited to 'allocation.php')
-rw-r--r--allocation.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/allocation.php b/allocation.php
new file mode 100644
index 0000000..e6fd038
--- /dev/null
+++ b/allocation.php
@@ -0,0 +1,59 @@
+<?php
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+?>
+<?php
+/* vim: set ts=4 sw=4 et : */
+
+$year = 2022;
+if (isset($_GET['year'])) $year = $_GET['year'];
+$_title = "Mittelverwendung ($year)";
+require_once __DIR__ . "/check_auth.php";
+require_once __DIR__ . "/../includes/common.php";
+require_once __DIR__ . "/header.php";
+?>
+
+<h1><?=$_title?></h1>
+
+<?
+(function () use ($mysqli, $constraint, $nospinner, $noactions, $year) {
+ if (!isset($noactions))
+ $noactions = false;
+
+ $sql = "
+SELECT contracts.id AS VertrID, contracts.`call`, Förderer.ID AS FoerdID, Organisationen.Name AS Förderer, Personen.Nachname as Zuständig, contracts.ls, contracts.ls_months AS` LS-Monate`, contracts.ss, contracts.ss_months AS `SS-Monate`, (contracts.ls_months + contracts.ss_months) * 150 AS `∑ projektiert`,
+SUM( TIMESTAMPDIFF(MONTH, Stipendien.Förderbeginn, Stipendien.Förderende) + 1 ) AS `Monate allokiert`,
+SUM( TIMESTAMPDIFF(MONTH, Stipendien.Förderbeginn, Stipendien.Förderende) + 1) * 150 AS `∑ allokiert`,
+((contracts.ls_months + contracts.ss_months) * 150) - (SUM( TIMESTAMPDIFF(MONTH, Stipendien.Förderbeginn, Stipendien.Förderende) + 1) * 150) AS `Delta`
+FROM contracts
+INNER JOIN Förderer ON contracts.patron = Förderer.ID
+LEFT JOIN Organisationen ON Förderer.Organisation = Organisationen.ID
+LEFT JOIN Personen ON Förderer.zuständig = Personen.ID
+LEFT JOIN Stipendien ON Stipendien.Förderer = Förderer.ID AND Stipendien.Jahr = 2021 AND Stipendien.Förderart NOT IN (2, 5)
+WHERE contracts.`call`=?
+GROUP BY contracts.id
+";
+ $sql .= $constraint;
+ $stmt = $mysqli->prepare($sql);
+ $stmt->bind_param("i", $year);
+ $stmt->execute();
+ $r = $stmt->get_result();
+ $id = "Mittelverwendung";
+ $order = '[[1, "asc"], [3, "asc"], [4, "asc"]]';
+ $ajax = false;
+ $entrytable = 'Mittelverwendung';
+ $nospinner = true;
+ include __DIR__ . '/autotable.php';
+ $stmt->reset();
+})();
+
+include_once __DIR__ . "/footer.php";