<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class Cileungsi_model extends CI_Model {

    function __construct() {
        parent::__construct();
        //$this->load->library('bahasa');
        //$this->bhs = $this->bahasa->get_lang();
    }

    function get_kunjungan_debitur() {
        $data =   $this->db2->query("exec procDashboardKunjunganRawatJalanCompany ?", date('Y'));
        return $data;
    }

    function get_pendapatan_debitur() {
        $data =   $this->db2->query("exec procDashboardPendapatanRawatJalanCompany ?", date('Y'));
        return $data;
    }

    function get_get_kunjungan_poliklinik() {
        $data =   $this->db2->query("exec procDashboardKunjunganRawatJalan ?", date('Y'));
        return $data;
    }

    function get_get_pendapatan_poliklinik() {
        $data =   $this->db2->query("exec procDashboardPendapatanRawatJalan ?", date('Y'));
        return $data;
    }

    function get_kunjungan_penujang_medis() {
        $data =   $this->db2->query("exec procDashboardKunjunganPenunjang ?", date('Y'));
        return $data;
    }

    function chart_get_kunjungan_debitur() {
        $id = $this->uri->segment('3');
        $data =   $this->db2->query("exec procProcDashboardKunjunganRawatJalanCompanyByMonth ?,?", array(date('Y'), $id));
        return $data;
    }

    function chart_get_kunjungan_debitur_by_tahun($tahun) {
        $id = $this->uri->segment('3');
        $data =   $this->db2->query("exec procProcDashboardKunjunganRawatJalanCompanyByMonth ?,?", array($tahun, $id));
        return $data;
    }

    function chart_get_kunjungan_poliklinik() {
        $id = urldecode($this->uri->segment('3'));
        $data =   $this->db2->query("exec procProcDashboardKunjunganRawatJalanByMonth ?,?", array(date('Y'), $id));
        return $data;
    }

    function chart_get_kunjungan_poliklinik_by_tahun($tahun) {
        $id = urldecode($this->uri->segment('3'));
        $data =   $this->db2->query("exec procProcDashboardKunjunganRawatJalanByMonth ?,?", array($tahun, $id));
        return $data;
    }

    function chart_get_kunjungan_penujang_medis() {
        $id = urldecode($this->uri->segment('3'));
        $data =   $this->db2->query("exec procProcDashboardKunjunganPenunjangByMonth ?,?", array(date('Y'), $id));
        return $data;
    }

    function chart_get_kunjungan_penujang_medis_by_tahun($tahun) {
        $id = urldecode($this->uri->segment('3'));
        $data =   $this->db2->query("exec procProcDashboardKunjunganPenunjangByMonth ?,?", array($tahun, $id));
        return $data;
    }

    function get_barberjohnson() {
        $data =   $this->db2->query("exec procDashboardBarberJohnson ?", date('Y'));
        return $data;
    }

     function chart_get_barberjohnson() {
        $id = urldecode($this->uri->segment('3'));
        if($id == 'Bed Occupancy Rate'){
            $data =   $this->db2->query("exec procDashboardBorDetail ?", date('Y'));
        }
        else if($id == 'Average Lenght Of Stay'){
            $data =   $this->db2->query("exec procDashboardAVLOSDetail ?", date('Y'));
        }
        else if($id == 'Turn Over Interval'){
            $data =   $this->db2->query("exec procDashboardTOIDetail ?", date('Y'));
        }
        else if($id == 'Bed Turn Over'){
            $data =   $this->db2->query("exec procDashboardBTODetail ?", date('Y'));
        }else{
            $data = 'Data Tidak DiTemukan !';
        }

        return $data;
    }

    function chart_get_barberjohnson_by_tahun($tahun) {
        $id = urldecode($this->uri->segment('3'));
        if($id == 'Bed Occupancy Rate'){
            $data =   $this->db2->query("exec procDashboardBorDetail ?", $tahun);
        }
        else if($id == 'Average Lenght Of Stay'){
            $data =   $this->db2->query("exec procDashboardAVLOSDetail ?", $tahun);
        }
        else if($id == 'Turn Over Interval'){
            $data =   $this->db2->query("exec procDashboardTOIDetail ?", $tahun);
        }
        else if($id == 'Bed Turn Over'){
            $data =   $this->db2->query("exec procDashboardBTODetail ?", $tahun);
        }else{
            $data = 'Data Tidak DiTemukan !';
        }

        return $data;
    }

    function view_thamrin(){
       return $this->db2->query('select NamaPerusahaan from Utama');
    }

   }