load->library('session'); $this->load->model('Generate_bill_model'); if (!$this->ion_auth->in_group(array('admin'))) { if(!$this->ion_auth->coordinator_permission('generate_bill')){ redirect('home/permission'); } } } function index($id = NULL){ //print_r($id);exit; $data = array(); $id = $_POST['id']; $this->load->model('Generate_bill_model'); $data['data'] = $this->Generate_bill_model->name_list(); //echo '
'; print_r($data); echo '
'; exit; if($id){ //echo $id;exit; $data['caregiver'] = $this->Generate_bill_model->caregiverInfo($id); } $data['tab']=1; //echo '
'; print_r($data['caregiver']); echo '
'; exit; $this->load->view('home/dashboard',$data); // just the header file $this->load->view('add_new',$data); $this->load->view('home/footer'); // just the header file } public function getList() { //print_r($data);die; //$this->load->model('Generate_bill_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['name'] = $this->Generate_bill_model->getNameByLimitBySearch($limit, $start, $search,$orderColumn, $orderType); } else { $data['name'] = $this->Generate_bill_model->getNameByLimit($limit, $start, $orderColumn, $orderType); } // echo '
'; print_r($data); echo '
'; //die; $listCount = sizeof($data['name']); foreach ($data['name'] as $data) { //echo '
'; print_r($data); echo '
'; exit; //$id = $data['id']; $options1 = '' . lang('Generate Bill') .' '; // $options1 = '' . lang('Generate Bill') .' '; static $slno = 1; $info[] = array( $slno, $data['name'], $data['billed_count'], $data['unBilled_count'], $options1 // // $switch, // //$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->Generate_bill_model->name_list()), "recordsFiltered" => count($this->Generate_bill_model->name_list()), "data" => $info ); } else { $output = array( // "draw" => 1, "recordsTotal" => 0, "recordsFiltered" => 0, "data" => [] ); $output[$csrf_name] = $csrf_hash; } echo json_encode($output); } function selectForBilling(){ $data = array(); $id = $this->input->post('id'); if($id){ $data['caregiver'] = $this->Generate_bill_model->caregiverInfo($id); // echo '
'; print_r($data); echo '
';die; } $data['tab']=2; // echo '
'; print_r($data); echo '
';die; $data['view_link'] =$this->load->view('caregiverDetails',$data,TRUE); // echo '
'; print_r($data); echo '
';die; //$data['html_view'] = $this->load->view($data['view_link'],'',TRUE); echo json_encode($data); } function createBill(){ $data = array(); $id = $_POST['id']; //print_r($id);exit; $data['tab']=3; $data['bill_units']=count($id); $this->load->model('Generate_bill_model'); $data['payerTypes'] = $this->Generate_bill_model->getPayerType(); //echo '
'; print_r($data); echo '
'; die; if($id){ $data['patient'] = $this->Generate_bill_model->getPatientInformation($id); } //echo '
'; print_r($data); echo '
'; die; $data['view_link'] =$this->load->view('billDetails',$data,TRUE); echo json_encode($data); } function storeBill(){ $post = $this->input->post(); // echo '
'; print_r($post); echo '
'; die; $patient = $this->Generate_bill_model->getPatient($post['patient_id']); //echo '
'; print_r($patient); echo '
'; die; $this->load->model('Generate_bill_model'); $this->Generate_bill_model->saveBill($post); if($patient->patient_email){ $name=$patient->first_name." ".$patient->last_name; $from = array( 'name' => 'HMS Admin', 'email' => 'admin@hms.com' ); $subject ='Bill has been generated'; $emaildata['emaildata'] = array( 'name' =>$name ); $to = $patient->patient_email; $message= $this->load->view('email_template_management/bill',$emaildata,TRUE); send_email($from,$to,$subject,$message); } $this->session->set_flashdata('feedback', 'Inserted'); redirect('bills'); } }