Esempio n. 1
0
 public function getPaymentHistorysJoinPaymentJournal($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BasePaymentHistoryPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collPaymentHistorys === null) {
         if ($this->isNew()) {
             $this->collPaymentHistorys = array();
         } else {
             $criteria->add(PaymentHistoryPeer::ACADEMIC_COST_ID, $this->getId());
             $this->collPaymentHistorys = PaymentHistoryPeer::doSelectJoinPaymentJournal($criteria, $con);
         }
     } else {
         $criteria->add(PaymentHistoryPeer::ACADEMIC_COST_ID, $this->getId());
         if (!isset($this->lastPaymentHistoryCriteria) || !$this->lastPaymentHistoryCriteria->equals($criteria)) {
             $this->collPaymentHistorys = PaymentHistoryPeer::doSelectJoinPaymentJournal($criteria, $con);
         }
     }
     $this->lastPaymentHistoryCriteria = $criteria;
     return $this->collPaymentHistorys;
 }
Esempio n. 2
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(PaymentHistoryPeer::ID, $pks, Criteria::IN);
         $objs = PaymentHistoryPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Esempio n. 3
0
 public function filterHistory($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'ACADEMIC_COST_COMPONENT_ID') {
             $c->addJoin(AcademicCostPeer::ACADEMIC_COST_COMPONENT_ID, AcademicCostComponentPeer::ID);
             $c->addJoin(PaymentJournalPeer::ACADEMIC_COST_ID, AcademicCostPeer::ID);
             $column = AcademicCostPeer::getTableMap()->getColumn($key);
         } elseif ($key == 'DEPARTMENT_ID') {
             $c->addJoin(DepartmentPeer::ID, CurriculumPeer::DEPARTMENT_ID);
             $c->addJoin(CurriculumPeer::ID, AcademicCalendarPeer::CURRICULUM_ID);
             $c->addJoin(AcademicCostPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
             $c->addJoin(PaymentJournalPeer::ACADEMIC_COST_ID, AcademicCostPeer::ID);
             $column = CurriculumPeer::getTableMap()->getColumn($key);
         } elseif ($key == 'PAYER') {
             $c->addJoin(StudentPeer::ID, PaymentJournalPeer::PAYER);
             $c->addJoin(StudentPeer::CURRICULUM_ID, AcademicCalendarPeer::CURRICULUM_ID);
             $c->addJoin(AcademicCostPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
             $c->addJoin(PaymentJournalPeer::ACADEMIC_COST_ID, AcademicCostPeer::ID);
             $column = StudentPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'ACADEMIC_PROCESS_ID') {
             $c->addJoin(PaymentJournalPeer::ID, PaymentHistoryPeer::PAYMENT_JOURNAL_ID);
             $column = PaymentJournalPeer::getTableMap()->getColumn($key);
         } else {
             $column = PaymentHistoryPeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             $c2 = null;
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
                 $c2 = $c->getCriterion($name);
             }
             if ($from != '' && $from != null && $to != '' && $to != null) {
                 $c3 = new Criterion($c, $name, $to, Criteria::LESS_EQUAL);
                 $c2->addAnd($c3);
             }
             if (($from == '' || $from == null) && $to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::INTEGER) {
                 $c->add($name, $value, Criteria::EQUAL);
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR || $creoleType == CreoleTypes::CHAR) {
                     $c->add($name, "%{$value}%", Criteria::LIKE);
                 }
             }
         }
     }
 }
Esempio n. 4
0
 public function countPaymentHistorys($criteria = null, $distinct = false, $con = null)
 {
     include_once 'lib/model/om/BasePaymentHistoryPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(PaymentHistoryPeer::PAYMENT_JOURNAL_ID, $this->getId());
     return PaymentHistoryPeer::doCount($criteria, $distinct, $con);
 }
Esempio n. 5
0
 public function executeShowHistory()
 {
     $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_history = PaymentHistoryPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($payment_history);
     $this->payment_history = $payment_history;
     $this->type = 'detail';
     $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' => 'sky'));
     array_push($actions2, array('name' => '<span>Histori Pembayaran</span>', 'url' => 'student_payment/listHistory?student_id=' . $student->getId(), 'color' => 'sun', 'type' => 'direct'));
     $this->actions2 = $actions2;
     $this->subtitle = $payment_history->toString() . ' - id:' . $payment_history->getId();
     $this->student = $student;
 }
Esempio n. 6
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = PaymentHistoryPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setPaymentJournalId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setAmount($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setCreatedAt($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setStatus($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setMonth($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setCredit($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setAcademicCostId($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setPaid($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setReceivable($arr[$keys[9]]);
     }
 }
Esempio n. 7
0
 public function executeDelete()
 {
     $payment_history = PaymentHistoryPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($payment_history);
     $ref_error = 0;
     foreach ($payment_history->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $payment_history->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('payment_history/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('payment_history/delete', '_ERR_DELETE_ (' . $payment_history->toString() . ' - id:' . $payment_history->getId() . ')');
     } else {
         $payment_history->delete();
     }
     return $this->forward('payment_history', 'list');
 }