db->query("SELECT a.id_akun, o.nama_otoritas, a.userid, a.namauser FROM akun_unlasys as a JOIN otoritas as o ON o.id_otoritas = a.id_otoritas WHERE a.id_akun != 1 ORDER BY a.id_akun LIMIT $num OFFSET $offset"); return $query; } function list_agr_1_r_k($kdfakultas,$id_thn_akad,$thun_agr){ $query = $this->db->query("SELECT ma.id_urut , ma.nama_mtagr , ma.master_mtagr , ma.id_mtagr , ma.kd_mtagr , ma.no_mtagr , ifnull((SELECT sum(total) FROM anggaran_detail2 AS ad WHERE ad.kdfakultas = '$kdfakultas' AND ad.stat_realisasi = '11' AND ad.sub_agr = 'r' AND ad.id_thn_akad = '$id_thn_akad' AND ad.id_mstragr = ma.master_mtagr), 0) AS total_agr_b1 , ifnull((SELECT sum(total) FROM anggaran_detail2 AS ad WHERE ad.kdfakultas = '$kdfakultas' AND ad.stat_realisasi = '11' AND ad.sub_agr = 'k' AND ad.id_thn_akad = '$id_thn_akad' AND ad.id_mstragr = ma.master_mtagr), 0) AS total_agr_k1 FROM mata_anggaran AS ma WHERE ma.parent_mtagr = '1' AND ma.thun_agr = '$thun_agr'"); return $query; } function list_agr_2_r_k($kdfakultas,$id_thn_akad,$thun_agr){ $query = $this->db->query("SELECT ma.id_urut , ma.no_mtagr , ma.nama_mtagr , ma.master_mtagr , ma.id_mtagr , ma.kd_mtagr , ifnull((SELECT sum(total) FROM anggaran_detail2 AS ad WHERE ad.kdfakultas = '$kdfakultas' AND ad.stat_realisasi = '11' AND ad.sub_agr = 'r' AND ad.id_thn_akad = '$id_thn_akad' AND ad.id_mstragr = ma.master_mtagr), 0) AS total_agr_b2 , ifnull((SELECT sum(total) FROM anggaran_detail2 AS ad WHERE ad.kdfakultas = '$kdfakultas' AND ad.stat_realisasi = '11' AND ad.sub_agr = 'k' AND ad.id_thn_akad = '$id_thn_akad' AND ad.id_mstragr = ma.master_mtagr), 0) AS total_agr_k2 , ifnull((SELECT sum(total) FROM anggaran_detail2 AS ad WHERE ad.kdfakultas = '$kdfakultas' AND ad.stat_realisasi = '11' AND ad.sub_agr = 'r' AND ad.id_thn_akad = '$id_thn_akad' AND ad.stat_realisasi= '11' AND ad.id_mstragr = ma.master_mtagr), 0) AS total_real_b2 , ifnull((SELECT sum(total) FROM anggaran_detail2 AS ad WHERE ad.kdfakultas = '$kdfakultas' AND ad.stat_realisasi = '11' AND ad.sub_agr = 'k' AND ad.id_thn_akad = '$id_thn_akad' AND ad.stat_realisasi= '11' AND ad.id_mstragr = ma.master_mtagr), 0) AS total_real_k2 FROM mata_anggaran AS ma WHERE ma.parent_mtagr = '32' AND ma.thun_agr = '$thun_agr'"); return $query; } function master_mtagr($id_ma){ $query = $this->db->query("SELECT master_mtagr FROM mata_anggaran_2020 where no_mtagr = $id_ma"); foreach ($query->result() as $row) { $master_mtagr = $row->master_mtagr; return $master_mtagr; } } function ajuan_real($kdfakultas, $id_thn_akad){ $sql = "select count(id_detail) as hasil from anggaran_detail2 where stat_realisasi = '2' and kdfakultas = '$kdfakultas' and id_thn_akad ='$id_thn_akad'"; $query = $this->db->query($sql)->result(); $hasil = ''; foreach ($query as $row){ $hasil = $row->hasil; return $hasil; } } function ajuan_p_baku($kdfakultas, $id_thn_akad){ $sql = "select count(id_detail) as hasil from anggaran_detail2 where stat_realisasi = '3' OR stat_realisasi = '4' and kdfakultas = '$kdfakultas' and id_thn_akad ='$id_thn_akad'"; $query = $this->db->query($sql)->result(); $hasil = ''; foreach ($query as $row){ $hasil = $row->hasil; return $hasil; } } function ajuan_p_rektor($kdfakultas, $id_thn_akad){ $sql = "select count(id_detail) as hasil from anggaran_detail2 where stat_realisasi = '5' OR stat_realisasi = '6' and kdfakultas = '$kdfakultas' and id_thn_akad ='$id_thn_akad'"; $query = $this->db->query($sql)->result(); $hasil = ''; foreach ($query as $row){ $hasil = $row->hasil; return $hasil; } } function ajuan_validasi($kdfakultas, $id_thn_akad){ $sql = "select count(id_detail) as hasil from anggaran_detail2 where stat_realisasi = '7' OR stat_realisasi = '11' and kdfakultas = '$kdfakultas' and id_thn_akad ='$id_thn_akad'"; $query = $this->db->query($sql)->result(); $hasil = ''; foreach ($query as $row){ $hasil = $row->hasil; return $hasil; } } function detail_agr_1_r_k($master_mtagr, $thun_agr){ $query = $this->db->query("SELECT ma.no_mtagr , ma.nama_mtagr , ma.master_mtagr , ma.id_mtagr , ma.kd_mtagr FROM mata_anggaran AS ma WHERE ma.thun_agr = $thun_agr and ma.master_mtagr = $master_mtagr"); return $query; } function detail_agr_2_r_k($master_mtagr, $thun_agr){ $query = $this->db->query("SELECT mar.no_mtagr , mar.nama_mtagr , mar.master_mtagr , mar.id_mtagr , mar.kd_mtagr FROM mata_anggaran AS mar WHERE mar.thun_agr = $thun_agr and mar.master_mtagr = $master_mtagr"); return $query; } function hitung_detagr_1($id_thn_akad, $kd_fakultas, $master_mtagr, $id_sub, $thun_agr){ $query = $this->db->query("SELECT sum(ad.total) AS total_detagr_1 from anggaran_detail2 as ad join mata_anggaran as ma on ma.no_mtagr = ad.id_mtagr where ma.thun_agr = $thun_agr and ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and ma.master_mtagr = '$master_mtagr' and ad.sub_agr = '$id_sub'"); return $query; } function hitung_detagr_2($id_thn_akad, $kd_fakultas, $master_mtagr, $id_sub, $thun_agr){ $query = $this->db->query("SELECT sum(ad.total) AS total_detagr_2 from anggaran_detail2 as ad join mata_anggaran as ma on ma.no_mtagr = ad.id_mtagr where ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and ma.master_mtagr = '$master_mtagr' and ad.sub_agr = '$id_sub'"); return $query; } function hitung_totagr_r1($id_thn_akad, $kd_fakultas, $thun_agr){ $query = $this->db->query("SELECT sum(ad.total) AS total_detagr_r1 from anggaran_detail2 as ad join mata_anggaran as ma on ma.no_mtagr = ad.id_mtagr where ma.thun_agr = $thun_agr and ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and ma.unit = '1' and ad.sub_agr = 'r' and ad.stat_realisasi = '11'"); return $query; } function hitung_totagr_k1($id_thn_akad, $kd_fakultas,$thun_agr){ $query = $this->db->query("SELECT sum(ad.total) AS total_detagr_k1 from anggaran_detail2 as ad join mata_anggaran as ma on ma.no_mtagr = ad.id_mtagr where ma.thun_agr = $thun_agr and ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and ma.unit = '1' and ad.sub_agr = 'k' and ad.stat_realisasi = '11'"); return $query; } function hitung_totagr_r2($id_thn_akad, $kd_fakultas,$thun_agr){ $query = $this->db->query("SELECT sum(ad.total) AS total_detagr_r2 from anggaran_detail2 as ad join mata_anggaran as ma on ma.no_mtagr = ad.id_mtagr where ma.thun_agr = $thun_agr and ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and ma.unit = '2' and ad.sub_agr = 'r' and ad.stat_realisasi = '11'"); return $query; } function hitung_totagr_k2($id_thn_akad, $kd_fakultas,$thun_agr){ $query = $this->db->query("SELECT sum(ad.total) AS total_detagr_k2 from anggaran_detail2 as ad join mata_anggaran as ma on ma.no_mtagr = ad.id_mtagr where ma.thun_agr = $thun_agr and ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and ma.unit = '2' and ad.sub_agr = 'k' and ad.stat_realisasi = '11'"); return $query; } function hitung_totreal_r2($id_thn_akad, $kd_fakultas){ $query = $this->db->query("SELECT sum(ad.total) AS total_detreal_r2 from anggaran_detail2 as ad join mata_anggaran_2020 as ma on ma.no_mtagr = ad.id_mtagr where ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and stat_realisasi = '11' and ma.unit = '2' and ad.sub_agr = 'r'"); return $query; } function hitung_totreal_k2($id_thn_akad, $kd_fakultas){ $query = $this->db->query("SELECT sum(ad.total) AS total_detreal_k2 from anggaran_detail2 as ad join mata_anggaran_2019_r as ma on ma.no_mtagr = ad.id_mtagr where ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and stat_realisasi = '11' and ma.unit = '2' and ad.sub_agr = 'k'"); return $query; } function mstragr($kd_ma, $thun_agr){ $query = $this->db->query("SELECT master_mtagr FROM mata_anggaran where thun_agr = '$thun_agr' and no_mtagr = '$kd_ma'"); foreach ($query->result() as $row){ $id_mstragr = $row->master_mtagr; return $id_mstragr; } } function nmfakultas($kdfakultas){ $query = $this->db->query("SELECT nmfakultas FROM fakultas where kdfakultas = $kdfakultas"); foreach ($query->result() as $row){ $nmfakultas = $row->nmfakultas; return $nmfakultas; } } function nmbulan($id_bulan){ $query = $this->db->query("SELECT nm_bulan FROM bulan where id_bulan = $id_bulan"); foreach ($query->result() as $row){ $nm_bulan = $row->nm_bulan; return $nm_bulan; } } function simpan_ajuan($data){ $this->db->insert('anggaran_detail2', $data); } function hapus_ajuan($id){ $this->db->where('id_detail',$id); $this->db->delete('anggaran_detail2'); } function update_ajuan($id, $data){ $this->db->where('id_detail', $id); $this->db->update('anggaran_detail2', $data); } function detail_ajuan($id_a,$thun_agr){ $query = $this->db->query("SELECT ma.no_mtagr, ma.nama_mtagr, ad.ket_agr, ad.jumlah, ag.nama_satuan, ad.volume, ad.besaran, ad.total, ad.stat_realisasi, ad.id_mtagr FROM anggaran_detail2 as ad JOIN mata_anggaran as ma on ma.no_mtagr = ad.id_mtagr JOIN agr_satuan as ag on ag.id_satuan = ad.id_satuan WHERE ad.id_detail = '$id_a' and ma.thun_agr = '$thun_agr' "); return $query; } function list_kompilasi($thn_akad){ $query = $this->db->query("SELECT ak.total_realisasi FROM anggaran_kompilasi as ak WHERE id_thn_akad = $thn_akad ORDER BY ak.id_mtagr"); return $query; } function list_dppallprodi(){ $KEDUA = $this->load->database('second', TRUE); $query = $KEDUA->query("CALL sp_getdppallprodinew('4','20201')"); return $query; } function list_dppallprodi_genap(){ $KEDUA = $this->load->database('second', TRUE); $query = $KEDUA->query("CALL sp_getdppallprodinew('4','20202')"); return $query; } function list_dppfakultas($kdfakultas){ $KEDUA = $this->load->database('second', TRUE); $query = $KEDUA->query("CALL sp_getdppprodi('$kdfakultas','4','20201')"); return $query; } function list_dppfakultas_genap($kdfakultas){ $KEDUA = $this->load->database('second', TRUE); $query = $KEDUA->query("CALL sp_getdppprodi('$kdfakultas','4','20202')"); return $query; } function list_dpkallprodi(){ $KEDUA = $this->load->database('second', TRUE); $query = $KEDUA->query("CALL sp_getdpkallprodi('2020', '4')"); return $query; } function list_dpkfakultas($kdfakultas){ $KEDUA = $this->load->database('second', TRUE); $query = $KEDUA->query("CALL sp_getDpkfakultas_chart('2020','4',$kdfakultas)"); return $query; } function list_dppdetail($id_thn_akad, $kdprodi){ $KEDUA = $this->load->database('second', TRUE); $query = $KEDUA->query("CALL sp_getDppDet($kdprodi,'4',$id_thn_akad,'0','>=','','')"); return $query; } function list_agr_rapb($id_thn_akad, $kd_fakultas, $master_mtagr, $id_sub){ $query = $this->db->query("select *, ma.no_mtagr, ma.nama_mtagr, ma.isi_mtagr, i.nama_satuan, st.stat_ajuan from anggaran_detail as ad join mata_anggaran_2019 as ma on ma.id_mtagr = ad.id_mtagr join inv_satuan as i on i.id_satuan = ad.id_satuan join st_ajuan as st on st.id_st_ajuan = ad.stat_agr where ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and ma.master_mtagr = '$master_mtagr' and ad.sub_agr = '$id_sub'"); return $query; } function list_rapb($id_thn_akad, $kd_fakultas, $master_mtagr, $id_sub){ $query = $this->db->query("select *, ma.no_mtagr, ma.nama_mtagr, i.nama_satuan, st.stat_ajuan from anggaran_detail as ad join mata_anggaran_2019 as ma on ma.id_mtagr = ad.id_mtagr join inv_satuan as i on i.id_satuan = ad.id_satuan join st_ajuan as st on st.id_st_ajuan = ad.stat_realisasi where ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and ma.master_mtagr = '$master_mtagr' and ad.sub_agr = '$id_sub'"); return $query; } function hitung_agr($id_thn_akad, $kd_fakultas, $master_mtagr, $id_sub){ $query = $this->db->query("SELECT sum(ad.total) AS total from anggaran_detail as ad join mata_anggaran_2019 as ma on ma.id_mtagr = ad.id_mtagr where ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and ma.master_mtagr = '$master_mtagr' and ad.sub_agr = '$id_sub' and ad.stat_agr != '1'"); foreach ($query->result() as $row) { $total_agr = $row->total; return $total_agr; } } function hitung_total_ma2($id_thn_akad, $kd_fakultas, $master_mtagr, $id_sub){ $query = $this->db->query("SELECT sum(ad.total) AS total from anggaran_detail as ad join mata_anggaran_2019 as ma on ma.id_mtagr = ad.id_mtagr where ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and ma.master_mtagr = '$master_mtagr' and ad.sub_agr = '$id_sub' and ad.stat_realisasi != '1'"); return $query; } function hitung_total($id_thn_akad, $kd_fakultas, $master_mtagr, $id_sub){ $query = $this->db->query("SELECT sum(ad.total) AS total, sum(ad.pengajuan) AS total_real from anggaran_detail as ad join mata_anggaran_2019 as ma on ma.id_mtagr = ad.id_mtagr where ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and ma.master_mtagr = '$master_mtagr' and ad.sub_agr = '$id_sub' and ad.stat_realisasi != '1'"); return $query; } function hitung_real($id_thn_akad, $kd_fakultas, $master_mtagr, $id_sub){ $query = $this->db->query("SELECT sum(ad.pengajuan) AS total_realisasi from anggaran_detail as ad join mata_anggaran_2019 as ma on ma.id_mtagr = ad.id_mtagr where ad.id_thn_akad = '$id_thn_akad' and ad.kdfakultas = '$kd_fakultas' and ma.master_mtagr = '$master_mtagr' and ad.sub_agr = '$id_sub' and ad.stat_realisasi != '1'"); foreach ($query->result() as $row) { $total_real = $row->total_realisasi; return $total_real; } } function get_rapb_agr($id_detail){ $query = $this->db->query("select *, ma.no_mtagr, ma.nama_mtagr, i.nama_satuan, st.id_st_ajuan, st.stat_ajuan from anggaran_detail as ad join mata_anggaran_2019 as ma on ma.id_mtagr = ad.id_mtagr join inv_satuan as i on i.id_satuan = ad.id_satuan join st_ajuan as st on st.id_st_ajuan = ad.stat_agr where ad.id_detail = '$id_detail'"); return $query; } function get_rapb($id_detail){ $query = $this->db->query("select *, ma.no_mtagr, ma.nama_mtagr, i.nama_satuan, st.id_st_ajuan, st.stat_ajuan from anggaran_detail as ad join mata_anggaran_2019 as ma on ma.id_mtagr = ad.id_mtagr join inv_satuan as i on i.id_satuan = ad.id_satuan join st_ajuan as st on st.id_st_ajuan = ad.stat_realisasi where ad.id_detail = '$id_detail'"); return $query; } function get_realisasi_detail($id_detail){ $query = $this->db->query("select *, ma.no_mtagr, ma.nama_mtagr, i.nama_satuan, st.id_st_ajuan, st.stat_ajuan from anggaran_detail2 as ad join mata_anggaran as ma on ma.no_mtagr = ad.id_mtagr join agr_satuan as i on i.id_satuan = ad.id_satuan join st_ajuan as st on st.id_st_ajuan = ad.stat_realisasi where ad.id_detail = '$id_detail'"); return $query; } function list_d($thn_akad){ $query = $this->db->query("SELECT ma.no_mtagr, ma.nama_mtagr, ad.total, ad.total_k FROM anggaran_detail as ad JOIN mata_anggaran_2019 as ma on ma.id_mtagr = ad.id_mtagr WHERE ad.id_thn_akad = $thn_akad ORDER BY ad.id_mtagr"); return $query; } function list_d_fak($thn_akad, $kdfakultas){ $query = $this->db->query("SELECT ma.no_mtagr, ma.nama_mtagr, ad.total FROM anggaran_detail as ad JOIN mata_anggaran_2019 as ma on ma.id_mtagr = ad.id_mtagr WHERE ad.id_thn_akad = $thn_akad and ad.kdfakultas = $kdfakultas ORDER BY ad.id_mtagr"); return $query; } function update_ajuan_realisasi($id_detail, $data) { $this->db->where("id_detail", $id_detail) ->update("anggaran_detail2", $data); } function update_agr_kompilasi($id_mtagr, $id_thn_akad, $kdfakultas, $data) { $this->db->where("id_mtagr", $id_mtagr) ->where("id_thn_akad", $id_thn_akad) ->where("kdfakultas", $kdfakultas) ->update("anggaran_kompilasi", $data); } function save_batch($data) { return $this->db->insert_batch('anggaran_detail', $data); } /* manajemen akun */ function detail_thn_akad($thn_akad){ $query = $this->db->query("SELECT id_thn_akad, thn_akad FROM thn_akad where id_thn_akad = $thn_akad"); return $query; } public function get_drop_st_ajuan(){ $query = $this->db->query('SELECT id_st_ajuan, stat_ajuan FROM st_ajuan ORDER BY id_st_ajuan asc')->result(); return $query; } public function get_drop_thn_akad(){ $query = $this->db->query('SELECT id_thn_akad, thn_akad FROM thn_akad ORDER BY id_thn_akad asc')->result(); return $query; } public function get_drop_fak(){ $query = $this->db->query('SELECT kdfakultas, nmfakultas FROM fakultas ORDER BY kdfakultas asc')->result(); return $query; } public function get_drop_bulan(){ $query = $this->db->query('SELECT id_bulan, nm_bulan FROM bulan ORDER BY id_bulan asc')->result(); return $query; } function get_drop_satuan(){ $query = $this->db->query('SELECT id_satuan, nama_satuan FROM agr_satuan ORDER BY id_satuan asc')->result(); return $query; } function get_drop_proses($level_id){ $query = $this->db->query("SELECT id_st_ajuan, stat_ajuan FROM st_ajuan where otoritas = $level_id ORDER BY id_st_ajuan asc")->result(); return $query; } function detail_akun($id_akun){ $query = $this->db->query("SELECT id_akun, userid, id_otoritas, passwd FROM akun_unlasys WHERE id_akun = '$id_akun' "); return $query; } function simpan_akun($data){ $this->db->insert('akun_unlasys', $data); } function update_akun($id, $data){ $this->db->where('id_akun', $id); $this->db->update('akun_unlasys', $data); } function delete_akun($id){ $this->db->where('id_akun',$id); $this->db->delete('akun_unlasys'); } /* otoritas akun */ function list_menu(){ $this->db->select("id_menu, kode_menu, nama_menu, parent_menu, url"); $this->db->from("menu"); $this->db->order_by("kode_menu", "ASC"); return $this->db->get()->result(); } function cek_menu_id($otoritas_id, $menu_id){ $sql = "SELECT COUNT(*) AS hasil FROM otoritas_menu WHERE id_otoritas='$otoritas_id' AND id_menu='$menu_id'"; $query = $this->db->query($sql)->result(); $hasil = ''; foreach ($query as $row){ $hasil = $row->hasil; } if ($hasil>0){ return "ADA"; }else{ return "KOSONG"; } } function cek_ubah($otoritas_id, $menu_id){ $sql = "SELECT ubah FROM otoritas_menu WHERE id_otoritas='$otoritas_id' AND id_menu='$menu_id'"; $query = $this->db->query($sql)->result(); $ubah = ''; foreach ($query as $row){ $ubah = $row->ubah; } if ($ubah=="T"){ return "ADA"; }else if($ubah=="F"){ return "KOSONG"; }else{ return "BELUM"; //--Jika belum di setting TRUE atau FALSE--// } } function cek_hapus($otoritas_id, $menu_id){ $sql = "SELECT hapus FROM otoritas_menu WHERE id_otoritas='$otoritas_id' AND id_menu='$menu_id'"; $query = $this->db->query($sql)->result(); $hapus = ''; foreach ($query as $row){ $hapus = $row->hapus; } if ($hapus=="T"){ return "ADA"; }else if($hapus=="F"){ return "KOSONG"; }else{ return "BELUM"; //--Jika belum di setting TRUE atau FALSE--// } } function simpan_otoritas_akun($data){ $this->db->insert("otoritas_menu", $data); } function delete_otoritas_akun($id_otoritas, $id_menu){ $this->db->where("id_otoritas", $id_otoritas) ->where("id_menu", $id_menu); $this->db->delete("otoritas_menu"); } function update_ubah_hapus($id_otoritas, $id_menu, $data){ $this->db->where("id_otoritas", $id_otoritas) ->where("id_menu", $id_menu) ->update("otoritas_menu", $data); } }