/**
  *
  */
 private function init_data()
 {
     if (!$this->staffTable) {
         $this->staffTable = new StaffDataAccess($this->getDbAdapter());
     }
     if (!$this->staff) {
         $this->staff = $this->getCurrentStaff();
     }
     if (!$this->leaveTable) {
         $this->leaveTable = new LeaveDataAccess($this->getDbAdapter());
     }
     if (!$this->calendarTable) {
         $this->calendarTable = new CalendarDataAccess($this->getDbAdapter());
     }
     $constantTable = new ConstantDataAccess($this->getDbAdapter());
     if (!$this->formulaList) {
         $this->formulaList = $constantTable->getComboByName('payroll_formula', 'payroll');
     }
     if (!$this->workingHours) {
         $constant = $constantTable->getConstantByName('work_hour');
         $this->workingHours = $constant->getValue();
     }
     if (!$this->leaveValues) {
         $constant = $constantTable->getConstantByName('leave_type');
         $this->leaveValues = $constant->getValue();
     }
     if (!$this->lateList) {
         $lateData = $constantTable->getConstantByName('late_condition', 'payroll');
         $lateList = Json::decode($lateData->getValue());
         usort($lateList, function ($a, $b) {
             if ($a->minute == $b->minute) {
                 return 0;
             }
             return $a->minute > $b->minute ? -1 : 1;
         });
         $this->lateList = $lateList;
     }
     if (!$this->leaveTypeList) {
         $result = $constantTable->getConstantByName('leave_type');
         $leaveTypes = json_decode($result->getValue());
         $comboList = array();
         foreach ($leaveTypes as $leave) {
             $comboList[$leave->id] = $leave->title;
         }
         $this->leaveTypeList = $comboList;
     }
 }
 private function initCombo()
 {
     $staffDA = new StaffDataAccess($this->getDbAdapter());
     $constantDA = new ConstantDataAccess($this->getDbAdapter());
     $this->staffList = $staffDA->getComboData('staffId', 'staffCode');
     $this->statusList = $constantDA->getComboByName('leave_status');
     unset($this->statusList['R']);
     $result = $constantDA->getConstantByName('leave_type');
     $leaveTypes = json_decode($result->getValue());
     if (!$this->leaveTypeList) {
         $comboList = array();
         foreach ($leaveTypes as $leave) {
             $comboList[$leave->id] = $leave->title;
             $this->annualLeave[$leave->id] = $leave->value;
         }
         $this->leaveTypeList = $comboList;
     }
 }
 private function init_data()
 {
     if (!$this->staffTable) {
         $this->staffTable = new StaffDataAccess($this->getDbAdapter());
     }
     if (!$this->staffId) {
         $staff = $this->getCurrentStaff();
         $this->staffId = boolval($staff) ? $staff->getStaffId() : 0;
     }
     if (!$this->payrollTable) {
         $this->payrollTable = new PayrollDataAccess($this->getDbAdapter());
     }
     if (!$this->calendarTable) {
         $this->calendarTable = new CalendarDataAccess($this->getDbAdapter());
     }
     $constantTable = new ConstantDataAccess($this->getDbAdapter());
     if (!$this->formulaList) {
         $this->formulaList = $constantTable->getComboByName('payroll_formula', 'payroll');
     }
     if (!$this->workingHours) {
         $constant = $constantTable->getConstantByName('work_hour');
         $this->workingHours = $constant->getValue();
     }
     if (!$this->leaveValues) {
         $constant = $constantTable->getConstantByName('leave_type');
         $this->leaveValues = $constant->getValue();
     }
     $constantDataAccess = new ConstantDataAccess($this->getDbAdapter());
     if (!$this->lateList) {
         $lateData = $constantDataAccess->getConstantByName('late_condition', 'payroll');
         $lateList = Json::decode($lateData->getValue());
         usort($lateList, function ($a, $b) {
             if ($a->minute == $b->minute) {
                 return 0;
             }
             return $a->minute > $b->minute ? -1 : 1;
         });
         $this->lateList = $lateList;
     }
 }
 /**
  * @return mixed
  */
 private function getSkipTypes()
 {
     $dataAccess = new ConstantDataAccess($this->getDbAdapter());
     $result = json_decode($dataAccess->getConstantByName('closing_type_id')->getValue());
     return array_unique(array($result->open, $result->close));
 }