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 :  /wamp/www/SIPBOS_2020/application/modules/pemindahbukuan/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /wamp/www/SIPBOS_2020/application/modules/pemindahbukuan/models/pemindahbukuan_model_terbaru.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Pemindahbukuan_model extends Aktivitas_Model {

  var $fieldmap_daftar;
  var $fieldmap_filter;
  var $fieldmap_pemindahbukuan;
  var $fieldmap_rincian;
  var $data_pemindahbukuan;
  var $data_rincian;
  var $purge_rincian;
  var $id_jurnal;

  function __construct()
  {
    parent::__construct();

    $this->tipe = 'PB';

    $this->fieldmap_daftar = array(
      'ID_AKTIVITAS',
      'NOMOR',
      'TANGGAL',
      'DESKRIPSI',
      'KEPERLUAN',
      'BEBAN',
      'DEBET',
      'KREDIT',
    );

    $this->fieldmap_daftar_aggregate = array(
      'debet' => "sum(nj.debet)",
      'kredit' => "sum(nj.kredit)",
    );

    $this->fieldmap_filter = array(
      'no' => 'a.NOMOR',
      'tgl' => 'a.TANGGAL',
      'ket' => 'cast(substring(a.deskripsi from 1 for 5000) as varchar(5000))',
      'kdskpd' => 's.KODE_SKPD_LKP',
      'nmskpd' => 's.NAMA_SKPD',
      'beban' => 'j.BEBAN',
      'keperluan' => 'j.KEPERLUAN',
      'debet' => 'nj.DEBET',
      'kredit' => 'nj.KREDIT'
    );

    $this->fieldmap_pemindahbukuan = array(
      'id' => 'ID_AKTIVITAS',
      'id_jurnal' => 'ID_JURNAL',
      'tipe'=> 'TIPE',
      'tahun' => 'TAHUN',
      'tgl' => 'TANGGAL_JURNAL',
      'id_skpd' => 'ID_SKPD',
      'beban' => 'BEBAN',
      'keperluan' => 'KEPERLUAN',
    );

    $this->fieldmap_rincian = array(
      'idr' => 'ID_RINCIAN_JURNAL',
      'idrek' => 'ID_REKENING',
      'idkeg' => 'ID_KEGIATAN',
      'debet' => 'DEBET',
      'kredit' => 'KREDIT'
    );
  }

  function get_grid_model()
  {
    $grid = array(
        'colNames' => array('Nomor', 'Tanggal', 'Keterangan', 'Keperluan', 'Beban', 'Debet', 'Kredit'),
        'colModel' => array(
          array('name' => 'no', 'width' => 150, 'sortable' => true, 'formatter' => 'daftarOpFmatter'),
          array('name' => 'tgl', 'width' => 80, 'sortable' => true, 'formatter' => 'date', 'align' => 'center'),
          array('name' => 'ket','width' => 200, 'sortable' => true),
          array('name' => 'keperluan','width' => 60, 'sortable' => true, 'align' => 'center'),
          array('name' => 'beban','width' => 60, 'sortable' => true, 'align' => 'center'),
          array('name' => 'debet','width' => 150, 'sortable' => true, 'formatter' => 'currency', 'align' => 'right'),
          array('name' => 'kredit','width' => 150, 'sortable' => true, 'formatter' => 'currency', 'align' => 'right'),
        ),
    );
    return $grid;
  }

  // ----- search advance ---- >>
  function get_data_fields()
  {
    $fields = array(
              'no' => array('name' => 'Nomor', 'kategori'=>'string'),
              'tgl' => array('name' => 'Tanggal', 'kategori'=>'date'),
              'ket' => array('name' => 'Keterangan', 'kategori'=>'string'),
              'keperluan' => array('name' => 'Keperluan', 'kategori'=>'string'),
              'beban' => array('name' => 'Beban', 'kategori'=>'string'),
              'debet' => array('name' => 'Debet', 'kategori'=>'numeric'),
              'kredit' => array('name' => 'Kredit', 'kategori'=>'numeric'),
             );

    return $fields;
  }

  function fill_data()
  {
    parent::fill_data();

    /* ambil data Pemindahbukuan */
    foreach($this->fieldmap_pemindahbukuan as $key => $value){
      switch ($key)
      {
        case 'tipe'  : $$key = $this->tipe; break;
        case 'tahun'  : $$key = $this->tahun; break;
        case 'tgl'   : $$key = $this->input->post($key) ? prepare_date($this->input->post($key)) : NULL; break;
        default : $$key = $this->input->post($key) ? $this->input->post($key) : NULL;
      }
      if(isset($$key))
        $this->data_pemindahbukuan[$value] = $$key;
    }

    /* ambil data rincian Permindahbukuan */
    $this->purge_rincian = $this->input->post('purge'); $this->purge_rincian = $this->purge_rincian ? $this->purge_rincian : NULL;
    $rinci = $this->input->post('rincian') ? $this->input->post('rincian') : NULL;
    if ($rinci)
    {
      $rinci = json_decode($rinci);
      for ($i=0; $i <= count($rinci) - 1; $i++) {
        foreach($this->fieldmap_rincian as $key => $value){
          switch ($key)
          {
           case 'tipe'  : $$key = $this->tipe; break;
           default : $$key = isset($rinci[$i]->$key) && $rinci[$i]->$key ? $rinci[$i]->$key : NULL;
          }
          if(isset($$key))
            $this->data_rincian[$i][$value] = $$key;
        }
      }
    }
  }

  function insert_aktivitas()
  {
    // cek apakah entri baru dan penomoran otomatis
    if ($this->input->post('id') == 0 && $this->input->post('auto') == 'true')
    {
      $id_skpd = $this->input->post('id_skpd');
      $param = array(
        'tipe' => $this->tipe,
        'id_skpd' => $id_skpd,
      );
      $auto_number = $this->autho->check_nomor_aktivitas($param);
      $this->data_aktivitas['NOMOR'] = $auto_number;
    }

    return parent::insert_aktivitas();
  }

  /*
    Simpan data Permindahbukuan
    Jurnal pemindahbukuan masuk ke dalam jurnal finansial
    - Entitas Akuntansi bila ppkd = 0 (draft 2)
    - Entitas Pelaporan bila ppkd = 1 (draft 4)
  */
  function insert_pemindahbukuan()
  {
    $this->id_jurnal = isset($this->data_pemindahbukuan['ID_JURNAL']) ? $this->data_pemindahbukuan['ID_JURNAL'] : 0;
    $this->db->select('1')->from('JURNAL')->where('ID_AKTIVITAS', $this->id)->where('ID_JURNAL', $this->id_jurnal);
    $rs = $this->db->get()->row_array();

    $this->data_pemindahbukuan['ID_SKPD'] = $this->data_aktivitas['ID_SKPD'];
    $this->data_pemindahbukuan['ID_SKPD_AKTIVITAS'] = $this->data_aktivitas['ID_SKPD'];
    $this->data_pemindahbukuan['NOMOR_AKTIVITAS'] = $this->data_aktivitas['NOMOR'];
    $this->data_pemindahbukuan['DRAFT'] = $this->ppkd > 0 ? 4 : 2;

    if ($rs)
    {
      $this->db->where('ID_AKTIVITAS', $this->id);
      $this->db->where('ID_JURNAL', $this->id_jurnal);
      $this->db->update('JURNAL', $this->data_pemindahbukuan);
      $this->check_trans_status('update jurnal failed');
      return $this->data_pemindahbukuan['ID_JURNAL'];
    }
    else
    {
      $this->data_pemindahbukuan['ID_AKTIVITAS'] = $this->id;

      $this->db->insert('JURNAL', $this->data_pemindahbukuan);
      $this->check_trans_status('insert jurnal failed');
      $this->db->select_max('ID_JURNAL')->from('JURNAL');
      $rs = $this->db->get()->row_array();
      return $rs['ID_JURNAL'];
    }
  }

  /* Simpan rincian Pemindahbukuan */
  function insert_rincian()
  {
    if($this->purge_rincian)
    {
      $this->db->where_in('ID_RINCIAN_JURNAL', $this->purge_rincian);
      $this->db->delete('RINCIAN_JURNAL');
      $this->check_trans_status('delete rincian_jurnal failed');
    }

    $jml = count($this->data_rincian);
    for ($i=0; $i <= $jml - 1; $i++)
    {
      $idr = $this->data_rincian[$i]['ID_RINCIAN_JURNAL'];
      $this->db->select('1')->from('RINCIAN_JURNAL')->where('ID_RINCIAN_JURNAL', $idr);
      $rs = $this->db->get()->row_array();

      if ($rs)
      {
        $this->db->where('ID_RINCIAN_JURNAL', $idr);
        $this->db->update('RINCIAN_JURNAL', $this->data_rincian[$i]);
        $this->check_trans_status('update rincian_jurnal failed');
      }
      else
      {
        unset($this->data_rincian[$i]['ID_RINCIAN_JURNAL']);
        $this->data_rincian[$i]['ID_JURNAL'] = $this->id_jurnal;
        $this->db->insert('RINCIAN_JURNAL', $this->data_rincian[$i]);
        $this->check_trans_status('insert rincian_jurnal failed');
      }
    }
  }

  function save_detail()
  {
    $this->id_jurnal = $this->insert_pemindahbukuan();
    $this->insert_rincian();
  }

  /* Query daftar */
  function build_query_daftar()
  {
    $this->db->select('
        a.id_aktivitas,
        a.nomor,
        a.tanggal,
        cast(substring(a.deskripsi from 1 for 5000) as varchar(5000)) deskripsi,
        j.id_jurnal,
        a.tipe,
        a.tahun,
        j.beban,
        j.keperluan,
        nj.debet,
        nj.kredit,
        s.kode_skpd,
        s.kode_skpd_lkp,
        s.nama_skpd,
        a.id_skpd
    ');
    $this->db->from('aktivitas a');
    $this->db->join('jurnal j ', 'a.id_aktivitas = j.id_aktivitas ');
    $this->db->join('v_skpd s', 'a.id_skpd = s.id_skpd');
    $this->db->join('v_nominal_jurnal nj ', 'nj.id_jurnal = j.id_jurnal','left outer');
    $this->db->where('a.tahun', $this->tahun);
    $this->db->where('('.$this ->id_skpd.' = 0 or a.id_skpd = '.$this->id_skpd.')');
    $this->db->where("a.tipe = 'PB' and j.tipe = a.tipe");
  }

  /* Query form */
  function build_query_form($id=0)
  {
    $this->db->select('
        a.id_aktivitas,
        j.id_jurnal,
        a.nomor,
        a.nomor_int,
        a.tanggal,
        a.id_skpd,
        s.kode_skpd_lkp,
        s.nama_skpd,
        cast(substring(a.deskripsi from 1 for 2000) as varchar(2000)) deskripsi,
        j.keperluan,
        j.beban,
        nj.debet as nominal
    ');
    $this->db->from('aktivitas a');
    $this->db->join('v_skpd s', 's.id_skpd = a.id_skpd');
    $this->db->join('jurnal j', 'j.id_aktivitas = a.id_aktivitas');
    $this->db->join('v_nominal_jurnal nj', 'j.id_jurnal = nj.id_jurnal');
    $this->db->where('a.id_aktivitas', $id);
  }

  function build_query_hapus($id=0)
  {
    $this->db->where("id_jurnal = (select first 1 j.id_jurnal from jurnal j where j.id_aktivitas = '".$id."')")->delete('rincian_jurnal');
    $this->check_trans_status('delete rincian_jurnal failed');
    $this->db->where('id_aktivitas', $id)->delete('jurnal');
    $this->check_trans_status('delete jurnal failed');
    $this->db->where('id_aktivitas', $id)->delete('aktivitas');
    $this->check_trans_status('delete aktivitas failed');
  }

  /* Query rincian Permindahbukuan */
  function get_rinci_by_id($id)
  {
    $this->db->select('
        rj.id_jurnal,
        rj.id_rincian_jurnal,
        rj.id_rekening,
        rj.id_kegiatan,
        k.kode_kegiatan_skpd,
        k.nama_kegiatan,
        rj.kode_rekening,
        rj.nama_rekening,
        rj.debet,
        rj.kredit
    ');

    $this->db->from('aktivitas a');
    $this->db->join('jurnal j', 'j.id_aktivitas = a.id_aktivitas');
    $this->db->join('rincian_jurnal rj', 'rj.id_jurnal = j.id_jurnal ');
    $this->db->join('v_kegiatan_skpd k', 'k.id_skpd = j.id_skpd and k.id_kegiatan = rj.id_kegiatan', 'left');
    $this->db->where('a.id_aktivitas', $id);
    $this->db->order_by('rj.kode_rekening');
    $result = $this->db->get()->result_array();

    return $result;
  }

  function get_sisa_kas_bank($param)
  {
    $this->db->select("coalesce(a.nominal, 0) nominal");
    $this->db->from("sisa_kas_bank("
            .$param['id_skpd'].", "
            .$this->tahun.", "
            ."'".$param['id_kegiatan']."', "
            ."'".$param['keperluan']."', "
            ."'".$param['beban']."', "
            ."0, "
            .$param['id'].", 0 ) a
    ");
    $result = $this->db->get()->row_array();

    return $result;
  }

}

Youez - 2016 - github.com/yon3zu
LinuXploit