echo $student->getAcademicCalendar()->toString(); ?> </td></tr> <tr><td style="vertical-align: top;">Untuk Pembayaran</td><td>:</td> <td style="vertical-align: top;"> <?php $c = new Criteria(); $c->add(PaymentJournalPeer::PAYER, $student->getId()); $c->add(PaymentJournalPeer::PAID_AT, $paid_at); $c->add(PaymentJournalPeer::YEAR, $year); $c->add(PaymentJournalPeer::TRANSACTION_STATUS_ID, 1); $c->add(PaymentJournalPeer::ACADEMIC_COST_ID, $ac_cost->getId()); $payments = PaymentJournalPeer::doSelect($c); ?> <b><?php echo AcademicCostPeer::retrieveByPk($ac_cost->getId())->getAcademicCostComponent()->toString() . ' - Rp. ' . format_number(AcademicCostPeer::retrieveByPk($ac_cost->getId())->getAmount()); ?> </b><br /> <b><?php echo '('; ?> <?php $i = 0; foreach ($payments as $payment) { ++$i; ?> <?php if ($payment->getMonth() == 1) { echo __('Januari'); } elseif ($payment->getMonth() == 2) { echo __('Februari');
public function executeUpdateSpp() { $user_id = $this->getContext()->getUser()->getAttribute('user_id', null, 'bo'); $student = StudentPeer::retrieveByPk($this->getRequestParameter('student_id')); $this->forward404Unless($student); $academic_cost = AcademicCostPeer::retrieveByPk($this->getRequestParameter('academic_cost_id')); $this->forward404Unless($academic_cost); $paid_at = $this->getRequestParameter('paid_at'); $year = $this->getRequestParameter('year'); $month_list_ser = $this->getRequestParameter('month_list_ser'); $params = array(); foreach (explode('&', $this->getRequestParameter('month_list_ser')) as $p) { $p = explode('=', $p); $params[rawurldecode($p[0])][] = rawurldecode($p[1]); } if (array_key_exists('months', $params)) { $total_cost = 0; foreach ($params['months'] as $month_id) { $payment_student = new PaymentJournal(); $ac_cost = AcademicCostPeer::retrieveByPK($this->getRequestParameter('academic_cost_id')); $payment_student->setPayer($this->getRequestParameter('student_id')); $payment_student->setAcademicCostId($ac_cost->getId()); $payment_student->setAcademicProcessId($ac_cost->getAcademicProcessId()); $payment_student->setAmount($ac_cost->getAmount()); $payment_student->setPaid($ac_cost->getAmount()); $payment_student->setReceivable($ac_cost->getAmount() - $ac_cost->getAmount()); $payment_student->setPaidAt($this->getRequestParameter('paid_at')); $payment_student->setPayerType(PaymentJournal::PAYER_TYPE_STUDENT); $payment_student->setPaymentModelId(2); $payment_student->setYear($this->getRequestParameter('year')); $payment_student->setMonth($month_id); $payment_student->setStatus('S'); $payment_student->setTransactionStatusId(1); $payment_student->setJobId($user_id); $payment_student->save(); $total_cost += $payment_student->getAmount(); $amount_changed = $ac_cost->getAmount(); if ($amount_changed != 0) { $ph = new PaymentHistory(); $ph->setPaymentJournal($payment_student); $ph->setAmount($amount_changed); $ph->setStatus($payment_student->getStatus()); $ph->setReceivable($payment_student->getReceivable()); $ph->setAcademicCostId($payment_student->getAcademicCostId()); $ph->setMonth($payment_student->getMonth()); $ph->setCredit($payment_student->getMonth()); $ph->save(); } } } $this->student = $student; $this->academic_cost = $academic_cost; $this->paid_at = $paid_at; $this->year = $year; $this->month_list_ser = $month_list_ser; $this->getRequest()->setParameter('student_id', $student->getId()); $this->getRequest()->setParameter('academic_cost_id', $academic_cost->getId()); $this->getRequest()->setParameter('paid_at', $paid_at); $this->getRequest()->setParameter('year', $year); return $this->forward('student_payment', 'previewSpp'); }
public function executeDelete2() { $academic_cost = AcademicCostPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($academic_cost); $ref_error = 0; foreach ($academic_cost->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $academic_cost->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('academic_cost/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('academic_cost/delete', '_ERR_DELETE_ (' . $academic_cost->toString() . ' - id:' . $academic_cost->getId() . ')'); } else { $academic_cost->delete(); } return $this->forward('academic_cost', 'list2'); }