| 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 : /wamp/www/SIPBOS_2020/application/modules/setoran_sisa/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Setoran_sisa extends Aktivitas_Controller {
public function __construct()
{
parent::__construct();
$this->modul_name = 'setoran_sisa';
$this->modul_display = 'Setoran Sisa';
$this->view_form = 'setoran_form';
$this->view_daftar = 'setoran_view';
$this->report_daftar = 'Daftar Setoran Sisa';
$this->report_form = 'Form Setoran Sisa';
$this->load->model('Setoran_model', 'data_model');
$this->message_aktivitas_dihapus = 'Setoran Sisa telah dihapus.';
$this->message_aktivitas_gagal_dihapus = 'Setoran Sisa telah dicairkan, tidak bisa dihapus.';
}
function validasi()
{
$this->form_validation->set_rules('id_kasda', 'Akun Kasda', 'trim|integer');
$this->form_validation->set_rules('id_pekas', 'Akun Bendahara', 'trim|integer');
/* cek rincian ada isinya atau tidak dan apakah sisanya ada yang minus */
// $this->form_validation->set_rules('rincian', '', 'required|callback__cek_minus_rek');
// $this->form_validation->set_message('_cek_minus_rek', 'Ada rincian yang sisanya minus.');
/* TODO : cek rincian ada isinya atau tidak */
$this->form_validation->set_rules('sd', 'Rincian Sumber Dana', 'required');
}
public function _cek_minus_rek($data)
{
$arrdata = json_decode($data);
if (is_array($arrdata)){
$param = array(
'id_skpd' => $this->input->post('id_skpd') ? $this->input->post('id_skpd') : 0,
'beban' => $this->input->post('beban') ? $this->input->post('beban') : '',
'keperluan' => $this->input->post('keperluan') ? $this->input->post('keperluan') : '',
'tanggal' => $this->input->post('tgl') ? $this->input->post('tgl') : '',
'id_aktivitas' => $this->input->post('id') ? $this->input->post('id') : 0,
);
for ($i=0; $i < count($arrdata); $i++){
$param['id_kegiatan'] = $arrdata[$i]->idkeg ? $arrdata[$i]->idkeg : 0;
$param['id_rekening'] = $arrdata[$i]->idrek;
$sisa = $this->data_model->get_sisa_rekening($param);
if ($sisa && (float) $sisa['NOMINAL'] - $arrdata[$i]->nom < 0.0) return false;
}
}
else return true;
}
function _cek_bku()
{
// lakukan pengecekan bku hanya untuk Setoran Sisa yang sudah disimpan
// return TRUE jika sudah masuk BKU
$id = (int) $this->input->post('id');
if ($id != 0) return $this->data_model->check_bku($id);
else return FALSE;
}
function get_extra_data($id)
{
$extra = array();
$extra['spp_tu'] = $this->session->userdata('konf_spp_tu');
return $extra;
}
protected function extra_message()
{
return array(
'id_bku' => $this->data_model->id_bku,
'no_bku' => $this->data_model->no_bku
);
}
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_RINCIAN_SETORAN_SISA'];
$response->rows[$i]['cell'] = array(
$result[$i]['ID_RINCIAN_SETORAN_SISA'],
$result[$i]['ID_KEGIATAN'],
$result[$i]['ID_REKENING'],
$result[$i]['KODE_KEGIATAN_SKPD'],
$result[$i]['NAMA_KEGIATAN'],
$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);
}
public function sisa_kas()
{
$param = array(
'id' => $this->input->post('id') ? $this->input->post('id') : 0,
'id_skpd' => $this->input->post('id_skpd') ? $this->input->post('id_skpd') : 0,
'tanggal' => $this->input->post('tgl') ? prepare_date($this->input->post('tgl')) : 0,
'beban' => $this->input->post('beban') ? $this->input->post('beban') : '',
'keperluan' => $this->input->post('keperluan') ? $this->input->post('keperluan') : '',
'id_rekening_pekas' => $this->input->post('pekas') ? $this->input->post('pekas') : 0,
'id_kegiatan' => $this->input->post('id_kegiatan') ? $this->input->post('id_kegiatan') : '0',
);
$bank = $this->data_model->get_sisa_kas_bank($param);
$tunai = $this->data_model->get_sisa_kas_tunai($param);
$response = (object) NULL;
$response = array(
'bank' => isset($bank['NOMINAL']) ? $bank['NOMINAL'] : 0,
'bank_tgl' => isset($bank['NOMINAL_TANGGAL']) ? $bank['NOMINAL_TANGGAL'] : 0,
'tunai' => isset($tunai['NOMINAL']) ? $tunai['NOMINAL'] : 0,
'tunai_tgl' => isset($tunai['NOMINAL_TANGGAL']) ? $tunai['NOMINAL_TANGGAL'] : 0,
'sql' => $this->db->queries,
);
echo json_encode($response);
}
public function sisa_rekening()
{
$idr = $this->input->post('idr') ? $this->input->post('idr') : 0;
$param = array(
'id_skpd' => $this->input->post('id_skpd') ? $this->input->post('id_skpd') : 0,
'beban' => $this->input->post('beban') ? $this->input->post('beban') : '',
'keperluan' => $this->input->post('keperluan') ? $this->input->post('keperluan') : '',
'id_kegiatan' => $this->input->post('id_kegiatan') ? $this->input->post('id_kegiatan') : 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(
'idr' => $idr,
'sisa' => isset($result['NOMINAL']) ? $result['NOMINAL'] : 0
);
echo json_encode($response);
}
public function sisa_kegiatan()
{
$idr = $this->input->post('idr') ? $this->input->post('idr') : 0;
$param = array(
'id_skpd' => $this->input->post('id_skpd') ? $this->input->post('id_skpd') : 0,
'keperluan' => $this->input->post('keperluan') ? $this->input->post('keperluan') : '',
'id_kegiatan' => $this->input->post('id_kegiatan') ? $this->input->post('id_kegiatan') : 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_kegiatan($param);
$response = (object) NULL;
$response = array(
'idr' => $idr,
'sisa' => isset($result['NOMINAL']) ? $result['NOMINAL'] : 0
);
echo json_encode($response);
}
}