From bba3adbb76d5d395e65ef1f11fb69759fb389a61 Mon Sep 17 00:00:00 2001
From: Tim Repke <repketim@informatik.hu-berlin.de>
Date: Sat, 20 Sep 2014 19:10:58 +0100
Subject: [PATCH] overview page added, some changes in listing page

---
 registration-system/admin/pages.php          |   5 +-
 registration-system/admin/pages_list.php     |   6 +-
 registration-system/admin/pages_overview.php | 117 +++++++++++++++++++
 registration-system/config.inc.php           |   4 +-
 4 files changed, 125 insertions(+), 7 deletions(-)
 create mode 100644 registration-system/admin/pages_overview.php

diff --git a/registration-system/admin/pages.php b/registration-system/admin/pages.php
index 0be9cda..298875b 100644
--- a/registration-system/admin/pages.php
+++ b/registration-system/admin/pages.php
@@ -5,8 +5,9 @@ require_once("../config.inc.php");
 
 function page_stuff()
 {
-    global $text;
-    $text .= "Ãœbersichtsseite";
+    //global $text;
+    //$text .= "Ãœbersichtsseite";
+    require_page("pages_overview.php");
 }
 
 function page_list(){
diff --git a/registration-system/admin/pages_list.php b/registration-system/admin/pages_list.php
index 7fac73f..4701511 100644
--- a/registration-system/admin/pages_list.php
+++ b/registration-system/admin/pages_list.php
@@ -80,12 +80,12 @@ $columns = array(
 $columnFunctions = array(
     "Anmelde-ID" => function($person) { return $person["bachelor_id"]; }
     //,"FahrtID" => function($person) { return $person["fahrt_id"]; }
-,"Anmeldung" => function($person) { return date("m.d.Y", $person['anm_time']); },
+,"Anmeldung" => function($person) { return date("d.m.Y", $person['anm_time']); },
     "Name" => function($person) { return "<a href='mailto:".$person["mehl"]."?subject=FS-Fahrt'>".$person["forname"]." ".$person["sirname"]." (".$person["pseudo"].")</a>"; },
     "Anreisetyp" => function($person) { return $person["antyp"]; },
     "Abreisetyp" => function($person) { return $person["abtyp"]; },
-    "Anreisetag" => function($person) { return  date("m.d.Y", $person["anday"]); },
-    "Abreisetag" => function($person) { return date("m.d.Y", $person["abday"]); },
+    "Anreisetag" => function($person) { return  date("d.m.Y", $person["anday"]); },
+    "Abreisetag" => function($person) { return date("d.m.Y", $person["abday"]); },
     "Kommentar" => function($person) { return $person["comment"]; },
     "StudiTyp" => function($person) { return $person["studityp"]; },
     "PaidReBack" => function($person) { return ($person["paid"] ? $person["paid"] : "0") .",". ($person["repaid"] ? $person["repaid"] : "0") .",". ($person["backstepped"] ? $person["backstepped"] : "0"); }
diff --git a/registration-system/admin/pages_overview.php b/registration-system/admin/pages_overview.php
new file mode 100644
index 0000000..db03ccf
--- /dev/null
+++ b/registration-system/admin/pages_overview.php
@@ -0,0 +1,117 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: tim
+ * Date: 9/17/14
+ * Time: 8:04 PM
+ */
+
+global $text, $headers, $admin_db, $config_current_fahrt_id, $ajax, $config_reisearten, $config_admin_verbose_level, $config_verbose_level;
+$config_admin_verbose_level = 4;
+$config_verbose_level = 4;
+$text .= "<h1>Ãœbersichtsseite</h1>";
+
+
+$mitfahrer['gesam'] = $admin_db->count("bachelor", ["AND"=>
+                                        ["backstepped" => NULL,
+                                         "fahrt_id"    => $config_current_fahrt_id]]);
+
+$antag = $admin_db->query("SELECT date_format(von, '%j') as von FROM fahrten WHERE fahrt_id=$config_current_fahrt_id")->fetchAll()[0]['von'];
+$abtag = date('z', DateTime::createFromFormat('Y-m-d',$admin_db->get("fahrten","bis", ["fahrt_id"=>$config_current_fahrt_id]))->getTimestamp());
+$mitfahrer['erste'] = $admin_db->count("bachelor", ["AND"=>
+                                        ["backstepped" => NULL,
+                                         "fahrt_id"    => $config_current_fahrt_id,
+                                         "anday"       => $antag]]);
+$mitfahrer['zweit'] = $admin_db->count("bachelor", ["AND"=>
+                                        ["backstepped" => NULL,
+                                         "fahrt_id"    => $config_current_fahrt_id,
+                                         "abday"       => $abtag]]);
+$mitfahrer['veget'] = $admin_db->count("bachelor", ["AND"=>
+                                        ["backstepped" => NULL,
+                                         "fahrt_id"    => $config_current_fahrt_id,
+                                         ""]]);
+$mitfahrer['backs'] = $admin_db->count("bachelor", ["AND"=>
+                                        ["backstepped[!]" => NULL,
+                                         "fahrt_id"    => $config_current_fahrt_id]]);
+$mitfahrer['treff'] = $admin_db->count("bachelor", ["AND" =>
+                                        ["antyp"       => $config_reisearten[0],
+                                         "backstepped" => NULL,
+                                         "fahrt_id"    => $config_current_fahrt_id]]);
+
+
+$text .= "<div style='float:left; margin-left: 15px'><h2>Mitfahrer</h2>
+        <ul class='list-nodeco'>
+            <li>Gesamt: ".$mitfahrer['gesam']."</li>
+            <ul>
+                <li>Erste Nacht: ".$mitfahrer['erste']."</li>
+                <li>Zweite Nacht: ".$mitfahrer['zweit']."</li>
+                <li>Vegetarier: ".$mitfahrer['veget']."</li>
+                <li>Zurückgetreten: ".$mitfahrer['backs']."</li>
+                <li>Personen am Treffpunkt: ".$mitfahrer['treff']."</li>
+            </ul>
+            <li>Verteilung</li>
+            <ul>
+                <li>Erstis:</li>
+                <li>Hörstis:</li>
+                <li>Tutti: </li>
+                <li>= Ratio (E vs T+H): </li>
+            </ul>
+        </ul></div>";
+
+$text .= "<div style='float:left; margin-left: 15px'><h2>Zahlungen</h2>
+        <ul>
+            <li>Zahlungen</li>
+            <ul>
+                <li>Erhalten:</li>
+                <li>Ausstehend:</li>
+            </ul>
+            <li>Einnahmen</li>
+            <ul>
+                <li>Soll:</li>
+                <li>Ist:</li>
+                <li>Differenz:</li>
+            </ul>
+        </ul></div>";
+
+$text .= "<p style='clear:both'></p>";
+
+
+/* Vorlage:
+ *
+ *
+ *
+Gesamt	77	80	Personen am Treffpunkt	59
+erste Nacht	75
+zweite Nacht	75
+Vegetarier	4			Arbeitsaufwand	22
+					+ nebenbei
+Zahlungen erhalten	77
+Zahlungen ausstehend	0
+
+Einnahmen (ist)	4.620,00 €
+Einnahmen (soll)	4.620,00 €	0 €
+
+voraussichtliche Ausgaben
+Gesamt	3.925,66 €
+Unterkunft (lt. Vertrag)	2.095,00 €	1990,25 €
+Unterkunft (theoretisch)	3.226,30 €	3064,985 €
+Verpflegung	389,36 €
+Fahrtkosten (nur Bus)	205,20 €
+
+Ausgaben		 	effektiv pro Person:	22,41 €
+Einkäufe
+Unterkunft
+Rücküberweisungen (Storno)	0,00 €		Ausstehende Überweisungen:
+	0 €		4620 €	zzgl. Förderung	2.200,00 €
+
+			6820 €
+			161,31 €	pro Person
+
+				Frühabreiser Rückzahlungszuschlag	19,70 €
+
+		Ratio:
+Erstis	51	66,23%
+Hörstis	26	33,77%
+
+Abmeldungen vorher	11
+ */
\ No newline at end of file
diff --git a/registration-system/config.inc.php b/registration-system/config.inc.php
index f4457b3..b332ff2 100644
--- a/registration-system/config.inc.php
+++ b/registration-system/config.inc.php
@@ -18,8 +18,8 @@ $config_studitypen = array(
     //"Wechsli",     // 1 - woanders/was anderes studiert, jetzt hier
     //"MasterErsti", // 2
     "Hoersti",      // 3 - länger an der HU
-    "Tutti",       // 4 - Tutor
-    "Fachi"        // 5 - FS Ini
+    "Tutor"       // 4 - Tutor
+    //"Fachi"        // 5 - FS Ini
 );
 
 $config_essen = array(
-- 
GitLab