Add Laporan Bulanan, Laporan By Kelurahan, laporan By Kecamatan, and Fix Some Bugs

This commit is contained in:
2021-09-19 21:39:23 +07:00
parent 4a12d026fd
commit b42ee3ba25
25 changed files with 5098 additions and 51 deletions

View File

@@ -75,6 +75,15 @@ class AbsensiModel extends CI_Model
return $this->db->update($this->_table, $this, array('id_absensi' => $id_absensi));
}
public function getDesemberAbsensiByYearAndByKelurahan($tahun,$kelurahan){
$this->db->join('tb_user','tb_user.id_user = tb_absensi.id_pemilik');
$this->db->where('bulan', 12);
$this->db->where('tahun', $tahun);
$this->db->where('tb_absensi.kelurahan', $kelurahan);
//$this->db->limit(1);
return $absensi = $this->db->get($this->_table)->result();
}
public function getLastMonthAbsensi($bulan,$tahun){
$bulan = $bulan-1;
$this->db->where('bulan', $bulan);

View File

@@ -18,6 +18,18 @@ class LaporanModel extends CI_Model
return $laporan = count($this->db->get($this->_table)->result());
}
public function getCountByTahunByKelurahan($tahun,$kelurahan){
$this->db->where('tahun',$tahun);
$this->db->where('kelurahan',$kelurahan);
return $laporan = count($this->db->get($this->_table)->result());
}
public function getCountByTahunByKecamatan($tahun,$kecamatan){
$this->db->where('tahun',$tahun);
$this->db->where('kecamatan',$kecamatan);
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);
@@ -48,6 +60,31 @@ class LaporanModel extends CI_Model
return $laporan =$this->db->get($this->_table)->row();
}
public function getLaporanByTahunAndKelurahan($tahun,$kelurahan){
$this->db->where('tahun',$tahun);
$this->db->where('kelurahan',$kelurahan);
$this->db->order_by('bulan','ASC');
return $laporan =$this->db->get($this->_table)->result();
}
public function getKelurahanByTahunAndKecamatan($tahun,$kecamatan){
$this->db->select('kelurahan');
$this->db->distinct('kelurahan');
$this->db->where('tahun',$tahun);
$this->db->where('kecamatan',$kecamatan);
$this->db->order_by('kelurahan','ASC');
return $laporan =$this->db->get($this->_table)->result();
}
public function getLastMonthLaporan($tahun){
$this->db->select('bulan');
$this->db->where('tahun',$tahun);
$this->db->distinct('bulan');
$this->db->order_by('bulan','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);