Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 23 |
|
0.00% |
0 / 9 |
CRAP | |
0.00% |
0 / 1 |
| DeletedBuyReport | |
0.00% |
0 / 23 |
|
0.00% |
0 / 9 |
132 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| setDates | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getDeletedBuys | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
12 | |||
| getDeletedBuysArray | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setDeletedBuysArray | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getEndDate | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setEndDate | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getStartDate | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setStartDate | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BuyerKiosk\Core; |
| 4 | |
| 5 | class DeletedBuyReport extends Store { |
| 6 | public $deletedBuysArray; |
| 7 | |
| 8 | private $db; |
| 9 | private $endDate; |
| 10 | private $startDate; |
| 11 | private $store; |
| 12 | |
| 13 | |
| 14 | function __construct($dateStart, $dateEnd, $typeNum) |
| 15 | { |
| 16 | parent::__construct(); |
| 17 | $this->store = new \Store(); |
| 18 | $this->store->createStore($typeNum); |
| 19 | |
| 20 | $this->setDates($dateStart, $dateEnd); |
| 21 | |
| 22 | $this->db = dbConnectByName($this->store->getDbName()); |
| 23 | |
| 24 | $this->getDeletedBuys(); |
| 25 | } |
| 26 | public function setDates($dateStart, $dateEnd) { |
| 27 | $this->setStartDate(getDateRange($dateStart)); |
| 28 | $this->setEndDate(getDateRange($dateEnd)); |
| 29 | } |
| 30 | |
| 31 | public function getDeletedBuys() { |
| 32 | if(isset($this->db)) { |
| 33 | $query = "SELECT * FROM deletedBuys WHERE timeDeleted BETWEEN :startDate AND :endDate"; |
| 34 | $stmt = $this->db->prepare($query); |
| 35 | $stmt->bindParam(':startDate', $this->startDate['dateStart']->format("Y-m-d H:i:s")); |
| 36 | $stmt->bindParam(':endDate', $this->endDate['dateEnd']->format("Y-m-d H:i:s")); |
| 37 | $stmt->execute(); |
| 38 | while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
| 39 | $tempBuy = new \DeletedBuy($row['buyID'], $this->store->getTypeNum()); |
| 40 | $this->deletedBuysArray[] = $tempBuy; |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * @return mixed |
| 47 | */ |
| 48 | public function getDeletedBuysArray() |
| 49 | { |
| 50 | return $this->deletedBuysArray; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * @param mixed $deletedBuysArray |
| 55 | */ |
| 56 | private function setDeletedBuysArray($deletedBuysArray) |
| 57 | { |
| 58 | $this->deletedBuysArray = $deletedBuysArray; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @return mixed |
| 63 | */ |
| 64 | public function getEndDate() |
| 65 | { |
| 66 | return $this->endDate; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @param mixed $endDate |
| 71 | */ |
| 72 | private function setEndDate($endDate) |
| 73 | { |
| 74 | $this->endDate = $endDate; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * @return mixed |
| 79 | */ |
| 80 | public function getStartDate() |
| 81 | { |
| 82 | return $this->startDate; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * @param mixed $startDate |
| 87 | */ |
| 88 | private function setStartDate($startDate) |
| 89 | { |
| 90 | $this->startDate = $startDate; |
| 91 | } |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | } |