Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| ExchangeRequestscope | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace BO\Zmsdb\Query; |
| 4 | |
| 5 | class ExchangeRequestscope extends Base |
| 6 | { |
| 7 | /** |
| 8 | * @var String TABLE mysql table reference |
| 9 | */ |
| 10 | const TABLE = 'statistik'; |
| 11 | |
| 12 | const REQUESTTABLE = 'request'; |
| 13 | |
| 14 | const QUERY_READ_REPORT = ' |
| 15 | SELECT |
| 16 | s.`standortid` as scopeid, |
| 17 | s.`behoerdenid` as departmentid, |
| 18 | s.`organisationsid` as organisationid, |
| 19 | DATE_FORMAT(s.`Datum`, :groupby) as date, |
| 20 | ( |
| 21 | CASE |
| 22 | WHEN s.anliegenid = -1 THEN "Dienstleistung wurde nicht erfasst" |
| 23 | WHEN s.anliegenid = 0 THEN "Dienstleistung konnte nicht erbracht werden" |
| 24 | ELSE r.name |
| 25 | END |
| 26 | ) as name, |
| 27 | COUNT(s.anliegenid) as requestscount, |
| 28 | AVG(s.bearbeitungszeit) as processingtime |
| 29 | FROM ' . self::TABLE . ' AS s |
| 30 | LEFT JOIN ' . self::REQUESTTABLE . ' as r ON r.id = s.anliegenid |
| 31 | WHERE s.`standortid` IN (:scopeid) AND s.`Datum` BETWEEN :datestart AND :dateend |
| 32 | GROUP BY date, s.anliegenid |
| 33 | ORDER BY r.name |
| 34 | '; |
| 35 | |
| 36 | const QUERY_SUBJECTS = ' |
| 37 | SELECT |
| 38 | scope.`StandortID` as subject, |
| 39 | periodstart, |
| 40 | periodend, |
| 41 | CONCAT(scope.`Bezeichnung`, " ", scope.`standortinfozeile`) AS description |
| 42 | FROM ' . Scope::TABLE . ' AS scope |
| 43 | INNER JOIN |
| 44 | ( |
| 45 | SELECT |
| 46 | s.standortid as scopeid, |
| 47 | MIN(s.`datum`) AS periodstart, |
| 48 | MAX(s.`datum`) AS periodend |
| 49 | FROM ' . self::TABLE . ' s |
| 50 | group by scopeid |
| 51 | ) |
| 52 | maxAndminDate ON maxAndminDate.`scopeid` = scope.`StandortID` |
| 53 | GROUP BY scope.`StandortID` |
| 54 | ORDER BY scope.`StandortID` ASC |
| 55 | '; |
| 56 | |
| 57 | const QUERY_PERIODLIST_MONTH = ' |
| 58 | SELECT date |
| 59 | FROM ' . Scope::TABLE . ' AS scope |
| 60 | INNER JOIN ( |
| 61 | SELECT |
| 62 | `StandortID`, |
| 63 | DATE_FORMAT(`Datum`,"%Y-%m") AS date |
| 64 | FROM ' . self::TABLE . ' |
| 65 | ) s ON scope.`StandortID` = s.`standortid` |
| 66 | WHERE scope.`StandortID` = :scopeid |
| 67 | GROUP BY date |
| 68 | ORDER BY date ASC |
| 69 | '; |
| 70 | } |