Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
ExchangeNotificationdepartment
n/a
0 / 0
n/a
0 / 0
0
n/a
0 / 0
1<?php
2
3namespace BO\Zmsdb\Query;
4
5class ExchangeNotificationdepartment extends Base
6{
7    /**
8     * @var String TABLE mysql table reference
9     */
10    const TABLE = 'abrechnung';
11
12    const QUERY_READ_REPORT = '
13        SELECT
14            d.`BehoerdenID` as subjectid,
15            DATE_FORMAT(n.`Datum`, :groupby) as date,
16            o.`Organisationsname` as organisationname,
17            d.`Name` as departmentname,
18            CONCAT(s.`Bezeichnung`, " ", s.`standortkuerzel`) AS scopename,
19            IFNULL(SUM(n.`gesendet`), 0) as notificationscount
20        FROM ' . Department::TABLE . ' AS d
21            LEFT JOIN ' . Organisation::TABLE . ' o ON o.`OrganisationsID` = d.`OrganisationsID`
22            LEFT JOIN ' . Scope::TABLE . ' s ON d.`BehoerdenID` = s.`BehoerdenID`
23            LEFT JOIN
24                ' . self::TABLE . ' n ON s.`StandortID` = n.`StandortID` AND n.`Datum` BETWEEN :datestart AND :dateend
25        WHERE
26            s.`BehoerdenID` = :departmentid 
27        GROUP BY scopename
28        ORDER BY date, scopename
29    ';
30
31    const QUERY_SUBJECTS = '
32      SELECT
33          d.`BehoerdenID` as subject,
34          MIN(n.`Datum`) AS periodstart,
35          MAX(n.`Datum`) AS periodend,
36          o.`Organisationsname` AS organisationname,
37          d.`Name` AS description
38      FROM ' . self::TABLE . ' AS n
39          LEFT JOIN ' . Scope::TABLE . ' AS s ON n.`standortid` = s.`StandortID`
40          INNER JOIN ' . Department::TABLE . ' AS d ON s.`BehoerdenID` = d.`BehoerdenID`
41          LEFT JOIN ' . Organisation::TABLE . ' AS o ON d.`OrganisationsID` = o.`OrganisationsID`
42      GROUP BY d.`BehoerdenID`
43      ORDER BY d.`BehoerdenID` ASC
44    ';
45
46    const QUERY_PERIODLIST_MONTH = '
47        SELECT
48            DATE_FORMAT(n.datum,"%Y-%m") AS date
49        FROM ' . self::TABLE . ' AS n
50            LEFT JOIN ' . Scope::TABLE . ' AS s ON n.`standortid` = s.`StandortID`
51            LEFT JOIN ' . Department::TABLE . ' AS d ON s.`BehoerdenID` = d.`BehoerdenID`
52        WHERE d.`BehoerdenID` = :departmentid
53        GROUP BY date
54        ORDER BY date ASC
55    ';
56}