diff --git a/application/controllers/admin/TambahAbsen.php b/application/controllers/admin/TambahAbsen.php
index 88e4b96..4bafd05 100644
--- a/application/controllers/admin/TambahAbsen.php
+++ b/application/controllers/admin/TambahAbsen.php
@@ -98,10 +98,17 @@ class TambahAbsen extends CI_Controller {
foreach($daftarumkm as $umkm){
if($bulan_absen!=='1'){
- $latestabsensi = $this->AbsensiModel->getLatestAbsensi($post['bulan'],$post['tahun'],$umkm->id_umkm);
- $aset_absensi= $latestabsensi->aset;
- $karyawan_absensi_l = $latestabsensi->karyawan_l;
- $karyawan_absensi_p = $latestabsensi->karyawan_p;
+ if(count($this->AbsensiModel->getLatestAbsensi($post['bulan'],$post['tahun'],$umkm->id_umkm))>0){
+ $latestabsensi = $this->AbsensiModel->getLatestAbsensi($post['bulan'],$post['tahun'],$umkm->id_umkm);
+ $aset_absensi= $latestabsensi->aset;
+ $karyawan_absensi_l = $latestabsensi->karyawan_l;
+ $karyawan_absensi_p = $latestabsensi->karyawan_p;
+ } else{
+ $aset_absensi= $umkm->aset_awal;
+ $karyawan_absensi_l= $umkm->karyawan_l;
+ $karyawan_absensi_p= $umkm->karyawan_p;
+ }
+
} else {
$aset_absensi= $umkm->aset_awal;
$karyawan_absensi_l= $umkm->karyawan_l;
diff --git a/application/controllers/user/DetailUmkm.php b/application/controllers/user/DetailUmkm.php
index bb793b1..dc31b79 100644
--- a/application/controllers/user/DetailUmkm.php
+++ b/application/controllers/user/DetailUmkm.php
@@ -76,37 +76,48 @@ class DetailUmkm extends CI_Controller {
if($this->AbsenModel->getCountActiveAbsen()>0){
$data['data_absen'] = $this->AbsenModel->getActiveAbsen();
- if($data['data_absen']->bulan=='1'){
- $bulan = 'Januari';
- } elseif($data['data_absen']->bulan=='2'){
- $bulan = 'Februari';
- } elseif($data['data_absen']->bulan=='3'){
- $bulan = 'Maret';
- } elseif($data['data_absen']->bulan=='4'){
- $bulan = 'April';
- } elseif($data['data_absen']->bulan=='5'){
- $bulan = 'Mei';
- } elseif($data['data_absen']->bulan=='6'){
- $bulan = 'Juni';
- } elseif($data['data_absen']->bulan=='7'){
- $bulan = 'Juli';
- } elseif($data['data_absen']->bulan=='8'){
- $bulan = 'Agustus';
- } elseif($data['data_absen']->bulan=='9'){
- $bulan = 'September';
- } elseif($data['data_absen']->bulan=='10'){
- $bulan = 'Oktober';
- } elseif($data['data_absen']->bulan=='11'){
- $bulan = 'November';
- } elseif($data['data_absen']->bulan=='12'){
- $bulan = 'Desember';
+ if($this->AbsensiModel->getCountAbsensiByAbsenIdAndUmkmId($umkm->id_umkm,$data['data_absen']->id_absen)>0){
+ if($data['data_absen']->bulan=='1'){
+ $bulan = 'Januari';
+ } elseif($data['data_absen']->bulan=='2'){
+ $bulan = 'Februari';
+ } elseif($data['data_absen']->bulan=='3'){
+ $bulan = 'Maret';
+ } elseif($data['data_absen']->bulan=='4'){
+ $bulan = 'April';
+ } elseif($data['data_absen']->bulan=='5'){
+ $bulan = 'Mei';
+ } elseif($data['data_absen']->bulan=='6'){
+ $bulan = 'Juni';
+ } elseif($data['data_absen']->bulan=='7'){
+ $bulan = 'Juli';
+ } elseif($data['data_absen']->bulan=='8'){
+ $bulan = 'Agustus';
+ } elseif($data['data_absen']->bulan=='9'){
+ $bulan = 'September';
+ } elseif($data['data_absen']->bulan=='10'){
+ $bulan = 'Oktober';
+ } elseif($data['data_absen']->bulan=='11'){
+ $bulan = 'November';
+ } elseif($data['data_absen']->bulan=='12'){
+ $bulan = 'Desember';
+ }
+ $data['bulan'] = $bulan;
+
+ $data['active_absen'] = true;
+
+
+ $absenisi = $this->AbsensiModel->getAbsensiByAbsenIdAndUmkmId($umkm->id_umkm,$data['data_absen']->id_absen);
+
+ $data['absenisiaktif'] = $absenisi;
+ $data['signed']=$absenisi->signed;
+ } else {
+
+ $data['active_absen'] = false;
+ $data['data_absen'] = '';
}
- $data['bulan'] = $bulan;
-
- $data['active_absen'] = true;
-
- $data['absenisiaktif'] = $this->AbsensiModel->getAbsensiByAbsenIdAndUmkmId($umkm->id_umkm,$data['data_absen']->id_absen);
} else {
+
$data['data_absen'] = '';
$data['active_absen'] = false;
}
diff --git a/application/models/AbsensiModel.php b/application/models/AbsensiModel.php
index b981db1..1a917d8 100644
--- a/application/models/AbsensiModel.php
+++ b/application/models/AbsensiModel.php
@@ -16,6 +16,12 @@ class AbsensiModel extends CI_Model
return $absensi = $this->db->get($this->_table)->row();
}
+ public function getCountAbsensiByAbsenIdAndUmkmId($id_umkm,$id_absen){
+ $this->db->where('id_absen', $id_absen);
+ $this->db->where('id_umkm', $id_umkm);
+ return $absensi = count($this->db->get($this->_table)->result());
+ }
+
public function update($id_absensi){
$post = $this->input->post();
$this->aset = $post["aset"];
diff --git a/application/views/admin/absensi.php b/application/views/admin/absensi.php
index cf72ae8..51f900a 100644
--- a/application/views/admin/absensi.php
+++ b/application/views/admin/absensi.php
@@ -48,7 +48,7 @@
-
+
-
+
@@ -100,7 +100,7 @@
-
+
Absensi Bulan Tahun tahun ?>
@@ -140,7 +140,7 @@
-