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