Adjust form to new table einsatz and co.
[misc/kostenrechnung] / masks / overview_kosten.php
1 <?php
2
3 include_once($_SESSION['sys']['basedir'].'/lib/overview_utils.php');
4
5 if (empty($_SESSION['overview_kosten.year'])) $_SESSION['overview_kosten.year'] = 0;
6
7 $mask = array(
8               'table' => 'einsatz',
9               'title' => 'Kostenaufwand für Kostenstellen',
10               'join' => array(
11                               'einsatzpersonal ON einsatzpersonal.einsatz = einsatz.id',
12                               'einsatzgeraete ON einsatzgeraete.einsatz = einsatz.id',
13                               'personal ON einsatzpersonal.personal = personal.id',
14                               'gerate ON einsatzgeraete.geraet = gerate.id',
15                               'anbaugeraete ON einsatzgeraete.anbaugeraet = anbaugeraete.id',
16                               'arbeitsarten ON einsatz.arbeiten = arbeitsarten.id',
17                               'gebiet ON einsatz.gebiet = gebiet.id',
18                               'kostenstellen ON einsatz.kostenstelle = kostenstellen.id',
19                               ),
20               'where' => "arbeitsarten.arbeitsart <> 'Urlaub' AND arbeitsarten.arbeitsart <> 'Krank' AND arbeitsarten.arbeitsart <> 'Sonstige Fehltage'"
21                        . " AND date_part('year', datum) = " . $_SESSION['overview_kosten.year']
22                        . " GROUP BY einsatz.id,gebiet.gebiet,kostenstellen.kostenstelle,kostenstellen.id,personal.name,personal.vorname,gerate.geraet,laenge",
23               'select' => array(
24                                 'title' => 'Auswahl',
25                                 'options' => discover_years(),
26                                 'default' => 'Jahr wählen',
27                                 'selected' => $_SESSION['overview_kosten.year'],
28                                 'onchange' => "setvar(this,'year',select_year_calback,select_year_status)",
29                                 ),
30               'variables' => array(
31                                    'year' => array(),
32                                    ),
33               'list' => array(
34                               'id' => array(
35                                             'name' => 'ID',
36                                             'visible' => false,
37                                             'width' => 60,
38                                             'sql' => 'einsatz.id',
39                                             ),
40                               'gebiet' => array(
41                                             'name' => 'Gebiet',
42                                             'sql' => "gebiet.gebiet",
43                                             'width' => 150,
44                                             'specs' => "filterUI: 's'",
45                                             ),
46                               'kostenstelle' => array(
47                                             'name' => 'Kostenstelle',
48                                             'sql' => "kostenstellen.kostenstelle",
49                                             'width' => 250,
50                                             'specs' => "filterUI: 's'",
51                                             ),
52                               'personal' => array(
53                                             'name' => 'Mitarbeiter',
54                                             'sql' => "personal.vorname || ' ' || personal.name",
55                                             'width' => 150,
56                                             'specs' => "filterUI: 's'",
57                                             ),
58                               'geraet' => array(
59                                             'name' => 'Gerät',
60                                             'sql' => "gerate.geraet",
61                                             'width' => 150,
62                                             'specs' => "filterUI: 's'",
63                                             ),
64                               'laenge' => array(
65                                             'name' => 'Länge',
66                                             'type' => 'number',
67                                             'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
68                                             'width' => 70,
69                                             ),
70                               'personalkosten' => array(
71                                             'name' => 'Mitarbeiterkosten',
72                                             'type' => 'number',
73                                             'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
74                                             'width' => 90,
75                                             'sql' => 'sum(einsatzpersonal.stunden * personal.persstdsatz)',
76                                             ),
77                               'geraetkosten' => array(
78                                             'name' => 'Gerätkosten',
79                                             'type' => 'number',
80                                             'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
81                                             'width' => 90,
82                                             'sql' => 'sum(einsatzgeraete.stunden * gerate.geraetkst_intern + ' .
83                                                      'einsatzgeraete.stunden * anbaugeraete.anbkst_intern)',
84                                             ),
85                               'gesamtkosten' => array(
86                                             'name' => 'Gesamtkosten',
87                                             'type' => 'number',
88                                             'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
89                                             'width' => 90,
90                                             'sql' => 'sum(einsatzpersonal.stunden * personal.persstdsatz + ' . 
91                                                      'einsatzgeraete.stunden * gerate.geraetkst_intern + ' .
92                                                      'einsatzgeraete.stunden * anbaugeraete.anbkst_intern)',
93                                             ),
94                               'prolfdm' => array(
95                                             'name' => 'pro lfdm',
96                                             'type' => 'number',
97                                             'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
98                                             'width' => 60,
99                                             'sql' => 'sum(einsatzpersonal.stunden * personal.persstdsatz + ' . 
100                                                      'einsatzgeraete.stunden * gerate.geraetkst_intern + ' .
101                                                      'einsatzgeraete.stunden * anbaugeraete.anbkst_intern) / laenge',
102                                             ),
103                               ),
104               );
105
106 ?>