public function action_delete($id = null) { is_null($id) and Response::redirect('companies'); if ($company = Model_Company::find($id)) { $company->delete(); Session::set_flash('success', 'Deleted company #' . $id); } else { Session::set_flash('error', 'Could not delete company #' . $id); } Response::redirect('companies'); }
public function action_print($id = null, $month = null, $year = null) { parent::has_access("print_salary_statement"); (is_null($id) or is_null($month) or is_null($year)) and Response::redirect('salaries'); $data['rename'] = Model_Rename::find('first'); $data['company'] = Model_Company::find('first', array('where' => array('city' => "Bangalore"))); $data['employee'] = Model_Employee::find('first', array('where' => array('id' => $id))); if (!($data['salary'] = Model_Salary::find('first', array('where' => array(array('employee_id' => $id), array('month' => $month), array('year' => $year)))))) { Session::set_flash('error', 'Could not find salary #' . $id); Response::redirect('salaries'); } $data['fytd'] = $this->findFYTD($id, $month, $year); return Response::forge(View::forge('salaries/payslip', $data)); }