Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| ExchangeWaitingorganisation | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace BO\Zmsdb\Query; |
| 4 | |
| 5 | class ExchangeWaitingorganisation extends Base |
| 6 | { |
| 7 | /** |
| 8 | * @var String TABLE mysql table reference |
| 9 | */ |
| 10 | const TABLE = 'wartenrstatistik'; |
| 11 | |
| 12 | const QUERY_READ_DAY = ' |
| 13 | SELECT |
| 14 | w.`datum`, |
| 15 | ' . ExchangeWaitingscope::WAITING_VALUES . ' |
| 16 | FROM ' . self::TABLE . ' as w |
| 17 | LEFT JOIN ' . Scope::TABLE . ' AS s ON w.`standortid` = s.`StandortID` |
| 18 | LEFT JOIN ' . Department::TABLE . ' AS d ON s.`BehoerdenID` = d.`BehoerdenID` |
| 19 | LEFT JOIN ' . Organisation::TABLE . ' AS o ON o.`OrganisationsID` = d.`OrganisationsID` |
| 20 | WHERE |
| 21 | o.`OrganisationsID` = :organisationid |
| 22 | AND `datum` BETWEEN :datestart AND :dateend |
| 23 | GROUP BY w.`datum` ASC |
| 24 | ORDER BY w.`datum` ASC |
| 25 | '; |
| 26 | |
| 27 | //PLEASE REMEMBER THE REALY COOL DYNAMIC VERSION |
| 28 | const QUERY_READ_MONTH = ' |
| 29 | SELECT |
| 30 | DATE_FORMAT(w.`datum`, "%Y-%m") as datum, |
| 31 | ' . ExchangeWaitingscope::WAITING_VALUES . ' |
| 32 | FROM ' . self::TABLE . ' as w |
| 33 | LEFT JOIN ' . Scope::TABLE . ' AS s ON w.`standortid` = s.`StandortID` |
| 34 | LEFT JOIN ' . Department::TABLE . ' AS d ON s.`BehoerdenID` = d.`BehoerdenID` |
| 35 | LEFT JOIN ' . Organisation::TABLE . ' AS o ON o.`OrganisationsID` = d.`OrganisationsID` |
| 36 | WHERE |
| 37 | o.`OrganisationsID` = :organisationid AND |
| 38 | w.`datum` BETWEEN :datestart AND :dateend |
| 39 | GROUP BY DATE_FORMAT(w.`datum`, "%Y-%m") |
| 40 | ORDER BY DATE_FORMAT(w.`datum`, "%Y-%m") ASC |
| 41 | '; |
| 42 | |
| 43 | const QUERY_READ_QUARTER = ' |
| 44 | SELECT |
| 45 | CONCAT(YEAR(w.`datum`),"-",QUARTER(w.`datum`)) as datum, |
| 46 | ' . ExchangeWaitingscope::WAITING_VALUES . ' |
| 47 | FROM ' . self::TABLE . ' as w |
| 48 | LEFT JOIN ' . Scope::TABLE . ' AS s ON w.`standortid` = s.`StandortID` |
| 49 | LEFT JOIN ' . Department::TABLE . ' AS d ON s.`BehoerdenID` = d.`BehoerdenID` |
| 50 | LEFT JOIN ' . Organisation::TABLE . ' AS o ON o.`OrganisationsID` = d.`OrganisationsID` |
| 51 | WHERE |
| 52 | o.`OrganisationsID` = :organisationid AND |
| 53 | w.`datum` BETWEEN :datestart AND :dateend |
| 54 | GROUP BY CONCAT(YEAR(w.`datum`),"-",QUARTER(w.`datum`)) |
| 55 | ORDER BY CONCAT(YEAR(w.`datum`),"-",QUARTER(w.`datum`)) ASC |
| 56 | '; |
| 57 | |
| 58 | const QUERY_SUBJECTS = ' |
| 59 | SELECT |
| 60 | d.`OrganisationsID` as subject, |
| 61 | MIN(`datum`) AS periodstart, |
| 62 | MAX(`datum`) AS periodend, |
| 63 | o.`Organisationsname` AS description |
| 64 | FROM ' . self::TABLE . ' AS w |
| 65 | LEFT JOIN ' . Scope::TABLE . ' AS s ON w.`standortid` = s.`StandortID` |
| 66 | LEFT JOIN ' . Department::TABLE . ' AS d ON s.`BehoerdenID` = d.`BehoerdenID` |
| 67 | LEFT JOIN ' . Organisation::TABLE . ' AS o ON d.`OrganisationsID` = o.`OrganisationsID` |
| 68 | GROUP BY o.`OrganisationsID` |
| 69 | ORDER BY o.`OrganisationsID` ASC, periodstart DESC |
| 70 | '; |
| 71 | |
| 72 | const QUERY_PERIODLIST_DAY = ' |
| 73 | SELECT |
| 74 | `datum` |
| 75 | FROM ' . self::TABLE . ' AS w |
| 76 | LEFT JOIN ' . Scope::TABLE . ' AS s ON w.`standortid` = s.`StandortID` |
| 77 | LEFT JOIN ' . Department::TABLE . ' AS d ON s.`BehoerdenID` = d.`BehoerdenID` |
| 78 | LEFT JOIN ' . Organisation::TABLE . ' AS o ON d.`OrganisationsID` = o.`OrganisationsID` |
| 79 | WHERE |
| 80 | o.`OrganisationsID` = :organisationid |
| 81 | ORDER BY `datum` ASC |
| 82 | '; |
| 83 | |
| 84 | const QUERY_PERIODLIST_MONTH = ' |
| 85 | SELECT DISTINCT |
| 86 | DATE_FORMAT(`datum`,"%Y-%m") AS date |
| 87 | FROM ' . self::TABLE . ' AS w |
| 88 | LEFT JOIN ' . Scope::TABLE . ' AS s ON w.`standortid` = s.`StandortID` |
| 89 | LEFT JOIN ' . Department::TABLE . ' AS d ON s.`BehoerdenID` = d.`BehoerdenID` |
| 90 | LEFT JOIN ' . Organisation::TABLE . ' AS o ON d.`OrganisationsID` = o.`OrganisationsID` |
| 91 | WHERE |
| 92 | o.`OrganisationsID` = :organisationid |
| 93 | ORDER BY `datum` ASC |
| 94 | '; |
| 95 | } |