| 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/simbada_2019/application/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Preview extends Core_Laporan {
public function __construct()
{
parent::__construct();
$this->modul_name = 'preview';
//$this->load->model('auth/login_model', 'auth');
$this->xml_file = 'simbada_base.xml';
$this->xml_custom = 'simbada_base_custom.xml';
$this->xml_temp = 'simbada_base_temp.xml';
$report = $this->load->library('report_builder');
$this->report_builder->get_html_menu($this->xml_file, $this->xml_custom, $this->xml_temp);
}
function param($tipe = '', $area = '', $grup = '', $unit = '', $varname = '')
{
if ( $tipe == '' || $area == '' || $grup == '' || $unit == '' )
{
echo 'Parameter tidak lengkap';
return FALSE;
}
$this->tipe = intval($tipe);
$this->area = intval($area);
$this->group = intval($grup);
$this->unit = strval(urldecode($unit));
$this->varname = intval($varname);
if ($varname !== '')
{
$this->reload_param();
}
else
{
$this->get_parameter();
}
}
protected function read_xml()
{
if (! $this->xml = simplexml_load_file($this->path2fr3.$this->xml_temp) )
{
echo 'Laporan tidak ditemukan';
return FALSE;
}
$report = (object) null;
// cek apakah ada laporan custom daerah
if (isset($this->app_config['custom']) && $this->app_config['custom'] != '')
{
$daerah = $this->app_config['custom'];
$report = $this->xml->xpath('//AREA[@id="'.$daerah.'"]//REPORT[@caption="'.$this->unit.'"]');
}
$cek = (array) $report;
if ( empty( $cek ) )
{
// laporan standar
$daerah = 'SEMUA';
$report = $this->xml->xpath('//AREA[@id="'.$daerah.'"]//REPORT[@caption="'.$this->unit.'"]');
}
$cek = (array) $report;
if ( empty( $cek ) ) return FALSE;
$this->fr3 = (string) $report[0]->attributes()->file;
$this->nama_laporan = (string) $report[0]->attributes()->namafile;
return $report[0]->children();
}
function get_search_param(){
$sidx = $this->input->post('sidx') ? $this->input->post('sidx') : 0; // get index row - i.e. user click to sort
$sord = $this->input->post('sord') ? $this->input->post('sord') : ''; // get the direction if(!$sidx) $sidx =1;
// untuk keperluan pencarian
$mode = $this->input->post('m') ? $this->input->post('m') : '';
$q = $this->input->post('q') ? $this->input->post('q') : '';
//untuk keperluan neraca lajur
$tg1 = $this->input->post('tg1')? $this->input->post('tg1') : '';
$tg2 = $this->input->post('tg2')? $this->input->post('tg2') : '';
if (!$tg1 == '' || !$tg2 == '')
{
$tg1 = prepare_date($tg1);
$tg2 = prepare_date($tg2);
}
return array (
"sort_by" => $sidx,
"sort_direction" => $sord,
"search_mode" => $mode,
"q" => $q,
"tg1" =>$tg1,
"tg2" =>$tg2,
);
}
function proses($tipe = '', $area = '', $grup = '', $unit = '')
{
if ( $tipe == '' || $area == '' || $grup == '' || $unit == '' )
{
echo 'Parameter tidak lengkap';
return FALSE;
}
$format = $this->input->post('format');
$this->tipe = intval($tipe);
$this->area = intval($area);
$this->group = intval($grup);
$this->unit = strval(urldecode($unit));
if (! $report = $this->read_xml() )
{
return FALSE;
}
$param['fr3'] = $this->fr3;
$param['nama'] = $this->nama_laporan;
$param['format'] = $format ? $format : 'pdf';
// parameter default
foreach($this->default_param as $key => $val)
{
$param['opt'][$key] = $val;
}
$post = $this->input->post();
foreach( $post as $key => $value )
{
$param['opt'][ $key ] = $value;
}
$tipe = $this->input->post('tipe');
$modul = $this->input->post('modul');
$model = '';
if ($tipe === 'daftar')
{
switch ($modul) {
case 'inventaris_a' : $model = 'inventaris_a/inventarisa_model'; break;
case 'inventaris_b' : $model = 'inventaris_b/inventarisb_model'; break;
case 'inventaris_c' : $model = 'inventaris_c/inventarisc_model'; break;
case 'inventaris_d' : $model = 'inventaris_d/inventarisd_model'; break;
case 'inventaris_e' : $model = 'inventaris_e/inventarise_model'; break;
case 'inventaris_f' : $model = 'inventaris_f/inventarisf_model'; break;
case 'mutasi' : $model = 'mutasi/mutasi_model'; break;
case 'mutasi_hibah_masuk' : $model = 'mutasi_hibah_masuk/mutasi_hibah_masuk_model'; break;
case 'mutasi_masuk' : $model = 'mutasi_masuk/mutasi_masuk_model'; break;
case 'pengadaan' : $model = 'pengadaan/pengadaan_model'; break;
case 'urusan' : $model = 'urusan/urusan_model'; break;
case 'fungsi' : $model = 'fungsi/fungsi_model'; break;
case 'bidang' : $model = 'bidang/bidang_model'; break;
case 'program' : $model = 'program/program_model'; break;
case 'kegiatan' : $model = 'kegiatan/kegiatan_model'; break;
case 'skpd' : $model = 'skpd/skpd_model'; break;
case 'pejabat_daerah' : $model = 'pejabat_daerah/pejabatdaerah_model'; break;
}
if ($model != '')
{
$search_param = $this->get_search_param();
$this->load->model($model, 'data_model');
$query_str = $this->data_model->get_data($search_param, FALSE, TRUE);
$query_str = preg_replace("/[\n\r]/"," ", $query_str);
$param['opt']['SQLFilter'] = $query_str;
}
}
$this->start($param);
}
}