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

use Brick\Money\Context\AutoContext;
use Brick\Money\CurrencyConverter;
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
use Brick\Money\ExchangeRateProvider\PDOProvider;
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
use Brick\Money\Money;

class HealthCareSheets  extends CI_Controller
{
	function __construct()
	{
		parent::__construct();

		// Load member model
		$this->load->model('pagination/HealthCareSheets_model', 'model');
	}


	function getLists()
	{
		$data = $row = array();

		// Fetch member's records
		$witData = $this->model->getRows($_POST);

		$i = $_POST['start'];
		$current_url = $_POST['currentURL'];
		foreach ($witData as $row) {
			$data[] = array($row->health_care_sheet_id , $row->type , $row->insured_id , $row->patient_lastname.' '.$row->patient_firstname, $this->lang->line($row->patient_situation),
				$row->institution_name, $row->practitioner_lastname.' '.$row->practitioner_firstname, $this->lang->line($row->care_condition), $this->lang->line($row->state), $row->created_at,
				'<a href="'.$current_url.'?history=insurance-health_care_sheets&id='.$row->health_care_sheet_id.'" class="btn btn-primary" > '.$this->lang->line('Voir plus...').'</a>');
		}

		$output = array(
			"draw" => $_POST['draw'],
			"recordsTotal" => $this->model->countAll($_POST),
			"recordsFiltered" => $this->model->countFiltered($_POST),
			"data" => $data,
		);

		// Output to JSON format
		echo json_encode($output);
	}

}
