Merge branch 'main' of github.com:yandrs/accounting

This commit is contained in:
Wian Drs
2026-05-30 16:16:05 +07:00
2 changed files with 68 additions and 2 deletions
@@ -0,0 +1,65 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Attendancemonthly extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->database();
}
public function index()
{
$data = [
"active_menu" => "attendance_monthly"
];
$this->load->view('partials/header', $data);
$this->load->view('employees/attendance_monthly');
$this->load->view('partials/footer');
}
public function get_data()
{
$date = $this->input->get('date');
if(!$date){
$date = date('Y-m-d');
}
$data = $this->db->query("
SELECT
a.*,
e.employee_code,
e.full_name,
s.shift_name
FROM k_attendances a
LEFT JOIN k_employees e ON e.id = a.employee_id
LEFT JOIN k_shifts s ON s.id = a.shift_id
WHERE a.attendance_date = '$date'
ORDER BY a.checkin_time DESC
")->result();
$rows = [];
$no = 1;
foreach($data as $d){
$rows[] = [
$no++,
$d->employee_code,
$d->full_name,
$d->shift_name,
$d->checkin_time,
$d->checkout_time,
$d->attendance_status
];
}
echo json_encode([
'data' => $rows
]);
}
}