public function revenue_detail($hotelId, $acctCat) { if (!$this->securitypolicy->validateAccessRight(1, 'read')) { $this->_redirectInvalidAccess(); } $hotel = new Hotel(); $acctCat = urldecode($acctCat); # check date filters in session if ($this->session->has_userdata('revFilter')) { $dateFilterVal = $this->session->userdata('revFilter'); if (array_key_exists('start-date', $dateFilterVal)) { $sDateFilter = new DateFilter(); $sDateFilter->setFilter(array('type' => 'start', 'value' => $dateFilterVal['start-date'][0])); $hotel->addRevenueFilter($sDateFilter); } if (array_key_exists('end-date', $dateFilterVal)) { $eDateFilter = new DateFilter(); $eDateFilter->setFilter(array('type' => 'end', 'value' => $dateFilterVal['end-date'][0])); $hotel->addRevenueFilter($eDateFilter); } } $hotel->setById($hotelId); $this->_viewData['hotel'] = $hotel; $financeAccts = new FinanceAccts(); $financeAccts->setAll(); if (!is_numeric($acctCat)) { $this->_viewData['revenuedata'] = $this->_getCompositeRevenueData($hotel, $acctCat); } else { $this->_viewData['revenuedata'] = $hotel->finances->getRevenueGroup($acctCat); $acctCat = $financeAccts->getName($acctCat); } $this->_viewData['financeAccts'] = $financeAccts; $this->_viewData['title'] = $acctCat; $this->load->view('revenue_list_detail', $this->_viewData); }
/** * Sets hotel objects using database records. */ public function setByData($data) { foreach ($data as $hotelData) { $hotel = new Hotel(); $filters = new FilterCollection(); foreach ($this->_revFilters as $filter) { $hotel->addRevenueFilter($filter); } $hotel->setByData($hotelData); $hotel->getRevData(); $this->_hotels[] = $hotel; } }