public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = EmployeeMedicalPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setCode($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setEmployeeId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setDepartmentId($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setAcademicCalendarId($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setStaffTypeId($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setEmployeeLevelId($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setIllnessId($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setDetailMedical($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setMedicalDate($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setHospital($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setPatientName($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setRelation($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setTotal($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setStatus($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { $this->setMedicine($arr[$keys[15]]); } if (array_key_exists($keys[16], $arr)) { $this->setHospitalization($arr[$keys[16]]); } }
public function executeDelete() { $employee_medical = EmployeeMedicalPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee_medical); $employee_id = $employee_medical->getEmployeeId(); $ref_error = 0; foreach ($employee_medical->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $employee_medical->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('employee_medical/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('employee_medical/delete', '_ERR_DELETE_ (' . $employee_medical->toString() . ' - id:' . $employee_medical->getId() . ')'); } else { $employee_medical->delete(); } return $this->redirect('employee_medical/list?employee_id=' . $employee_id); }
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(EmployeeMedicalPeer::ID, $pks, Criteria::IN); $objs = EmployeeMedicalPeer::doSelect($criteria, $con); } return $objs; }
public function filterMedical($c, $filters) { $filters_key = array_keys($filters); foreach ($filters_key as $key) { $value = $filters[$key]; if ($value == '' || $value == null) { continue; } if ($key == 'EXTRA_CODE') { $c->addJoin(EmployeePeer::ID, EmployeeMedicalPeer::EMPLOYEE_ID); $c->addJoin(EmployeeDetailPeer::EMPLOYEE_ID, EmployeePeer::ID); $column = EmployeeDetailPeer::getTableMap()->getColumn('EXTRA_CODE'); } elseif ($key == 'LEVEL') { $c->addJoin(EmployeeLevelPeer::ID, EmployeeMedicalPeer::EMPLOYEE_LEVEL_ID); $column = EmployeeLevelPeer::getTableMap()->getColumn('LEVEL'); } elseif ($key == 'SALARY') { $c->addJoin(EmployeeLevelPeer::ID, EmployeeMedicalPeer::EMPLOYEE_LEVEL_ID); $column = EmployeeLevelPeer::getTableMap()->getColumn('SALARY'); } elseif ($key == 'EMP_NO') { $c->addJoin(EmployeePeer::ID, EmployeeMedicalPeer::EMPLOYEE_ID); $column = EmployeePeer::getTableMap()->getColumn('CODE'); } elseif ($key == 'NAME') { $c->addJoin(EmployeePeer::ID, EmployeeMedicalPeer::EMPLOYEE_ID); $column = EmployeePeer::getTableMap()->getColumn('NAME'); } else { $column = EmployeeMedicalPeer::getTableMap()->getColumn($key); } $name = $column->getFullyQualifiedName(); $creoleType = $column->getCreoleType(); if ($creoleType == CreoleTypes::TIMESTAMP) { $from = $value['from']; $to = $value['to']; if ($from != '' && $from != null) { $c->add($name, $from, Criteria::GREATER_EQUAL); } if ($to != '' && $to != null) { $c->add($name, $to, Criteria::LESS_EQUAL); } } elseif ($creoleType == CreoleTypes::DATE) { $from = $value['from']; $to = $value['to']; if ($from != '' && $from != null) { $c->add($name, $from, Criteria::GREATER_EQUAL); } if ($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); } } } } }
public function getEmployeeMedicalsJoinIllness($criteria = null, $con = null) { include_once 'lib/model/om/BaseEmployeeMedicalPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collEmployeeMedicals === null) { if ($this->isNew()) { $this->collEmployeeMedicals = array(); } else { $criteria->add(EmployeeMedicalPeer::EMPLOYEE_LEVEL_ID, $this->getId()); $this->collEmployeeMedicals = EmployeeMedicalPeer::doSelectJoinIllness($criteria, $con); } } else { $criteria->add(EmployeeMedicalPeer::EMPLOYEE_LEVEL_ID, $this->getId()); if (!isset($this->lastEmployeeMedicalCriteria) || !$this->lastEmployeeMedicalCriteria->equals($criteria)) { $this->collEmployeeMedicals = EmployeeMedicalPeer::doSelectJoinIllness($criteria, $con); } } $this->lastEmployeeMedicalCriteria = $criteria; return $this->collEmployeeMedicals; }
public function executeShowMedical() { $employee_medical = EmployeeMedicalPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee_medical); $this->subtitle = $employee_medical->toString() . ' - id:' . $employee_medical->getId(); $academic_calendar_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id); $this->forward404Unless($academic_calendar); $department_id = $this->getRequestParameter('department_id'); $department = DepartmentPeer::retrieveByPK($department_id); $this->forward404Unless($department); $actions = array(array('name' => 'Kembali', 'url' => 'employee_report/lisMedical?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'black')); $this->actions = $actions; $this->employee_medical = $employee_medical; $actions2 = array(array('name' => '<span>Rekap Kepegawaian</span>', 'url' => 'employee_report/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Mutasi Jabatan</span>', 'url' => 'employee_report/listJob?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky')); array_push($actions2, array('name' => '<span>Absensi Pegawai</span>', 'url' => 'employee_report/listAbsence?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky')); array_push($actions2, array('name' => '<span>Absen Per Pegawai</span>', 'url' => 'employee_report/listAbsenceEmployee?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky')); array_push($actions2, array('name' => '<span>Cuti Pegawai</span>', 'url' => 'employee_report/listLeave?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky')); array_push($actions2, array('name' => '<span>Izin Pegawai</span>', 'url' => 'employee_report/listPermit?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky')); array_push($actions2, array('name' => '<span>Pengobatan</span>', 'url' => 'employee_report/listMedical?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sun', 'type' => 'direct')); array_push($actions2, array('name' => '<span>Gaji Pegawai</span>', 'url' => 'employee_report/listSalary?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky')); $this->actions2 = $actions2; $cd = new Criteria(); $cd->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee_permit->getEmployeeId()); $this->employee_detail = EmployeeDetailPeer::doSelectOne($cd); $this->academic_calendar = $academic_calendar; $this->department = $department; }