<?php
class PoliklinikCR 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\poliklinik';

        $view['poliklinik_now']    =   $this->live_model->show_poliklinik_now();
        $view['dokter_rajal_now']    =   $this->live_model->show_dokter_rajal_now();

        $view['data_pendapatan_rajal'] = $this->live_model->get_get_pendapatan_poliklinik()->result();

        $view['data'] = $this->live_model->view_thamrin()->result();
        $this->load->view('index', $view);
    }



    function search_tanggal()
    {
        $start = $this->input->post('tanggal');
        $startformat = date("d F Y", strtotime($start));
        $finish = $this->input->post('tanggal_to');
        $finishformat = date("d F Y", strtotime($finish));
        $data['a'] = $this->input->post('tanggal');
        $data['b'] = $this->input->post('tanggal_to');

        $data['data'] = $this->live_model->view_thamrin()->result();
        $data['content'] = 'table/tbl_poliklinik';
        $data['uri'] = 'chart_kunjungan_poliklinik/'.$this->uri->segment('3');
        $data["tanggal_from"] = $startformat;
        $data["tanggal_last"] = $finishformat;
        $tanggal    =   $this->input->post('tanggal');
        $tanggal_to = $this->input->post('tanggal_to');
        $data['dokter_rajal_now']    =   $this->live_model->show_dokter_rajal_now();
        $data['results']    =   $this->live_model->show_poliklinik($tanggal,$tanggal_to);
        $this->load->view('index',$data);
    }

    function search_tanggal_dokter()
    {
        $start = $this->input->post('tanggal');
        $startformat = date("d F Y", strtotime($start));
        $finish = $this->input->post('tanggal_to');
        $finishformat = date("d F Y", strtotime($finish));
        $data['tgla'] = $this->input->post('tanggal');
        $data['tglb'] = $this->input->post('tanggal_to');

        $data['data'] = $this->live_model->view_thamrin()->result();
        $data['content'] = 'table/tbl_dokterop';
        $data['uri'] = 'dokter_poliklinik/'.$this->uri->segment('3');
        $data["tanggal_from"] = $startformat;
        $data["tanggal_last"] = $finishformat;
        $tanggal    =   $this->input->post('tanggal');
        $tanggal_to = $this->input->post('tanggal_to');
        $data['poliklinik_now']    =   $this->live_model->show_poliklinik_now();
        $data['results']    =   $this->live_model->show_dokter_rajal($tanggal,$tanggal_to);
        $this->load->view('index',$data);
    }

}
?>