<?php

class Lp_simrs_kemenkes 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       = 'KEMENKES';
    public $link        = 'Lp_simrs';
    public $index       = 'index.php/Lp_simrs_kemenkes';
    public $maincontent = 'simrs/kemenkes/';
    //public $mcicd       = 'simrs/kemenkes/billing/';
    //public $mctindakan  = 'simrs/tindakan/';
    //public $mcpx        = 'simrs/pasien/';
    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 icd(){
        $data['title']          = "KEMENKES - ICD REKAP";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/icd/v_icd_rekap";
        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_kemenkes_lp');
        $icd = $this->m_simrs_kemenkes_lp->icd();
        $this->load->vars('icd', $icd);

        $this->load->model('m_simrs_kemenkes_lp');
        $billrj = $this->m_simrs_kemenkes_lp->billingrajal();
        $this->load->vars('billrj', $billrj);

        $this->load->model('m_simrs_kemenkes_lp');
        $billbtl = $this->m_simrs_kemenkes_lp->orderbatalbillrajal();
        $this->load->vars('billbtl', $billbtl);

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

    public function tes(){
        $data['title']          = "KEMENKES - TES REKAP";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/tes/v_tes_rekap";
        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_kemenkes_lp');
        $pnj = $this->m_simrs_kemenkes_lp->billrajalpenunjang();
        $this->load->vars('pnj', $pnj);

        // $this->load->model('m_simrs_kemenkes_lp');
        // $billrj = $this->m_simrs_kemenkes_lp->billingrajal();
        // $this->load->vars('billrj', $billrj);

        // $this->load->model('m_simrs_kemenkes_lp');
        // $billbtl = $this->m_simrs_kemenkes_lp->orderbatalbillrajal();
        // $this->load->vars('billbtl', $billbtl);

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

    public function tindakan(){
        $data['title']          = "KEMENKES - TINDAKAN REKAP";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/tindakan/v_icdcm_rekap";
        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_kemenkes_lp');
        $icdcm = $this->m_simrs_kemenkes_lp->icdcm();
        $this->load->vars('icdcm', $icdcm);

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

    public function variable_klaim(){
        $data['title']          = "PASIEN IGD";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link;
        $data['main_content']   = $this->maincontent."/variableklaim/v_variable_klaim";
        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_kemenkes_lp');
        $pxigd = $this->m_simrs_kemenkes_lp->pxigd();
        $this->load->vars('pxigd', $pxigd);

        $this->load->model('m_simrs_kemenkes_lp');
        $icdcmigd = $this->m_simrs_kemenkes_lp->icdcmigd();
        $this->load->vars('icdcmigd', $icdcmigd);

        $this->load->model('m_simrs_kemenkes_lp');
        $icdigd = $this->m_simrs_kemenkes_lp->icdigd();
        $this->load->vars('icdigd', $icdigd);

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

?>