| 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/sipkd_2019_test/application/modules/sts1/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Sts extends Aktivitas_Controller {
public function __construct()
{
parent::__construct();
$this->modul_name = 'sts';
$this->modul_display = 'STS';
$this->view_form = 'sts_form';
$this->view_daftar = 'sts_view';
$this->report_daftar = 'Daftar STS';
$this->report_form = 'Form STS';
$this->load->model('sts_model', 'data_model');
$this->message_aktivitas_dihapus = 'STS telah dihapus.';
$this->message_aktivitas_gagal_dihapus = 'STS telah dicairkan, tidak bisa dihapus.';
}
function validasi()
{
$this->form_validation->set_rules('id_skpd', 'SKPD', 'required|trim|integer');
$this->form_validation->set_rules('kaskpd', 'Kepala SKPD', 'trim|integer');
$this->form_validation->set_rules('bt', 'Bendahara Penerimaan', 'trim|integer');
/* TODO : cek rincian ada isinya atau tidak */
$this->form_validation->set_rules('sd', 'Rincian Sumber Dana', 'required');
}
function _cek_bku()
{
// lakukan pengecekan bku hanya untuk STS yang sudah disimpan
// return TRUE jika sudah masuk BUD
$id = (int) $this->input->post('id');
if ($id != 0) return $this->data_model->check_bku($id);
else return FALSE;
}
protected function extra_message()
{
return array(
'id_bku' => $this->data_model->id_bku,
'no_bku' => $this->data_model->no_bku
);
}
public function rinci($id=0)
{
$result = $this->data_model->get_rinci_by_id($id);
$response = (object) NULL;
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]['NOMINAL'],
0, // sisa
0, // batas
$result[$i]['ID_SUMBER_DANA'],
);
}
}
echo json_encode($response);
}
function sumberdana($id=0)
{
$result = $this->data_model->get_sumberdana_by_id($id);
$response = (object) NULL;
if ($result){
for($i=0; $i<count($result); $i++)
{
$response->rows[$i]['id'] = $result[$i]['ID_SUMBER_DANA'];
$response->rows[$i]['cell']=array(
$result[$i]['ID_SUMBER_DANA'],
$result[$i]['KODE_REKENING'],
$result[$i]['NAMA_REKENING'],
$result[$i]['NOMINAL'],
);
}
}
echo json_encode($response);
}
/* mengembalikan rincian rekening untuk STS Pakai TBP */
public function get_rincian_tbp()
{
$response = (object) NULL;
$param = array(
'id_skpd' => $this->input->post('id_skpd') ? $this->input->post('id_skpd') : 0,
'tanggal' => $this->input->post('tgl') ? $this->input->post('tgl') : '',
);
$result = $this->data_model->get_rekening_tbp($param);
for ($i = 0; $i < count($result); $i++)
{
$id = $i + 1;
$response->rekening->rows[$i] = array(
'id' => $result[$i]['ID_REKENING'],
'idrek' => $result[$i]['ID_REKENING'],
'kdrek' => $result[$i]['KODE_REKENING'],
'nmrek' => $result[$i]['NAMA_REKENING'],
'nom' => $result[$i]['NOMINAL_SISA'],
'sisa' => 0,
'batas' => $result[$i]['NOMINAL_SISA'],
'idsd' => $result[$i]['ID_SUMBER_DANA']
);
}
$response->sql = $this->db->queries;
echo json_encode($response);
}
public function sisa_rekening()
{
$param = array(
'id_skpd' => $this->input->post('id_skpd') ? $this->input->post('id_skpd') : 0,
'id_rekening' => $this->input->post('id_rekening') ? $this->input->post('id_rekening') : 0,
'tanggal' => $this->input->post('tanggal') ? $this->input->post('tanggal') : '',
'id_aktivitas' => $this->input->post('id') ? $this->input->post('id') : 0,
);
$result = $this->data_model->get_sisa_rekening($param);
$response = (object) NULL;
$response = array(
'idrek' => $param['id_rekening'],
'sisa' => isset($result['NOMINAL']) ? $result['NOMINAL'] : 0,
'sql' => $this->db->queries,
);
echo json_encode($response);
}
}