Adjust form to new table einsatz and co.
[misc/kostenrechnung] / masks / overview_kosten.php
index 7800dfc..6196b12 100644 (file)
@@ -7,16 +7,19 @@ if (empty($_SESSION['overview_kosten.year'])) $_SESSION['overview_kosten.year']
 $mask = array(
              'table' => 'einsatz',
              'title' => 'Kostenaufwand f├╝r Kostenstellen',
-             'join' => array('personal ON einsatz.personal = personal.id',
-                             'gerate ON einsatz.geraet = gerate.id',
-                             'anbaugeraete ON einsatz.anbaugeraet = anbaugeraete.id',
+             'join' => array(
+                             'einsatzpersonal ON einsatzpersonal.einsatz = einsatz.id',
+                             'einsatzgeraete ON einsatzgeraete.einsatz = einsatz.id',
+                             'personal ON einsatzpersonal.personal = personal.id',
+                             'gerate ON einsatzgeraete.geraet = gerate.id',
+                             'anbaugeraete ON einsatzgeraete.anbaugeraet = anbaugeraete.id',
                              'arbeitsarten ON einsatz.arbeiten = arbeitsarten.id',
                              'gebiet ON einsatz.gebiet = gebiet.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_kosten.year']
-                      . " GROUP BY gebiet.gebiet,kostenstellen.kostenstelle,kostenstellen.id,personal.name,personal.vorname,gerate.geraet,laenge",
+                      . " GROUP BY einsatz.id,gebiet.gebiet,kostenstellen.kostenstelle,kostenstellen.id,personal.name,personal.vorname,gerate.geraet,laenge",
              'select' => array(
                                'title' => 'Auswahl',
                                'options' => discover_years(),
@@ -31,7 +34,8 @@ $mask = array(
                              'id' => array(
                                            'name' => 'ID',
                                            'visible' => false,
-                                           'sql' => 'kostenstellen.id',
+                                           'width' => 60,
+                                           'sql' => 'einsatz.id',
                                            ),
                              'gebiet' => array(
                                            'name' => 'Gebiet',
@@ -68,33 +72,33 @@ $mask = array(
                                            'type' => 'number',
                                            'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
                                            'width' => 90,
-                                           'sql' => 'sum(stunden * personal.persstdsatz)',
+                                           'sql' => 'sum(einsatzpersonal.stunden * personal.persstdsatz)',
                                            ),
                              'geraetkosten' => array(
                                            'name' => 'Ger├Ątkosten',
                                            'type' => 'number',
                                            'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
                                            'width' => 90,
-                                           'sql' => 'sum(geraetstunden * gerate.geraetkst_intern + ' .
-                                                    'geraetstunden * anbaugeraete.anbkst_intern)',
+                                           'sql' => 'sum(einsatzgeraete.stunden * gerate.geraetkst_intern + ' .
+                                                    'einsatzgeraete.stunden * anbaugeraete.anbkst_intern)',
                                            ),
                              'gesamtkosten' => array(
                                            'name' => 'Gesamtkosten',
                                            'type' => 'number',
                                            'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
                                            'width' => 90,
-                                           'sql' => 'sum(stunden * personal.persstdsatz + ' . 
-                                                    'geraetstunden * gerate.geraetkst_intern + ' .
-                                                    'geraetstunden * anbaugeraete.anbkst_intern)',
+                                           'sql' => 'sum(einsatzpersonal.stunden * personal.persstdsatz + ' . 
+                                                    'einsatzgeraete.stunden * gerate.geraetkst_intern + ' .
+                                                    'einsatzgeraete.stunden * anbaugeraete.anbkst_intern)',
                                            ),
                              'prolfdm' => array(
                                            'name' => 'pro lfdm',
                                            'type' => 'number',
                                            'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
                                            'width' => 60,
-                                           'sql' => 'sum(stunden * personal.persstdsatz + ' . 
-                                                    'geraetstunden * gerate.geraetkst_intern + ' .
-                                                    'geraetstunden * anbaugeraete.anbkst_intern) / laenge',
+                                           'sql' => 'sum(einsatzpersonal.stunden * personal.persstdsatz + ' . 
+                                                    'einsatzgeraete.stunden * gerate.geraetkst_intern + ' .
+                                                    'einsatzgeraete.stunden * anbaugeraete.anbkst_intern) / laenge',
                                            ),
                              ),
              );