public function execute() { $this->checkinCounts = PHPWS_DB::getAssoc("select hall_name, count(*) from hms_checkin JOIN hms_hall_structure ON hms_checkin.bed_id = hms_hall_structure.bedid WHERE term = {$this->term} and checkout_date IS NULL GROUP BY hall_name ORDER BY hall_name"); if (PHPWS_Error::isError($this->checkinCounts)) { throw new DatabaseException($this->checkinCounts->toString()); } }
public function execute() { PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php'); foreach ($this->getHalls() as $hall) { $hallCount = PHPWS_DB::getAssoc("select reason, count(*) from hms_assignment JOIN hms_bed ON hms_assignment.bed_id = hms_bed.id JOIN hms_room ON hms_bed.room_id = hms_room.id JOIN hms_floor ON hms_room.floor_id = hms_floor.id JOIN hms_residence_hall ON hms_floor.residence_hall_id = hms_residence_hall.id where hms_residence_hall.id = {$hall->getId()} AND hms_assignment.term = {$this->getTerm()} group by reason order by reason"); if (PHPWS_Error::isError($hallCount)) { throw new DatabaseException($hallCount->toString()); } $this->hallCounts[$hall->getId()] = $hallCount; $floors = $hall->get_floors(); foreach ($floors as $floor) { $floorCount = PHPWS_DB::getAssoc("select reason, count(*) from hms_assignment JOIN hms_bed ON hms_assignment.bed_id = hms_bed.id JOIN hms_room ON hms_bed.room_id = hms_room.id JOIN hms_floor ON hms_room.floor_id = hms_floor.id where hms_floor.id = {$floor->getId()} AND hms_assignment.term = {$this->getTerm()} group by reason order by reason"); if (PHPWS_Error::isError($floorCount)) { throw new DatabaseException($floorCount->toString()); } $this->floorCounts[$floor->getId()] = $floorCount; } } }