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