107 lines
3.8 KiB
PHP
Executable File
107 lines
3.8 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class Bills extends MX_Controller {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
$this->load->library('session');
|
|
$this->load->model('Bills_model');
|
|
$this->load->model('generate_bill/Generate_bill_model');
|
|
|
|
if (!$this->ion_auth->in_group(array('admin'))) {
|
|
if(!$this->ion_auth->coordinator_permission('bills')){
|
|
redirect('home/permission');
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public function index() {
|
|
//die;
|
|
$data = array();
|
|
$this->load->model('Bills_model');
|
|
|
|
$data['data'] = $this->Bills_model->name_list();
|
|
//echo '<pre>'; print_r($data); echo '</pre>'; exit;
|
|
$this->load->view('home/dashboard',$data); // just the header file
|
|
$this->load->view('namelist',$data);
|
|
$this->load->view('home/footer'); // just the header file
|
|
}
|
|
|
|
public function getList()
|
|
{
|
|
$this->load->model('Bills_model');
|
|
$requestData = $_REQUEST;
|
|
$start = $requestData['start'];
|
|
$limit = $requestData['length'];
|
|
|
|
$orderColumn=$requestData['order'][0]['column'];
|
|
$orderType=$requestData['order'][0]['dir'];
|
|
|
|
$search = $this->input->post('search')['value'];
|
|
|
|
if(!empty($search))
|
|
{
|
|
$data['patient_name'] = $this->Bills_model->getNameByLimitBySearch($limit, $start, $search,$orderColumn, $orderType);
|
|
}else{
|
|
$data['patient_name'] = $this->Bills_model->getNameByLimit($limit, $start, $orderColumn, $orderType);
|
|
}
|
|
|
|
|
|
$listCount = sizeof($data['patient_name']);
|
|
$slno = 1;
|
|
foreach ($data['patient_name'] as $data) {
|
|
// $options1 = '<a class="btn btn-primary" title="' . lang('Edit') .'" href="bills/getBillDetails/'. $data->id .'" ><i class="la la-edit"></i>' . lang('edit') .' </a>';
|
|
$options1 = '<a class="btn btn-primary" title="' . lang('Edit') .'" href="javascript:void(0);" ><i class="la la-edit"></i>' . lang('edit') .' </a>';
|
|
$options2 = '<a class="btn btn-primary" title="' . lang('Print') .'" href="bills/getBillDetails/'. $data->id .'" ><i class="la la-print"></i>' . lang('Print') .' </a>';
|
|
$bill_amount=$data->rate * $data->bill_units;
|
|
$info[] = array(
|
|
$slno,
|
|
$data->invoice_id,
|
|
$data->patient_name,
|
|
$bill_amount,
|
|
$options1." ".$options2
|
|
);
|
|
$slno++;
|
|
}
|
|
|
|
$csrf_name = $this->security->get_csrf_token_name();
|
|
$csrf_hash = $this->security->get_csrf_hash();
|
|
if ($listCount > 0) {
|
|
$output = array(
|
|
"draw" => intval($requestData['draw']),
|
|
"recordsTotal" => count($this->Bills_model->name_list()),
|
|
"recordsFiltered" => count($this->Bills_model->name_list()),
|
|
"data" => $info
|
|
);
|
|
}
|
|
else {
|
|
$output = array(
|
|
// "draw" => 1,
|
|
"recordsTotal" => 0,
|
|
"recordsFiltered" => 0,
|
|
"data" => []
|
|
);
|
|
$output[$csrf_name] = $csrf_hash;
|
|
}
|
|
echo json_encode($output);
|
|
}
|
|
public function getBillDetails($id) {
|
|
//echo '<pre>'; print_r($id); echo '</pre>'; exit;
|
|
$data = array();
|
|
$this->load->model('Bills_model');
|
|
|
|
$data['data'] = $this->Bills_model->bill_details($id);
|
|
$data['patient'] = $this->Generate_bill_model->getPatient($data['data']->patient_id);
|
|
//echo '<pre>'; print_r($data); echo '</pre>'; exit;
|
|
|
|
$this->load->view('billDetails',$data);
|
|
|
|
}
|
|
|
|
}
|
|
|