New form according to mail request
authorJoey Schulze <joey@infodrom.org>
Fri, 12 Mar 2010 17:13:41 +0000 (18:13 +0100)
committerJoey Schulze <joey@infodrom.org>
Fri, 12 Mar 2010 17:13:41 +0000 (18:13 +0100)
masks/overview_kostenstellen.php

index 5d06147..3b59b6c 100644 (file)
@@ -5,13 +5,9 @@ include_once($_SESSION['sys']['basedir'].'/lib/overview_utils.php');
 if (empty($_SESSION['overview_kostenstellen.year'])) $_SESSION['overview_kostenstellen.year'] = 0;
 
 $mask = array(
-             'table' => 'einsatz',
-             'title' => 'Stundenübersicht nach Kostenstellen',
-             'join' => array('arbeitsarten ON einsatz.arbeiten = arbeitsarten.id',
-                             'kostenstellen ON einsatz.kostenstelle = kostenstellen.id',
-                             ),
-             'where' => "arbeitsarten.arbeitsart <> 'Urlaub' AND arbeitsarten.arbeitsart <> 'Krank' AND arbeitsarten.arbeitsart <> 'Sonstige Fehltage'"
-                      . " AND date_part('year', datum) = " . $_SESSION['overview_kostenstellen.year'],
+             'table' => 'kostenstellen',
+             'title' => 'Übersicht nach Kostenstellen',
+             'join' => array('gebiet ON kostenstellen.gebiet = gebiet.id'),
              'select' => array(
                                'title' => 'Auswahl',
                                'options' => discover_years(),
@@ -26,50 +22,56 @@ $mask = array(
                              'id' => array(
                                            'name' => 'ID',
                                            'visible' => false,
-                                           'sql' => 'einsatz.id',
+                                           'width' => 60,
+                                           'sql' => 'kostenstellen.id',
                                            ),
-                             'datum' => array(
-                                           'name' => 'Datum',
-                                           'type' => 'date',
-                                           'width' => 70,
+                             'gebiet' => array(
+                                           'name' => 'Gebiet',
+                                           'sql' => "gebiet.gebiet",
+                                           'width' => 150,
+                                           'specs' => "filterUI: 't'",
                                            ),
                              'kostenstelle' => array(
-                                           'name' => 'Kostenstelle',
+                                           'name' => 'Gewässer',
                                            'sql' => "kostenstellen.kostenstelle",
                                            'width' => 150,
-                                           'specs' => "filterUI: 's'",
-                                           ),
-                             'arbeitsarten' => array(
-                                           'name' => 'Arbeiten',
-                                           'sql' => "arbeitsarten.arbeitsart",
-                                           'width' => 150,
-                                           'specs' => "filterUI: 's'",
+                                           'specs' => "filterUI: 't'",
                                            ),
-                             'stunden' => array(
-                                           'name' => 'Personalstunden',
+                             'laenge' => array(
+                                           'name' => 'Länge',
                                            'type' => 'number',
                                            'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
                                            'width' => 60,
                                            ),
-                             'geraetstunden' => array(
-                                           'name' => 'Gerätstunden',
+                             'personalstunden' => array(
+                                           'name' => 'Personalstunden',
                                            'type' => 'number',
                                            'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
                                            'width' => 60,
+                                           'sql' => "(SELECT sum(stunden) FROM einsatzpersonal WHERE einsatz IN " .
+                                                    "(SELECT id FROM einsatz WHERE kostenstelle = kostenstellen.id " .
+                                                    "AND date_part('year', datum) = " . $_SESSION['overview_kostenstellen.year'] . "))",
                                            ),
-                             'gesamtstunden' => array(
-                                           'name' => 'Gesamtstunden',
+                             'geraetstunden' => array(
+                                           'name' => 'Gerätestunden',
                                            'type' => 'number',
                                            'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
                                            'width' => 60,
-                                           'sql' => 'stunden + geraetstunden',
+                                           'sql' => "(SELECT sum(stunden) FROM einsatzgeraete WHERE einsatz IN " .
+                                                    "(SELECT id FROM einsatz WHERE kostenstelle = kostenstellen.id " .
+                                                    "AND date_part('year', datum) = " . $_SESSION['overview_kostenstellen.year'] . "))",
                                            ),
                              'stdlfdm' => array(
                                            'name' => 'Stunden pro lfdm',
                                            'type' => 'number',
                                            'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
                                            'width' => 60,
-                                           'sql' => '(stunden + geraetstunden) / laenge',
+                                           'sql' => "((SELECT sum(stunden) FROM einsatzpersonal WHERE einsatz IN " .
+                                                    "(SELECT id FROM einsatz WHERE kostenstelle = kostenstellen.id " .
+                                                    "AND date_part('year', datum) = " . $_SESSION['overview_kostenstellen.year'] . ")) + ".
+                                                    "(SELECT sum(stunden) FROM einsatzgeraete WHERE einsatz IN " .
+                                                    "(SELECT id FROM einsatz WHERE kostenstelle = kostenstellen.id " .
+                                                    "AND date_part('year', datum) = " . $_SESSION['overview_kostenstellen.year'] . "))) / laenge",
                                            ),
                              ),
              );