first commit
This commit is contained in:
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
//-------------ID loket ranap admin = 23
|
||||
|
||||
class Ps_ranap_admin extends CI_Controller {
|
||||
|
||||
//-----------start variables for check action access----------//
|
||||
public $vartambah = null;
|
||||
public $varedit = null;
|
||||
public $vardelete = null;
|
||||
public $varview = null;
|
||||
//-----------start variables for check action access----------//
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$this->check_isvalidated();
|
||||
$this->load->helper(array('form', 'date'));
|
||||
}
|
||||
private function check_isvalidated(){
|
||||
if(! $this->session->userdata('validated')){
|
||||
redirect('index.php/login');
|
||||
}
|
||||
|
||||
//--------------start check access this form page-------------//
|
||||
$this->db->where('mum_tipeuser_id', $this->session->userdata('s_FK_TipeUser'));
|
||||
$this->db->where('mum_menu_id', '23');
|
||||
$cekMenu = $this->db->get('master_user_menu');
|
||||
$rowcount = $cekMenu->num_rows();
|
||||
if($rowcount==0){
|
||||
redirect('index.php');
|
||||
}else{
|
||||
foreach ($cekMenu->result() as $cm)
|
||||
{
|
||||
$this->vartambah=$cm->mum_tambah;
|
||||
$this->varedit=$cm->mum_ubah;
|
||||
$this->vardelete=$cm->mum_hapus;
|
||||
$this->varview=$cm->mum_lihat;
|
||||
}
|
||||
}
|
||||
//--------------end check access this form page-------------//
|
||||
}
|
||||
|
||||
public function index($error = NULL) {
|
||||
$data['title'] = 'Ranap Admin';
|
||||
$data['main_content'] = 'ranap/v_ranapadmin';
|
||||
$data['error']=$error;
|
||||
|
||||
$this->load->model('m_loketranap');
|
||||
$loketranap = $this->m_loketranap->index();
|
||||
$this->load->vars('rn', $loketranap);
|
||||
|
||||
$this->load->model('m_loketranap');
|
||||
$loketsearch = $this->m_loketranap->searchloket();
|
||||
$this->load->vars('sl', $loketsearch);
|
||||
|
||||
$this->load->view('includes/template', $data);
|
||||
}
|
||||
|
||||
public function prosesadd() {
|
||||
|
||||
$no_antrian;
|
||||
$hasil_nomor = "";
|
||||
$this->db->like('ppr_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->order_by('ppr_nomor_antrian', 'ASC');
|
||||
//$this->db->where('ppr_tanggal_periksa', date("Y-m-d"));
|
||||
$query = $this->db->get('proses_pengunjung_ranap');
|
||||
foreach ($query->result() as $datpengunjung){
|
||||
$no_antrian = $datpengunjung->ppr_nomor_antrian;
|
||||
}
|
||||
|
||||
if(isset($no_antrian)){
|
||||
$hasil_nomor = $no_antrian+1;
|
||||
$nomjum = strlen($hasil_nomor);$nol="";
|
||||
if($nomjum=="1"){$nol="00";}
|
||||
elseif($nomjum=="2"){$nol="0";}
|
||||
$hasil_nomor=$nol.$hasil_nomor;
|
||||
}else {
|
||||
$hasil_nomor="001";
|
||||
}
|
||||
|
||||
$insert = array(
|
||||
'ppr_nomor_antrian' => $hasil_nomor,
|
||||
'ppr_tanggal_periksa' => date("Y-m-d H:i:s"),
|
||||
'ppr_status' => "0",
|
||||
);
|
||||
$this->db->insert('proses_pengunjung_ranap', $insert);
|
||||
$last_insert_id = $this->db->insert_id();
|
||||
|
||||
redirect('index.php/ps_ranap_admin/print_ranap/'.$last_insert_id);
|
||||
}
|
||||
|
||||
public function print_ranap($id){
|
||||
$data['title'] = 'Ranap';
|
||||
$data['main_content'] = 'print/print_ranap/print_ranap';
|
||||
|
||||
$this->load->model('m_loketranap');
|
||||
$getpas = $this->m_loketranap->datapengunjung($id);
|
||||
$this->load->vars('dp', $getpas);
|
||||
|
||||
$this->load->view('print/print_ranap/print_ranap',$data);
|
||||
}
|
||||
|
||||
public function next(){
|
||||
$pengunjung="";
|
||||
|
||||
$this->db->where('ppr_status', "0");
|
||||
$this->db->where('ppr_loket is NULL', NULL, TRUE);
|
||||
$this->db->like('ppr_tanggal_periksa', date("Y-m-d"));
|
||||
$this->db->order_by('ppr_tanggal_periksa', 'DESC');
|
||||
$query = $this->db->get('proses_pengunjung_ranap');
|
||||
foreach ($query->result() as $datpengunjung){
|
||||
$pengunjung = $datpengunjung->ppr_id;
|
||||
}
|
||||
|
||||
$update = array(
|
||||
'ppr_loket' => $this->session->userdata('s_loket'),
|
||||
'ppr_panggil' => date("Y-m-d H:i:s"),
|
||||
'ppr_callsound' => date("Y-m-d H:i:s"),
|
||||
'ppr_callstatus'=> "1",
|
||||
'ppr_status' => "1",
|
||||
);
|
||||
$this->db->where('ppr_id', $pengunjung);
|
||||
$this->db->update('proses_pengunjung_ranap', $update);
|
||||
|
||||
redirect('index.php/ps_ranap_admin');
|
||||
}
|
||||
|
||||
public function selesai($id){
|
||||
$update = array(
|
||||
'ppr_loket' => null,
|
||||
'ppr_callsound' => null,
|
||||
'ppr_status' => "3",
|
||||
);
|
||||
$this->db->where('ppr_id', $id);
|
||||
$this->db->update('proses_pengunjung_ranap', $update);
|
||||
|
||||
redirect('index.php/ps_ranap_admin');
|
||||
}
|
||||
|
||||
public function callsound($id){
|
||||
$update = array(
|
||||
//'ppr_panggil' => date("Y-m-d H:i:s"),
|
||||
'ppr_callsound' => date("Y-m-d H:i:s"),
|
||||
'ppr_callstatus'=> "1",
|
||||
);
|
||||
$this->db->where('ppr_id', $id);
|
||||
$this->db->update('proses_pengunjung_ranap', $update);
|
||||
|
||||
redirect('index.php/ps_ranap_admin');
|
||||
}
|
||||
|
||||
public function pending($id){
|
||||
$update = array(
|
||||
'ppr_loket' => null,
|
||||
'ppr_callsound' => null,
|
||||
'ppr_status' => "2",
|
||||
);
|
||||
$this->db->where('ppr_id', $id);
|
||||
$this->db->update('proses_pengunjung_ranap', $update);
|
||||
|
||||
redirect('index.php/ps_ranap_admin');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user