Beispiel #1
0
 public function addPaymentJournal(PaymentJournal $l)
 {
     $this->collPaymentJournals[] = $l;
     $l->setAcademicCost($this);
 }
Beispiel #2
0
 public function executePrintForm()
 {
     $student = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
     #$this->forward404Unless($student);
     $payment_model = PaymentModelPeer::retrieveByPK($this->getRequestParameter('payment_model_id'));
     #$this->forward404Unless($payment_model);
     $paid_at = $this->getRequestParameter('paid_at');
     $year = $this->getRequestParameter('year');
     $c = new Criteria();
     $c->add(PaymentJournalPeer::PAYER_TYPE, PaymentJournal::PAYER_TYPE_STUDENT);
     $c->add(PaymentJournalPeer::PAYER, $student->getId());
     $c->add(PaymentJournalPeer::ACADEMIC_PROCESS_ID, 2);
     $c->add(PaymentJournalPeer::STATUS, 'S');
     $c->add(PaymentJournalPeer::PAYMENT_MODEL_ID, $payment_model->getId());
     $c->add(PaymentJournalPeer::PAID_AT, $paid_at);
     $payments = PaymentJournal::doSelect($c);
     $total_cost = 0;
     foreach ($payments as $c) {
         $total_cost += $c->getAmount();
     }
     $this->student = $student;
     $this->payment_model = $payment_model;
     $this->paid_at = $paid_at;
     $this->year = $year;
     $this->actions = $actions;
     $this->subtitle = $student->toString();
     $this->type = '';
     $this->total_cost = $total_cost;
     $this->setViewClass('sfDomPDF');
     $this->payments = $payments;
 }
Beispiel #3
0
 public function executeUpdate()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     $student = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
     $this->forward404Unless($student);
     $this->student = $student;
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $student_leave = new StudentLeave();
         $student_leave->setStatus(StudentLeave::STATUS_PROPOSED);
     } else {
         $student_leave = StudentLeavePeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($student_leave);
         $student_leave->setStatus(StudentLeave::STATUS_CANCELED);
     }
     $student_leave->setId($this->getRequestParameter('id'));
     $student_leave->setStudentId($this->getRequestParameter('student_id'));
     $student_leave->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $student_leave->save();
     $stu = $student_leave->getStudent();
     if ($student_leave->getStatus() == StudentLeave::STATUS_ACTIVE) {
         // add payment journal
         $job = JobPeer::retrieveByCode($this->getModuleName());
         $academic_process = $job->getAcademicProcess();
         $c = new Criteria();
         $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, $academic_process->getId());
         $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $student_leave->getAcademicCalendarId());
         $costs = AcademicCostPeer::doSelect($c);
         foreach ($costs as $c) {
             $pj = new PaymentJournal();
             $pj->setPayer($stu->getId());
             $pj->setAcademicCost($c);
             $pj->setJob($job);
             $pj->setAmount($c->getAmount());
             $pj->setPaid($c->getAmount());
             $pj->setReceivable(0);
             $pj->setAcademicProcess($academic_process);
             $pj->setPayerType(PaymentJournal::PAYER_TYPE_STUDENT);
             $pj->save();
             $ph = new PaymentHistory();
             $ph->setPaymentJournal($pj);
             $ph->setAmount($c->getAmount());
             $ph->save();
         }
         // set student status
         $stu->setStatus(Student::STATUS_INACTIVE);
         $stu->save();
         // cancelled all student course
         $c = new Criteria();
         $c->add(StudentCoursePeer::STUDENT_ID, $stu->getId());
         $c->add(StudentCoursePeer::STATUS, array(StudentCourse::STATUS_PLANNED, StudentCourse::STATUS_APPROVED, StudentCourse::STATUS_ACTIVE), Criteria::IN);
         $scs = StudentCoursePeer::doSelect($c);
         foreach ($scs as $sc) {
             $sc->setStatus(StudentCourse::STATUS_CANCELED);
             $sc->save();
         }
     } elseif ($student_leave->getStatus() == StudentLeave::STATUS_DONE) {
         $stu->setStatus(Student::STATUS_ACTIVE);
         $stu->save();
     }
     return $this->redirect('student_leave_s/list?student_id=' . $student->getId());
 }
Beispiel #4
0
 public function executeInsertPaymentJournal()
 {
     $student_course = StudentCoursePeer::retrieveByPK($this->getRequestParameter('id'));
     $stu = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
     $accal = $student_course->getAcademicCalendar();
     $job = JobPeer::retrieveByCode($this->getModuleName());
     $academic_process = $job->getAcademicProcess();
     $this->forward404Unless($student_course && $stu && $accal && $job && $academic_process);
     //		$c = new Criteria();
     //		$c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $accal->getId());
     //		$c->add(AcademicProcessPeer::CODE, $academic_process->getCode());
     //		$c->addJoin(AcademicProcessPeer::ID, AcademicCostPeer::ACADEMIC_PROCESS_ID);
     //		$costs = AcademicCostPeer::doSelect($c);
     #$c = new Criteria();
     #$c->add(StudentCoursePeer::STUDENT_ID, $stu->getId());
     #$c->add(SubjectAccalPeer::ACADEMIC_CALENDAR_ID, $accal->getId());
     #$c->add(StudentCoursePeer::STATUS, StudentCourse::STATUS_APPROVED);
     #$c->addJoin(SubjectAccalPeer::ID, StudentCoursePeer::SUBJECT_ACCAL_ID);
     #$scs = StudentCoursePeer::doSelect($c);
     $paids = $this->getRequestParameter('paid');
     foreach ($paids as $key => $val) {
         $c = AcademicCostPeer::retrieveByPK($key);
         $payment_journal = new PaymentJournal();
         $payment_journal->setAcademicCost($c);
         $payment_journal->setJob($job);
         $payment_journal->setPayer($stu->getId());
         #$amount = 0;
         #if ($c->getAcademicCostComponent()->getUnit() == AcademicCostComponent::UNIT_CREDIT) {
         #	foreach ($scs as $sc) {
         #		$amount += $c->getAmount() * $sc->getSubjectAccal()->getSubject()->getCredit();
         #	}
         #} elseif ($c->getAcademicCostComponent()->getUnit() == AcademicCostComponent::UNIT_SUBJECT) {
         #	foreach ($scs as $sc) {
         #		$amount += $c->getAmount();
         #	}
         #} else {
         $amount = $c->getAmount();
         #}
         $payment_journal->setAmount($amount);
         $payment_journal->setPaid($val);
         $payment_journal->setReceivable($amount - $val);
         $payment_journal->setAcademicProcess($academic_process);
         $payment_journal->setPayerType(PaymentJournal::PAYER_TYPE_STUDENT);
         if ($amount - $val == 0) {
             $payment_journal->setStatus('S');
         } elseif ($amount - $val > 0) {
             $payment_journal->setStatus('M');
         } elseif ($amount - $val < 0) {
             $payment_journal->setStatus('P');
         }
         $payment_journal->save();
         $ph = new PaymentHistory();
         $ph->setPaymentJournal($payment_journal);
         $ph->setAmount($val);
         $ph->save();
     }
     // activate all paid credit
     if ($this->hasRequestParameter('status[student_course]') && $this->getRequestParameter('status[student_course]') == 1) {
         $c = new Criteria();
         $c->add(StudentCoursePeer::STUDENT_ID, $stu->getId());
         $c->add(StudentCoursePeer::STATUS, StudentCourse::STATUS_APPROVED);
         $approved_scs = StudentCoursePeer::doSelect($c);
         foreach ($approved_scs as $asc) {
             $asc->setStatus(StudentCourse::STATUS_ACTIVE);
             $asc->save();
         }
     }
     // change student status to active
     if ($this->hasRequestParameter('status[student]') && $this->getRequestParameter('status[student]') == Student::STATUS_ACTIVE) {
         $stu->setStatus(Student::STATUS_ACTIVE);
         $stu->setAcademicCalendarId($accal->getId());
         $stu->save();
     }
     return $this->redirect('student_course/list?student_id=' . $stu->getId());
 }
Beispiel #5
0
 public function executeUpdate()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $comprehensive_exam = new ComprehensiveExam();
     } else {
         $comprehensive_exam = ComprehensiveExamPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($comprehensive_exam);
     }
     $comprehensive_exam->setId($this->getRequestParameter('id'));
     $comprehensive_exam->setStudentId($this->getRequestParameter('student_id'));
     if ($this->getRequestParameter('exam_date')) {
         $comprehensive_exam->setExamDate($this->getRequestParameter('exam_date'));
     }
     $comprehensive_exam->setStatus($this->getRequestParameter('status'));
     $comprehensive_exam->save();
     $c = new Criteria();
     $c->add(ComprehensiveReviewerPeer::COMPREHENSIVE_EXAM_ID, $comprehensive_exam->getId());
     ComprehensiveReviewerPeer::doDelete($c);
     $reviewers = $this->getRequestParameter('isSelected');
     if ($reviewers) {
         foreach ($reviewers as $id) {
             $cr = new ComprehensiveReviewer();
             $cr->setComprehensiveExam($comprehensive_exam);
             $cr->setEmployeeId($id);
             $cr->save();
         }
     }
     if ($comprehensive_exam->getStatus() == ComprehensiveExam::STATUS_ACTIVE) {
         // add payment journal
         $job = JobPeer::retrieveByCode($this->getModuleName());
         $academic_process = $job->getAcademicProcess();
         $c = new Criteria();
         $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, $academic_process->getId());
         $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $comprehensive_exam->getAcademicCalendarId());
         $costs = AcademicCostPeer::doSelect($c);
         foreach ($costs as $c) {
             $pj = new PaymentJournal();
             $pj->setPayer($comprehensive_exam->getStudent()->getId());
             $pj->setAcademicCost($c);
             $pj->setJob($job);
             $pj->setAmount($c->getAmount());
             $pj->setPaid($c->getAmount());
             $pj->setReceivable(0);
             $pj->setAcademicProcess($academic_process);
             $pj->setPayerType(PaymentJournal::PAYER_TYPE_STUDENT);
             $pj->save();
             $ph = new PaymentHistory();
             $ph->setPaymentJournal($pj);
             $ph->setAmount($pj->getPaid());
             $ph->save();
         }
     } elseif ($comprehensive_exam->getStatus() == ComprehensiveExam::STATUS_PASSED) {
         $s = $comprehensive_exam->getStudent();
         $s->setStatus(Student::STATUS_GRADUATE);
         $s->save();
         $gc = new GradCeremony();
         $gc->setStudent($s);
         $gc->setStatus(GradCeremony::STATUS_UNLISTED);
         $gc->setAcademicCalendarId($comprehensive_exam->getAcademicCalendarId());
         $gc->save();
     }
     return $this->redirect('comprehensive_exam/list');
 }
Beispiel #6
0
 public function executeSimpanElse()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     $student = StudentPeer::retrieveByPk($this->getRequestParameter('student_id'));
     $this->forward404Unless($student);
     $amount_changed = 0;
     $tanggal = $this->getRequestParameter('thn') . '-' . $this->getRequestParameter('bln') . '-' . $this->getRequestParameter('tgl');
     $tgl_code = $this->getRequestParameter('tgl') . $this->getRequestParameter('bln') . $this->getRequestParameter('thn');
     $paids = $this->getRequestParameter('paid');
     foreach ($paids as $ac_id => $paid) {
         if ($paid != null) {
             $payment_journal = new PaymentJournal();
             $payment_journal->setPayer($student->getId());
             $payment_journal->setAcademicCostId($ac_id);
             $ac_cost = AcademicCostPeer::retrieveByPK($ac_id);
             $payment_journal->setAcademicProcessId($ac_cost->getAcademicProcessId());
             $payment_journal->setPaidAt($tanggal);
             $payment_journal->setPayerType(PaymentJournal::PAYER_TYPE_STUDENT);
             $payment_journal->setAmount($ac_cost->getAmount());
             $payment_journal->setPaid($paid);
             $payment_journal->setReceivable($ac_cost->getAmount() - $paid);
             $payment_journal->setPaymentModelId($this->getRequestParameter('payment_model_id'));
             $payment_journal->setYear($this->getRequestParameter('thn'));
             $payment_journal->setTransactionStatusId(2);
             $payment_journal->save();
         }
     }
     return $this->redirect('student_payment/previewElse?student_id=' . $student->getId() . '&tgl_code=' . $tgl_code . '&tgl=' . $tanggal . '&model=' . $this->getRequestParameter('payment_model_id'));
 }
Beispiel #7
0
 public function executeUpdate()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $grad_ceremony = new GradCeremony();
     } else {
         $grad_ceremony = GradCeremonyPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($grad_ceremony);
     }
     $old_status = $grad_ceremony->getStatus();
     $grad_ceremony->setId($this->getRequestParameter('id'));
     $grad_ceremony->setStudentId($this->getRequestParameter('student_id'));
     $grad_ceremony->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $grad_ceremony->setStatus($this->getRequestParameter('status'));
     $grad_ceremony->save();
     if ($grad_ceremony->getStatus() != $old_status && $grad_ceremony->getStatus() == GradCeremony::STATUS_ENROLLED) {
         // add payment journal
         $job = JobPeer::retrieveByCode($this->getModuleName());
         $academic_process = $job->getAcademicProcess();
         $c = new Criteria();
         $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, $academic_process->getId());
         $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $grad_ceremony->getAcademicCalendarId());
         $costs = AcademicCostPeer::doSelect($c);
         foreach ($costs as $c) {
             $pj = new PaymentJournal();
             $pj->setPayer($grad_ceremony->getStudent()->getId());
             $pj->setAcademicCost($c);
             $pj->setJob($job);
             $pj->setAmount($c->getAmount());
             $pj->setPaid($c->getAmount());
             $pj->setReceivable(0);
             $pj->setAcademicProcess($academic_process);
             $pj->setPayerType(PaymentJournal::PAYER_TYPE_STUDENT);
             $pj->save();
             $ph = new PaymentHistory();
             $ph->setPaymentJournal($pj);
             $ph->setAmount($pj->getPaid());
             $ph->save();
         }
     }
     return $this->redirect('grad_ceremony/list');
 }
Beispiel #8
0
 public function addPaymentJournal(PaymentJournal $l)
 {
     $this->collPaymentJournals[] = $l;
     $l->setJob($this);
 }