403Webshell
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/sipapbd_2017_perubahan/application/libraries/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : D:/wamp/www/sipapbd_2017_perubahan/application/libraries/autho.php
<?php
/*
 * Class penomoran otomatis
 */
class autho
{
  var $CI = null;
  function __construct()
  {
    $this->CI = & get_instance();
  }

  function check_nomor_aktivitas($param, $cek_duplikasi = FALSE)
  {
    $id_skpd = isset($param['id_skpd']) ? $param['id_skpd'] : 0;
    $form = isset($param['tipe']) ? $param['tipe'] : '';
    $beban = isset($param['beban']) ? $param['beban'] : '';
    $jenis_beban = isset($param['jenis_beban']) ? $param['jenis_beban'] : '';
    $keperluan = isset($param['keperluan']) ? $param['keperluan'] : '';
    $nomor_aktivitas = isset($param['nomor']) ? $param['nomor'] : '';  // untuk keperluan cek duplikasi nomor
    $id_aktivitas = isset($param['id']) ? $param['id'] : 0;
    $tipe = '';

    if ($jenis_beban != '') $beban = $jenis_beban;

    switch ($form)
    {
      case 'SPD' :
      case 'SKPD' :
      case 'TBP' :
      case 'STS' :
      case 'SPP' :
      case 'SPM' :
      case 'SP2D' :
      case 'SPJP' :
      case 'DP' :
      case 'CP' :
      case 'SSU' :
      case 'SSP' :
      case 'SPJK' :
      case 'SPFK' :
      case 'MP' :
      case 'BLJ' :
      case 'SPJ' :
      case 'SPJKD' :
      case 'PB' :
      case 'PB_TARIK' :
      case 'PB_SETOR' :
      case 'BKU' :
      case 'BKUS' :
      case 'PANJAR' :
      case 'SISA_PJR' :
      case 'SPJ_PANJAR' : $tipe = $form; break;
      case 'BKUSP' : $tipe = $form; break;
      case 'VER_SPP' : $tipe = 'SPP'; break;
      case 'VER_SPM' : $tipe = 'SPM'; break;
      case 'VER_SPJ' : $tipe = 'SPJ'; break;
    }

    /* ambil template sesuai tipe aktivitas */
    $db = $this->CI->db;
    $db->select('template')->from('penomoran')->where('tipe', $form);
    $result = $db->get()->row_array();

    if ( count($result) == 0 ){
      return false;
    }

    $only_nomor = FALSE;
    $template = $result['TEMPLATE'];
    $sql_cek = $template;

    /*  Proses {nomor}
    ******************************************************************************************
    */
    $pattern  = "{nomor:\d+(:AN)?}";
    preg_match_all($pattern, $template, $tmp);
    $tmp_nomor = $tmp[0];
    $digit_ = '';
    $digit = 1;

//    $first_digit = strpos ($template, "{nomor") + 1;
    if (count($tmp_nomor) > 0)
    {
      $nomor = $tmp_nomor[0];
      $tmp = explode(':', $nomor);
      $digit = $tmp[1];
      $digit_ = str_repeat('_', $digit);
      if (isset($tmp[2]) && $tmp[2] === 'AN')
      {
        $only_nomor =  TRUE;
        $tmp_nomor = str_replace(':AN', '', $nomor);
      }
      $sql_cek = str_replace("{".$nomor."}", $digit_, $sql_cek);
    }

    /*  Proses {skpd}
    ******************************************************************************************
    */
    if ($id_skpd)
    {
      $pattern  = "{skpd:\d+}";
      preg_match_all($pattern, $template, $tmp);
      $tmp_skpd = $tmp[0];

      for ($i = 0; $i < count($tmp_skpd); $i++)
      {
        $tmp = explode(':', $tmp_skpd[$i]);
        $digit_skpd = $tmp[1];

        switch ($digit_skpd)
        {
          case 3 : $db->select('kode_administrasi')->from('skpd')->where('id_skpd', $param['id_skpd']); break;
          default : $db->select('kode_skpd, kode_skpd_lkp')->from('v_skpd')->where('id_skpd', $param['id_skpd']);
        }
        $skpd = $db->get()->row_array();

        switch ($digit_skpd)
        {
          case 1 : $kode_skpd = $skpd['KODE_SKPD']; break;
          case 2 : $kode_skpd = $skpd['KODE_SKPD_LKP']; break;
          case 3 : $kode_skpd = $skpd['KODE_ADMINISTRASI']; break;
        }

        $sql_cek = str_replace("{".$tmp_skpd[$i]."}", $kode_skpd, $sql_cek);
      }

      /*  Proses {adm}
      ******************************************************************************************
      */
      $pattern  = "{adm}";
      preg_match_all($pattern, $template, $tmp);
      $tmp_adm = $tmp[0];
      if (count($tmp_adm) > 0)
      {
        $db->select('kode_administrasi')->from('skpd')->where('id_skpd', $param['id_skpd']);
        $skpd = $db->get()->row_array();

        $sql_cek = str_replace($pattern, $skpd['KODE_ADMINISTRASI'], $sql_cek);
      }

    }

    /*  Proses {spp}
    ******************************************************************************************
    */
    if (in_array($form, array('SPP', 'VER_SPP', 'SPM', 'VER_SPM', 'SP2D')) )
    {
      $pattern  = "{spp}";
      preg_match_all($pattern, $template, $tmp);
      $tmp_tipe = $tmp[0];
      if (count($tmp_tipe) > 0)
      {
        $spp = $keperluan;
        if ($jenis_beban === 'GJ') $spp = 'GJ';
        $sql_cek = str_replace($pattern, $spp, $sql_cek);
      }
    }

    /*  Proses {tipe}
    ******************************************************************************************
    */
    $pattern  = "{tipe}";
    preg_match_all($pattern, $template, $tmp);
    $tmp_tipe = $tmp[0];
    if (count($tmp_tipe) > 0)
    {
      $sql_cek = str_replace($pattern, $param['tipe'], $sql_cek);
    }

    /*  Proses {triwulan}
    ******************************************************************************************
    */
    $pattern  = "{triwulan}";
    preg_match_all($pattern, $template, $tmp);
    $tmp_tw = $tmp[0];
    if (count($tmp_tw) > 0)
    {
      $triwulan = $this->triwulan(date("m"));
      $sql_cek = str_replace($pattern, $triwulan, $sql_cek);
    }

    /*  Proses {bulan}
    ******************************************************************************************
    */
    $pattern  = "{bulan}";
    preg_match_all($pattern, $template, $tmp);
    $tmp_bulan = $tmp[0];
    if (count($tmp_bulan) > 0)
    {
      $bulan = $this->bulan(date("m"));
      $sql_cek = str_replace($pattern, $bulan, $sql_cek);
    }

    /*  Proses {tahun}
    ******************************************************************************************
    */
    $pattern  = "{tahun}";
    preg_match_all($pattern, $template, $tmp);
    $tmp_tahun = $tmp[0];
    if (count($tmp_tahun) > 0)
    {
      $tahun = date("Y");
      $sql_cek = str_replace($pattern, $tahun, $sql_cek);
    }

    /*  Proses {keperluan}
    ******************************************************************************************
    */
    if ($keperluan)
    {
      $pattern  = "{keperluan}";
      preg_match_all($pattern, $template, $tmp);
      $tmp_kpl = $tmp[0];
      if (count($tmp_kpl) > 0)
      {
        $sql_cek = str_replace($pattern, $keperluan, $sql_cek);
      }
    }

    /*  Proses {beban}
    ******************************************************************************************
    */
    if ($beban)
    {
      $pattern  = "{beban}";
      preg_match_all($pattern, $template, $tmp);
      $tmp_bbn = $tmp[0];
      if (count($tmp_bbn) > 0)
      {
        $sql_cek = str_replace($pattern, $beban, $sql_cek);
      }
    }

    if ($digit_ != '')
    {
      $first_digit = strpos ($sql_cek, $digit_);

      /* cek nomor terakhir */
      switch ($tipe)
      {
        case 'SPD' : $tabel = 'SPD'; break;
        case 'SKPD' : $tabel = 'SKRD'; break;
        case 'TBP' : $tabel = 'TBP'; break;
        case 'STS' : $tabel = 'STS'; break;
        case 'SPP' : $tabel = 'V_SPP_2'; break;
        case 'SPM' : $tabel = 'V_SPM_2'; break;
        case 'SP2D' : $tabel = 'V_SP2D'; break;
        case 'SPJP' : $tabel = 'SPJP'; break;
        case 'DP' : $tabel = 'DAFTAR_PENGUJI'; break;
        case 'CP' : $tabel = 'KONTRA_POS'; break;
        case 'SSU' : $tabel = 'SETORAN_SISA'; break;
        case 'SSP' : $tabel = 'SETORAN_PAJAK'; break;
        case 'SPJK' : $tabel = 'SETORAN_PAJAK_SP2D'; break;
        case 'SPFK' : $tabel = 'SETORAN_PFK_SP2D'; break;
        case 'MP' : $tabel = 'MEMO_PENYESUAIAN'; break;
        case 'BLJ' : $tabel = 'BELANJA'; break;
        case 'SPJ' : $tabel = 'SPJ'; break;
        case 'SPJKD' : $tabel = 'SPJKD'; break;
        case 'PB' :
        case 'PB_TARIK' :
        case 'PB_SETOR' : $tabel = ''; break;
        case 'PANJAR' :
        case 'SISA_PJR' :
        case 'SPJ_PANJAR' : $tabel = 'PANJAR'; break;
        case 'BKU' : $tabel = 'BKU'; break;
        case 'BKUS' :
        case 'BKUSP' : $tabel = 'BKU_SKPD'; break;
      }

      if (in_array($form, array('VER_SPP', 'VER_SPM', 'VER_SPJ')) )
      {
        /* untuk form verifikasi yang dicek dari NOMOR_VERIFIKASI */
        $kolom_nomor = 'b.nomor_verifikasi';
        $kolom_nomor_int = 'b.nomor_verifikasi_int';
      }
      else {
        /* selain form verifikasi diambil dari NOMOR di tabel AKTIVITAS */
        $kolom_nomor = 'a.nomor';
        $kolom_nomor_int = 'a.nomor_int';
      }

      if ( $cek_duplikasi ){
        $db->select('count(1) dup');
        $db->from('aktivitas a');
        $db->where('a.tipe', $tipe);
        $db->where('a.tahun', $this->CI->tahun);
        if ($only_nomor){
          $db->where($kolom_nomor_int." = ", substr($nomor_aktivitas, $first_digit, $digit) );
        }
        else {
          $db->where($kolom_nomor, $nomor_aktivitas);
        }
        // khusus untuk Aktivitas SP2D tidak perlu di filter SKPD
        if ($param['tipe'] !== 'SP2D') {
          if ($param['id_skpd']) $db->where('a.id_skpd', $param['id_skpd']);
        }
        if ($id_aktivitas > 0) $db->where('a.id_aktivitas < ', $id_aktivitas);
        else $db->where('a.id_aktivitas <> ', $id_aktivitas);
        $result = $db->get()->row_array();
        return $result['DUP'] == 0;  // return TRUE jika tidak ada duplikasi
      }
      else {
        $db->select('max('.$kolom_nomor_int.') maxno');
        $db->from('aktivitas a');
        if ($tabel !== '') $db->join($tabel." b", 'b.id_aktivitas = a.id_aktivitas');
        $db->where('a.tipe', $tipe);
        $db->where('a.tahun', $this->CI->session->userdata('tahun'));
        // khusus untuk Aktivitas SP2D tidak perlu di filter SKPD
        if ($param['tipe'] !== 'SP2D') {
          if ($param['id_skpd']) $db->where('a.id_skpd', $param['id_skpd']);
        }

        if (!$only_nomor)
        {
          if (isset($digit_skpd) && $id_skpd > 0) $db->where('a.id_skpd', $id_skpd);
          if ($keperluan && count($tmp_kpl) > 0) $db->where('b.keperluan', $keperluan);
          if ($beban && count($tmp_bbn) > 0)
          {
            if (in_array($form, array('SPP', 'SPM', 'SP2D', 'VER_SPP', 'VER_SPM')))
              $db->where('b.jenis_beban', $jenis_beban);
            else
              $db->where('b.beban', $beban);
          }
        }

        $result = $db->get()->row_array();

        if (count($result) > 0)
          $maxno = (int) $result['MAXNO'] == 0 ? 1 : (int) $result['MAXNO'] + 1;
        else
          $maxno = 1;

        $nomor = $this->FormatNoTrans($maxno, $digit);

        return array(
            'nomor' => substr_replace($sql_cek, $nomor, $first_digit, $digit),
            'nomor_int' => $maxno
        );
      }
    }
    else
      return $sql_cek;
  }

  function FormatNoTrans($num,$panjang) {
    $pjg_kar = strlen($num);
    $rpt = $panjang - $pjg_kar;
    $prev = '';
    if($rpt > 0){
      for($u=0;$u<$rpt;$u++){
        $prev.="0";
      }
      $NoTrans = $prev.$num;
    }
    else{
      $NoTrans = $num;
    }

    return $NoTrans;
  }

  function bulan($bulan)
  {
    switch ($bulan)
    {
      case  1 : $bulan = "JAN"; break;
      case  2 : $bulan = "FEB"; break;
      case  3 : $bulan = "MAR"; break;
      case  4 : $bulan = "APR"; break;
      case  5 : $bulan = "MEI"; break;
      case  6 : $bulan = "JUN"; break;
      case  7 : $bulan = "JUL"; break;
      case  8 : $bulan = "AGS"; break;
      case  9 : $bulan = "SEP"; break;
      case 10 : $bulan = "OKT"; break;
      case 11 : $bulan = "NOV"; break;
      case 12 : $bulan = "DES"; break;
    }
    return $bulan;
  }

  function triwulan($bulan)
  {
    switch ($bulan)
    {
      case  1 :
      case  2 :
      case  3 : $triwulan = 'I'; break;
      case  4 :
      case  5 :
      case  6 : $triwulan = 'II'; break;
      case  7 :
      case  8 :
      case  9 : $triwulan = 'III'; break;
      case 10 :
      case 11 :
      case 12 : $triwulan = 'IV'; break;
    }
    return $triwulan;
  }

}

Youez - 2016 - github.com/yon3zu
LinuXploit