<?php

class Lp_ppi extends CI_Controller {
    
//-----------start variables for check action access----------//
    public $vartambah   = null;
    public $varedit     = null;
    public $vardelete   = null;
    public $varview     = null;

    public $parent      = 'PPI';
    public $title       = 'PPI';
    public $link        = 'Lp_ppi';
    public $index       = 'index.php/Lp_ppi';
    public $maincontent = 'ppi/laporan/';
    public $maincontentcc= 'ppi/cucitangan/';
    public $maincontentapd= 'ppi/apd/';
    public $idmenu      = '7';

//-----------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/ps_login');
        }
//--------------start check access this form page-------------//
        $this->db->where('am_fk_rolegroup_id', $this->session->userdata('s_IDRoleGroup'));
        $this->db->where('am_fk_menu_id', $this->idmenu);
        $this->db->where('am_access', 1);
        $cekMenu = $this->db->get('access_menu');
        $rowcount = $cekMenu->num_rows();
        if($rowcount==0){
            redirect('index.php');
        }else{
            foreach ($cekMenu->result() as $cm)
                {
                    $this->vartambah= $cm->am_create;
                    $this->varedit  = $cm->am_edit;
                    $this->vardelete= $cm->am_delete;
                    $this->varview  = $cm->am_view;
                }
        }
//--------------end check access this form page-------------//
    }

//----------------------------------------------------------------PLEBITIS
    public function plebitis(){
        $data['title']          = "PLEBITIS";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."v_plebitis";
        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;
        
        $this->load->model('m_drts_lp_ppi');
        $plebitis = $this->m_drts_lp_ppi->plebitis();
        $this->load->vars('plb', $plebitis);

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->view('includes/template', $data);
    }

//----------------------------------------------------------------VAP
    public function vap(){
        $data['title']          = "VAP";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."v_vap";
        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;
        
        $this->load->model('m_drts_lp_ppi');
        $vap = $this->m_drts_lp_ppi->vap();
        $this->load->vars('vap', $vap);

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->view('includes/template', $data);
    }

//----------------------------------------------------------------HAP
    public function hap(){
        $data['title']          = "HAP";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."v_hap";
        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;
        
        $this->load->model('m_drts_lp_ppi');
        $hap = $this->m_drts_lp_ppi->hap();
        $this->load->vars('hap', $hap);

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->view('includes/template', $data);
    }

    //----------------------------------------------------------------IADANAK
    public function iadanak(){
        $data['title']          = "IAD ANAK";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."v_iadanak";
        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;
        
        $this->load->model('m_drts_lp_ppi');
        $iadanak = $this->m_drts_lp_ppi->iadanak();
        $this->load->vars('iadanak', $iadanak);

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->view('includes/template', $data);
    }

    //----------------------------------------------------------------IADDEWASA
    public function iaddewasa(){
        $data['title']          = "IAD DEWASA";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."v_iaddewasa";
        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;
        
        $this->load->model('m_drts_lp_ppi');
        $iaddewasa = $this->m_drts_lp_ppi->iaddewasa();
        $this->load->vars('iaddewasa', $iaddewasa);

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->view('includes/template', $data);
    }

//----------------------------------------------------------------ISKANAK
    public function iskanak(){
        $data['title']          = "ISK ANAK";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."v_iskanak";
        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;
        
        $this->load->model('m_drts_lp_ppi');
        $iskanak = $this->m_drts_lp_ppi->iskanak();
        $this->load->vars('iskanak', $iskanak);

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->view('includes/template', $data);
    }

//----------------------------------------------------------------ISKDEWASA
    public function iskdewasa(){
        $data['title']          = "ISK DEWASA";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."v_iskdewasa";
        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;
        
        $this->load->model('m_drts_lp_ppi');
        $iskdewasa = $this->m_drts_lp_ppi->iskdewasa();
        $this->load->vars('iskdewasa', $iskdewasa);

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->view('includes/template', $data);
    }

//----------------------------------------------------------------IDOBERSIH
    public function idobersih(){
        $data['title']          = "IDO BERSIH";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."v_idobersih";
        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;
        
        $this->load->model('m_drts_lp_ppi');
        $idobersih = $this->m_drts_lp_ppi->idobersih();
        $this->load->vars('idobersih', $idobersih);

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->view('includes/template', $data);
    }

//----------------------------------------------------------------IDOTERKONTAMINASI
    public function idoterkontaminasi(){
        $data['title']          = "IDO TERKONTAMINASI";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."v_idoterkontaminasi";
        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;
        
        $this->load->model('m_drts_lp_ppi');
        $idoterkontaminasi = $this->m_drts_lp_ppi->idoterkontaminasi();
        $this->load->vars('idoterkontaminasi', $idoterkontaminasi);

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->view('includes/template', $data);
    }

//----------------------------------------------------------------PASIEN PPI
    public function pasien_ppi(){
        $data['title']          = "PASIEN PPI";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."v_pasien_ppi";
        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->model('m_drts_lp_ppi');
        $plebitis = $this->m_drts_lp_ppi->plebitis();
        $this->load->vars('plb', $plebitis);

        $this->load->model('m_drts_lp_ppi');
        $mp = $this->m_drts_lp_ppi->medisplebitis();
        $this->load->vars('mplb', $mp);

        $this->load->model('m_drts_lp_ppi');
        $vap = $this->m_drts_lp_ppi->vap();
        $this->load->vars('vap', $vap);

        $this->load->model('m_drts_lp_ppi');
        $mv = $this->m_drts_lp_ppi->medisvap();
        $this->load->vars('mvap', $mv);

        $this->load->model('m_drts_lp_ppi');
        $hap = $this->m_drts_lp_ppi->hap();
        $this->load->vars('hap', $hap);

        $this->load->model('m_drts_lp_ppi');
        $mh = $this->m_drts_lp_ppi->medishap();
        $this->load->vars('mhap', $mh);

        $this->load->model('m_drts_lp_ppi');
        $iadanak = $this->m_drts_lp_ppi->iadanak();
        $this->load->vars('iadanak', $iadanak);

        $this->load->model('m_drts_lp_ppi');
        $miadanak = $this->m_drts_lp_ppi->medisiadanak();
        $this->load->vars('miadanak', $miadanak);

        $this->load->model('m_drts_lp_ppi');
        $iaddewasa = $this->m_drts_lp_ppi->iaddewasa();
        $this->load->vars('iaddewasa', $iaddewasa);

        $this->load->model('m_drts_lp_ppi');
        $miaddewasa = $this->m_drts_lp_ppi->medisiaddewasa();
        $this->load->vars('miaddewasa', $miaddewasa);

        $this->load->model('m_drts_lp_ppi');
        $iskanak = $this->m_drts_lp_ppi->iskanak();
        $this->load->vars('iskanak', $iskanak);

        $this->load->model('m_drts_lp_ppi');
        $miskanak = $this->m_drts_lp_ppi->medisiskanak();
        $this->load->vars('miskanak', $miskanak);

        $this->load->model('m_drts_lp_ppi');
        $iskdewasa = $this->m_drts_lp_ppi->iskdewasa();
        $this->load->vars('iskdewasa', $iskdewasa);

        $this->load->model('m_drts_lp_ppi');
        $miskdewasa = $this->m_drts_lp_ppi->medisiskdewasa();
        $this->load->vars('miskdewasa', $miskdewasa);

        $this->load->model('m_drts_lp_ppi');
        $idobersih = $this->m_drts_lp_ppi->idobersih();
        $this->load->vars('idobersih', $idobersih);

        $this->load->model('m_drts_lp_ppi');
        $mido = $this->m_drts_lp_ppi->medisidobersih();
        $this->load->vars('mido', $mido);

        $this->load->model('m_drts_lp_ppi');
        $idoterkontaminasi = $this->m_drts_lp_ppi->idoterkontaminasi();
        $this->load->vars('idoterkontaminasi', $idoterkontaminasi);

        $this->load->model('m_drts_lp_ppi');
        $midot = $this->m_drts_lp_ppi->medisidoterkontaminasi();
        $this->load->vars('midot', $midot);

        $this->load->view('includes/template', $data);
    }
//----------------------------------------------------------------RUANG PPI
    public function ruang_ppi(){
        $data['title']          = "RUANG PPI";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."v_ruang_ppi";

        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }

        $data['awal']       = $awal;
        $data['akhir']      = $akhir;

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->model('m_drts_lp_ppi');
        $plebitis = $this->m_drts_lp_ppi->plebitis();
        $this->load->vars('plb', $plebitis);

        $this->load->model('m_drts_lp_ppi');
        $mp = $this->m_drts_lp_ppi->medisplebitis();
        $this->load->vars('mplb', $mp);

        $this->load->model('m_drts_lp_ppi');
        $vap = $this->m_drts_lp_ppi->vap();
        $this->load->vars('vap', $vap);

        $this->load->model('m_drts_lp_ppi');
        $mv = $this->m_drts_lp_ppi->medisvap();
        $this->load->vars('mvap', $mv);

        $this->load->model('m_drts_lp_ppi');
        $hap = $this->m_drts_lp_ppi->hap();
        $this->load->vars('hap', $hap);

        $this->load->model('m_drts_lp_ppi');
        $mh = $this->m_drts_lp_ppi->medishap();
        $this->load->vars('mhap', $mh);

        $this->load->model('m_drts_lp_ppi');
        $iadanak = $this->m_drts_lp_ppi->iadanak();
        $this->load->vars('iadanak', $iadanak);

        $this->load->model('m_drts_lp_ppi');
        $miadanak = $this->m_drts_lp_ppi->medisiadanak();
        $this->load->vars('miadanak', $miadanak);

        $this->load->model('m_drts_lp_ppi');
        $iaddewasa = $this->m_drts_lp_ppi->iaddewasa();
        $this->load->vars('iaddewasa', $iaddewasa);

        $this->load->model('m_drts_lp_ppi');
        $miaddewasa = $this->m_drts_lp_ppi->medisiaddewasa();
        $this->load->vars('miaddewasa', $miaddewasa);

        $this->load->model('m_drts_lp_ppi');
        $iskanak = $this->m_drts_lp_ppi->iskanak();
        $this->load->vars('iskanak', $iskanak);

        $this->load->model('m_drts_lp_ppi');
        $miskanak = $this->m_drts_lp_ppi->medisiskanak();
        $this->load->vars('miskanak', $miskanak);

        $this->load->model('m_drts_lp_ppi');
        $iskdewasa = $this->m_drts_lp_ppi->iskdewasa();
        $this->load->vars('iskdewasa', $iskdewasa);

        $this->load->model('m_drts_lp_ppi');
        $miskdewasa = $this->m_drts_lp_ppi->medisiskdewasa();
        $this->load->vars('miskdewasa', $miskdewasa);

        $this->load->model('m_drts_lp_ppi');
        $idobersih = $this->m_drts_lp_ppi->idobersih();
        $this->load->vars('idobersih', $idobersih);

        $this->load->model('m_drts_lp_ppi');
        $mido = $this->m_drts_lp_ppi->medisidobersih();
        $this->load->vars('mido', $mido);

        $this->load->model('m_drts_lp_ppi');
        $idoterkontaminasi = $this->m_drts_lp_ppi->idoterkontaminasi();
        $this->load->vars('idoterkontaminasi', $idoterkontaminasi);

        $this->load->model('m_drts_lp_ppi');
        $midot = $this->m_drts_lp_ppi->medisidoterkontaminasi();
        $this->load->vars('midot', $midot);

        $this->load->view('includes/template', $data);
    }

    //----------------------------------------------------------------CUCI TANGAN PPI
    public function cuci_tangan(){
        $data['title']          = "CUCI TANGAN";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontentcc."v_cuci_tangan";

        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;

        $this->load->model('m_drts_lp_ppi');
        $cc = $this->m_drts_lp_ppi->cucitangan();
        $this->load->vars('cc', $cc);

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->view('includes/template', $data);
    }

    public function detail_cuci_tangan(){
        $data['title']          = "DETAIL CUCI TANGAN";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontentcc."v_detail_cuci_tangan";

        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;

        $this->load->model('m_drts_lp_ppi');
        $cc = $this->m_drts_lp_ppi->cucitangan();
        $this->load->vars('cc', $cc);

        $this->load->view('includes/template', $data);
        
    }

    //----------------------------------------------------------------APD PPI
    public function apd(){
        $data['title']          = "APD";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontentapd."v_apd";

        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;

        $this->load->model('m_drts_lp_ppi');
        $apd = $this->m_drts_lp_ppi->apd();
        $this->load->vars('apd', $apd);

        $this->load->model('m_drts_lp_ppi');
        $rua = $this->m_drts_lp_ppi->ruang();
        $this->load->vars('rua', $rua);

        $this->load->view('includes/template', $data);
    }

    public function detail_apd(){
        $data['title']          = "DETAIL APD";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontentapd."v_detail_apd";

        if(isset($_POST['tanggalmonitoring'])) {
            $dateall    = $this->input->post('tanggalmonitoring');
            $pisah      = explode ("-", $dateall);
            $awal       = date("Y-m-d", strtotime($pisah[0]));
            $akhir      = date("Y-m-d", strtotime($pisah[1]));
        }else{
            $awal       = date("Y-m-d");
            $akhir      = date("Y-m-d");
        }
        $data['awal']       = $awal;
        $data['akhir']      = $akhir;

        $this->load->model('m_drts_lp_ppi');
        $apd = $this->m_drts_lp_ppi->apd();
        $this->load->vars('apd', $apd);

        $this->load->view('includes/template', $data);
    }
}

?>