2021-09-16 15:37:22 +07:00
|
|
|
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
|
|
|
|
class RiwayatAbsensi extends CI_Controller {
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
|
|
|
|
parent::__construct();
|
|
|
|
$this->load->model("UserModel");
|
|
|
|
$this->load->model("UmkmModel");
|
|
|
|
$this->load->model("KategoriModel");
|
|
|
|
$this->load->model("AbsensiModel");
|
|
|
|
$this->load->model("AbsenModel");
|
|
|
|
|
|
|
|
if($this->UserModel->isNotLogin()) {
|
|
|
|
redirect(site_url('login'));
|
|
|
|
} elseif(!($this->UserModel->isPemilik())) {
|
|
|
|
redirect(site_url('admin/dashboard'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$get = $this->input->get();
|
|
|
|
if($get['id_umkm']==NULL){
|
|
|
|
redirect(site_url('user/dashboard'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
|
|
|
|
$get = $this->input->get();
|
|
|
|
|
|
|
|
|
|
|
|
$umkm = $this->UmkmModel->getUmkmsById($get['id_umkm']);
|
|
|
|
$pemilik = $this->UserModel->getUsersById($umkm->id_pemilik);
|
|
|
|
$daftarkategori = $this->KategoriModel->getKategori();
|
|
|
|
|
|
|
|
// var_dump($this->input->post());die();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$cekabsensiakhir = $this->AbsensiModel->getLatestSignedAbsensiCountByUmkmId($umkm->id_umkm);
|
2021-09-17 21:26:28 +07:00
|
|
|
//var_dump($cekabsensiakhir);die();
|
2021-09-16 15:37:22 +07:00
|
|
|
|
|
|
|
if($cekabsensiakhir > 0 ){
|
|
|
|
$absensiakhir = $this->AbsensiModel->getLatestSignedAbsensiByUmkmId($umkm->id_umkm);
|
|
|
|
$aset = $absensiakhir->aset;
|
|
|
|
$karyawan_l = $absensiakhir->karyawan_l;
|
|
|
|
$karyawan_p = $absensiakhir->karyawan_p;
|
|
|
|
$data['listabsensi'] = $this->AbsensiModel->getSignedAbsensiByUmkmId($umkm->id_umkm);
|
|
|
|
} else {
|
|
|
|
$aset = $umkm->aset_awal;
|
|
|
|
$karyawan_l = $umkm->karyawan_l;
|
|
|
|
$karyawan_p = $umkm->karyawan_p;
|
2021-09-18 16:44:12 +07:00
|
|
|
$data['listabsensi'] = $this->AbsensiModel->getAllSignedAbsensiByUmkmId($umkm->id_umkm);
|
2021-09-16 15:37:22 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$data['omset'] = $umkm->omset_awal;
|
|
|
|
$data['karyawan_l'] = $karyawan_l;
|
|
|
|
$data['karyawan_p'] = $karyawan_p;
|
|
|
|
$data['aset'] = $aset;
|
|
|
|
$data['daftarkategori'] = $daftarkategori;
|
|
|
|
$data['umkm'] = $umkm;
|
|
|
|
$data['pemilik'] = $pemilik;
|
|
|
|
$data['user_logged'] = $this->session->userdata('user_logged');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->load->view('user/riwayatabsensi',$data);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|