Update filter select elements after selecting a new year
[misc/kostenrechnung] / masks / overview_kostenstellen.php
1 <?php
2
3 $jscode[] = <<<EOC
4
5 function select_year_calback(data)
6 {
7   grid_update(grid);
8   grid_update_filters(grid);
9 }
10
11 function select_year_status(obj, value, html)
12 {
13   if (value.length)
14     info('Jahr ' + value + ' ausgewählt');
15   else
16     info('');
17 }
18 EOC;
19
20 include_once($_SESSION['sys']['basedir'].'/lib/overview_utils.php');
21
22 if (empty($_SESSION['overview_kostenstellen.year'])) $_SESSION['overview_kostenstellen.year'] = 0;
23
24 $mask = array(
25               'table' => 'einsatz',
26               'title' => 'Einsatzübersicht nach Kostenstellen',
27               'join' => array('arbeitsarten ON einsatz.arbeiten = arbeitsarten.id',
28                               'kostenstellen ON einsatz.kostenstelle = kostenstellen.id',
29                               ),
30               'where' => "arbeitsarten.arbeitsart <> 'Urlaub' AND arbeitsarten.arbeitsart <> 'Krank' AND arbeitsarten.arbeitsart <> 'Sonstige Fehltage'"
31                        . " AND date_part('year', datum) = " . $_SESSION['overview_kostenstellen.year'],
32               'select' => array(
33                                 'title' => 'Auswahl',
34                                 'options' => discover_years(),
35                                 'default' => 'Jahr wählen',
36                                 'selected' => $_SESSION['overview_kostenstellen.year'],
37                                 'onchange' => "setvar(this,'year',select_year_calback,select_year_status)",
38                                 ),
39               'variables' => array(
40                                    'year' => array(),
41                                    ),
42               'list' => array(
43                               'id' => array(
44                                             'name' => 'ID',
45                                             'visible' => false,
46                                             'sql' => 'einsatz.id',
47                                             ),
48                               'datum' => array(
49                                             'name' => 'Datum',
50                                             'type' => 'date',
51                                             'width' => 70,
52                                             ),
53                               'kostenstelle' => array(
54                                             'name' => 'Kostenstelle',
55                                             'sql' => "kostenstellen.kostenstelle",
56                                             'width' => 150,
57                                             'specs' => "filterUI: 's'",
58                                             ),
59                               'arbeitsarten' => array(
60                                             'name' => 'Arbeiten',
61                                             'sql' => "arbeitsarten.arbeitsart",
62                                             'width' => 150,
63                                             'specs' => "filterUI: 's'",
64                                             ),
65                               'stunden' => array(
66                                             'name' => 'Personalstunden',
67                                             'type' => 'number',
68                                             'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
69                                             'width' => 60,
70                                             ),
71                               'geraetstunden' => array(
72                                             'name' => 'Gerätstunden',
73                                             'type' => 'number',
74                                             'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
75                                             'width' => 60,
76                                             ),
77                               'gesamtstunden' => array(
78                                             'name' => 'Gesamtstunden',
79                                             'type' => 'number',
80                                             'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
81                                             'width' => 60,
82                                             'sql' => 'stunden + geraetstunden',
83                                             ),
84                               'stdlfdm' => array(
85                                             'name' => 'Stunden pro lfdm',
86                                             'type' => 'number',
87                                             'specs' => "decPlaces: 2, ClassName: 'alignright', suffix: '&nbsp;', canSort: false",
88                                             'width' => 60,
89                                             'sql' => '(stunden + geraetstunden) / laenge',
90                                             ),
91                               ),
92               );
93
94 ?>