Adjust form to new table einsatz and co.
[misc/kostenrechnung] / masks / kosten_geraete.php
1 <?php
2
3 include_once($_SESSION['sys']['basedir'].'/lib/overview_utils.php');
4
5 if (empty($_SESSION['kosten_geraete.year'])) $_SESSION['kosten_geraete.year'] = 0;
6
7 $mask = array(
8               'table' => 'einsatz',
9               'title' => 'Kostenaufwand für Geräte',
10               'join' => array('gerate ON einsatz.geraet = gerate.id',
11                               'anbaugeraete ON einsatz.anbaugeraet = anbaugeraete.id',
12                               'arbeitsarten ON einsatz.arbeiten = arbeitsarten.id',
13                               'kostenstellen ON einsatz.kostenstelle = kostenstellen.id',
14                               ),
15               'where' => "arbeitsarten.arbeitsart <> 'Urlaub' AND arbeitsarten.arbeitsart <> 'Krank' AND arbeitsarten.arbeitsart <> 'Sonstige Fehltage'"
16                        . " AND date_part('year', datum) = " . $_SESSION['kosten_geraete.year']
17                        . " GROUP BY gerate.id,gerate.geraet,kostenstellen.kostenstelle,laenge",
18               'select' => array(
19                                 'title' => 'Auswahl',
20                                 'options' => discover_years(),
21                                 'default' => 'Jahr wählen',
22                                 'selected' => $_SESSION['kosten_geraete.year'],
23                                 'onchange' => "setvar(this,'year',select_year_calback,select_year_status)",
24                                 ),
25               'variables' => array(
26                                    'year' => array(),
27                                    ),
28               'list' => array(
29                               'id' => array(
30                                             'name' => 'ID',
31                                             'visible' => false,
32                                             'sql' => 'gerate.id',
33                                             ),
34                               'geraet' => array(
35                                             'name' => 'Gerät',
36                                             'sql' => "gerate.geraet",
37                                             'width' => 170,
38                                             'specs' => "filterUI: 's'",
39                                             ),
40                               'kostenstelle' => array(
41                                             'name' => 'Kostenstelle',
42                                             'sql' => "kostenstellen.kostenstelle",
43                                             'width' => 200,
44                                             'specs' => "filterUI: 's'",
45                                             ),
46                               'laenge' => array(
47                                             'name' => 'Länge',
48                                             'type' => 'number',
49                                             'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
50                                             'width' => 70,
51                                             ),
52                               'gesamtkosten' => array(
53                                             'name' => 'Gesamtkosten',
54                                             'type' => 'number',
55                                             'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
56                                             'width' => 90,
57                                             'sql' => 'sum(geraetstunden * gerate.geraetkst_intern + ' .
58                                                      'geraetstunden * anbaugeraete.anbkst_intern)',
59                                             ),
60                               'prolfdm' => array(
61                                             'name' => 'pro lfdm',
62                                             'type' => 'number',
63                                             'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
64                                             'width' => 60,
65                                             'sql' => 'sum(geraetstunden * gerate.geraetkst_intern + ' .
66                                                      'geraetstunden * anbaugeraete.anbkst_intern) / laenge',
67                                             ),
68                               ),
69               );
70
71 ?>