| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/wamp/www/sipapbd_2020_pergeseran2/application/modules/kua 1/controllers/ |
Upload File : |
<?php
class Kua extends Userpage_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('kua_model','data_model');
$this->load->model('auth/login_model', 'auth');
$this->load->library('form_validation');
$this->report_daftar = 'Daftar KUA';
}
public function index()
{
$data['akses'] = $this->auth->get_level_akses($this->uri->slash_segment(1));
$data['title']='SIP APBD - Daftar KUA PPAS';
$data['main_content']='kua_view';
$data['modul'] = 'kua';
$data['report_daftar'] = $this->report_daftar;
$data['grid']['fields'] = $this->data_model->get_data_fields();
$this->load->view('layout/template',$data);
}
public function form($id = '')
{
$binary ='';
$data['akses'] = $this->auth->get_level_akses($this->uri->slash_segment(1));
$data['title']='SIP APBD - Entri KUA PPAS';
$data['main_content']='kua_form';
if($id)
{
$rows=$this->data_model->get_data_by_id($id);
$data['data'] = $this->data_model->get_data_by_id($id);
}
$File = $this->data_model->get_tab();
while ($File > 0) {
if ($File%2 == 0) {
$binary .= 0;
$File /=2;
}
else {
$binary .= 1;
$File = ($File/2)-0.5;
}
}
$data['tab_pendapatan'] = substr($binary,0,1);
$data['tab_BTL'] = substr($binary,1,1);
$data['tab_BL'] = substr($binary,2,1);
$data['tab_penerimaan'] = substr($binary,3,1);
$data['tab_pengeluaran']= substr($binary,4,1);
$this->load->view('layout/template',$data);
}
public function get_data_plafon($skpd)
{
$response = (object) NULL;
$plafon = $this->data_model->getnum_plafonBL($skpd);
if($plafon){
$response->PLAFON = $plafon;
}
else{
$response->PLAFON = '0';
}
echo json_encode($response);
}
public function get_data_skpd()
{
$rows = $this->data_model->get_data_skpd();
$response = (object) NULL;
$response->kode = $rows['KODE_SKPD_LKP'];
$response->nama = $rows['NAMA_SKPD'];
$response->id = $rows['ID_SKPD'];
echo json_encode($response);
}
public function proses()
{
$oper = $this->input->post('oper');
$tahun = $this->input->post('tahun');
$ID_SKPD = $this->input->post('id_skpd');
if($oper == 'del') {
$this->delete($TAHUN);
return '';
}
$respon = (object) NULL;
if($this->input->post('tahun'))
{
$id = $this->input->post('id');
$update = $this->data_model->update_data($id);
$respon->isSuccess = TRUE;
$respon->message = 'Data telah berhasil diperbaharui.';
$respon->id = $this->session->userdata('tahun');
}
else
{
$this->data_model->fill_data();
$this->data_model->insert_data();
$respon->isSuccess = TRUE;
$respon->message = 'Data telah berhasil disimpan.';
$respon->id = $this->session->userdata('tahun');
$respon->id_skpd = $ID_SKPD;
}
$this->db->queries;
echo json_encode($respon);
}
private function update()
{
$id = $this->input->post('id');
$update = $this->data_model->update_data($id);
return $update;
}
public function insert()
{
$insert = $this->data_model->insert_data();
return $insert;
}
public function get_daftar()
{
parent::get_daftar();
$count = $this->data_model->get_data($this->search_param, TRUE);
$response = (object) NULL;
$response->sql = $this->db->queries;
if($count == 0) // tidak ada data
{
echo json_encode($response);
return '';
}
$page = $this->page;
$limit = $this->limit;
$total_pages = ceil($count/$limit);
if ($page > $total_pages) $page = $total_pages;
$start = $limit * $page - $limit;
if($start < 0) $start = 0;
$this->search_param['limit'] = array(
'start' => $start,
'end' => $limit
);
$result = $this->data_model->get_data($this->search_param);
$response->page = $page;
$response->total = $total_pages;
$response->records = $count;
$response->sql = $this->db->queries;
$fields = $this->data_model->fieldmap_daftar;
for($i=0; $i<count($result); $i++)
{
$response->rows[$i]['id'] = $result[$i][$fields[0]];
$data = array();
for ($n=1; $n < count($fields); $n++)
{
if($n==4) $data[] = $result[$i]['BTL_PLF'] > 0 ? $result[$i]['BTL_PLF'] : $result[$i]['BTL_REK'];
else if($n==5) $data[] = $result[$i]['BL_PLF'] > 0 ? $result[$i]['BL_PLF'] : $result[$i]['BL_REK'];
else $data[] = $result[$i][$fields[$n]];
}
$response->rows[$i]['cell'] = $data;
}
echo json_encode($response);
}
public function get_daftar_pendapatan($id)
{
$response = (object) NULL;
$req_param['id'] = $id;
$result = $this->data_model->get_daftar_pendapatan($req_param);
if($result)
{
for($i=0; $i<count($result); $i++)
{
$response->rows[$i]['id']=$result[$i]['ID_REKENING'];
$response->rows[$i]['cell']=array($result[$i]['ID_REKENING'],
$result[$i]['KODE_REKENING'],
$result[$i]['NAMA_REKENING'],
$result[$i]['PLAFON'],
'RKA1'
);
}
echo json_encode($response);
}
else
{
$response->total = 0;
$response->records = 0;
echo json_encode($response);
}
}
public function get_daftar_BTL($id)
{
$response = (object) NULL;
$req_param['id'] = $id;
$result = $this->data_model->get_daftar_BTL($req_param);
if($result)
{
for($i=0; $i<count($result); $i++)
{
$response->rows[$i]['id']=$result[$i]['ID_REKENING'];
$response->rows[$i]['cell']=array($result[$i]['ID_REKENING'],
$result[$i]['KODE_REKENING'],
$result[$i]['NAMA_REKENING'],
$result[$i]['PLAFON'],
'RKA21'
);
}
echo json_encode($response);
}
else
{
$response->total = 0;
$response->records = 0;
echo json_encode($response);
}
}
public function get_daftar_BL($id)
{
$response = (object) NULL;
$req_param['id'] = $id;
$result = $this->data_model->get_daftar_BL($req_param);
if($result)
{
for($i=0; $i<count($result); $i++)
{
$response->rows[$i]['id']=$result[$i]['ID_KEGIATAN'];
$response->rows[$i]['cell']=array($result[$i]['ID_KEGIATAN'],
$result[$i]['KODE_KEGIATAN_LKP'],
$result[$i]['NAMA_KEGIATAN'],
$result[$i]['PLAFON'],
'RKA221'
);
}
echo json_encode($response);
}
else
{
$response->total = 0;
$response->records = 0;
echo json_encode($response);
}
}
public function get_daftar_Penerimaan($id)
{
$response = (object) NULL;
$req_param['id'] = $id;
$result = $this->data_model->get_daftar_Penerimaan($req_param);
if($result)
{
for($i=0; $i<count($result); $i++)
{
$response->rows[$i]['id']=$result[$i]['ID_REKENING'];
$response->rows[$i]['cell']=array($result[$i]['ID_REKENING'],
$result[$i]['KODE_REKENING'],
$result[$i]['NAMA_REKENING'],
$result[$i]['PLAFON'],
'RKA31'
);
}
echo json_encode($response);
}
else
{
$response->total = 0;
$response->records = 0;
echo json_encode($response);
}
}
public function get_daftar_Pengeluaran($id)
{
$response = (object) NULL;
$req_param['id'] = $id;
$result = $this->data_model->get_daftar_Pengeluaran($req_param);
if($result)
{
for($i=0; $i<count($result); $i++)
{
$response->rows[$i]['id']=$result[$i]['ID_REKENING'];
$response->rows[$i]['cell']=array($result[$i]['ID_REKENING'],
$result[$i]['KODE_REKENING'],
$result[$i]['NAMA_REKENING'],
$result[$i]['PLAFON'],
'RKA32'
);
}
echo json_encode($response);
}
else
{
$response->total = 0;
$response->records = 0;
echo json_encode($response);
}
}
public function get_data_footer()
{
$rka = $this->data_model->get_sum_rka();
$murni = $this->data_model->get_sum_murni();
$response = (object) NULL;
$response->NOMINAL_RKA = $rka;
$response->NOMINAL_MURNI = $murni;
echo json_encode($response);
}
public function cari_hal()
{
$result = $this->data_model->get_id_fa();
$respon = (object) NULL;
if($result==FALSE){
$respon->page['isi'][] = '';
}
else{
foreach($result as $row)
{
$respon->page['isi'][] = $row['KODE_SKPD_LKP'];
}
}
echo json_encode($respon);
}
public function cek_murni($skpd)
{
$murni = $this->data_model->cek_murni($skpd);
$respon = (object) NULL;
$respon->rows['status'] = false;
if($murni)
{
$respon->rows['status'] = true;
$respon->rows['form'] = $murni['ID_FORM_ANGGARAN'];
}
echo json_encode($respon);
}
public function get_daftar_rincian($id, $cek='')
{
$req_param['id'] = $id;
$result_tipe = $this->data_model->get_tipe($id);
$z=0;
$last_kelompok = 0;
$last_jenis = 0;
$response = (object) NULL;
for($i=0; $i<count($result_tipe); $i++)
{
//Tipe
$response->rows[$z]['id']=$result_tipe[$i]['ID_REKENING'];
// data berikut harus sesuai dengan kolom-kolom yang ingin ditampilkan di view (js)
$response->rows[$z]['cell']=array(
$result_tipe[$i]['ID_REKENING'],
$result_tipe[$i]['ID_PARENT_REKENING'],
$result_tipe[$i]['KODE_REKENING'],
$result_tipe[$i]['NAMA_REKENING'],
$result_tipe[$i]['PAGU'],
1
);
$z++;
//Kelompok
$result_kelompok = $this->data_model->get_kelompok($id, $result_tipe[$i]['TIPE']);
for($j=0; $j<count($result_kelompok); $j++)
{
if ($result_kelompok[$j]['KODE_REKENING'] != $last_kelompok){
$response->rows[$z]['id']=$result_kelompok[$j]['ID_REKENING'];
// data berikut harus sesuai dengan kolom-kolom yang ingin ditampilkan di view (js)
$response->rows[$z]['cell']=array(
$result_kelompok[$j]['ID_REKENING'],
$result_kelompok[$j]['ID_PARENT_REKENING'],
$result_kelompok[$j]['KODE_REKENING'],
$result_kelompok[$j]['NAMA_REKENING'],
$result_kelompok[$j]['PAGU'],
2
);
$z++;
}
$last_kelompok = $result_tipe[$i]['KODE_REKENING'];
//Jenis
$result_jenis = $this->data_model->get_jenis($id, $result_kelompok[$j]['TIPE'], $result_kelompok[$j]['KELOMPOK']);
for($k=0; $k<count($result_jenis); $k++)
{
if ($result_jenis[$k]['KODE_REKENING'] != $last_jenis){
$response->rows[$z]['id']=$result_jenis[$k]['ID_REKENING'];
// data berikut harus sesuai dengan kolom-kolom yang ingin ditampilkan di view (js)
$response->rows[$z]['cell']=array(
$result_jenis[$k]['ID_REKENING'],
$result_jenis[$k]['ID_PARENT_REKENING'],
$result_jenis[$k]['KODE_REKENING'],
$result_jenis[$k]['NAMA_REKENING'],
$result_jenis[$k]['PAGU'],
3
);
$z++;
}
$last_jenis = $result_kelompok[$j]['KODE_REKENING'];
}
}
}
echo json_encode($response);
}
public function get_rincian_anggaran($id)
{
$req_param['id'] = $id;
$result_tipe = $this->data_model->get_tipe($id);
$z=0;
$last_kelompok = 0;
$last_jenis = 0;
$surplus = $this->data_model->get_surplus($id);
$netto = $this->data_model->get_netto($id);
$response = (object) NULL;
for($i=0; $i<count($result_tipe); $i++)
{
//Tipe
$response->rows[$z]['ID_REKENING'] = $result_tipe[$i]['ID_REKENING'];
$response->rows[$z]['ID_PARENT_REKENING'] = $result_tipe[$i]['ID_PARENT_REKENING'];
$response->rows[$z]['KODE_REKENING'] = $result_tipe[$i]['KODE_REKENING'];
$response->rows[$z]['NAMA_REKENING'] = $result_tipe[$i]['NAMA_REKENING'];
$response->rows[$z]['PAGU'] = $result_tipe[$i]['PAGU'];
$response->rows[$z]['LEVEL'] = 1;
$z++;
//Kelompok
$result_kelompok = $this->data_model->get_kelompok($id, $result_tipe[$i]['TIPE']);
for($j=0; $j<count($result_kelompok); $j++)
{
if ($result_kelompok[$j]['KODE_REKENING'] != $last_kelompok){
$response->rows[$z]['ID_REKENING'] = $result_kelompok[$j]['ID_REKENING'];
$response->rows[$z]['ID_PARENT_REKENING'] = $result_kelompok[$j]['ID_PARENT_REKENING'];
$response->rows[$z]['KODE_REKENING'] = $result_kelompok[$j]['KODE_REKENING'];
$response->rows[$z]['NAMA_REKENING'] = $result_kelompok[$j]['NAMA_REKENING'];
$response->rows[$z]['PAGU'] = $result_kelompok[$j]['PAGU'];
$response->rows[$z]['LEVEL'] = 2;
$z++;
}
$last_kelompok = $result_tipe[$i]['KODE_REKENING'];
//Jenis
$result_jenis = $this->data_model->get_jenis($id, $result_kelompok[$j]['TIPE'], $result_kelompok[$j]['KELOMPOK']);
for($k=0; $k<count($result_jenis); $k++)
{
if ($result_jenis[$k]['KODE_REKENING'] != $last_jenis){
$response->rows[$z]['ID_REKENING'] = $result_jenis[$k]['ID_REKENING'];
$response->rows[$z]['ID_PARENT_REKENING'] = $result_jenis[$k]['ID_PARENT_REKENING'];
$response->rows[$z]['KODE_REKENING'] = $result_jenis[$k]['KODE_REKENING'];
$response->rows[$z]['NAMA_REKENING'] = $result_jenis[$k]['NAMA_REKENING'];
$response->rows[$z]['PAGU'] = $result_jenis[$k]['PAGU'];
$response->rows[$z]['LEVEL'] = 3;
$z++;
}
$last_jenis = $result_kelompok[$j]['KODE_REKENING'];
}
}
}
$response->surplus = $surplus;
$response->netto = $netto;
echo json_encode($response);
}
public function get_pejabat($id)
{
$response = (object) NULL;
$result = $this->data_model->get_pejabat($id);
for($i=0; $i<count($result); $i++)
{
$response->rows[$i]['id'] = $result[$i]['ID_PEJABAT_SKPD'];
$response->rows[$i]['nama'] = $result[$i]['NAMA_PEJABAT'];
$response->rows[$i]['jabatan'] = $result[$i]['JABATAN'];
}
echo json_encode($response);
}
public function delete()
{
$id = $this->input->post('id_fa');
$namaskpd = $this->input->post('namaskpd');
$gagal_skpd = array();
$jml = count($id);
$sukes = 0;
$gagal = 0;
$response = (object) NULL;
for($x=0;$x<count($id);$x++){
$cek = $this->data_model->cek_skpd($id[$x]);
if($cek)
{
$hapus = $this->data_model->delete_data($cek['ID_SKPD']);
$sukes+=1;
}
else
{
$gagal+=1;
$gagal_skpd[]=$namaskpd[$x];
}
}
$jjj = implode($gagal_skpd);
if($gagal < 0 && $gagal <= 3){
$response->isSuccess = TRUE;
$response->message = "Sukses Menghapus ".$sukes." dari ".$jml." KUA PPAS, Gagal $jjj";
}
else{
$response->isSuccess = TRUE;
$response->message = "Sukses Menghapus ".$sukes." dari ".$jml." KUA PPAS, Gagal ".$gagal."";
}
echo json_encode($response);
}
public function uraian( $jenis="insert", $id='null' )
{
if( $jenis="update" )
{
$this->sub_model->delete_data( $id );
}
elseif( $jenis="insert" )
{
$id = $this->data_model->get_id();
}
for( $i=0; $i<count($_POST['uraian']); $i++ )
{
$this->sub_model->data['id_def']=$id;
$this->sub_model->data['uraian']=$_POST['uraian'][$i];
$this->sub_model->insert_data();
}
}
public function get_list_uraian( $id='null' )
{
$rows = $this->sub_model->get_data_by_id( $id );
echo json_encode( $rows );
}
public function previewRKA()
{
if($this->status != $this->status_awal)
{
$nama_report = 'RKA';
$file_report = 'RKAPAK';
}
else
{
$nama_report = 'RKA';
$file_report = 'RKA';
}
if($this->input->post('id_form_anggaran') !=''){
$idfa = explode(',',$this->input->post('id_form_anggaran'));
}
else{
$idfa = array();
}
if (count($idfa) == 0){
$rslt = '';
$ID='';
}
else if(count($idfa) <= 500 && count($idfa) > 0){
$rslt = $idfa;
$ID = implode(", ", $rslt);
}
else if(count($idfa) > 500){
$cch = count($idfa) / 500;
$modl = count($idfa) % 500;
$pembagi = 0;
for ($j = 0;$j<$cch;$j++){
$idx[$j] = array_slice($idfa, $pembagi, 500);
$pembagi+=500;
}
$rslt = $idx;
$ID='';
for($l=0;$l < count($idx);$l++)
{
if($l==0){
$ID = implode(", ", $rslt[$l]);
}
else{
$ID.= ' OR A.ID_FORM_ANGGARAN IN (' .implode(", ", $rslt[$l]) .')';
}
}
}
$param = 'ID='.$ID.'&Status='.$this->status.'&Tahun='.$this->tahun;
$arr = array(
'_name'=>$nama_report,
'_fr3'=>$file_report,
'_opt'=>$param,
);
echo json_encode($arr);
}
public function previewDaftarRKA()
{
$nama_report = 'Daftar RKA SKPD';
$file_report = 'DaftarRKA';
if($this->input->post('id_form_anggaran') !=''){
$idfa = explode(',',$this->input->post('id_form_anggaran'));
}
else{
$idfa = array();
}
if (count($idfa) == 0){
$rslt = '';
$ID='';
$multi = 'N';
}
else if(count($idfa) <= 500 && count($idfa) > 0){
$rslt = $idfa;
$ID = implode(", ", $rslt);
$multi = 'N';
}
else if(count($idfa) > 500){
$cch = count($idfa) / 500;
$modl = count($idfa) % 500;
$pembagi = 0;
for ($j = 0;$j<$cch;$j++){
$idx[$j] = array_slice($idfa, $pembagi, 500);
$pembagi+=500;
}
$rslt = $idx;
$ID='';
for($l=0;$l < count($idx);$l++)
{
if($l==0){
$ID.= ' AND A.ID_FORM_ANGGARAN IN (' .implode(", ", $rslt[$l]) .')';
}
else{
$ID.= ' OR A.ID_FORM_ANGGARAN IN (' .implode(", ", $rslt[$l]) .')';
}
}
$multi = 'Y';
}
$param = 'Tahun='.$this->input->post('Tahun').'&Status='.$this->input->post('Status').'&ID='.$ID.'&multi='.$multi;
$arr = array(
'_name'=>$nama_report,
'_fr3'=>$file_report,
'_opt'=>$param,
);
echo json_encode($arr);
}
public function get_rekening()
{
$id = implode(",", $this->input->post('id'));
$result = $this->data_model->get_rek($id)->result_array();
$idx = 0;
$response = (object) NULL;
for($i=0; $i<count($result); $i++)
{
if ($result[$i]['LEVEL_REKENING']==3)
{
if ($idx>0)
{
$after = $response->rows[$idx-1]['id'];
}
else{
$after = NULL;
}
$response->rows[$idx]['after'] = $after;
$response->rows[$idx]['id'] = $result[$i]['ID_REKENING'];
$response->rows[$idx]['idrek'] = $result[$i]['ID_REKENING'];
$response->rows[$idx]['kode'] = $result[$i]['KODE_REKENING'];
$response->rows[$idx]['nama'] = $result[$i]['NAMA_REKENING'];
$response->rows[$idx]['level'] = $result[$i]['LEVEL_REKENING'];
$response->rows[$idx]['parent'] = $result[$i]['ID_REKENING'];
$idx++;
}
/*else{
if ($idx>0){
$after = $response->rows[$idx-1]['id'];
}
else{
$after = NULL;
}
$response->rows[$idx]['after'] = $after;
$response->rows[$idx]['id'] = $result[$i]['ID_REKENING'];
$response->rows[$idx]['idrek'] = $result[$i]['ID_REKENING'];
$response->rows[$idx]['kode'] = $result[$i]['KODE_REKENING'];
$response->rows[$idx]['nama'] = $result[$i]['NAMA_REKENING'];
$response->rows[$idx]['level'] = $result[$i]['LEVEL_REKENING'];
$response->rows[$idx]['parent'] = $result[$i]['ID_PARENT_REKENING'];
$idx++;
}*/
}
echo json_encode($response);
}
public function get_kegiatan()
{
$id = implode(",", $this->input->post('id'));
$id_skpd = $this->input->post('id_skpd');
$result = $this->data_model->get_keg($id,$id_skpd)->result_array();
$idx = 0;
$response = (object) NULL;
for($i=0; $i<count($result); $i++)
{
if ($idx>0)
{
$after = $response->rows[$idx-1]['id'];
}
else{
$after = NULL;
}
$response->rows[$idx]['after'] = $after;
//$response->rows[$idx]['id'] = "inp_".$result[$i]['ID_KEGIATAN'];
$response->rows[$idx]['id'] = $result[$i]['ID_KEGIATAN'];
$response->rows[$idx]['idrek'] = $result[$i]['ID_KEGIATAN'];
$response->rows[$idx]['kode'] = $result[$i]['KODE_KEGIATAN_LKP'];
$response->rows[$idx]['nama'] = $result[$i]['NAMA_KEGIATAN'];
$response->rows[$idx]['parent'] = $result[$i]['ID_KEGIATAN'];
$idx++;
}
echo json_encode($response);
}
public function get_satuan()
{
$q = strtolower($_GET["q"]);
if (!$q) return;
$result = $this->data_model->get_opt_satuan();
foreach ($result as $items)
{
foreach($items as $key=>$value)
{
if (strpos(strtolower($value), $q) !== false)
{
echo $value."\n";
}
}
}
}
function duplikasi_kode($str)
{
if ($this->data_model->get_data_kode($str))
{
$this->form_validation->set_message('duplikasi_kode', '%s "'.$str.'" sudah ada.');
return FALSE;
}
else
{
return TRUE;
}
}
public function get_daftar_subrekening_RekeningBL($skpd,$kegiatan)
{
$result = $this->data_model->get_data_subrekeningBL($skpd,$kegiatan)->result_array();
$response = (object) NULL;
for($i=0; $i<count($result); $i++)
{
$response->rows[$i]['id']=$result[$i]['ID_REKENING'];
if ($result[$i]['PAGU'] == null)
{
$pagu='0.00';
}
else
{
$pagu=$result[$i]['PAGU'];
}
// data berikut harus sesuai dengan kolom-kolom yang ingin ditampilkan di view (js)
$response->rows[$i]['cell']=array($result[$i]['ID_REKENING'],
$result[$i]['KODE_REKENING'],
$result[$i]['NAMA_REKENING'],
$pagu
);
}
echo json_encode($response);
}
public function proses_form_RekeningBL($skpd,$kegiatan)
{
$this->data_model->proses_form_RekeningBL($skpd,$kegiatan);
$response = (object) NULL;
$response->isSuccess = TRUE;
$response->message = 'Plafon Rekening Belanja Langsung Telah Diperbaharui.';
echo json_encode($response);
}
}