Add Anual Chart Report Feature

master
Hafidz Fachrisyah Widyarix 2021-09-18 16:44:12 +07:00
parent cd74f850b0
commit c3f1605f35
10 changed files with 14297 additions and 89 deletions

View File

@ -0,0 +1,280 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Laporan extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model("UserModel");
$this->load->model("LaporanModel");
$this->load->model("KategoriModel");
$this->load->model("JenisModel");
if($this->UserModel->isNotLogin()) {
redirect(site_url('login'));
} elseif(!($this->UserModel->isAdmin())) {
redirect(site_url('dashboard'));
}
}
public function index()
{
//cek ada laporan tahunan atau tidak
$countlaporan = $this->LaporanModel->getLaporanCount();
if($countlaporan>0){
$year = $this->LaporanModel->getLastYearLaporan()->tahun;
$data['tahun'] = $year;
$lap_bulan = $this->LaporanModel->getBulanLaporanByYear($year);
$omset_jen1=0;
$omset_jen2=0;
$omset_jen3=0;
foreach($lap_bulan as $bulan){
$umkm_jen1=0;
$umkm_jen2=0;
$umkm_jen3=0;
$umkm_jen1_ket1=0;
$umkm_jen1_ket2=0;
$umkm_jen1_ket3=0;
$umkm_jen2_ket1=0;
$umkm_jen2_ket2=0;
$umkm_jen2_ket3=0;
$umkm_jen3_ket1=0;
$umkm_jen3_ket2=0;
$umkm_jen3_ket3=0;
$aset_jen1=0;
$aset_jen2=0;
$aset_jen3=0;
$naker_jen1_l=0;
$naker_jen1_p=0;
$naker_jen2_l=0;
$naker_jen2_p=0;
$naker_jen3_l=0;
$naker_jen3_p=0;
$lap_kelurahan = $this->LaporanModel->getKelurahanByBulanAndYear($bulan->bulan,$year);
foreach($lap_kelurahan as $kelurahan){
$laporan = $this->LaporanModel->getLaporanByBulanByYearByKelurahan($bulan->bulan,$year,$kelurahan->kelurahan);
$umkm_jen1= $umkm_jen1+$laporan->umkm_jen1_kat1+$laporan->umkm_jen1_kat2+$laporan->umkm_jen1_kat3;
$umkm_jen2= $umkm_jen2+$laporan->umkm_jen2_kat1+$laporan->umkm_jen2_kat2+$laporan->umkm_jen2_kat3;
$umkm_jen3= $umkm_jen3+$laporan->umkm_jen3_kat1+$laporan->umkm_jen3_kat2+$laporan->umkm_jen3_kat3;
$omset_jen1= $omset_jen1+$laporan->omset_jenis1;
$omset_jen2= $omset_jen2+$laporan->omset_jenis2;
$omset_jen3= $omset_jen3+$laporan->omset_jenis3;
$aset_jen1= $aset_jen1+$laporan->aset_jenis1;
$aset_jen2= $aset_jen2+$laporan->aset_jenis2;
$aset_jen3= $aset_jen3+$laporan->aset_jenis3;
$naker_jen1_l = $naker_jen1_l + $laporan->karyawan_jen1_l;
$naker_jen1_p = $naker_jen1_p + $laporan->karyawan_jen1_p;
$naker_jen2_l = $naker_jen2_l + $laporan->karyawan_jen2_l;
$naker_jen2_p = $naker_jen2_p + $laporan->karyawan_jen2_p;
$naker_jen3_l = $naker_jen3_l + $laporan->karyawan_jen3_l;
$naker_jen3_p = $naker_jen3_p + $laporan->karyawan_jen3_p;
$umkm_jen1_ket1=$umkm_jen1_ket1+$laporan->umkm_jen1_kat1;
$umkm_jen1_ket2=$umkm_jen1_ket2+$laporan->umkm_jen1_kat2;
$umkm_jen1_ket3=$umkm_jen1_ket3+$laporan->umkm_jen1_kat3;
$umkm_jen2_ket1=$umkm_jen2_ket1+$laporan->umkm_jen2_kat1;
$umkm_jen2_ket2=$umkm_jen2_ket2+$laporan->umkm_jen2_kat2;
$umkm_jen2_ket3=$umkm_jen2_ket3+$laporan->umkm_jen2_kat3;
$umkm_jen3_ket1=$umkm_jen3_ket1+$laporan->umkm_jen3_kat1;
$umkm_jen3_ket2=$umkm_jen3_ket2+$laporan->umkm_jen3_kat2;
$umkm_jen3_ket3=$umkm_jen3_ket3+$laporan->umkm_jen3_kat3;
}
}
$data['umkm_jen1_ket1']=$umkm_jen1_ket1;
$data['umkm_jen1_ket2']=$umkm_jen1_ket2;
$data['umkm_jen1_ket3']=$umkm_jen1_ket3;
$data['umkm_jen2_ket1']=$umkm_jen2_ket1;
$data['umkm_jen2_ket2']=$umkm_jen2_ket2;
$data['umkm_jen2_ket3']=$umkm_jen2_ket3;
$data['umkm_jen3_ket1']=$umkm_jen3_ket1;
$data['umkm_jen3_ket2']=$umkm_jen3_ket2;
$data['umkm_jen3_ket3']=$umkm_jen3_ket3;
$omset_bln_jen1= $omset_jen1/12;
$omset_bln_jen2= $omset_jen2/12;
$omset_bln_jen3= $omset_jen3/12;
$data['umkm_jen1']=$umkm_jen1;
$data['umkm_jen2']=$umkm_jen2;
$data['umkm_jen3']=$umkm_jen3;
$data['omset_bln_jen1'] = $omset_bln_jen1;
$data['omset_bln_jen2'] = $omset_bln_jen2;
$data['omset_bln_jen3'] = $omset_bln_jen3;
$data['aset_jen1'] = $aset_jen1;
$data['aset_jen2'] = $aset_jen2;
$data['aset_jen3'] = $aset_jen3;
$data['naker_jen1_l'] = $naker_jen1_l;
$data['naker_jen1_p'] = $naker_jen1_p;
$data['naker_jen2_l'] = $naker_jen2_l;
$data['naker_jen2_p'] = $naker_jen2_p;
$data['naker_jen3_l'] = $naker_jen3_l;
$data['naker_jen3_p'] = $naker_jen3_p;
//komulatif
$data['omset_1'] = $omset_bln_jen1+$omset_bln_jen2+$omset_bln_jen3;
$data['aset_1'] = $aset_jen1+$aset_jen2+$aset_jen3;
$data['umkm_1'] = $umkm_jen1+$umkm_jen2+$umkm_jen3;
$naker_1 = $naker_jen1_l+$naker_jen2_l+$naker_jen3_l;
$data['naker_1'] = $naker_1+$naker_jen1_p+$naker_jen2_p+$naker_jen3_p;
$data['mikro_1'] = $umkm_jen1_ket1+$umkm_jen2_ket1+$umkm_jen3_ket1;
$data['kecil_1'] = $umkm_jen1_ket2+$umkm_jen2_ket2+$umkm_jen3_ket2;
$data['menengah_1'] = $umkm_jen1_ket3+$umkm_jen2_ket3+$umkm_jen3_ket3;
//cek ada laporan tahun sebelumnya atau tidak
$countlaporanbefore = $this->LaporanModel->getLaporanBeforeCount();
if($countlaporanbefore>0){
$yearbefore = $this->LaporanModel->getLastYearLaporanBefore()->tahun;
$data['tahun_0'] = $yearbefore;
$lap_bulan_0 = $this->LaporanModel->getBulanLaporanByYear($yearbefore);
$omset_jen1_0=0;
$omset_jen2_0=0;
$omset_jen3_0=0;
foreach($lap_bulan_0 as $bulan_0){
$umkm_jen1_0=0;
$umkm_jen2_0=0;
$umkm_jen3_0=0;
$umkm_jen1_ket1_0=0;
$umkm_jen1_ket2_0=0;
$umkm_jen1_ket3_0=0;
$umkm_jen2_ket1_0=0;
$umkm_jen2_ket2_0=0;
$umkm_jen2_ket3_0=0;
$umkm_jen3_ket1_0=0;
$umkm_jen3_ket2_0=0;
$umkm_jen3_ket3_0=0;
$aset_jen1_0=0;
$aset_jen2_0=0;
$aset_jen3_0=0;
$naker_jen1_l_0=0;
$naker_jen1_p_0=0;
$naker_jen2_l_0=0;
$naker_jen2_p_0=0;
$naker_jen3_l_0=0;
$naker_jen3_p_0=0;
$lap_kelurahan_0 = $this->LaporanModel->getKelurahanByBulanAndYear($bulan_0->bulan,$yearbefore);
foreach($lap_kelurahan_0 as $kelurahan_0){
$laporan_0 = $this->LaporanModel->getLaporanByBulanByYearByKelurahan($bulan_0->bulan,$yearbefore,$kelurahan_0->kelurahan);
$umkm_jen1_0= $umkm_jen1_0+$laporan_0->umkm_jen1_kat1+$laporan_0->umkm_jen1_kat2+$laporan_0->umkm_jen1_kat3;
$umkm_jen2_0= $umkm_jen2_0+$laporan_0->umkm_jen2_kat1+$laporan_0->umkm_jen2_kat2+$laporan_0->umkm_jen2_kat3;
$umkm_jen3_0= $umkm_jen3_0+$laporan_0->umkm_jen3_kat1+$laporan_0->umkm_jen3_kat2+$laporan_0->umkm_jen3_kat3;
$omset_jen1_0= $omset_jen1_0+$laporan_0->omset_jenis1;
$omset_jen2_0= $omset_jen2_0+$laporan_0->omset_jenis2;
$omset_jen3_0= $omset_jen3_0+$laporan_0->omset_jenis3;
$aset_jen1_0= $aset_jen1_0+$laporan_0->aset_jenis1;
$aset_jen2_0= $aset_jen2_0+$laporan_0->aset_jenis2;
$aset_jen3_0= $aset_jen3_0+$laporan_0->aset_jenis3;
$naker_jen1_l_0 = $naker_jen1_l_0 + $laporan_0->karyawan_jen1_l;
$naker_jen1_p_0 = $naker_jen1_p_0 + $laporan_0->karyawan_jen1_p;
$naker_jen2_l_0 = $naker_jen2_l_0 + $laporan_0->karyawan_jen2_l;
$naker_jen2_p_0 = $naker_jen2_p_0 + $laporan_0->karyawan_jen2_p;
$naker_jen3_l_0 = $naker_jen3_l_0 + $laporan_0->karyawan_jen3_l;
$naker_jen3_p_0 = $naker_jen3_p_0 + $laporan_0->karyawan_jen3_p;
$umkm_jen1_ket1_0=$umkm_jen1_ket1_0+$laporan_0->umkm_jen1_kat1;
$umkm_jen1_ket2_0=$umkm_jen1_ket2_0+$laporan_0->umkm_jen1_kat2;
$umkm_jen1_ket3_0=$umkm_jen1_ket3_0+$laporan_0->umkm_jen1_kat3;
$umkm_jen2_ket1_0=$umkm_jen2_ket1_0+$laporan_0->umkm_jen2_kat1;
$umkm_jen2_ket2_0=$umkm_jen2_ket2_0+$laporan_0->umkm_jen2_kat2;
$umkm_jen2_ket3_0=$umkm_jen2_ket3_0+$laporan_0->umkm_jen2_kat3;
$umkm_jen3_ket1_0=$umkm_jen3_ket1_0+$laporan_0->umkm_jen3_kat1;
$umkm_jen3_ket2_0=$umkm_jen3_ket2_0+$laporan_0->umkm_jen3_kat2;
$umkm_jen3_ket3_0=$umkm_jen3_ket3_0+$laporan_0->umkm_jen3_kat3;
}
}
$data['umkm_jen1_ket1_0']=$umkm_jen1_ket1_0;
$data['umkm_jen1_ket2_0']=$umkm_jen1_ket2_0;
$data['umkm_jen1_ket3_0']=$umkm_jen1_ket3_0;
$data['umkm_jen2_ket1_0']=$umkm_jen2_ket1_0;
$data['umkm_jen2_ket2_0']=$umkm_jen2_ket2_0;
$data['umkm_jen2_ket3_0']=$umkm_jen2_ket3_0;
$data['umkm_jen3_ket1_0']=$umkm_jen3_ket1_0;
$data['umkm_jen3_ket2_0']=$umkm_jen3_ket2_0;
$data['umkm_jen3_ket3_0']=$umkm_jen3_ket3_0;
$omset_bln_jen1_0= $omset_jen1_0/12;
$omset_bln_jen2_0= $omset_jen2_0/12;
$omset_bln_jen3_0= $omset_jen3_0/12;
$data['umkm_jen1_0']=$umkm_jen1_0;
$data['umkm_jen2_0']=$umkm_jen2_0;
$data['umkm_jen3_0']=$umkm_jen3_0;
$data['omset_bln_jen1_0'] = $omset_bln_jen1_0;
$data['omset_bln_jen2_0'] = $omset_bln_jen2_0;
$data['omset_bln_jen3_0'] = $omset_bln_jen3_0;
$data['aset_jen1_0'] = $aset_jen1_0;
$data['aset_jen2_0'] = $aset_jen2_0;
$data['aset_jen3_0'] = $aset_jen3_0;
$data['naker_jen1_l_0'] = $naker_jen1_l_0;
$data['naker_jen1_p_0'] = $naker_jen1_p_0;
$data['naker_jen2_l_0'] = $naker_jen2_l_0;
$data['naker_jen2_p_0'] = $naker_jen2_p_0;
$data['naker_jen3_l_0'] = $naker_jen3_l_0;
$data['naker_jen3_p_0'] = $naker_jen3_p_0;
//komulatif
$data['omset_0'] = $omset_bln_jen1_0+$omset_bln_jen2_0+$omset_bln_jen3_0;
$data['aset_0'] = $aset_jen1_0+$aset_jen2_0+$aset_jen3_0;
$data['umkm_0'] = $umkm_jen1_0+$umkm_jen2_0+$umkm_jen3_0;
$naker_0 = $naker_jen1_l_0+$naker_jen2_l_0+$naker_jen3_l_0;
$data['naker_0'] = $naker_0+$naker_jen1_p_0+$naker_jen2_p_0+$naker_jen3_p_0;
$data['mikro_0'] = $umkm_jen1_ket1_0+$umkm_jen2_ket1_0+$umkm_jen3_ket1_0;
$data['kecil_0'] = $umkm_jen1_ket2_0+$umkm_jen2_ket2_0+$umkm_jen3_ket2_0;
$data['menengah_0'] = $umkm_jen1_ket3_0+$umkm_jen2_ket3_0+$umkm_jen3_ket3_0;
}
$data['msg'] = 'found';
} else {
$data['msg'] = 'empty';
}
$data['user_logged'] = $this->session->userdata('user_logged');
$this->load->view('admin/laporan',$data);
}
}

View File

@ -49,7 +49,9 @@ class TutupTahun extends CI_Controller {
$listabsensi = $this->AbsensiModel->getAbsensiByBulanAndThn($absen->bulan,$tahun);
foreach($listabsensi as $absensi){
if($absensi->signed=='0'){
$this->AbsensiModel->absenBySystem($absensi->id_absensi);
}
$omset = $omset + $absensi->omset;
$aset = $aset + $absensi->aset;
$karyawan_l = $karyawan_l + $absensi->karyawan_l;
@ -75,6 +77,9 @@ class TutupTahun extends CI_Controller {
$listkelurahan = $this->KelurahanModel->getKelurahan();
foreach($listkelurahan as $kelurahan){
$listabsen = $this->AbsenModel->getAbsensByTahun($tahun);
foreach($listabsen as $absen){
$kecamatan = $kelurahan->kecamatan;
$aset=0;
$omset=0;
@ -103,7 +108,8 @@ class TutupTahun extends CI_Controller {
$umkm_jen3_kat1 = 0;
$umkm_jen3_kat2 = 0;
$umkm_jen3_kat3 = 0;
$listabsensiupdated = $this->AbsensiModel->getAbsensByTahunAndKelurahan($tahun,$kelurahan->kelurahan);
$listabsensiupdated = $this->AbsensiModel->getAbsensByTahunByBulanAndKelurahan($tahun,$absen->bulan,$kelurahan->kelurahan);
foreach($listabsensiupdated as $updatedabsensi){
$aset = $aset+$updatedabsensi->aset;
$omset = $omset+$updatedabsensi->omset;
@ -151,8 +157,15 @@ class TutupTahun extends CI_Controller {
$umkm_jen3_kat3++;
}
//ceklaporan sudah ada atau belum
if($this->LaporanModel->getCountByTahunByBulanByKelurahan($tahun,$updatedabsensi->bulan,$kelurahan->kelurahan)>0){
$existinglaporan = $this->LaporanModel->getLaporanByBulanByYearByKelurahan($updatedabsensi->bulan,$tahun,$kelurahan->kelurahan);
$id_exitinglaporan = $existinglaporan->id_laporan;
$this->LaporanModel->update($id_exitinglaporan,$tahun,$updatedabsensi->bulan,$kelurahan->kelurahan,$kecamatan,$aset,$omset,$jumlah_umkm,$karyawan_jenis1,$karyawan_jenis2,$karyawan_jenis3,$omset_jenis1,$omset_jenis2,$omset_jenis3,$aset_jenis1,$aset_jenis2,$aset_jenis3,$karyawan_jen1_l,$karyawan_jen1_p,$karyawan_jen2_l,$karyawan_jen2_p,$karyawan_jen3_l,$karyawan_jen3_p,$umkm_jen1_kat1,$umkm_jen1_kat2,$umkm_jen1_kat3,$umkm_jen2_kat1,$umkm_jen2_kat2,$umkm_jen2_kat3,$umkm_jen3_kat1,$umkm_jen3_kat2,$umkm_jen3_kat3);
}else {
$this->LaporanModel->save($tahun,$updatedabsensi->bulan,$kelurahan->kelurahan,$kecamatan,$aset,$omset,$jumlah_umkm,$karyawan_jenis1,$karyawan_jenis2,$karyawan_jenis3,$omset_jenis1,$omset_jenis2,$omset_jenis3,$aset_jenis1,$aset_jenis2,$aset_jenis3,$karyawan_jen1_l,$karyawan_jen1_p,$karyawan_jen2_l,$karyawan_jen2_p,$karyawan_jen3_l,$karyawan_jen3_p,$umkm_jen1_kat1,$umkm_jen1_kat2,$umkm_jen1_kat3,$umkm_jen2_kat1,$umkm_jen2_kat2,$umkm_jen2_kat3,$umkm_jen3_kat1,$umkm_jen3_kat2,$umkm_jen3_kat3);
}
}
}
}

View File

@ -45,9 +45,25 @@ class DetailUmkm extends CI_Controller {
$post = $this->input->post();
if($this->AbsensiModel->update($post['id_absensi'])){
$this->UmkmModel->updateAset($umkm->id_umkm,$post['aset']);
$id_absen = $this->AbsensiModel->getAbsenIdByAbsensiId($post['id_absensi'])->id_absen;
$omset = 0;
$aset = 0;
$karyawan_l = 0;
$karyawan_p = 0;
$listabsensi = $this->AbsensiModel->getAbsensiByAbsenId($id_absen);
foreach($listabsensi as $absensi){
$omset=$omset+$absensi->omset;
$aset=$aset+$absensi->aset;
$karyawan_l=$karyawan_l+$absensi->karyawan_l;
$karyawan_p=$karyawan_p+$absensi->karyawan_p;
}
$this->AbsenModel->update($id_absen,$omset,$aset,$karyawan_l,$karyawan_p);
redirect(site_url('user/detailumkm?id_umkm='.$umkm->id_umkm.'&msg=success'));
} else {
$data['msg']="error!";

View File

@ -52,7 +52,7 @@ class RiwayatAbsensi extends CI_Controller {
$aset = $umkm->aset_awal;
$karyawan_l = $umkm->karyawan_l;
$karyawan_p = $umkm->karyawan_p;
$data['listabsensi'] = array();
$data['listabsensi'] = $this->AbsensiModel->getAllSignedAbsensiByUmkmId($umkm->id_umkm);
}

View File

@ -10,6 +10,12 @@ class AbsensiModel extends CI_Model
return $absensi = $this->db->get($this->_table)->result();
}
public function getAbsenIdByAbsensiId($id_absensi){
$this->db->select('id_absen');
$this->db->where('id_absensi', $id_absensi);
return $absensi = $this->db->get($this->_table)->row();
}
public function getAbsensiByAbsenIdAndUmkmId($id_umkm,$id_absen){
$this->db->where('id_absen', $id_absen);
$this->db->where('id_umkm', $id_umkm);
@ -44,9 +50,11 @@ class AbsensiModel extends CI_Model
return $absensi = $this->db->get($this->_table)->result();
}
public function getAbsensByTahunAndKelurahan($tahun,$kelurahan){
public function getAbsensByTahunByBulanAndKelurahan($tahun,$bulan,$kelurahan){
$this->db->where('kelurahan', $kelurahan);
$this->db->where('bulan', $bulan);
$this->db->where('tahun', $tahun);
$this->db->order_by('id_absensi','ASC');
return $absensi = $this->db->get($this->_table)->result();
}
@ -113,6 +121,8 @@ class AbsensiModel extends CI_Model
return $absensi = count($this->db->get($this->_table)->result());
}
public function getLatestSignedAbsensiByUmkmId($id_umkm){
$this->db->where('signed', true);
$this->db->where('id_umkm', $id_umkm);
@ -130,12 +140,19 @@ class AbsensiModel extends CI_Model
}
public function getSignedAbsensiByUmkmId($id_umkm){
$this->db->where('signed', 1);
$this->db->where_in('signed', array(1,3));
// $this->db->where('signed', 3);
$this->db->where('id_umkm', $id_umkm);
$this->db->where('tahun', date('Y'));
$this->db->order_by('bulan', 'DESC');
$this->db->order_by('tahun', 'DESC');
$this->db->order_by('id_absensi', 'DESC');
return $user = $this->db->get($this->_table)->result();
}
public function getAllSignedAbsensiByUmkmId($id_umkm){
$this->db->where_in('signed', array(1,3));
$this->db->where('id_umkm', $id_umkm);
$this->db->order_by('tahun', 'DESC');
$this->db->order_by('id_absensi', 'DESC');
return $user = $this->db->get($this->_table)->result();
}

View File

@ -7,6 +7,70 @@ class LaporanModel extends CI_Model
public function getLaporanCountByYear($tahun){
$this->db->where('tahun',$tahun);
return $laporan = count($this->db->get($this->_table)->result());
}
public function getCountByTahunByBulanByKelurahan($tahun,$bulan,$kelurahan){
$this->db->where('tahun',$tahun);
$this->db->where('bulan',$bulan);
$this->db->where('kelurahan',$kelurahan);
return $laporan = count($this->db->get($this->_table)->result());
}
public function getLaporanByBulanByYearByKelurahan($bulan,$year,$kelurahan){
$this->db->where('tahun',$year);
$this->db->where('bulan',$bulan);
$this->db->where('kelurahan',$kelurahan);
return $laporan = $this->db->get($this->_table)->row();
}
public function getLaporanCount(){
$this->db->select('tahun');
$this->db->distinct('tahun');
$this->db->order_by('tahun','DESC');
return $laporan = count($this->db->get($this->_table)->result());
}
public function getLaporanBeforeCount(){
$this->db->select('tahun');
$this->db->distinct('tahun');
$this->db->order_by('tahun','DESC');
$this->db->limit(2,1);
return $laporan = count($this->db->get($this->_table)->result());
}
public function getLastYearLaporan(){
$this->db->select('tahun');
$this->db->distinct('tahun');
$this->db->order_by('tahun','DESC');
$this->db->limit(1);
return $laporan =$this->db->get($this->_table)->row();
}
public function getBulanLaporanByYear($tahun){
$this->db->select('bulan');
$this->db->where('tahun',$tahun);
$this->db->distinct('bulan');
$this->db->order_by('id_laporan','ASC');
return $laporan =$this->db->get($this->_table)->result();
}
public function getKelurahanByBulanAndYear($bulan,$year){
$this->db->select('kelurahan');
$this->db->where('tahun',$year);
$this->db->where('bulan',$bulan);
$this->db->distinct('kelurahan');
$this->db->order_by('id_laporan','ASC');
return $laporan =$this->db->get($this->_table)->result();
}
public function getLastYearLaporanBefore(){
$this->db->select('tahun');
$this->db->distinct('tahun');
$this->db->order_by('tahun','DESC');
$this->db->limit(2,1);
return $laporan =$this->db->get($this->_table)->row();
}
public function save($tahun,$bulan,$kelurahan,$kecamatan,$aset,$omset,$jumlah_umkm,$karyawan_jenis1,$karyawan_jenis2,$karyawan_jenis3,$omset_jenis1,$omset_jenis2,$omset_jenis3,$aset_jenis1,$aset_jenis2,$aset_jenis3,$karyawan_jen1_l,$karyawan_jen1_p,$karyawan_jen2_l,$karyawan_jen2_p,$karyawan_jen3_l,$karyawan_jen3_p,$umkm_jen1_kat1,$umkm_jen1_kat2,$umkm_jen1_kat3,$umkm_jen2_kat1,$umkm_jen2_kat2,$umkm_jen2_kat3,$umkm_jen3_kat1,$umkm_jen3_kat2,$umkm_jen3_kat3)
@ -48,5 +112,43 @@ class LaporanModel extends CI_Model
return $this->db->insert($this->_table, $this);
}
public function update($id_laporan,$tahun,$bulan,$kelurahan,$kecamatan,$aset,$omset,$jumlah_umkm,$karyawan_jenis1,$karyawan_jenis2,$karyawan_jenis3,$omset_jenis1,$omset_jenis2,$omset_jenis3,$aset_jenis1,$aset_jenis2,$aset_jenis3,$karyawan_jen1_l,$karyawan_jen1_p,$karyawan_jen2_l,$karyawan_jen2_p,$karyawan_jen3_l,$karyawan_jen3_p,$umkm_jen1_kat1,$umkm_jen1_kat2,$umkm_jen1_kat3,$umkm_jen2_kat1,$umkm_jen2_kat2,$umkm_jen2_kat3,$umkm_jen3_kat1,$umkm_jen3_kat2,$umkm_jen3_kat3)
{
$this->tahun = $tahun;
$this->bulan = $bulan;
$this->kelurahan = $kelurahan;
$this->kecamatan = $kecamatan;
$this->aset = $aset;
$this->omset = $omset;
$this->jumlah_umkm = $jumlah_umkm;
$this->karyawan_jenis1 = $karyawan_jenis1;
$this->karyawan_jenis2 = $karyawan_jenis2;
$this->karyawan_jenis3 = $karyawan_jenis3;
$this->omset_jenis1 = $omset_jenis1;
$this->omset_jenis2 = $omset_jenis2;
$this->omset_jenis3 = $omset_jenis3;
$this->aset_jenis1 = $aset_jenis1;
$this->aset_jenis2 = $aset_jenis2;
$this->aset_jenis3 = $aset_jenis3;
$this->karyawan_jen1_l = $karyawan_jen1_l;
$this->karyawan_jen1_p = $karyawan_jen1_p;
$this->karyawan_jen2_l = $karyawan_jen2_l;
$this->karyawan_jen2_p = $karyawan_jen2_p;
$this->karyawan_jen3_l = $karyawan_jen3_l;
$this->karyawan_jen3_p = $karyawan_jen3_p;
$this->umkm_jen1_kat1 = $umkm_jen1_kat1;
$this->umkm_jen1_kat2 = $umkm_jen1_kat2;
$this->umkm_jen1_kat3 = $umkm_jen1_kat3;
$this->umkm_jen2_kat1 = $umkm_jen2_kat1;
$this->umkm_jen2_kat2 = $umkm_jen2_kat2;
$this->umkm_jen2_kat3 = $umkm_jen2_kat3;
$this->umkm_jen3_kat1 = $umkm_jen3_kat1;
$this->umkm_jen3_kat2 = $umkm_jen3_kat2;
$this->umkm_jen3_kat3 = $umkm_jen3_kat3;
//var_dump($this);die();
return $this->db->update($this->_table, $this, array('id_laporan' => $id_laporan));
}
}

View File

@ -168,22 +168,36 @@
</div>
<div class="row">
<div class="col">
<?php
if($data_absen->jumlah_umkm > 0){
$ratarataaset = ($data_absen->aset/$data_absen->jumlah_umkm);
} else {
$ratarataaset = 0;
}
?>
<div class="card text-center">
<div class="card-header bg-success text-light">
Aset Bulan ini
Rata-rata Aset
</div>
<div class="card-body">
<h5 class="card-title"><?php echo rupiah($data_absen->aset) ?></h5>
<h5 class="card-title"><?php echo rupiah($ratarataaset) ?></h5>
</div>
</div>
</div>
<?php
if($data_absen->jumlah_umkm > 0){
$ratarataomset =($data_absen->omset/$data_absen->jumlah_umkm);
} else {
$ratarataomset = 0;
}
?>
<div class="col">
<div class="card text-center">
<div class="card-header bg-success text-light">
Omset Bulan ini
Rata-tata Omset Bulan ini
</div>
<div class="card-body">
<h5 class="card-title"><?php echo rupiah($data_absen->omset) ?></h5>
<h5 class="card-title"><?php echo rupiah($ratarataomset) ?></h5>
</div>
</div>
</div>
@ -214,7 +228,7 @@
?>
<tr>
<td><?php echo $no?></td>
<td><?php echo $signed_absensi->nama?></td>
<td class="text-left"><?php echo $signed_absensi->nama?></td>
<td><?php echo rupiah($signed_absensi->omset)?></td>
<td><?php echo rupiah($signed_absensi->aset)?></td>
<td><a target="_blank" href="<?php echo base_url('index.php/')?>admin/detailumkm?id_umkm=<?php echo $signed_absensi->id_umkm ?>" class="btn btn-block btn-info btn-sm">Detail</a></td>
@ -244,6 +258,8 @@
<tr>
<th>No</th>
<th>Umkm</th>
<th>Omset</th>
<th>Aset</th>
<th>Opsi</th>
</tr>
</thead>
@ -255,7 +271,9 @@
?>
<tr>
<td><?php echo $no?></td>
<td><?php echo $unsigned_absensi->nama?></td>
<td class="text-left"><?php echo $unsigned_absensi->nama?></td>
<td><?php echo rupiah($unsigned_absensi->omset)?></td>
<td><?php echo rupiah($unsigned_absensi->aset)?></td>
<td><a target="_blank" href="<?php echo base_url('index.php/')?>admin/detailumkm?id_umkm=<?php echo $unsigned_absensi->id_umkm ?>" class="btn btn-block btn-info btn-sm">Detail</a></td>
</tr>
<?php

View File

@ -0,0 +1,534 @@
<?php
function rupiah($angka){
$hasil_rupiah = "Rp " . number_format($angka,2,',','.');
return $hasil_rupiah;
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/dataTables.bootstrap4.min.css">
<link data-require="sweet-alert@*" data-semver="0.4.2" rel="stylesheet" href="<?php echo base_url()?>assets/css/sweetalert.min.css" />
<link rel="icon" type="image/png" href="../../assets/images/favicon.png" />
<title>Aplikasi UMKM</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">
<img src="<?php echo base_url()?>assets/images/logo-white.png" width="100" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
</ul>
<form methode="POST" action="../login/logout" class="form-inline my-2 my-lg-0" >
<button class="btn btn-outline-warning btn-sm my-2 my-sm-0" type="submit">Logout</button>
</form>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-3" style="cursor:pointer;">
<div class="card">
<div class="card-header text-center">
<img src="<?php echo base_url()?>assets/images/<?php echo $user_logged->foto_user ?>" width="125" /><br>
<strong><?php echo $user_logged->nama ?></strong>
</div>
<ul class="list-group list-group-flush">
<a href="<?php echo base_url('index.php/')?>admin/dashboard" style="text-decoration:none;">
<li class="list-group-item text-dark border-bottom">Data Pemilik UMKM</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/umkm" style="text-decoration:none;">
<li class="list-group-item text-dark border-bottom">Data UMKM</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/absensi" style="text-decoration:none;">
<li class="list-group-item text-dark border-bottom">Absensi</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/laporan" style="text-decoration:none;">
<li class="list-group-item bg-primary text-white border-bottom">Laporan</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/setting" style="text-decoration:none;">
<li class="list-group-item text-dark">Setting</li>
</a>
</ul>
</div>
</div>
<div class="col col-md-9 col-lg-9 col-sm-12 col-12">
<div class="card">
<h5 class="card-header">Laporan</h5>
<div class="card-body">
<div>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>admin/laporan" class="nav-link active">Tahunan</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>admin/laporanbulanan" class="nav-link">Bulanan</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>admin/laporankelurahan" class="nav-link">Kelurahan</a>
</li>
</ul>
<div class="mt-3">
<?php if(isset($tahun_0)){?>
<div class="card">
<div class="card-header bg-primary text-white">
Laporan Tahunan
</div>
<div class="card-body">
<div class="row">
<div class="col col-md-12 col-lg-12 col-sm-12 col-12">
<h4>Monografi Kota Magelang Tahun <?php echo $tahun ?></h4>
</div>
</div>
<div class="row">
<div class="col col-5">
<div class="row">
<canvas id="myChart" width="400" height="300"></canvas>
</div>
<div class="row">
<table class="table text-center text-nowarp table-responsive-md table-sm table-bordered table-striped">
<thead>
<tr>
<th></th>
<th><span class="badge">Aset</span></th>
<th><span class="badge">Omset</span></th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="badge"><?php echo $tahun ?></span></td>
<td><span class="badge"><?php echo rupiah($aset_1) ?></span></td>
<td><span class="badge"><?php echo rupiah($omset_1) ?></span></td>
</tr>
<tr>
<td><span class="badge"><?php echo $tahun_0 ?></span></td>
<td><span class="badge"><?php echo rupiah($aset_0) ?></span></td>
<td><span class="badge"><?php echo rupiah($omset_0) ?></span></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col col-7">
<div class="row pl-2">
<canvas id="myChart2" width="550" height="300"></canvas>
</div>
<div class="row pl-2">
<table class="table text-center table-responsive-md table-sm table-bordered table-striped">
<thead>
<tr>
<th></th>
<th><span class="badge">Jml UMKM</span></th>
<th><span class="badge">Tenaga Kerja</span></th>
<th><span class="badge">Mikro</span></th>
<th><span class="badge">Kecil</span></th>
<th><span class="badge">Menengah</span></th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="badge"><?php echo $tahun ?></span></td>
<td><span class="badge"><?php echo $umkm_1 ?></span></td>
<td><span class="badge"><?php echo $naker_1 ?></span></td>
<td><span class="badge"><?php echo $mikro_1 ?></span></td>
<td><span class="badge"><?php echo $kecil_1 ?></span></td>
<td><span class="badge"><?php echo $menengah_1 ?></span></td>
</tr>
<tr>
<td><span class="badge"><?php echo $tahun ?></span></td>
<td><span class="badge"><?php echo $umkm_0 ?></span></td>
<td><span class="badge"><?php echo $naker_0 ?></span></td>
<td><span class="badge"><?php echo $mikro_0 ?></span></td>
<td><span class="badge"><?php echo $kecil_0 ?></span></td>
<td><span class="badge"><?php echo $menengah_0 ?></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
<div class="card">
<div class="card-header bg-primary text-white">
Laporan Tahunan
</div>
<?php if($msg!=='empty'){?>
<div class="card-body">
<div class="row">
<div class="col col-md-12 col-lg-12 col-sm-12 col-12">
<h4>Data UMKM Kota Magelang Tahun <?php echo $tahun ?></h4>
</div>
</div>
<hr>
<div class="row">
<table class="table table-bordered table-sm text-center text-nowrap table-responsive-sm table-striped">
<thead class="">
<tr>
<th class="align-middle" colspan="3">Jumlah UMKM</th>
<th class="align-middle" colspan="3">Omset/Bulan</th>
</tr>
<tr>
<th>P</th>
<th>J</th>
<th>I</th>
<th>P</th>
<th>J</th>
<th>I</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $umkm_jen1 ?></td>
<td><?php echo $umkm_jen2 ?></td>
<td><?php echo $umkm_jen3 ?></td>
<td><?php echo rupiah($omset_bln_jen1) ?></td>
<td><?php echo rupiah($omset_bln_jen2) ?></td>
<td><?php echo rupiah($omset_bln_jen3) ?></td>
</tr>
</tbody>
<tfoot>
<tr>
<th class="align-middle" colspan="3">Total</th>
<th class="align-middle" colspan="3">Total</th>
</tr>
<?php
$umkm = $umkm_jen1+$umkm_jen2+$umkm_jen3;
$omset = $omset_bln_jen1+$omset_bln_jen2+$omset_bln_jen3;
?>
<tr>
<th class="align-middle" colspan="3" ><?php echo $umkm ?></th>
<th class="align-middle" colspan="3" ><?php echo rupiah($omset) ?></th>
</tr>
</tfoot>
</table>
</div>
<hr>
<div class="row">
<table class="table table-bordered table-sm text-center text-nowrap table-responsive-lg table-striped">
<thead class="">
<tr>
<th class="align-middle" colspan="3" rowspan="2">Aset</th>
<th class="align-middle" colspan="6" >Jumlah Naker</th>
</tr>
<tr>
<th colspan="2" >P</th>
<th colspan="2" >J</th>
<th colspan="2" >I</th>
</tr>
<tr>
<th>P</th>
<th>J</th>
<th>I</th>
<th>L</th>
<th>P</th>
<th>L</th>
<th>P</th>
<th>L</th>
<th>P</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo rupiah($aset_jen1) ?></td>
<td><?php echo rupiah($aset_jen2) ?></td>
<td><?php echo rupiah($aset_jen3) ?></td>
<td><?php echo $naker_jen1_l ?></td>
<td><?php echo $naker_jen1_p ?></td>
<td><?php echo $naker_jen2_l ?></td>
<td><?php echo $naker_jen2_p ?></td>
<td><?php echo $naker_jen3_l ?></td>
<td><?php echo $naker_jen3_p ?></td>
</tr>
</tbody>
<tfoot>
<tr>
<th class="align-middle" colspan="3">Total</th>
<th class="align-middle" colspan="6">Total</th>
</tr>
<?php
$naker = $naker_jen1_l+$naker_jen2_l+$naker_jen3_l;
$naker = $naker+$naker_jen1_p+$naker_jen2_p+$naker_jen3_p;
$aset = $aset_jen1+$aset_jen2+$aset_jen3;
?>
<tr>
<th class="align-middle" colspan="3" ><?php echo rupiah($aset) ?></th>
<th class="align-middle" colspan="6" ><?php echo $naker ?></th>
</tr>
</tfoot>
</table>
</div>
<hr>
<div class="row">
<table class="table table-bordered table-sm text-center text-nowrap table-responsive-sm table-striped">
<thead class="">
<tr>
<th class="align-middle" colspan="9" >Klasifikasi</th>
</tr>
<tr>
<th colspan="3" >P</th>
<th colspan="3" >J</th>
<th colspan="3" >I</th>
</tr>
<tr>
<th>M</th>
<th>K</th>
<th>MN</th>
<th>M</th>
<th>K</th>
<th>MN</th>
<th>M</th>
<th>K</th>
<th>MN</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $umkm_jen1_ket1?></td>
<td><?php echo $umkm_jen1_ket2?></td>
<td><?php echo $umkm_jen1_ket3?></td>
<td><?php echo $umkm_jen2_ket1?></td>
<td><?php echo $umkm_jen2_ket2?></td>
<td><?php echo $umkm_jen2_ket3?></td>
<td><?php echo $umkm_jen3_ket1?></td>
<td><?php echo $umkm_jen3_ket2?></td>
<td><?php echo $umkm_jen3_ket3?></td>
</tr>
</tbody>
<tfoot>
<tr>
<th class="align-middle" colspan="3">Mikro</th>
<th class="align-middle" colspan="3">Kecil</th>
<th class="align-middle" colspan="3">Menengah</th>
</tr>
<?php
$mikro = $umkm_jen1_ket1+$umkm_jen2_ket1+$umkm_jen3_ket1;
$kecil = $umkm_jen1_ket2+$umkm_jen2_ket2+$umkm_jen3_ket2;
$menengah = $umkm_jen1_ket3+$umkm_jen2_ket3+$umkm_jen3_ket3;
?>
<tr>
<th class="align-middle" colspan="3" ><?php echo $mikro ?></th>
<th class="align-middle" colspan="3" ><?php echo $kecil ?></th>
<th class="align-middle" colspan="3" ><?php echo $menengah ?></th>
</tr>
</tfoot>
</table>
</div>
</div>
<?php } else {?>
<div class="card-body text-center">
<img src="<?php echo base_url()?>assets/images/search.png" width="150" /><br>
<div class="alert alert-warning" role="alert">
Tidak ada <strong>laporan yang sudah dibuat</strong> saat ini.
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="<?php echo base_url()?>assets/js/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url()?>assets/js/dataTables.bootstrap4.min.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert.min.js"></script>
<script src="<?php echo base_url()?>assets/js/chart.js"></script>
<script>
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Aset', 'Omset'],
datasets: [
{
label: '<?php echo $tahun ?>',
data: [<?php echo $aset_1 ?>, <?php echo $omset_1 ?>],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(255, 99, 132, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(255, 99, 132, 1)'
],
borderWidth: 1
},
{
label: '<?php echo $tahun_0 ?>',
data: [<?php echo $aset_0 ?>, <?php echo $omset_0 ?>],
backgroundColor: [
'rgba(54, 162, 235, 0.2)',
'rgba(54, 162, 235, 0.2)'
],
borderColor: [
'rgba(54, 162, 235, 1)',
'rgba(54, 162, 235, 1)'
],
borderWidth: 1
}
]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
</script>
<script>
var ctx = document.getElementById('myChart2').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Jml UMKM', 'Tenaga Kerja', 'Mikro', 'Kecil','Menengah'],
datasets: [
{
label: '<?php echo $tahun ?>',
data: [<?php echo $umkm_1 ?>, <?php echo $naker_1 ?>, <?php echo $mikro_1 ?>, <?php echo $kecil_1 ?>, <?php echo $menengah_1 ?>],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(255, 99, 132, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(255, 99, 132, 1)'
],
borderWidth: 1
},
{
label: '<?php echo $tahun_0 ?>',
data: [<?php echo $umkm_0 ?>, <?php echo $naker_0 ?>, <?php echo $mikro_0 ?>, <?php echo $kecil_0 ?>, <?php echo $menengah_0 ?>],
backgroundColor: [
'rgba(54, 162, 235, 0.2)',
'rgba(54, 162, 235, 0.2)'
],
borderColor: [
'rgba(54, 162, 235, 1)',
'rgba(54, 162, 235, 1)'
],
borderWidth: 1
}
]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
</script>
<script>
$(document).ready(function() {
$('#tabeldata').DataTable();
} );
</script>
<script>
const element = document.querySelectorAll('#btn_hapus')
element.forEach(function(el){
el.addEventListener('click', function (e) {
e.preventDefault();
var urlToRedirect = e.currentTarget.getAttribute('href'); //use currentTarget because the click may be on the nested i tag and not a tag causing the href to be empty
console.log(urlToRedirect); // verify if this is the right URL
swal({
title: "Kamu yakin ?",
text: "Data yang dihapus tidak bisa dikembalikan.",
icon: "warning",
buttons: [
'Batal',
'Hapus'
],
dangerMode: true,
}).then(function(isConfirm) {
if (isConfirm) {
swal({
title: 'Berhasil',
text: 'Data berhasil terhapus',
icon: 'success'
}).then(function() {
window.location.href = urlToRedirect;
});
} else {
swal("Batal", "Data tidak terhapus.)", "error");
}
});
});
});
</script>
</body>
</html>

View File

@ -215,6 +215,7 @@
<th>Omset Bulan Ini</th>
<th>Jumlah l</th>
<th>Jumlah p</th>
<th>status</th>
</tr>
</thead>
<tbody>
@ -258,6 +259,11 @@
<td><?php echo rupiah($absensi->omset) ?></td>
<td><?php echo $absensi->karyawan_l ?></td>
<td><?php echo $absensi->karyawan_p ?></td>
<?php if($absensi->signed=='3'){ ?>
<td><span class="badge badge-sm badge-warning">By system</span></td>
<?php }elseif($absensi->signed=='1'){ ?>
<td><span class="badge badge-sm badge-success">By Owner</span></td>
<?php } ?>
</tr>
<?php
}

13222
assets/js/chart.js 100644

File diff suppressed because it is too large Load Diff