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

class Home extends CI_Controller {

    function __construct(){
        parent::__construct();
      
         $this->load->model('live_model');
         $this->load->helper('content');
    }

    function index(){
    	set_time_limit(0);
        ini_set('memory_limit', '1024M');

        $view['error'] = '';
        $view['content'] = 'admin/home';
        $view['data_kunjungan_rajal'] = $this->live_model->get_get_kunjungan_poliklinik()->result();
        $view['data_kunjungan_rajal_by_company'] = $this->live_model->get_kunjungan_debitur()->result();
        $view['data_kunjungan_penunjang'] = $this->live_model->get_kunjungan_penujang_medis()->result();
        $view['data_barberjohnson'] = $this->live_model->get_barberjohnson()->result();
        $view['data'] = $this->live_model->view_thamrin()->result();
        $this->load->view('admin/index', $view);
    }


    /*Debitur*/
    public function chart_kunjungan_debitur() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_kunjungan_debitur/'.$this->uri->segment('3');
        $view['title'] = 'Kunjungan Rawat Jalan Berdasarkan Penjamin - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_kunjungan_debitur()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Kunjungan Rawat Jalan Berdasarkan Penjamin - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_kunjungan_debitur_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }

    public function chart_pendapatan_debitur() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_pendapatan_debitur/'.$this->uri->segment('3');
        $view['title'] = 'Pendapatan Rawat Jalan Berdasarkan Penjamin - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_pendapatan_debitur()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Pendapatan Rawat Jalan Berdasarkan Penjamin - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_pendapatan_debitur_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }


    /*Poliklinik*/
    public function chart_kunjungan_poliklinik() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_kunjungan_poliklinik/'.$this->uri->segment('3');
        $view['title'] = 'Kunjungan Rawat Jalan Berdasarkan Poliklinik - ' .str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_kunjungan_poliklinik()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Kunjungan Rawat Jalan Berdasarkan Poliklinik - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_kunjungan_poliklinik_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }

    public function chart_pendapatan_poliklinik() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_kunjungan_poliklinik/'.$this->uri->segment('3');
        $view['title'] = 'pendapatan Rawat Jalan Berdasarkan Poliklinik - ' .str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_pendapatan_poliklinik()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'pendapatan Rawat Jalan Berdasarkan Poliklinik - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_pendapatan_poliklinik_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }



    /*Penunjang Medis*/
    public function chart_kunjungan_penunjang_medis() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_kunjungan_penunjang_medis/'.$this->uri->segment('3');
        $view['title'] = 'Kunjungan Rawat Jalan Berdasarkan Penunjang Medis - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_kunjungan_penujang_medis()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Kunjungan Rawat Jalan Berdasarkan Penunjang Medis - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_kunjungan_penujang_medis_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }

    public function chart_pendapatan_penunjang_medis() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_kunjungan_penunjang_medis/'.$this->uri->segment('3');
        $view['title'] = 'Pendapatan Rawat Jalan Berdasarkan Penunjang Medis - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_pendapatan_penujang_medis()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Pendapatan Rawat Jalan Berdasarkan Penunjang Medis - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_pendapatan_penujang_medis_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }

    /*Farmasi*/
    public function chart_kunjungan_farmasi() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_kunjungan_penunjang_medis/'.$this->uri->segment('3');
        $view['title'] = 'Kunjungan Rawat Jalan Berdasarkan Farmasi - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_kunjungan_farmasi()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Kunjungan Rawat Jalan Berdasarkan Farmasi - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_kunjungan_farmasi_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }

    public function chart_pendapatan_farmasi() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_pendapatan_penunjang_medis/'.$this->uri->segment('3');
        $view['title'] = 'Pendapatan Rawat Jalan Berdasarkan Farmasi - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_pendapatan_farmasi()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Pendapatan Rawat Jalan Berdasarkan Farmasi - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_pendapatan_farmasi_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }


    /*Bedah*/
    public function chart_kunjungan_bedah() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_kunjungan_bedah/'.$this->uri->segment('3');
        $view['title'] = 'Kunjungan Berdasarkan Tindakan Bedah - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_kunjungan_bedah()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Kunjungan Berdasarkan Tindakan Bedah - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_kunjungan_bedah_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }

    public function chart_pendapatan_bedah() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_pendapatan_bedah/'.$this->uri->segment('3');
        $view['title'] = 'Pendapatan Berdasarkan Tindakan Bedah - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_pendapatan_bedah()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Pendapatan Berdasarkan Tindakan Bedah - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_pendapatan_bedah_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }

    /*Operasi*/
    public function chart_kunjungan_operasi() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_kunjungan_bedah/'.$this->uri->segment('3');
        $view['title'] = 'Kunjungan Berdasarkan Tindakan Operasi - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_kunjungan_operasi()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Kunjungan Berdasarkan Tindakan Operasi - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_kunjungan_operasi_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }

    public function chart_pendapatan_operasi() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_pendapatan_bedah/'.$this->uri->segment('3');
        $view['title'] = 'Pendapatan Berdasarkan Tindakan Operasi - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_pendapatan_operasi()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Pendapatan Berdasarkan Tindakan Operasi - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_pendapatan_operasi_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }



    /*Indikator RS*/
    public function chart_barberjohnson() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_barberjohnson/'.$this->uri->segment('3');
        $view['title'] = 'Indikator RS - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_barberjohnson()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Indikator RS - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_barberjohnson_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }


    /*Ranap Company*/
    public function chart_kunjungan_penjamin_ranap() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_kunjungan_poliklinik/'.$this->uri->segment('3');
        $view['title'] = 'Kunjungan Rawat Inap Berdasarkan Penjamin - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_kunjungan_ranap_penjamin()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Kunjungan Rawat Inap Berdasarkan Penjamin - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_kunjungan_ranap_penjamin_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }

    public function chart_pendapatan_penjamin_ranap() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_kunjungan_poliklinik/'.$this->uri->segment('3');
        $view['title'] = 'Pendapatan Rawat Inap Berdasarkan Penjamin - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_pendapatan_ranap_penjamin()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Pendapatan Rawat Inap Berdasarkan Penjamin - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_pendapatan_ranap_penjamin_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }


    /*Tindakan Khusus*/
    public function chart_kunjungan_tindakan_khusus() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_kunjungan_tinsus/'.$this->uri->segment('3');
        $view['title'] = 'Kunjungan Tindakan Khusus - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_kunjungan_tinsus()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Kunjungan Tindakan Khusus - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_kunjungan_tinsus_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }

    public function chart_pendapatan_tindakan_khusus() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_pendapatan_tinsus/'.$this->uri->segment('3');
        $view['title'] = 'Pendapatan Tindakan Khusus - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_pendapatan_tinsus()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Pendapatan Tindakan Khusus - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_pendapatan_tinsus_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }

    /*Tindakan Intensive*/
    public function chart_kunjungan_intensive() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_kunjungan_intensive/'.$this->uri->segment('3');
        $view['title'] = 'Kunjungan Tindakan Intensive - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_kunjungan_intensive()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Kunjungan Tindakan Intensive - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
            $view['data'] = $this->live_model->chart_get_kunjungan_intensive_by_tahun($tahun)->result();
        }
        $this->load->view('admin\index', $view);
    }

    public function chart_pendapatan_intensive() {
        $view['content'] = 'chart/indikator_rs';
        $view['nama'] = $this->live_model->view_thamrin()->result();
        $view['uri'] = 'chart_pendapatan_intensive/'.$this->uri->segment('3');
        $view['title'] = 'Pendapatan Tindakan Intensive - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0);
        $view['data'] = $this->live_model->chart_get_pendapatan_intensive()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Pendapatan Tindakan Intensive - '.str_replace("%20",' ',($this->uri->segment(3))?$this->uri->segment(3):0) .$tahun;
            $view['data'] = $this->live_model->chart_get_pendapatan_intensive_by_tahun($tahun)->result();
        }
        $this->load->view('admin/index', $view);
    }


    /*public function view_thamrin(){
        $view['data'] = $this->live_model->view_thamrin()->result();
        $this->load->view('admin/index', $view);
    }*/

}
?>