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

class Cases extends CI_Controller
{
    // CONSTRUCT
    public function __construct()
    {
        parent::__construct();
        $this->load->helper('form');
        $this->load->library('form_validation');
        $this->load->model('M_user');
        $this->load->model('M_Pendaftaran');
		$this->load->model('M_anamnesa');
        $this->load->helper('url');

        if (!$this->session->userdata('username')) {
            redirect('login');
        }
    }

	public function list()
	{
        $data['judul'] = "Klinik";
        $data['user'] = $this->M_user->getUserSession()->row_array();
		$data['cases'] = $this->M_Pendaftaran->list()->result_array();
		$this->load->view('properti/header', $data);
		$this->load->view('properti/menu', $data);
		$this->load->view('pendaftaran/listpendaftaran', $data);
		$this->load->view('properti/footer', $data);
	}

    public function kunjungan()
	{
		extract($_GET);
		// ---------------------------------------------------------------------
        $data['judul'] = "Klinik";
        $data['user'] = $this->M_user->getUserSession()->row_array();
		// ---------------------------------------------------------------------
		$data['case'] = $this->db->query("SELECT * FROM Cases c, Company o, Doctor d WHERE c.DoctIncharge=d.DoctorID AND c.CompanyCode=o.CompanyCode AND [Case ID] = '$src'")->result_array();
		$this->load->view('properti/header', $data);
		$this->load->view('properti/menu', $data);
		$this->load->view('pendaftaran/filter', $data);
		$this->load->view('properti/footer', $data);
	}

	public function nomr()
	{
		extract($_GET);
		// ---------------------------------------------------------------------
		$data['judul'] = "Klinik";
        $data['user'] = $this->M_user->getUserSession()->row_array();
		// ---------------------------------------------------------------------
		$data['case'] = $this->db->query("SELECT * FROM Cases c, Company o, Doctor d WHERE c.DoctIncharge=d.DoctorID AND c.CompanyCode=o.CompanyCode AND [PatientCode] = '$src'")->result_array();
		$this->load->view('properti/header', $data);
		$this->load->view('properti/menu', $data);
		$this->load->view('pendaftaran/filter', $data);
		$this->load->view('properti/footer', $data);
	}

	public function nosep()
	{
		extract($_GET);
		// ---------------------------------------------------------------------
		$data['judul'] = "Klinik";
        $data['user'] = $this->M_user->getUserSession()->row_array();
		// ---------------------------------------------------------------------
		$data['case'] = $this->db->query("SELECT * FROM Cases c, Company o, Doctor d WHERE c.DoctIncharge=d.DoctorID AND c.CompanyCode=o.CompanyCode AND [NoSEP] = '$src'")->result_array();
		$this->load->view('properti/header', $data);
		$this->load->view('properti/menu', $data);
		$this->load->view('pendaftaran/filter', $data);
		$this->load->view('properti/footer', $data);
	}

	public function status()
	{
		extract($_GET);
		// ---------------------------------------------------------------------
		$data['judul'] = "Klinik";
        $data['user'] = $this->M_user->getUserSession()->row_array();
		// ---------------------------------------------------------------------
		$data['case'] = $this->db->query("SELECT * FROM Cases c, Company o, Doctor d WHERE c.DoctIncharge=d.DoctorID AND c.CompanyCode=o.CompanyCode AND [Case Status] = '$src' AND [Intake Date] = '$tgl'")->result_array();
		$this->load->view('properti/header', $data);
		$this->load->view('properti/menu', $data);
		$this->load->view('pendaftaran/filter', $data);
		$this->load->view('properti/footer', $data);
	}

	public function tanggal()
	{
		extract($_GET);
		// ---------------------------------------------------------------------
		$data['judul'] = "Klinik";
        $data['user'] = $this->M_user->getUserSession()->row_array();
		// ---------------------------------------------------------------------
		$data['case'] = $this->db->query("SELECT * FROM Cases c, Company o, Doctor d WHERE c.DoctIncharge=d.DoctorID AND c.CompanyCode=o.CompanyCode AND [Intake Date] = '$src'")->result_array();
		$this->load->view('properti/header', $data);
		$this->load->view('properti/menu', $data);
		$this->load->view('pendaftaran/filter', $data);
		$this->load->view('properti/footer', $data);
	}

	public function nomranamesa()
	{
		extract($_GET);
		// ---------------------------------------------------------------------
		$data['judul'] = "Klinik";
        $data['user'] = $this->M_user->getUserSession()->row_array();
		// ---------------------------------------------------------------------
		$data['pasien'] = $this->M_anamnesa->pasienmr($src)->result_array();
		$this->load->view('properti/header', $data);
		$this->load->view('properti/menu', $data);
		$this->load->view('anamnesa/pasien', $data);
		$this->load->view('properti/footer', $data);
	}

	public function tglanamesa()
	{
		extract($_GET);
		// ---------------------------------------------------------------------
		$data['judul'] = "Klinik";
        $data['user'] = $this->M_user->getUserSession()->row_array();
		// ---------------------------------------------------------------------
		$data['pasien'] = $this->M_anamnesa->pasientgl($tgl)->result_array();
		$this->load->view('properti/header', $data);
		$this->load->view('properti/menu', $data);
		$this->load->view('anamnesa/pasien', $data);
		$this->load->view('properti/footer', $data);
	}

	public function nomrpelayanan()
	{
		extract($_GET);
		// ---------------------------------------------------------------------
		$data['judul'] = "Klinik";
        $data['user'] = $this->M_user->getUserSession()->row_array();
		// ---------------------------------------------------------------------
		$data['pasien'] = $this->M_Pendaftaran->pasienmr($src)->result_array();
		$this->load->view('properti/header', $data);
		$this->load->view('properti/menu', $data);
		$this->load->view('rekamMedis/pasien', $data);
		$this->load->view('properti/footer', $data);
	}

	public function tglpelayanan()
	{
		extract($_GET);
		// ---------------------------------------------------------------------
		$data['judul'] = "Klinik";
        $data['user'] = $this->M_user->getUserSession()->row_array();
		// ---------------------------------------------------------------------
		$data['pasien'] = $this->M_Pendaftaran->pasientglpelayanan($tgl)->result_array();
		$this->load->view('properti/header', $data);
		$this->load->view('properti/menu', $data);
		$this->load->view('rekamMedis/pasien', $data);
		$this->load->view('properti/footer', $data);
	}



}
?>