karyawan page completed

This commit is contained in:
kicap1992
2021-05-05 03:57:01 +08:00
parent 6fb6596e75
commit 85ec0bc8dc
5 changed files with 512 additions and 8 deletions

View File

@ -65,6 +65,46 @@ class Api_server extends RestController
}
function karyawan_get(){
$nik_karyawan = $this->get('nik_karyawan');
$cek_data = $this->model->tampil_data_where('tb_karyawan' ,['nik_karyawan' => $nik_karyawan])->result();
if(count($cek_data) > 0){
$this->response(['message' => 'sini ada','data' => $cek_data], 200);
}else{
$this->response(['message' => 'tiada data'], 401);
}
}
function karyawan_put(){
$where = $this->put('where');
$data = $this->put('data');
$cek_data = $this->model->tampil_data_where('tb_karyawan' ,$where)->result();
if(count($cek_data) > 0){
$this->model->update('tb_karyawan',$where,$data);
$this->response(['message' => 'ok'], 200);
}else{
$this->response(['message' => 'tiada data'], 401);
}
}
function karyawan_delete(){
$where = $this->delete('where');
// $data = $this->put('data');
$cek_data = $this->model->tampil_data_where('tb_karyawan' ,$where)->result();
if(count($cek_data) > 0){
$this->model->delete('tb_karyawan',$where);
$this->response(['message' => 'ok',$where], 200);
}else{
$this->response(['message' => 'tiada data'], 401);
}
}
function login_petugas_get(){
$username = $this->get('username');
$password = $this->get('password');

View File

@ -64,11 +64,53 @@ class Home extends CI_Controller {
}
function laporan(){
// print_r('sini home');
$main['header'] = 'Halaman Laporan Absensi';
$this->load->view('home/index', $main);
function laporan($tahun = null, $bulan = null){
if ($this->input->post('proses') == "table_all") {
$list = $this->m_tabel_ss->get_datatables(array('bulan','tahun'),array('tahun','bulan',null),array('id_absensi' => 'desc'),"tb_absensi",null,null,"*");
$data = array();
$no = 0;
foreach ($list as $field) {
$no++;
$row = array();
$row[] = $this->model->bulan($field->bulan);
$row[] = $field->tahun;
$row[] = '<center><a href="'.base_url().'home/laporan/'.$field->tahun.'/'.$field->bulan.'"><button type="button" class="btn btn-primary btn-circle btn-sm waves-effect waves-light"><i class="ico fa fa-edit"></i></button></a></center>';
$data[] = $row;
}
$output = array(
"draw" => $_POST['draw'],
"recordsTotal" => $this->m_tabel_ss->count_all("tb_absensi",null,null,"*"),
"recordsFiltered" => $this->m_tabel_ss->count_filtered(array('bulan','tahun'),array('tahun','bulan',null),array('id_absensi' => 'desc'),"tb_absensi",null,null,"*"),
"data" => $data,
);
//output dalam format JSON
echo json_encode($output);
}
else if ($tahun != null) {
if (is_numeric($tahun) and is_numeric($bulan)) {
$cek_data = $this->model->tampil_data_where('tb_absensi',['tahun' => $tahun,'bulan' => $bulan])->result();
if (count($cek_data) > 0) {
}else{
redirect('/home/laporan');
}
}else{
redirect('/home/laporan');
}
}
else{
$main['header'] = 'Halaman Laporan Absensi';
$this->load->view('home/menu/laporan', $main);
}
}