public function executePaymentSlip() { $stu = StudentPeer::retrieveByPK($this->getRequestParameter('student_id')); $job = JobPeer::retrieveByCode($this->getModuleName()); $academic_process = $job->getAcademicProcess(); $this->forward404Unless($stu && $job && $academic_process); $c = new Criteria(); $c->add(AcademicProcessPeer::CODE, $academic_process->getCode()); $c->addJoin(AcademicProcessPeer::ID, AcademicCostPeer::ACADEMIC_PROCESS_ID); $c->addJoin(AcademicCostPeer::ACADEMIC_CALENDAR_ID, StudentLeavePeer::ACADEMIC_CALENDAR_ID); $c->add(StudentLeavePeer::STATUS, StudentLeave::STATUS_APPROVED); $c->add(StudentLeavePeer::STUDENT_ID, $stu->getId()); $costs = AcademicCostPeer::doSelect($c); $total_cost = 0; foreach ($costs as $c) { $total_cost += $c->getAmount(); } $this->stu = $stu; $this->costs = $costs; $this->total_cost = $total_cost; $this->setViewClass('sfDomPDF'); }
public function executePrintBankTransferForm() { $student_course = StudentCoursePeer::retrieveByPK($this->getRequestParameter('id')); $stu = StudentPeer::retrieveByPK($this->getRequestParameter('student_id')); $accal = $student_course->getSubjectAccal()->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); $total_subject = 0; $total_credit = 0; $total_credit_cost = 0; $total_cost = 0; $total_subject_cost = 0; foreach ($costs as $c) { if ($c->getAcademicCostComponent()->getUnit() == AcademicCostComponent::UNIT_CREDIT) { foreach ($scs as $sc) { $total_credit += $sc->getSubjectAccal()->getSubject()->getCredit(); $total_cost += $c->getAmount() * $sc->getSubjectAccal()->getSubject()->getCredit(); $total_credit_cost += $c->getAmount() * $sc->getSubjectAccal()->getSubject()->getCredit(); } } elseif ($c->getAcademicCostComponent()->getUnit() == AcademicCostComponent::UNIT_SUBJECT) { foreach ($scs as $sc) { ++$total_subject; $total_cost += $c->getAmount(); $total_subject_cost += $c->getAmount(); } } else { $total_cost += $c->getAmount(); } } $this->stu = $stu; $this->accal = $accal; $this->costs = $costs; $this->total_credit = $total_credit; $this->total_credit_cost = $total_credit_cost; $this->total_cost = $total_cost; $this->total_subject = $total_subject; $this->total_subject_cost = $total_subject_cost; $this->setViewClass('sfDomPDF'); }
public function executePaymentSlip() { $comprehensive_exam = ComprehensiveExamPeer::retrieveByPK($this->getRequestParameter('id')); $stu = $comprehensive_exam->getStudent(); $job = JobPeer::retrieveByCode($this->getModuleName()); $academic_process = $job->getAcademicProcess(); $this->forward404Unless($stu && $job && $academic_process); $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); $total_cost = 0; foreach ($costs as $c) { $total_cost += $c->getAmount(); } $this->stu = $stu; $this->costs = $costs; $this->total_cost = $total_cost; $this->setViewClass('sfDomPDF'); }
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()); }
public function executePaymentSlip() { $gradc = GradCeremonyPeer::retrieveByPK($this->getRequestParameter('id')); $stu = $gradc->getStudent(); $accal = $gradc->getAcademicCalendar(); $job = JobPeer::retrieveByCode($this->getModuleName()); $academic_process = $job->getAcademicProcess(); $this->forward404Unless($gradc && $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); $total_cost = 0; foreach ($costs as $c) { $total_cost += $c->getAmount(); } $this->gradc = $gradc; $this->stu = $stu; $this->accal = $accal; $this->costs = $costs; $this->total_cost = $total_cost; $this->setViewClass('sfDomPDF'); }