Example #1
0
echo $student->getAcademicCalendar() ? $student->getAcademicCalendar()->toString() : '-';
?>
</p>
       </td>
    </tr>
    <tr>
       <td style="vertical-align:middle;"><label><?php 
echo __('Tipe Siswa');
?>
</label></td>
       <td style="text-align:center; vertical-align:middle;">:</td>
	   <td style="vertical-align:middle;">
       <p class="detail" style="font-weight: bold;"><?php 
$c = new Criteria();
$c->add(StudentTypePeer::STUDENT_ID, $student->getId());
$stu_type = StudentTypePeer::doSelectOne($c);
if ($stu_type) {
    if ($stu_type->getPayerTypeId() != null) {
        if ($stu_type->getPayerType()->getParent() == 7) {
            echo "<font class='level_yellow'>" . $stu_type->getPayerType()->getParentName() . ' - ' . $stu_type->getPayerType()->getDescription() . "</font>";
        } elseif ($stu_type->getPayerType()->getParent() == 8) {
            echo "<font class='level_green'>" . $stu_type->getPayerType()->getParentName() . ' - ' . $stu_type->getPayerType()->getDescription() . "</font>";
        } else {
            echo "<font class='level_green'>" . $stu_type->getPayerType()->getParentName() . ' - ' . $stu_type->getPayerType()->getDescription() . "</font>";
        }
    }
} else {
    echo '-';
}
?>
</p>
Example #2
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('student_type_id')) {
         $student_type = new StudentType();
     } else {
         $student_type = StudentTypePeer::retrieveByPk($this->getRequestParameter('student_type_id'));
         $this->forward404Unless($student_type);
     }
     $student = StudentPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($student);
     $student_type->setId($this->getRequestParameter('student_type_id'));
     $student_type->setStatus($student->getStatus());
     $student_type->setStudentId($student->getId());
     $student_type->setPayerTypeId($this->getRequestParameter('payer_type_id'));
     $student_type->save();
     return $this->redirect('student_type/list');
 }
Example #3
0
 public function executeSave()
 {
     $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');
     $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)) {
         foreach ($params['months'] as $month_id) {
             $payment_student = new PaymentJournal();
             $student = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
             $c = new Criteria();
             $c->add(StudentTypePeer::STUDENT_ID, $student->getId());
             $stu_type = StudentTypePeer::doSelectOne($c);
             $cr = new Criteria();
             $cton1 = $cr->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, $stu_type->getPayerTypeId(), Criteria::IN);
             $cton2 = $cr->getNewCriterion(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2, Criteria::IN);
             $cton3 = $cr->getNewCriterion(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $student->getAcademicCalendarId(), Criteria::IN);
             $cton4 = $cr->getNewCriterion(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $student->getAcademicCalendar()->getParent(), Criteria::IN);
             $cton3->addOr($cton4);
             $cton2->addAnd($cton3);
             $cton1->addAnd($cton2);
             $cr->add($cton1);
             $ac_cost = AcademicCostPeer::doSelectOne($cr);
             $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($this->getRequestParameter('payment_model_id'));
             $payment_student->setYear($this->getRequestParameter('year'));
             $payment_student->setMonth($month_id);
             $payment_student->setStatus('S');
             $payment_student->save();
             $amount_changed = $ac_cost->getAmount();
             if ($amount_changed != 0) {
                 $ph = new PaymentHistory();
                 $ph->setPaymentJournal($payment_student);
                 $ph->setAmount($amount_changed);
                 $ph->save();
             }
         }
     }
     return $this->redirect('payment_student/list');
     #return $this->forward('payment_student', 'preview?student_id='.$this->getRequestParameter('student_id').'&paid_at='.$this->getRequestParameter('paid_at').'&payment_model_id='.$this->getRequestParameter('payment_model_id').'&year='.$this->getRequestParameter('year'));
     #return $this->redirect('payment_student/preview?student_id='.$this->getRequestParameter('student_id').'&paid_at='.$this->getRequestParameter('paid_at').'&payment_model_id='.$this->getRequestParameter('payment_model_id').'&year='.$this->getRequestParameter('year'));
     #return $this->redirect('payment_student/list',
     #					    'before'=>"window.open('".$this->getController()->genUrl('/payment_student/printForm').
     #		  "?student_id='+$('student_id').value+'&paid_at='+$('paid_at').value+'&payment_model_id='+$('payment_model_id').value+'&year='+$('year').value,
     #								'link',
     #								'height=480,width=640,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no'
     #								)")
 }
Example #4
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = StudentTypePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setAcademicCalendarId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setDepartmentId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setPayerTypeId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setStudentId($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setStatus($arr[$keys[5]]);
     }
 }
Example #5
0
 public function executeEditLastElse()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $c = new Criteria();
     $c->add(JobPeer::CODE, 'student_type');
     $job = JobPeer::doSelectOne($c);
     $acl = AclPeer::retrieveByPK($group_id, $job->getId());
     if (!$acl) {
         $this->forward('default', 'error404');
     }
     $this->can_edit = $acl->getEditPriv() == 1;
     $this->can_remove = $acl->getRemovePriv() == 1;
     $student = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
     $this->forward404Unless($student);
     $payment_student = PaymentJournalPeer::retrieveByPK($this->getRequestParameter('id'));
     $this->forward404Unless($payment_student);
     $cr = new Criteria();
     $cr->add(StudentTypePeer::STUDENT_ID, $student->getId());
     $stu_type = StudentTypePeer::doSelectOne($cr);
     $this->academic_costs = array();
     $c = new Criteria();
     $cton1 = $c->getNewCriterion(VAcaCostElsePeer::ACADEMIC_CALENDAR_ID, $student->getAcademicCalendar()->getChildRecurs(), Criteria::IN);
     $cton2 = $c->getNewCriterion(VAcaCostElsePeer::CLASS_GROUP_ID, $student->getClassGroup()->getParentRecurs(), Criteria::IN);
     $cton3 = $c->getNewCriterion(VAcaCostElsePeer::PAYER_TYPE_ID, $stu_type->getPayerTypeId(), Criteria::IN);
     $cton4 = $c->getNewCriterion(VAcaCostElsePeer::PAYER_TYPE_ID, $stu_type->getPayerType()->getParent(), Criteria::IN);
     $cton5 = $c->getNewCriterion(VAcaCostElsePeer::PAYER_CODE, $stu_type->getPayerType()->getCode(), Criteria::IN);
     $cton4->addOr($cton5);
     $cton3->addOr($cton4);
     $cton2->addAnd($cton3);
     $cton1->addAnd($cton2);
     $c->add($cton1);
     $costs = VAcaCostElsePeer::doSelect($c);
     foreach ($costs as $cost) {
         $academic_costs[$cost->getId()] = $cost->getAcademicCostComponent()->toString();
     }
     $this->academic_costs = $academic_costs;
     $this->payment_student = $payment_student;
     $this->type = 'edit';
     $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
     if ($acl->getRemovePriv()) {
         array_push($actions, array('name' => 'delete', 'url' => 'student_payment/deleteElse?id=' . $payment_student->getId() . '&student_id=' . $student->getId(), 'color' => 'red'));
     }
     array_push($actions, array('name' => 'cancel', 'url' => 'student_payment/listElse?student_id=' . $student->getId(), 'color' => 'black'));
     $this->actions = $actions;
     $actions2 = array(array('name' => '<span>Daftar Murid</span>', 'url' => 'student_type/list', 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Pembayaran SPP</span>', 'url' => 'student_payment/listSpp?student_id=' . $student->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Pembayaran Lain-lain</span>', 'url' => 'student_payment/listElse?student_id=' . $student->getId(), 'color' => 'sun', 'type' => 'direct'));
     array_push($actions2, array('name' => '<span>Histori Pembayaran</span>', 'url' => 'student_payment/listHistory?student_id=' . $student->getId(), 'color' => 'sky'));
     $this->actions2 = $actions2;
     $this->subtitle = $payment_student->toString();
     $this->student = $student;
 }
Example #6
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(StudentTypePeer::ID, $pks, Criteria::IN);
         $objs = StudentTypePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #7
0
 public function getStudentTypesJoinStudent($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseStudentTypePeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collStudentTypes === null) {
         if ($this->isNew()) {
             $this->collStudentTypes = array();
         } else {
             $criteria->add(StudentTypePeer::PAYER_TYPE_ID, $this->getId());
             $this->collStudentTypes = StudentTypePeer::doSelectJoinStudent($criteria, $con);
         }
     } else {
         $criteria->add(StudentTypePeer::PAYER_TYPE_ID, $this->getId());
         if (!isset($this->lastStudentTypeCriteria) || !$this->lastStudentTypeCriteria->equals($criteria)) {
             $this->collStudentTypes = StudentTypePeer::doSelectJoinStudent($criteria, $con);
         }
     }
     $this->lastStudentTypeCriteria = $criteria;
     return $this->collStudentTypes;
 }
Example #8
0
 public function executeListByStudent()
 {
     $student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
     $student = StudentPeer::retrieveByPK($student_id);
     $this->forward404Unless($student);
     $dept = $this->getContext()->getUser()->getAttribute('department_id', null, 'bo');
     $cr = new Criteria();
     $cr->add(StudentTypePeer::STUDENT_ID, $student->getId());
     $stu_type = StudentTypePeer::doSelectOne($cr);
     $c = new Criteria();
     $cton1 = $c->getNewCriterion(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $student->getAcademicCalendarId(), Criteria::IN);
     $cton2 = $c->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, $stu_type->getPayerTypeId(), Criteria::IN);
     $cton3 = $c->getNewCriterion(AcademicCostPeer::CLASS_GROUP_ID, $student->getClassGroupId(), Criteria::IN);
     $cton4 = $c->getNewCriterion(AcademicCostPeer::CLASS_GROUP_ID, $student->getClassGroup()->getParent(), Criteria::IN);
     $cton3->addOr($cton4);
     $cton2->addAnd($cton3);
     $cton1->addAnd($cton2);
     $c->add($cton1);
     $this->sort($c);
     if ($this->getRequest()->hasParameter('filters')) {
         $filters = $this->getRequestParameter('filters');
         if ($filters == 'clear') {
             $this->filters = null;
         } else {
             $defined_filter = false;
             foreach ($filters as $f) {
                 if (is_array($f)) {
                     if (strlen($f['from']) > 0 || strlen($f['to']) > 0) {
                         $defined_filter = true;
                         break;
                     }
                 } else {
                     if ($f != null && $f != '') {
                         $defined_filter = true;
                         break;
                     }
                 }
             }
             if ($defined_filter) {
                 $this->filters = $filters;
                 $this->filter($c, $this->getRequestParameter('filters'));
             }
         }
     }
     $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'academic_cost'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'academic_cost');
     $pager = new sfPropelPager('AcademicCost', $rpp);
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'academic_cost'));
     $this->getUser()->setAttribute('page', $page, 'academic_cost');
     $pager->setPage($page);
     $pager->init();
     $this->pager = $pager;
     $actions = array(array('name' => 'filter', 'color' => 'white'));
     array_unshift($actions, array('name' => '_AS_CSV_', 'url' => "academic_cost/listByStudentAsCSV", 'color' => 'black', 'type' => 'direct'));
     array_unshift($actions, array('name' => '_AS_PDF_', 'url' => "academic_cost/listByStudentAsPDF", 'color' => 'black', 'type' => 'direct'));
     $this->actions = $actions;
     $this->subtitle = $student->getName() . ' - ' . $student->getClassGroup()->toString();
     $this->student_id = $student_id;
     $this->student = $student;
 }