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