<?php
class OperasiCR 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'] = 'page\bedah';
        $view['data_kunjungan_operasi'] = $this->live_model->get_kunjungan_operasi()->result();
        $view['data_pendapatan_operasi'] = $this->live_model->get_pendapatan_operasi()->result();
        $view['data'] = $this->live_model->view_thamrin()->result();
        $this->load->view('index', $view);
    }



    public function chart_kunjungan_operasi() {
        $view['content'] = 'chart/indikator_rs';
        $view['uri'] = 'chart_kunjungan_bedah/'.$this->uri->segment('3');
        $view['title'] = 'Kunjungan Berdasarkan Tindakan Bedah - '.date('Y');
        $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 Bedah - '.$tahun;
            $view['data'] = $this->live_model->chart_get_kunjungan_bedah_by_operasi($tahun)->result();
        }
        $this->load->view('bedah', $view);
    }

    public function chart_pendapatan_operasi() {
        $view['content'] = 'chart/indikator_rs';
        $view['uri'] = 'chart_kunjungan_poliklinik/'.$this->uri->segment('3');
        $view['title'] = 'Pendapatan Berdasarkan Tindakan Bedah - '.date('Y');
        $view['data'] = $this->live_model->chart_get_pendapatan_operasi()->result();
        $view['tahun'] = date('Y');
        if(isset($_POST['filter'])){
            $tahun = $_POST['tahun'];
            $view['title'] = 'Kunjungan Berdasarkan Tindakan Bedah - '.$tahun;
            $view['data'] = $this->live_model->chart_get_pendapatan_operasi_by_tahun($tahun)->result();
        }
        $this->load->view('index', $view);
    }

}
?>