Bug di jurnal Umum
Fix Bug keterangan
This commit is contained in:
@@ -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
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user