Esempio n. 1
0
 public function getSignups()
 {
     return Signup::model()->findAllBySql('select signup.* 
           from signup
           left join class_info
            on signup.class_id = class_info.id
           where signup.student_id = :stid
             and class_info.session_id = :ssid', array('ssid' => ClassSession::savedSessionId(), 'stid' => $this->id));
 }
Esempio n. 2
0
 /**
  * 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['class_id'])) {
             // XXX this is stupid and tedious. fix.
             $this->_model = Signup::model()->findbyPk(array('student_id' => $_GET['student_id'], 'class_id' => $_GET['class_id']));
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
Esempio n. 3
0
 /**
  * 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.
  * @param integer $id the ID of the model to be loaded
  * @return Signup the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Signup::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 4
0
 public function getSignup()
 {
     return Signup::model()->find(array("condition" => "(class_id = :cid and student_id = :sid)", 'params' => array('cid' => $this->class_id, 'sid' => $this->student_id)));
 }
Esempio n. 5
0
 public function actionDunningReport()
 {
     $s = Signup::model()->findAllBySql("select\n     (if(signup.status != 'Enrolled', 0,\n        (class_info.cost_per_class * meeting.meetings) +\n           coalesce(fees.total,0))\n       -  coalesce(income_summary.paid, 0)) as total_owed,\n     signup.*\nfrom signup\nleft join student\n  on student.id = signup.student_id\nleft join class_info\n  on class_info.id = signup.class_id\n     and class_info.session_id = :sid\nleft join (select count(class_meeting.id) as meetings,\n     class_meeting.class_id as class_id\n     from class_meeting\n     where  class_meeting.makeup < 1\n     group by class_meeting.class_id) \n     as meeting\n  on signup.class_id = meeting.class_id\nleft join (\n    select sum(extra_fee.amount) as total,\n    extra_fee.class_id as class_id\n    from extra_fee\n    group by extra_fee.class_id\n    )\n   as fees\n     on signup.class_id = fees.class_id\nleft join (\n     select sum(income.amount) as paid ,\n     income.class_id as class_id,\n     income.student_id as student_id\n     from income\n     left join check_income\n        on check_income.id = income.check_id\n        and (check_income.returned is null\n                   or check_income.returned < '2000-01-01')\n     group by income.class_id, income.student_id)\n     as income_summary\n on signup.class_id = income_summary.class_id\n      and signup.student_id = income_summary.student_id\nwhere signup.class_id is not null\n      and signup.student_id is not null\n       and signup.scholarship < 1\n        and signup.status = 'Enrolled'\ngroup by signup.class_id, signup.student_id\nhaving total_owed != 0\norder by student.first_name, student.last_name, class_info.class_name\n", array('sid' => ClassSession::savedSessionId()));
     $this->render('dunning_report', array('results' => $s));
 }
Esempio n. 6
0
 public function getSortedNoCancelled()
 {
     return Signup::model()->findAllBySql("select signup.*\n       from signup\n       left join student on student.id = signup.student_id\n      where signup.class_id = :cid\n      and signup.status != 'Cancelled'\n      order by FIND_IN_SET(status, 'Enrolled,Waitlist'), \n        signup.signup_date asc, student.last_name ASC, student.first_name ASC\n      ", array('cid' => $this->id));
 }