Membuat Antrian PTSP part 4 cetak antrian sidang

Bismillahirrahmanirrahim,

***UPDATE***

sebelum lanjut harus diupdate dulu code pada views  v_antrian_depan.php (application/tray_app/antrian_depan/views).

<?php 
  $fav = $this->db->query("SELECT gambar FROM tbl_pengaturan WHERE id = 7")->row()->gambar;
  $sistem = $this->db->query("SELECT * FROM tbl_pengaturan WHERE id = 14")->row();
  $instansi = $this->db->query("SELECT * FROM tbl_pengaturan WHERE id = 11")->row();
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title><?php echo $sistem->judul.' | '.$sistem->deskripsi;?></title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!--=================================================================-->
  <link rel="icon" type="image/png" href="<?php echo base_url('img/'.$fav);?>"/>
<!--=================================================================-->
  <link rel="stylesheet" href="<?php echo base_url('bootstrap4/css/bootstrap.min.css');?>">
  <link rel="stylesheet" href="<?php echo base_url();?>bower_components/font-awesome/css/font-awesome.min.css">
  <script src="<?php echo base_url('bootstrap4/js/jquery.min.js')?>"></script>
  <script src="<?php echo base_url('bootstrap4/js/bootstrap.min.js');?>"></script>

</head>
<body>
<div class="container">
<h1 align="center">SELAMAT DATANG DI PTSP<br/>
<?php echo strtoupper($instansi->keterangan);?></h1>
<hr/>
<div class="row" style="text-align: center;">
  <form class="col-md alert btn-info" action="<?php echo $link_informasi;?>" method="POST">
  <input type="hidden" name="ad_jenis_id" value="1">
  <button type="submit" class="col-md alert btn-lg btn-info" style="height: 270px;color:white;">
    <b style="font-size:30px;">MEJA<br/>INFORMASI</b><br/><br/>
    <i class="fa fa-info-circle" style="font-size:40px;"></i><br/><br/>
    <div class="btn btn-lg btn-block btn-danger">AMBIL ANTRIAN</div>
  </button>
  </form>
  <form class="col-md alert btn-success" action="<?php echo $link_pendaftaran;?>" method="POST">
  <input type="hidden" name="ad_jenis_id" value="2">
  <button class="col-md alert btn-lg btn-success" style="height: 270px;color:white;">
    <b style="font-size:30px;">PENDAFTARAN<br/>PERKARA</b><br/><br/>
    <i class="fa fa-book" style="font-size:40px;"></i><br/><br/>
    <div class="btn btn-lg btn-block btn-warning" style="color:white;">AMBIL ANTRIAN</div>
  </button>
  </form>
  <form class="col-md alert btn-warning" action="<?php echo $link_produk;?>" method="POST">
  <input type="hidden" name="ad_jenis_id" value="3">
  <button class="col-md alert btn-lg btn-warning" style="height: 270px;color:white;">
    <b style="font-size:30px;">PRODUK<br/>PENGADILAN</b><br/><br/>
    <i class="fa fa-file" style="font-size:40px;"></i><br/><br/>
    <div class="btn btn-lg btn-block btn-success">AMBIL ANTRIAN</div>
  </button>
  </form>
  <form class="col-md alert btn-danger" action="<?php echo $link_pengaduan;?>" method="POST">
  <input type="hidden" name="ad_jenis_id" value="4">
  <button class="col-md alert btn-lg btn-danger" style="height: 270px;color:white;">
    <b style="font-size:30px;">LAYANAN<br/>PENGADUAN</b><br/><br/>
    <i class="fa fa-ticket" style="font-size:40px;"></i><br/><br/>
    <div class="btn btn-lg btn-block btn-info">AMBIL ANTRIAN</div>
  </button>
  </form>
  <button class="col-md alert btn-lg btn-primary" style="height: 220px;color:white;" data-toggle="modal" data-target="#myModal">
    <b style="font-size:30px;">JADWAL SIDANG</b><br/><br/>
    <i class="fa fa-calendar" style="font-size:40px;"></i><br/><br/>
    <a href="#" class="btn btn-lg btn-block btn-danger">AMBIL ANTRIAN</a>
  </button>
</div>
<hr/>
</div> <!-- end container -->
</body>
</html>

<!-- The Modal -->
<div class="modal" id="myModal">
  <div class="container">
    <div class="modal-content">

      <!-- Modal Header -->
      <div class="modal-header">
        <h4 class="modal-title">JADWAL SIDANG <?php echo strtoupper($instansi->keterangan);?></h4>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>

      <!-- Modal body -->
      <div class="modal-body">
        <div class="row">
        	<?php foreach($jadwal_sidang as $js){ ?>
        	<?php if(empty($js->ad_nomor_panggil) OR $js->ad_nomor_panggil == ''){ ?>
        	<form class="col-md" action="<?php echo $link_sidang;?>" method="POST">
        		<input type="hidden" name="ad_jenis_id" value="5">
        <input type="hidden" name="ad_nomor_perkara" value="<?php echo $js->nomor_perkara; ?>">
        		<input type="hidden" name="ad_ruangan" value="<?php echo $js->ruangan;?>">
        		<button type="submit" class="alert btn-info" style="width: 100%;height: 200px;">
        			<b>ANTRIAN SIDANG</b><br/>Nomor Perkara<br/>
        			<b><?php echo $js->nomor_perkara; ?></b><br/>
        			<i><?php echo $js->pihak1_text; ?><br/>
        			<?php echo $js->pihak2_text; ?></i><br/>
        			<span style="font-size: 10px;">Ruang Sidang : <?php if(empty($js->ruangan)){echo '1';}else{echo $js->ruangan;}?></span>
        		</button>
        	</form>
        	<?php }else{ ?>
        	<div class="col-md" action="" method="POST">
        		<input type="hidden" name="ad_jenis_id" value="5">
        <input type="hidden" name="ad_nomor_perkara" value="<?php echo $js->nomor_perkara; ?>">
        		<input type="hidden" name="ad_ruangan" value="<?php echo $js->ruangan;?>">
        		<button type="submit" class="alert btn-default" style="width: 100%;height: 200px;">
        			<b>NOMOR <?php echo $js->ad_nomor_panggil;?></b><br/><?php echo date('d-m-Y H:i:s',strtotime($js->ad_tgl));?><br/>
        			<b><?php echo $js->nomor_perkara; ?></b><br/>
        			<i><?php echo $js->pihak1_text; ?><br/>
        			<?php echo $js->pihak2_text; ?></i><br/>
        			<span style="font-size: 10px;">Ruang Sidang : <?php if(empty($js->ruangan)){echo '1';}else{echo $js->ruangan;}?></span>
        		</button>
        	</div>
        	<?php } ?>
        <?php } ?>
        </div>
      </div>

      <!-- Modal footer -->
      <div class="modal-footer">
        <button type="button" class="btn btn-danger" data-dismiss="modal">Kembali</button>
      </div>

    </div>
  </div>
</div>

dari code diatas terlihat ada penambahan JS

<script src=”<?php echo base_url(‘bootstrap4/js/jquery.min.js’)?>”></script>
<script src=”<?php echo base_url(‘bootstrap4/js/bootstrap.min.js’);?>”></script>

untuk js bootstraps sudah ada dipaketan bootstraps 4.x.x sedangkan untuk jquery.min.js  belum ada dipaketan bisa didownload secara terpisah disini 

kemudian save di dalam folder folder bootstap4/js/

pada posting kali ini akan ditambahkan menu cetak antrian baru, yaitu cetak antrian sidang, data antrian sidang diambil dari database sipp (Sistem Informasi Penelusuran Perkara), menggabungkan dua database seperti halnya pada Form Pengambilan Akta Cerai.

karena adanya penambahan antrian baru pada sistem ini, maka kita harus menambahkan field baru pada tbl_antrian_depan, untuk menampung data yang diambil dari database sipp,

field yang ditambahkan adalah ad_nomor_perkara dan ad_ruangan lihat seperti gambar dibawah ini :

Berikut Source Code yang harus di update, kita mulai dari perubahan Models, Views dan Controllers pada folder (application/tray_app/antrian_depan)

– Antrian_depan_model.php

pada script
public $db_sipp = disesuaikan dengan nama database sipp
public $db_ptsp = disesuaikan dengan nama database ptsp

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Antrian_depan_model extends CI_Model
{
    public $table   = 'tbl_antrian_depan';
    public $db_sipp = 'sipp.v_jadwal_sidang';
    public $db_ptsp = 'ptsp.tbl_antrian_depan';

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

    function get_data_cetak(){
    	return $this->db->query("SELECT * FROM tbl_antrian_depan ORDER BY ad_id DESC LIMIT 0,1")->row();
    }

    function insert($data)
    {
        $this->db->insert($this->table, $data);
    }

    function jadwal_sidang($tgl_sidang){
        $this->db->select("$this->db_sipp.*,$this->db_ptsp.*");
        $this->db->from($this->db_sipp);
        $this->db->join($this->db_ptsp,"$this->db_sipp.nomor_perkara = $this->db_ptsp.ad_nomor_perkara","LEFT");
        $this->db->where("$this->db_sipp.tanggal_sidang", $tgl_sidang);
        $this->db->group_by("$this->db_sipp.nomor_perkara");
        $this->db->ORDER_BY("$this->db_ptsp.ad_nomor_panggil","ASC");
        $this->db->ORDER_BY("$this->db_sipp.nomor_perkara","ASC");
            return $this->db->get()->result();
    }

}

Selanjutnya dengan memengupdate Controllers Antrian_depan.php menjadi ini :

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Antrian_depan extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        $this->load->model('Antrian_depan_model');
    }

    public function index()
    {
        $tgl_sidang = date('Y-m-d');
        $data = array(
           'link_informasi' => site_url('antrian_depan/informasi'),
           'link_pengaduan' => site_url('antrian_depan/pengaduan'),
           'link_pendaftaran' => site_url('antrian_depan/pendaftaran'),
           'link_produk' => site_url('antrian_depan/produk'),
           'link_sidang' => site_url('antrian_depan/jadwal_sidang'),
           'jadwal_sidang' =>  $this->Antrian_depan_model->jadwal_sidang($tgl_sidang),
        );
    $this->load->view('antrian_depan/v_antrian_depan',$data);
  }

    public function get_nomor($jenis_id){
        $tahun = date("Y");
        $bulan = date("m");
        $hari  = date("d");
        $query = $this->db->query("SELECT MAX(ad_nomor) as max_id FROM tbl_antrian_depan where YEAR(ad_tgl)='$tahun' AND MONTH(ad_tgl) = '$bulan' AND DAY(ad_tgl) = $hari AND ad_jenis_id = $jenis_id ");
        $row = $query->row_array();
        $max_id = $row['max_id'];
        $max_id1 =(int) substr($max_id,0,3);
        $nomor = $max_id1 +1;
        $maxkode = sprintf("%03s",$nomor);
        return $maxkode;
    }

    public function get_sisa_antrian($jenis_id){
        $tahun = date("Y");
        $bulan = date("m");
        $hari  = date("d");
        $query = $this->db->query("SELECT count(ad_id) as sisa FROM tbl_antrian_depan where YEAR(ad_tgl)='$tahun' AND MONTH(ad_tgl) = '$bulan' AND DAY(ad_tgl) = $hari AND ad_jenis_id = $jenis_id ");
        $sisa = $query->row()->sisa;
        return $sisa;
    }

    public function cetak_antrian(){
        $row = $this->Antrian_depan_model->get_data_cetak();
        if ($row) {
        $data = array(
            'row' => $row,
        );
        if(empty($row->ad_nomor_perkara)){
            $this->load->view('antrian_depan/v_cetak_antrian',$data);
        }else{
            $this->load->view('antrian_depan/v_cetak_antrian_sidang',$data);
        }
        
        }else{
            redirect(site_url('antrian_depan'));
        } 
    }
    
    //06-01-2019//
    public function informasi() 
    {
        $ad_jenis_id = $this->input->post('ad_jenis_id',TRUE);
        $ad_jenis_nama = 'MEJA INFORMASI';
        if (empty($ad_jenis_id) OR $ad_jenis_id == '') {
            $this->index();
        } else {
            $data = array(
        'ad_nomor' => $this->get_nomor(1),
        'ad_nomor_panggil' => 'A'.$this->get_nomor(1),
        'ad_jenis_id' => $this->input->post('ad_jenis_id',TRUE),
        'ad_jenis_nama' => $ad_jenis_nama,
        'ad_tgl' => date('Y-m-d H:i:s'),
        'ad_status' => '1',
        'ad_ke' => '',
        'ad_sisa_antrian' => $this->get_sisa_antrian(1),
        );
            $this->Antrian_depan_model->insert($data);
            redirect(site_url('antrian_depan/cetak_antrian'));
        }
    }

    public function pendaftaran() 
    {
        $ad_jenis_id = $this->input->post('ad_jenis_id',TRUE);
        $ad_jenis_nama = 'PENDAFTARAN PERKARA';
        if (empty($ad_jenis_id) OR $ad_jenis_id == '') {
            $this->index();
        } else {
            $data = array(
        'ad_nomor' => $this->get_nomor(2),
        'ad_nomor_panggil' => 'B'.$this->get_nomor(2),
        'ad_jenis_id' => $this->input->post('ad_jenis_id',TRUE),
        'ad_jenis_nama' => $ad_jenis_nama,
        'ad_tgl' => date('Y-m-d H:i:s'),
        'ad_status' => '1',
        'ad_ke' => '',
        'ad_sisa_antrian' => $this->get_sisa_antrian(2),
        );
            $this->Antrian_depan_model->insert($data);
            redirect(site_url('antrian_depan/cetak_antrian'));
        }
    }

    public function produk() 
    {
        $ad_jenis_id = $this->input->post('ad_jenis_id',TRUE);
        $ad_jenis_nama = 'PRODUK PENGADILAN';
        if (empty($ad_jenis_id) OR $ad_jenis_id == '') {
            $this->index();
        } else {
            $data = array(
        'ad_nomor' => $this->get_nomor(3),
        'ad_nomor_panggil' => 'C'.$this->get_nomor(3),
        'ad_jenis_id' => $this->input->post('ad_jenis_id',TRUE),
        'ad_jenis_nama' => $ad_jenis_nama,
        'ad_tgl' => date('Y-m-d H:i:s'),
        'ad_status' => '1',
        'ad_ke' => '',
        'ad_sisa_antrian' => $this->get_sisa_antrian(3),
        );
            $this->Antrian_depan_model->insert($data);
            redirect(site_url('antrian_depan/cetak_antrian'));
        }
    }

    public function pengaduan() 
    {
        $ad_jenis_id = $this->input->post('ad_jenis_id',TRUE);
        $ad_jenis_nama = 'LAYANAN PENGADUAN';
        if (empty($ad_jenis_id) OR $ad_jenis_id == '') {
            $this->index();
        } else {
            $data = array(
        'ad_nomor' => $this->get_nomor(4),
        'ad_nomor_panggil' => 'D'.$this->get_nomor(4),
        'ad_jenis_id' => $this->input->post('ad_jenis_id',TRUE),
        'ad_jenis_nama' => $ad_jenis_nama,
        'ad_tgl' => date('Y-m-d H:i:s'),
        'ad_status' => '1',
        'ad_ke' => '',
        'ad_sisa_antrian' => $this->get_sisa_antrian(4),
        );
            $this->Antrian_depan_model->insert($data);
            redirect(site_url('antrian_depan/cetak_antrian'));
        }
    }

    public function jadwal_sidang() 
    {
        $ad_jenis_id = $this->input->post('ad_jenis_id',TRUE);
        $ad_jenis_nama = 'ANTRIAN SIDANG';
        $ruangan = $this->input->post('ad_ruangan',TRUE);
        if(empty($ruangan) OR $ruangan == '' ){
            $ad_ruangan = '1';
        }else{
            $ad_ruangan = $this->input->post('ad_ruangan',TRUE);
        }
        if (empty($ad_jenis_id) OR $ad_jenis_id == '') {
            $this->index();
        } else {
            $data = array(
        'ad_nomor' => $this->get_nomor(5),
        'ad_nomor_panggil' => 'E'.$this->get_nomor(5),
        'ad_jenis_id' => $this->input->post('ad_jenis_id',TRUE),
        'ad_jenis_nama' => $ad_jenis_nama,
        'ad_tgl' => date('Y-m-d H:i:s'),
        'ad_status' => '1',
        'ad_ke' => '',
        'ad_nomor_perkara' => $this->input->post('ad_nomor_perkara',TRUE),
        'ad_ruangan' => $ad_ruangan,
        'ad_sisa_antrian' => $this->get_sisa_antrian(5),
        );
            $this->Antrian_depan_model->insert($data);
            redirect(site_url('antrian_depan/cetak_antrian'));
        }
    }
}

Kemudian membuat file baru di Views (application/tray_app/antrian_depan/views/) dengan nama v_cetak_antrian_sidang.php isi dengan code seperti ini :

<?php 
  $fav = $this->db->query("SELECT gambar FROM tbl_pengaturan WHERE id = 7")->row()->gambar;
  $sistem = $this->db->query("SELECT * FROM tbl_pengaturan WHERE id = 14")->row();
  $instansi = $this->db->query("SELECT * FROM tbl_pengaturan WHERE id = 11")->row();
  $link_web = $this->db->query("SELECT * FROM tbl_pengaturan WHERE id = 12")->row();

  $hari=date('D');
  if($hari=='Sun'){$hari='Minggu';}
  else if($hari=='Mon'){$hari='Senin';}
  else if($hari=='Tue'){$hari='Selasa';}
  else if($hari=='Wed'){$hari='Rabu';}
  else if($hari=='Thu'){$hari='Kamis';}
  else if($hari=='Fri'){$hari='Jum\'at';}
  else if($hari=='Sat'){$hari='Sabtu';
  }
  
  $bulan=date('m');
  if($bulan=='01'){$bulan='Januari';}
  else if($bulan=='02'){$bulan='Februari';}
  else if($bulan=='03'){$bulan='Maret';}
  else if($bulan=='04'){$bulan='April';}
  else if($bulan=='05'){$bulan='Mei';}
  else if($bulan=='06'){$bulan='Juni';}
  else if($bulan=='07'){$bulan='Juli';}
  else if($bulan=='08'){$bulan='Agustus';}
  else if($bulan=='09'){$bulan='September';}
  else if($bulan=='10'){$bulan='Oktober';}
  else if($bulan=='11'){$bulan='November';}
  else if($bulan=='12'){$bulan='Desember';}
  
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="3; url=<?php echo base_url('antrian_depan');?>">
<textarea id="printing-css" style="display:none;">.no-print{display:none}</textarea>
<iframe id="printing-frame" name="print_frame" src="about:blank" style="display:none;"></iframe>
<script type="text/javascript">
 window.focus();
 window.print();
//}
</script>
</head>
<body>
<div id="print_antrian">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<center>
<table style="width:300px;">
<tr>
<td class="text-center">
<div class="container text-center">
  <div class="row">
    <div class="col-md bg-success" style="padding:10px;text-align:center">
      <div style="font-weight:bold;font-size:20px;padding-bottom:5px;"><?php echo strtoupper($instansi->keterangan);?></div>
      <div style="border-top:1px solid gray;width: 230px;margin-left: auto;margin-right: auto;"></div>
      <div style="padding:5px;font-weight:bold;font-size:15px;"><?php echo $row->ad_jenis_nama;?></div>			
      <div style="font-size:50px;font-weight:bold;padding:5px;">
        <?php echo $row->ad_nomor_panggil;?>
      </div>			
      <div style="font-size:18px;font-weight:bold;padding:5px;">
        Nomor Perkara<br/>
        <?php echo $row->ad_nomor_perkara;?>
      </div>
      <div style="padding-top:5px;font-size:13px;">
      <span style="font-size: 10px;">Ruang Sidang : <?php if(empty($row->ruangan)){echo '1';}else{echo $row->ruangan;}?></span><br/>
      <?php echo date('d-m-Y H:i:s' ,strtotime($row->ad_tgl)); ?>
      </div>
      <div style="padding:5px;font-size:15px;font-weight:bold">
        Sisa Antrian : <?php echo $row->ad_sisa_antrian;?>
      </div>
      <div style="padding:5px;font-size:13px;"><?php echo $link_web->link;?></div>
      </div>
  </div>
</div>	
</td>
</tr>
</table>
</center>
</div>

</body>
</html>

sehingga nanti hasil akhir yang diperoleh adalah sebagai berikut :

Setelah antrian sidang dicetak, secara otomatis nomor antrian yang sudah diambil tidak bisa di klik  (diproses) lagi, terlihat warna abu-abu seperti dibawah ini

Recommended For You

About the Author: adyrhs

Leave a Reply

Your email address will not be published. Required fields are marked *