| 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/susun_jurnal/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Susun_jurnal extends Userpage_Controller {
public function __construct()
{
parent::__construct();
$this->modul_name = 'susun_jurnal';
$this->modul_display = 'Penyusunan Jurnal';
$this->load->model('susun_jurnal_model', 'data_model');
}
public function index()
{
$this->form();
}
public function form()
{
$data['modul'] = $this->modul_name;
$data['modul_display'] = $this->modul_display;
$data['main_content'] = 'susun_jurnal_form';
$data['konsolidator'] = $this->id_skpd == 0 && $this->ppkd == 0 && !$this->admin;
if ($this->admin > 0) $role = 3; // user admin
else if ($this->ppkd > 0) $role = 2; // user ppkd
else if ($this->id_skpd > 0) $role = 1; // user sip skpd
else $role = 0; // user sipkd / konsolidasi
$data['role'] = $role;
$this->load->view('layout/template',$data);
}
function go()
{
$response = (object) NULL;
$tipe1 = $this->input->post('tipe1') ? $this->input->post('tipe1') : 'true';
$tipe2 = $this->input->post('tipe2') ? $this->input->post('tipe2') : 'false';
$tipe3 = $this->input->post('tipe3') ? $this->input->post('tipe3') : 'false';
$tipe4 = $this->input->post('tipe4') ? $this->input->post('tipe4') : 'false';
$tipe5 = $this->input->post('tipe5') ? $this->input->post('tipe5') : 'false';
$periode = $this->input->post('periode') ? $this->input->post('periode') : '';
$bulan = $this->input->post('bulan') ? $this->input->post('bulan') : '';
$tgl1 = $this->input->post('tgl1') ? $this->input->post('tgl1') : '';
$tgl2 = $this->input->post('tgl2') ? $this->input->post('tgl2') : '';
$periode_set = array(0, 1, 2);
$bulan_set = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
if (!in_array((int) $periode, $periode_set))
{
$response->isSuccess = FALSE;
$response->message = 'Pilihan Periode tidak valid';
}
if ($periode == 1 && !in_array((int) $bulan, $bulan_set))
{
$response->isSuccess = FALSE;
$response->message = 'Periode Bulan tidak valid';
}
if ($periode == 2 && ($tgl1 == '' || $tgl2 == ''))
{
$response->isSuccess = FALSE;
$response->message = 'Periode Tanggal tidak valid';
}
if (isset($response->isSuccess) && $response->isSuccess === FALSE)
{
echo json_encode($response);
return;
}
if ($periode == 2)
{
$tgl1 = prepare_date($tgl1);
$tgl2 = prepare_date($tgl2);
}
else if ($periode == 1)
{
$tgl = new DateTime($this->data_model->tahun."-".$bulan."-01");
$tgl1 = $tgl->format('Y/m/d');
$tgl2 = $tgl->format('Y/m/t');
}
else if ($periode == 0)
{
$tgl1 = null;
$tgl2 = null;
}
$param = array(
'aktivitas' => $tipe1,
'saldo_awal' => $tipe2,
'penyesuaian' => $tipe3,
'pembalik' => $tipe4,
'penutup' => $tipe5,
'periode' => $periode,
'tgl1' => $tgl1,
'tgl2' => $tgl2,
);
/*
if ($this->data_model->id_skpd === 0 && $this->data_model->ppkd !== 1)
{
$response->isSuccess = FALSE;
$response->message = 'Anda tidak berhak melakukan proses jurnal.';
echo json_encode($response);
return;
}
*/
$cek = $this->data_model->do_jurnal($param);
if ($cek)
{
$response->isSuccess = TRUE;
$response->message = 'Jurnal berhasil dibuat';
}
else
{
$response->isSuccess = FALSE;
$response->message = 'Jurnal gagal dibuat';
if ($this->data_model->last_error_message !== '')
{
$error = $this->data_model->last_error_message;
if (strpos($error, 'E_JURNAL_INCOMPLETE'))
{
$at = strpos($error, 'At');
$start = strlen("exception 3 E_JURNAL_INCOMPLETE ");
$msg = substr($error, $start, $at - $start);
$tipe = '';
if (strpos($error, '_ANGGARAN')) $tipe = 'ANGGARAN';
else if (strpos($error, '_BAST')) $tipe = 'BAST';
else if (strpos($error, '_SKRD')) $tipe = 'SKPD';
else if (strpos($error, '_TBP')) $tipe = 'TBP';
else if (strpos($error, '_STS')) $tipe = 'STS';
else if (strpos($error, '_SP2D')) $tipe = 'SP2D';
else if (strpos($error, '_BELANJA')) $tipe = 'BELANJA';
else if (strpos($error, '_PANJAR')) $tipe = 'PANJAR';
else if (strpos($error, '_SPJ_PJR')) $tipe = 'SPJ PANJAR';
else if (strpos($error, '_SISA_PJR')) $tipe = 'SETOR SISA PANJAR';
else if (strpos($error, '_SPJKD')) $tipe = 'SPJ FUNGSIONAL';
else if (strpos($error, '_SPJP')) $tipe = 'SPJ PENDAPATAN';
else if (strpos($error, '_CP')) $tipe = 'KONTRA POS';
else if (strpos($error, '_SSU')) $tipe = 'SETORAN SISA UP';
else if (strpos($error, '_SPFK')) $tipe = 'SETORAN PFK';
else if (strpos($error, '_SPJK')) $tipe = 'SETORAN PAJAK';
else if (strpos($error, '_SSP')) $tipe = 'SETORAN PAJAK';
else if (strpos($error, '_SPJ')) $tipe = 'SPJ ADMINISTRATIF';
else if (strpos($error, '_MP')) $tipe = 'MP';
$msg = $tipe .": ".$msg;
}
else $msg = "Penyebab kegagalan tidak diketahui. Hubungi admin.";
$response->detail = $msg;
$response->error = $error;
}
}
$response->sql = $this->db->queries;
echo json_encode($response);
}
}