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 | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ExchangeClientscope | n/a | 0 / 0 | n/a | 0 / 0 | 0 | n/a | 0 / 0 | |||
| 1 | <?php | |
| 2 | ||
| 3 | namespace BO\Zmsbackend\Exchange\Repository; | |
| 4 | ||
| 5 | class ExchangeClientscope extends \BO\Zmsbackend\Query\Base | |
| 6 | { | |
| 7 | /** | |
| 8 | * @var String TABLE mysql table reference | |
| 9 | */ | |
| 10 | const string TABLE = 'statistik'; | |
| 11 | ||
| 12 | const string BATABLE = 'buergeranliegen'; | |
| 13 | ||
| 14 | const QUERY_READ_REPORT = ' | |
| 15 | SELECT | |
| 16 | MIN(subjectid) as subjectid, | |
| 17 | date, | |
| 18 | SUM(clientscount) as clientscount, | |
| 19 | SUM(missed) as missed, | |
| 20 | SUM(withappointment) as withappointment, | |
| 21 | SUM(missedwithappointment) as missedwithappointment, | |
| 22 | SUM(requestcount) as requestcount, | |
| 23 | SUM(ticketprinter) as ticketprinter, | |
| 24 | SUM(ticketprintermissed) as ticketprintermissed | |
| 25 | ||
| 26 | FROM ( | |
| 27 | SELECT | |
| 28 | StandortID as subjectid, | |
| 29 | IFNULL(DATE_FORMAT(`Datum`, :groupby), 0) as date, | |
| 30 | SUM(IF(`nicht_erschienen`=0,AnzahlPersonen,0)) as clientscount, | |
| 31 | SUM(IF(`nicht_erschienen`=1,AnzahlPersonen,0)) as missed, | |
| 32 | SUM(IF(`nicht_erschienen`=0 AND mitTermin=1,AnzahlPersonen,0)) as withappointment, | |
| 33 | SUM(IF(`nicht_erschienen`=1 AND mitTermin=1,AnzahlPersonen,0)) as missedwithappointment, | |
| 34 | 0 AS requestcount, | |
| 35 | SUM(IF(`nicht_erschienen`=0 AND mitTermin=0 AND is_ticketprinter=1,AnzahlPersonen,0)) as ticketprinter, | |
| 36 | SUM(IF(`nicht_erschienen`=1 AND mitTermin=0 AND is_ticketprinter=1,AnzahlPersonen,0)) as ticketprintermissed | |
| 37 | FROM ' . \BO\Zmsbackend\Process\Repository\ProcessStatusArchived::TABLE . ' | |
| 38 | WHERE `StandortID` IN (:scopeids) AND `Datum` BETWEEN :datestart AND :dateend | |
| 39 | GROUP BY date | |
| 40 | ||
| 41 | UNION ALL | |
| 42 | SELECT | |
| 43 | StandortID as subjectid, | |
| 44 | IFNULL(DATE_FORMAT(`Datum`, :groupby), 0) as date, | |
| 45 | 0 AS clientscount, | |
| 46 | 0 AS missed, | |
| 47 | 0 AS withappointment, | |
| 48 | 0 AS missedwithappointment, | |
| 49 | COUNT(IF(ba.AnliegenID > 0, ba.AnliegenID, null)) as requestcount, | |
| 50 | 0 AS ticketprinter, | |
| 51 | 0 AS ticketprintermissed | |
| 52 | FROM ' . \BO\Zmsbackend\Process\Repository\ProcessStatusArchived::TABLE . ' a | |
| 53 | LEFT JOIN ' . self::BATABLE . ' as ba ON a.BuergerarchivID = ba.BuergerarchivID | |
| 54 | WHERE `StandortID` IN (:scopeids) AND `Datum` BETWEEN :datestart AND :dateend AND nicht_erschienen=0 | |
| 55 | GROUP BY date | |
| 56 | ) as unionresult | |
| 57 | GROUP BY date; | |
| 58 | '; | |
| 59 | ||
| 60 | const QUERY_SUBJECTS = ' | |
| 61 | SELECT | |
| 62 | scope.`StandortID` as subject, | |
| 63 | periodstart, | |
| 64 | periodend, | |
| 65 | CONCAT(scope.`Bezeichnung`, " ", scope.`standortinfozeile`) AS description | |
| 66 | FROM ' . \BO\Zmsbackend\Query\Scope::TABLE . ' AS scope | |
| 67 | INNER JOIN | |
| 68 | ( | |
| 69 | SELECT | |
| 70 | s.standortid as scopeid, | |
| 71 | MIN(s.`datum`) AS periodstart, | |
| 72 | MAX(s.`datum`) AS periodend | |
| 73 | FROM ' . self::TABLE . ' s | |
| 74 | group by scopeid | |
| 75 | ) | |
| 76 | maxAndminDate ON maxAndminDate.`scopeid` = scope.`StandortID` | |
| 77 | GROUP BY scope.`StandortID` | |
| 78 | ORDER BY scope.`StandortID` ASC | |
| 79 | '; | |
| 80 | ||
| 81 | const QUERY_PERIODLIST_MONTH = ' | |
| 82 | SELECT date | |
| 83 | FROM ' . \BO\Zmsbackend\Query\Scope::TABLE . ' AS scope | |
| 84 | INNER JOIN ( | |
| 85 | SELECT | |
| 86 | `StandortID`, | |
| 87 | DATE_FORMAT(`Datum`,"%Y-%m") AS date | |
| 88 | FROM ' . self::TABLE . ' | |
| 89 | ) s ON scope.`StandortID` = s.`standortid` | |
| 90 | WHERE scope.`StandortID` = :scopeid | |
| 91 | GROUP BY date | |
| 92 | ORDER BY date ASC | |
| 93 | '; | |
| 94 | } |