1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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";
|