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