Code Coverage  | 
      ||||||||||
Lines  | 
       Functions and Methods  | 
       Classes and Traits  | 
      ||||||||
| Total | n/a  | 
       0 / 0  | 
       n/a  | 
       0 / 0  | 
       CRAP | n/a  | 
       0 / 0  | 
      |||
| ExchangeWaitingowner | n/a  | 
       0 / 0  | 
       n/a  | 
       0 / 0  | 
       0 | n/a  | 
       0 / 0  | 
      |||
| 1 | <?php | 
| 2 | |
| 3 | namespace BO\Zmsdb\Query; | 
| 4 | |
| 5 | class ExchangeWaitingowner 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 ' . Owner::TABLE . ' AS own ON own.`KundenID` = d.`KundenID` | 
| 20 | WHERE | 
| 21 | own.`KundenID` = :ownerid | 
| 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 ' . Owner::TABLE . ' AS own ON own.`KundenID` = d.`KundenID` | 
| 36 | WHERE | 
| 37 | own.`KundenID` = :ownerid | 
| 38 | AND 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 ' . Owner::TABLE . ' AS own ON own.`KundenID` = d.`KundenID` | 
| 51 | WHERE | 
| 52 | own.`KundenID` = :ownerid 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 | own.`KundenID` as subject, | 
| 61 | MIN(`datum`) AS periodstart, | 
| 62 | MAX(`datum`) AS periodend, | 
| 63 | own.`Kundenname` 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 ' . Owner::TABLE . ' AS own ON own.`KundenID` = d.`KundenID` | 
| 68 | GROUP BY own.`KundenID` | 
| 69 | ORDER BY own.`KundenID` 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 ' . Owner::TABLE . ' AS own ON own.`KundenID` = d.`KundenID` | 
| 79 | WHERE | 
| 80 | own.`KundenID` = :ownerid | 
| 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 ' . Owner::TABLE . ' AS own ON own.`KundenID` = d.`KundenID` | 
| 91 | WHERE | 
| 92 | own.`KundenID` = :ownerid | 
| 93 | ORDER BY `datum` ASC | 
| 94 | '; | 
| 95 | } |