public function getIncome() { return Income::model()->findAllBySql("select income.* from income \nleft join check_income\n on check_income.id = income.check_id\nwhere (class_id = :cid and student_id = :sid)\nand (check_income.returned is null or check_income.returned < '2000-01-01')", array('cid' => $this->class_id, 'sid' => $this->student_id)); }
function getIncomes() { return Income::model()->findAllBySql("select income.*\nfrom income\nleft join check_income \n on income.check_id = check_income.id\nwhere check_income.payee_id = :id\n and check_income.session_id = :sid\norder by abs(check_income.check_num) asc", array('id' => $this->id, 'sid' => ClassSession::savedSessionId())); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['student_id']) && isset($_GET['check_id']) && isset($_GET['class_id'])) { // XXX this is stupid and tedious. fix. $this->_model = Income::model()->findbyPk(array('student_id' => $_GET['student_id'], 'check_id' => $_GET['check_id'], 'class_id' => $_GET['class_id'])); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }
public function getIncomes() { return Income::model()->findAllBySql('select income.* from income left join class_info on income.class_id = class_info.id where income.student_id = :stid and class_info.session_id = :ssid', array('ssid' => ClassSession::savedSessionId(), 'stid' => $this->id)); }