|
Server : LiteSpeed System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : outerorb ( 1091) PHP Version : 8.1.34 Disable Function : mail Directory : /home2/outerorb/crm.outerorbittech.com/application/controllers/ | |
|
Path: /home2/outerorb/crm.outerorbittech.com/application/controllers/Attendence.php
Size: 3.27 KB
Permissions: 0664
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Attendence extends CI_Controller
{
function __construct()
{
parent::__construct();
checklogin();
}
public function index()
{
$data['title'] = 'Attendence Sheet';
$data['datatable'] = true;
$data['emp'] = $this->db->get_where('emp', array('status' => 1))->result_array();
if ($this->input->get('emp')) {
$emp = $this->input->get('emp');
} else {
$emp = '';
}
if ($this->input->get('month')) {
$date = $this->input->get('month');
$exp = explode('-', $date);
$year = $exp[0];
$month = $exp[1];
} else {
$year = '';
$month = '';
}
$data['list'] = $this->db->get_where('attendence', array('emp_id' => $emp, 'year' => $year, 'month' => $month))->result_array();
$this->template->load('pages', 'attendence', $data);
}
public function incoming()
{
echo 'hii';
if ($_SESSION['row'] != '') {
$data['emp'] = $_SESSION['row'];
} else {
$data['emp'] = $this->input->post('emp');
$ar['status']=1;
}
$data['date'] = $this->input->post('date');
$data['n'] = $this->input->post('n');
$d = date('Y' . $data['date']);
$ar['in_time'] = $data['n'];
$this->db->where('emp_id', $data['emp']);
$this->db->where('date', $data['date']);
$up = $this->db->update('attendence', $ar);
if ($up == true) {
echo '1';
} else {
echo '0';
}
}
public function outgoing()
{
if ($_SESSION['row'] != '') {
$data['emp'] = $_SESSION['row'];
} else {
$data['emp'] = $this->input->post('emp');
$ar['status']=1;
}
$data['date'] = $this->input->post('date');
$data['n'] = $this->input->post('n');
$d = date('Y' . $data['date']);
$ar['out_time'] = $data['n'];
$this->db->where('emp_id', $data['emp']);
$this->db->where('date', $data['date']);
$up = $this->db->update('attendence', $ar);
if ($up == true) {
echo '1';
} else {
echo '0';
}
}
public function myattendence()
{
if ($_SESSION['role'] == 3) {
$data['title'] = 'Attendence Sheet';
$emp = $_SESSION['row'];
if ($this->input->get('month')) {
$date = $this->input->get('month');
$exp = explode('-', $date);
$year = $exp[0];
$month = $exp[1];
} else {
$year = '';
$month = '';
}
$data['list'] = $this->db->get_where('attendence', array('emp_id' => $emp, 'year' => $year, 'month' => $month))->result_array();
$this->template->load('pages', 'my_attendence', $data);
}
}
public function approve_attendence()
{
$data['title']='Approve Attendence';
$data['list'] = $this->db->get_where('attendence', array('status' => 0,'date'=>date('Y-m-d')))->result_array();
$this->template->load('pages', 'atten_approve', $data);
}
}