<?php

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

    public $parent      = 'SIMRS';
    public $title       = 'REPORT';
    public $link        = 'Lp_simrs_report';
    public $index       = 'index.php/Lp_simrs_report';
    public $maincontent = 'simrs/report/';
    public $idmenu      = '27';

//-----------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 labmikro(){
        $data['title']          = "SIMRS - REPORT MIKRO";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/labmikro/v_lab_mikro";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $labmikroall = $this->m_simrs_report_lp->labmikroall();
        $this->load->vars('labmikroall', $labmikroall);

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

    public function klaimlabmikro(){
        $data['title']          = "SIMRS - REPORT KLAIM MIKRO";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/labmikro/v_klaim_labmikro";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $klaimmikro = $this->m_simrs_report_lp->klaimmikro();
        $this->load->vars('klaimmikro', $klaimmikro);

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

    public function icd9(){
        $data['title']          = "SIMRS - REPORT ICD 9 - RM";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/rm/v_icd9";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $icd9 = $this->m_simrs_report_lp->icd9();
        $this->load->vars('icd9', $icd9);

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

    public function pasienbaru(){
        $data['title']          = "SIMRS - REPORT PASIEN BARU - RM";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/pasienbaru/v_pasienbaru";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $pasienbaru = $this->m_simrs_report_lp->pasienbaru();
        $this->load->vars('pasienbaru', $pasienbaru);

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

    public function pasiendetail(){
        $data['title']          = "SIMRS - REPORT PASIEN DETAIL - RM";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/pasiendetail/v_pasiendetail";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $pasiendetail = $this->m_simrs_report_lp->pasiendetail();
        $this->load->vars('pasiendetail', $pasiendetail);

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

    public function pasiendetailranap(){
        $data['title']          = "SIMRS - REPORT PASIEN DETAIL RAWAT INAP- RM";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/pasiendetailranap/v_pasiendetailranap";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $pasiendetailranap = $this->m_simrs_report_lp->pasiendetailranap();
        $this->load->vars('pasiendetailranap', $pasiendetailranap);

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

    public function pasienikpk(){
        $data['title']          = "SIMRS - REPORT PASIEN DETAIL - IKPK";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/pasienikpk/v_pasienikpk";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $pasiendetail = $this->m_simrs_report_lp->pasienikpk();
        $this->load->vars('pasiendetail', $pasiendetail);

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

    public function pasienkeuanganrajal(){
        $data['title']          = "SIMRS - REPORT PASIEN DETAIL - KEUANGAN RAWAT JALAN";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/pasienkeuanganrajal/v_pasienkeuanganrajal";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $pasiendetail = $this->m_simrs_report_lp->pasienkeuanganrajal();
        $this->load->vars('pasiendetail', $pasiendetail);

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

    public function pasienkeuanganranap(){
        $data['title']          = "SIMRS - REPORT PASIEN DETAIL - KEUANGAN RAWAT INAP";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/pasienkeuanganranap/v_pasienkeuanganranap";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $pasiendetail = $this->m_simrs_report_lp->pasienkeuanganranap();
        $this->load->vars('pasiendetail', $pasiendetail);

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

    public function pasieniurbearanap(){
        $data['title']          = "SIMRS - REPORT PASIEN DETAIL - KEUANGAN IURBEA RAWAT INAP";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/pasieniurbearanap/v_pasieniurbearanap";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $pasiendetail = $this->m_simrs_report_lp->pasieniurbearanap();
        $this->load->vars('pasiendetail', $pasiendetail);

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

    public function rekamedikrl32(){
        $data['title']          = "SIMRS - REPORT PASIEN DETAIL - REKAMEDIK RL 3.2";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/rekamedikrl32/v_rekamedikrl32";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $datanya = $this->m_simrs_report_lp->rekamedikrl32();
        $this->load->vars('datanya', $datanya);

        $this->load->model('m_simrs_report_lp');
        $datjum = $this->m_simrs_report_lp->jmlhariperawatan();
        $this->load->vars('datjum', $datjum);

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

    public function penggunareseprajal(){
        $data['title']          = "SIMRS - REPORT PENGGUNA RESEP RAJAL";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/penggunaresep/v_penggunareseprajal";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $dataklinik = $this->m_simrs_report_lp->ruangklinik();
        $this->load->vars('dataklinik', $dataklinik);

        $this->load->model('m_simrs_report_lp');
        $datanya = $this->m_simrs_report_lp->penggunareseprajal();
        $this->load->vars('datanya', $datanya);

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

    public function disposedokigd(){
        $data['title']          = "SIMRS - REPORT PENGGUNA RESEP RAJAL";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/disposedokigd/v_disposedokigd";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $datanya = $this->m_simrs_report_lp->disposedokigd();
        $this->load->vars('datanya', $datanya);

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

    public function obatkeluarrajal(){
        $data['title']          = "SIMRS - REPORT RESEP KELUAR RAJAL";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/obatkeluar/v_obatkeluarrajal";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $datarajal = $this->m_simrs_report_lp->farmasirajal();
        $this->load->vars('datarajal', $datarajal);

        $this->load->model('m_simrs_report_lp');
        $dataobat = $this->m_simrs_report_lp->dataobat();
        $this->load->vars('dataobat', $dataobat);

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

    public function obatkeluarranap(){
        $data['title']          = "SIMRS - REPORT RESEP KELUAR RANAP";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/obatkeluar/v_obatkeluarranap";
        if(isset($_POST['tanggal'])) {
            $dateall    = $this->input->post('tanggal');
            $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_simrs_report_lp');
        $dataranap = $this->m_simrs_report_lp->farmasiranap();
        $this->load->vars('dataranap', $dataranap);

        $this->load->model('m_simrs_report_lp');
        $dataobat = $this->m_simrs_report_lp->dataobat();
        $this->load->vars('dataobat', $dataobat);

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

?>