public function logout() { Audit_trail_model::auditLogout(); Users::logout_employee($this->session->userdata('employee_id')); $this->session->sess_destroy(); redirect('auth/login'); }
public function updateSupervision() { $data = array('supervisor_id' => $this->input->post('txtSupervisor'), 'employee_id' => $this->input->post('txtEmployee'), 'assigned_date' => date('Y-m-d')); if (Emp_supervision::create($data)) { $this->session->set_userdata('edited', 1); Audit_trail_model::auditSupervision($data); redirect("ems/supervisions"); } }
public function editStocks($id) { $stocks = Stock_info_model::find($id); $details = Stock_info_model::stocksDetails(); if ($stocks->update_attributes($details)) { $this->session->set_userdata('edited', 1); Audit_trail_model::auditEditItems($details); redirect('ams/view_inventory'); } }
public function assetTransfer() { $details = array("asset_status" => $this->input->post('txtStatus'), "employee_id" => $this->input->post('txtEmployee'), "assigned_date" => date('Y-m-d')); $asset = Assets_model::find($this->input->post('txtAssetID')); if ($asset->update_attributes($details)) { $this->session->set_userdata('edited', 1); Audit_trail_model::auditAssignAsset($details, $this->input->post('txtAssetID')); redirect('ams/view_assets'); } }
public function addPersonnel() { $this->form_validation->set_rules('txtProjectID', 'Project ID', 'trim|required'); $this->form_validation->set_rules('txtEmployee', 'Employee Name', 'trim|required'); $this->form_validation->set_rules('txtDateIssued', 'Assign Date', 'trim|required'); $data = array("project_id" => $this->input->post('txtProjectID'), "employee_id" => $this->input->post('txtEmployee'), "assigned_date" => $this->input->post('txtDateIssued')); if ($this->form_validation->run()) { if (Project_worker_model::create($data)) { $this->session->set_userdata('added', 1); Audit_trail_model::auditProjectPersonnel($data); redirect('ems/view_projects'); } } }
public function insertProject() { $this->form_validation->set_rules('txtProjectID', 'Project ID', 'trim|required'); $this->form_validation->set_rules('txtProjectName', 'Project Name', 'trim|required'); $this->form_validation->set_rules('txtClient', 'Client Name', 'trim|required'); $this->form_validation->set_rules('txtStartingDate', 'Starting Date', 'trim|required'); $this->form_validation->set_rules('txtEndingDate', 'Ending Date', 'trim|required'); if ($this->form_validation->run()) { if (Projects_model::create(Projects_model::projectDetails())) { $this->session->set_userdata('added', 1); Audit_trail_model::auditNewProject($this->input->post('txtProjectName')); redirect('ams/view_projects'); } } }
public function mobile_process_leave() { if (!empty($this->input->post('emp_id')) && !empty($this->input->post('leaveStarts')) && !empty($this->input->post('leaveEnds')) && !empty($this->input->post('txtLeaveType')) && !empty($this->input->post('txtReason'))) { $details = Leave_request_model::mobile_leave_details(); $leave = Leave_request_model::create($details); if ($leave) { Audit_trail_model::auditLeave($details); $response['message'] = 'Leave Request is successfully submitted'; } else { $response['message'] = 'Error'; } } else { $response['message'] = 'Please complete the information'; } echo json_encode($response); }
public function recordRestock() { $this->form_validation->set_rules('txtItemID', 'Item ID', 'trim|required'); $this->form_validation->set_rules('txtQuantity', 'Quantity', 'trim|required'); $this->form_validation->set_rules('txtVendor', 'Vendor', 'trim|required'); $this->form_validation->set_rules('txtDateRestock', 'Date Restock', 'trim|required'); if ($this->form_validation->run()) { $details = array('item_id' => $this->input->post('txtItemID'), 'quantity' => $this->input->post('txtQuantity'), 'vendor_id' => $this->input->post('txtVendor'), 'date_restock' => $this->input->post('txtDateRestock')); if (Restock_model::create($details)) { Stocks_model::addQuantity(); $this->session->set_userdata('edited', 1); Audit_trail_model::auditRestock($details); redirect('ams/view_inventory'); } } }
public function add_asset_info() { $this->form_validation->set_rules('txtAssetID', 'Asset ID', 'trim|required'); $this->form_validation->set_rules('txtAssetName', 'Asset Name', 'trim|required'); $this->form_validation->set_rules('txtDescription', 'Description', 'trim|required'); $this->form_validation->set_rules('txtVendor', 'Asset Vendor', 'trim|required'); $this->form_validation->set_rules('txtCategory', 'Asset Category', 'trim'); $this->form_validation->set_rules('txtDateAcquired', 'Date Acquired', 'trim|required'); if ($this->form_validation->run()) { $details = Assets_info_model::assetsDetails(); if (Assets_info_model::create($details)) { Assets_model::newAssets(); $this->session->set_userdata('added', 1); Audit_trail_model::auditNewAsset($details); redirect('ams/view_assets'); } } }
public function auditAddLeave($id) { $data = array('ip_address' => $this->input->ip_address(), 'user_level' => $this->session->userdata('user_level'), 'username' => $this->session->userdata('first_name'), 'action' => 'Added Leave to Employee ' . $id); Audit_trail_model::create($data); }
public function updateLeave($id, $leave) { $details = $this->input->post('txtDetails'); $type = Leave_left_model::find_by_leave_type_id_and_employee_id($leave, $id); $days = $type->days; $leaveDays = $days + $this->input->post('txtLeaveType'); $this->reports_model->update_leave($id, $leave, $leaveDays); Leave_history_model::addHistory($id, $leave, $days, 'Acquired', $leaveDays, $details, $this->input->post('txtLeaveType')); $this->session->set_userdata('edited', 1); Audit_trail_model::auditAddLeave($id); redirect("ems/view_details?emp_id={$id}"); }
public function post_announcement() { $data = array("description" => $this->input->post('txtAnnouncement'), 'posted_by' => $this->session->userdata('user_level') . ' ' . $this->session->userdata('first_name')); if (Announcement_model::create($data)) { $this->session->set_userdata('added', 1); Audit_trail_model::auditAnnouncement(); if ($this->is_admin()) { redirect('ems/admin_dashboard'); } else { redirect('ems/hr_dashboard'); } } }
public function audit_trail() { $data['audit'] = Audit_trail_model::all(); $data['pageTitle'] = 'Audit Trail - MSInc.'; $data['content'] = 'reports/audit_trail'; $this->load->view($this->master_layout, $data); }
public function add_evaluation() { $data = array('assessee_id' => $this->input->post('txtEmpID'), 'assessor_id' => $this->session->userdata('employee_id'), 'evaluation_desc' => $this->input->post('txtEvalTitle')); $eval = count(Evaluation_model::all()) + 1; // $rate1 = array ( // 'evaluation_id' => $eval, // 'criteria_id' => 1, // 'rate' => $this->input->post('txtRate1'), // ); // $rate2 = array ( // 'evaluation_id' => $eval, // 'criteria_id' => 2, // 'rate' => $this->input->post('txtRate2'), // ); // $rate3 = array ( // 'evaluation_id' => $eval, // 'criteria_id' => 3, // 'rate' => $this->input->post('txtRate3'), // ); // $rate4 = array ( // 'evaluation_id' => $eval, // 'criteria_id' => 4, // 'rate' => $this->input->post('txtRate4'), // ); // $rate5 = array ( // 'evaluation_id' => $eval, // 'criteria_id' => 5, // 'rate' => $this->input->post('txtRate5'), // ); // $rate6 = array ( // 'evaluation_id' => $eval, // 'criteria_id' => 6, // 'rate' => $this->input->post('txtRate6'), // ); // $rate7 = array ( // 'evaluation_id' => $eval, // 'criteria_id' => 7, // 'rate' => $this->input->post('txtRate7'), // ); // $rate8 = array ( // 'evaluation_id' => $eval, // 'criteria_id' => 8, // 'rate' => $this->input->post('txtRate8'), // ); // $rate9 = array ( // 'evaluation_id' => $eval, // 'criteria_id' => 9, // 'rate' => $this->input->post('txtRate9'), // ); // $rate10 = array ( // 'evaluation_id' => $eval, // 'criteria_id' => 10, // 'rate' => $this->input->post('txtRate10'), // ); $rate = array('evaluation_id' => $eval, 'rate1' => $this->input->post('txtRate1'), 'rate2' => $this->input->post('txtRate2'), 'rate3' => $this->input->post('txtRate3'), 'rate4' => $this->input->post('txtRate4'), 'rate5' => $this->input->post('txtRate5'), 'rate6' => $this->input->post('txtRate6'), 'rate7' => $this->input->post('txtRate7'), 'rate8' => $this->input->post('txtRate8'), 'rate9' => $this->input->post('txtRate9'), 'rate10' => $this->input->post('txtRate10')); if (Performance::create($data)) { // Evaluation_rate::create($rate1); // Evaluation_rate::create($rate2); // Evaluation_rate::create($rate3); // Evaluation_rate::create($rate4); // Evaluation_rate::create($rate5); // Evaluation_rate::create($rate6); // Evaluation_rate::create($rate7); // Evaluation_rate::create($rate8); // Evaluation_rate::create($rate9); // Evaluation_rate::create($rate10); Evaluation_rate::create($rate); $this->session->set_userdata('added', 1); Audit_trail_model::auditPerformance($data); if ($this->session->userdata('user_level') == 'Administrator') { redirect('ems/view_performance'); } else { $this->session->set_userdata('added', 1); redirect('ems/emp_dashboard'); } } }
public function delete_stocks() { $stocks = Stock_info_model::find($this->input->get('item_id')); if ($stocks->delete()) { $this->session->set_userdata('deleted', 1); Audit_trail_model::auditDeleteItem($this->input->get('item_id')); redirect('ams/view_inventory'); } }