public function detailAction() { $lecturer_id = $_GET['lecturer_id']; $data = ['lecturer_id' => $this->sessionGlobal->lecturer_id, 'semester' => $_GET['semester'], 'schoolyears_id' => $_GET['schoolyears_id']]; $salary = new Model_Salary(); $listClasses = $salary->findListClasses($data); $infoLecture = $salary->findLecturer($lecturer_id); $findConfig = $salary->findConfig(); $this->view->listClasses = $listClasses; $this->view->infoLecture = $infoLecture; $this->view->findConfig = $findConfig; }
public function action_process($month = null, $year = null) { parent::has_access("add_salary"); (is_null($month) or is_null($year)) and Response::redirect('salaries'); if ($month == 1) { $m = 12; $y = $year - 1; } else { $m = $month - 1; $y = $year; } $salaries = Model_Salary::find('all', array('where' => array(array('month' => $m), array('year' => $y)))); $data['month'] = $month; $data['year'] = $year; foreach ($salaries as $salary) { $emp = new Model_Salary(); $emp->employee_id = $salary->employee_id; $emp->month = $month; $emp->year = $year; $emp->lock = 'false'; $emp->pf_applicable = $salary->pf_applicable; $emp->gross = $salary->gross; $emp->sdxo = $salary->sdxo; $emp->pf_adjust = $salary->pf_adjust; $emp->basic = $salary->basic; $emp->hra = $salary->hra; $emp->lta = $salary->lta; $emp->medical = $salary->medical; $emp->travel = $salary->travel; $emp->pf_value = $salary->pf_value; $emp->credit_other = $salary->credit_other; $emp->bonus1 = $salary->bonus1; $emp->bonus2 = $salary->bonus2; $emp->allowance1 = $salary->allowance1; $emp->leave = $salary->leave; $emp->allowance2 = $salary->allowance2; $emp->allowance3 = $salary->allowance3; $emp->credit_total = $salary->credit_total; $emp->income_tax = $salary->income_tax; $emp->professional_tax = $salary->professional_tax; $emp->deduction1 = $salary->deduction1; $emp->deduction2 = $salary->deduction2; $emp->deduction3 = $salary->deduction3; $emp->total_debit = $salary->total_debit; $emp->net = $salary->net; $emp->sick_balance = 0; $emp->vacation_balance = 0; $emp->save(); } Response::redirect('salaries'); }
public function action_delete($id = null) { parent::has_access("archive_employee"); is_null($id) and Response::redirect('employees'); if ($employee = Model_Employee::find($id)) { $employee->activity_status = "delete"; if ($employee->save()) { Session::set_flash('success', 'Deleted employee #' . $id); } else { Session::set_flash('error', 'Could not delete employee #' . $id); } } else { Session::set_flash('error', 'Could not find employee #' . $id); } if ($salaries = Model_Salary::find('all', array('where' => array('employee_id' => $id)))) { foreach ($salaries as $salary) { $salary->lock = "delete"; $salary->save(); } } else { // Session::set_flash('error', 'Could not delete employee #' . $id); } Response::redirect('employees/viewarchive'); }
public function action_delete($id = null) { is_null($id) and Response::redirect('salaries'); if ($salary = Model_Salary::find($id)) { $salary->delete(); Session::set_flash('success', 'Deleted salary #' . $id); } else { Session::set_flash('error', 'Could not delete salary #' . $id); } Response::redirect('salaries'); }