| 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_2016/application/modules/susun_jurnal/models/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Susun_jurnal_model extends Base_Model{
function __construct()
{
parent::__construct();
}
function do_jurnal($param)
{
$tgl1 = $this->db->escape($param['tgl1']);
$tgl2 = $this->db->escape($param['tgl2']);
$this->db->trans_begin();
try {
if ($this->admin > 0) // user admin
{
if ($param['aktivitas'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_aktivitas(".$this->tahun.", '".$this->status."', ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_aktivitas failed');
}
if ($param['saldo_awal'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('SA', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (SA) failed');
}
if ($param['penyesuaian'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('MP', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (MP) failed');
}
if ($param['pembalik'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('PEMBALIK', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (PEMBALIK) failed');
}
if ($param['penutup'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('PENUTUP', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (PENUTUP) failed');
}
}
else if ($this->ppkd > 0) // user sipkd dan opsi ppkd di cek
{
if ($param['aktivitas'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_ppkd(".$this->tahun.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_ppkd failed');
}
if ($param['saldo_awal'] === 'true') {
$this->db->query("execute procedure rebuild_jurnal_mp('SA', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (SA) failed');
}
if ($param['penyesuaian'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('MP', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (MP) failed');
}
if ($param['pembalik'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('PEMBALIK', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (PEMBALIK) failed');
}
if ($param['penutup'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('PENUTUP', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (PENUTUP) failed');
}
}
else if ($this->id_skpd > 0) // user sip skpd
{
if ($param['aktivitas'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_sipskpd(".$this->tahun.", '".$this->status."', ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_sipskpd failed');
}
if ($param['saldo_awal'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('SA', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (SA) failed');
}
if ($param['penyesuaian'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('MP', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (MP) failed');
}
if ($param['pembalik'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('PEMBALIK', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (PEMBALIK) failed');
}
if ($param['penutup'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('PENUTUP', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (PENUTUP) failed');
}
}
else // user sipkd / konsolidasi
{
if ($param['saldo_awal'] === 'true') {
$this->db->query("execute procedure rebuild_jurnal_mp('SA', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (SA) failed');
}
if ($param['penyesuaian'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('MP', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (MP) failed');
}
if ($param['pembalik'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('PEMBALIK', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (PEMBALIK) failed');
}
if ($param['penutup'] === 'true')
{
$this->db->query("execute procedure rebuild_jurnal_mp('PENUTUP', ".$this->tahun.", ".$this->id_skpd.", ".$tgl1.", ".$tgl2.")");
$this->check_trans_status('procedure rebuild_jurnal_mp (PENUTUP) failed');
}
}
}
catch(Exception $e){
//TODO : log error to file
}
$this->last_error_id = $this->db->_error_number();
$this->last_error_message = $this->db->_error_message();
if ($this->db->trans_status() === FALSE)
{
$this->db->trans_rollback();
return FALSE;
}
else {
$this->db->trans_commit();
}
return true;
}
}