%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php defined('BASEPATH') OR exit('No direct script access allowed'); Class Surveysuers extends CI_Controller { function __construct(){ parent::__construct(); $this->load->model('Survey_Model'); if(! $this->session->userdata('adid')) { redirect('admin/login'); } } /* * Function : index * Desc : listing all records */ public function index() { $data = array(); $header = array(); $recordsArray = $this->Survey_Model->getCommonDistinctQuery('survey_answers','*',Null, array('date_created'=>'DESC')); $surveyRecords = array(); foreach($recordsArray as $row) { $surveyRecords[$row['contact_no']] = $row; } $data['recordsArray'] = $surveyRecords; if($_GET['export']=='1'){ $this->downloadreport($data); } $this->load->view('admin/_parts/header'); $this->load->view('admin/surveysuers/index',$data); $this->load->view('admin/_parts/footer'); setHistory('Go to Change Password'); } /* * Function : viewsurvey * Desc : For particular Record */ public function viewreport($id='') { // School Array $data = array(); $record_num = end($this->uri->segment_array()); $contact_no = base64_decode($record_num); $data['survey'] = $survey = $this->Survey_Model->getSingleRecord('survey_answers',' * ', array('contact_no'=>$contact_no)); $survey_id = $survey['survey_id']; $data['recordsArray'] = $data['qry'] = $this->Survey_Model->getAllRecords('survey_set',' * ', array('id'=>$survey_id)); $data['taken'] = '1'; $data['answers'] = $this->Survey_Model->customQuerySIngleRecords($survey_id, $contact_no); $data['sd'] = $this->Survey_Model->getSingleRecord('survey_set',' * ', array('id'=>$survey_id)); $data['questionArray'] = $this->Survey_Model->getAllRecords('survey_questions',' * ', array('survey_id'=>$survey_id,'status'=>'1')); $data['recordsTotalArray'] = $this->Survey_Model->getAllRecords('survey_answers','*', array('contact_no'=>$contact_no), 'survey_id'); $this->load->view('admin/_parts/header'); $this->load->view('admin/surveysuers/viewreport',$data); $this->load->view('admin/_parts/footer'); setHistory('Go to Add/Edit managesurvey'); } /* * Function : addrecord * Desc : For particular Record */ public function addrecord($id='') { // School Array $data = array(); if($_POST){ $this->form_validation->set_rules('equipment_type','Equipment Type','required'); $this->form_validation->set_rules('department','Department','required'); $this->form_validation->set_rules('location','Location','required'); $this->form_validation->set_rules('manufacture','Manufacture','required'); $this->form_validation->set_rules('sno','SNo','required'); $this->form_validation->set_rules('asset_tag','Asset Tag','required'); $this->form_validation->set_rules('model','Model','required'); $this->form_validation->set_rules('waranty_expiry','Waranty Expiry','required'); $this->form_validation->set_rules('custodian','Custodian','required'); $this->form_validation->set_rules('last_pmdate','Last PM Date','required'); $this->form_validation->set_rules('status','Status','required'); if($this->form_validation->run()) { $equipment_type = $this->input->post('equipment_type'); $department = $this->input->post('department'); $location = $this->input->post('location'); $manufacture = $this->input->post('manufacture'); $sno = $this->input->post('sno'); $asset_tag = $this->input->post('asset_tag'); $model = $this->input->post('model'); $custodian = $this->input->post('custodian'); $last_pmdate = $this->input->post('last_pmdate'); $waranty_expiry = $this->input->post('waranty_expiry'); $category = $this->input->post('category'); $business_unit = $this->input->post('business_unit'); $floor = $this->input->post('floor'); $room_no = $this->input->post('room_no'); $custodian_emp_code = $this->input->post('custodian_emp_code'); $custodian_email_id = $this->input->post('custodian_email_id'); $status = $this->input->post('status'); $data = array( 'category'=>$category, 'business_unit'=>$business_unit, 'floor'=>$floor, 'room_no'=>$room_no, 'custodian_emp_code'=>$custodian_emp_code, 'custodian_email_id'=>$custodian_email_id, 'equipment_type'=>$equipment_type, 'custodian'=>$custodian, 'last_pmdate'=>date('Y-m-d',strtotime($last_pmdate)), 'department'=>$department, 'location'=>$location, 'manufacture'=>$manufacture, 'sno'=>$sno, 'asset_tag'=>$asset_tag, 'waranty_expiry'=>$waranty_expiry, 'model'=>$model, 'custom_slug'=>str_replace(' ','-',strtolower($asset_tag)), 'status'=>$status, 'is_deleted'=>'0', 'createdon'=>date('y-m-d H:i:s') ); $records = $this->Survey_Model->getSingleRecord('tbl_pdms_op_patient_info',' * ', array('asset_tag'=>$asset_tag)); if(!empty($records)){ $id = $records['id']; $this->Survey_Model->updateinfo($tbl_name='tbl_pdms_op_patient_info',$data,'id',$id); setHistory('Info Auto Updated successfully'); } else { if($this->input->post('id')){ $id = $this->input->post('id'); $this->Survey_Model->updateinfo($tbl_name='tbl_pdms_op_patient_info',$data,'id',$id); setHistory('Info Updated successfully'); } else { $this->Survey_Model->saveinfo($tbl_name='tbl_pdms_op_patient_info',$data); setHistory('Info Added successfully'); } } redirect('admin/manageop'); } else { $this->load->view('admin/manageop/addrecord'); setHistory('Error! Add/Edit Custom page'); } } else { $data['sd'] = $this->Survey_Model->getSingleRecord('tbl_pdms_op_patient_info',' * ', array('id'=>$id)); $this->load->view('admin/_parts/header'); $this->load->view('admin/manageop/addrecord',$data); $this->load->view('admin/_parts/footer'); if($id>0){ setHistory('Go to Edit custom page'); } else { setHistory('Go to Add custom page'); } } } /* * Function : getuniquerandomkey */ public function getuniquerandomkey() { $leadscount = count($this->Survey_Model->getCommonQuery('tbl_pdms_op_patient_info')); $leadCounts = $leadscount+1; $final_number = str_pad($leadCounts, 4, '0', STR_PAD_LEFT); return date('Ymd').'1'.$final_number; } /* * Function : deleterecord * Desc : For records deletion */ public function deleterecord($uid) { if(in_array($this->session->userdata('adid')->role_id, array('1'))) { $this->Survey_Model->deleterecords('tbl_pdms_op_patient_info',$uid); $this->session->set_flashdata('success', 'Select record deleted successfully.'); setHistory('Current record deleted successfully - '.$uid); } redirect('admin/manageop'); } /* * Function : downloadreport */ private function downloadreport($data) { //print_r($data); die; header("Content-Disposition: attachment; filename=OP-report-".time().".csv"); $file = fopen('php://output', 'w'); $header = array("Sr. No.","Slag Id","Bill Number", "Patient Name","Department","Admission Date","Doctor Name","UHID","Contact Number","Pat Type"); fputcsv($file, $header); $i=1; $recordsArray = $data['recordsArray']; foreach ($recordsArray as $row){ $slag_id = "'".$row['slag_id']; $contact_number = 'xxxxxxxxxx'; $data=array($i,$slag_id,$row['bill_number'],$row['patient_name'],$row['department'],$row['billed_date'],$row['doctor_name'],$row['UHID'],$contact_number,$row['pat_type']); fputcsv($file,$data); $i++; } fclose($file); exit; } /* * function : bulkupload */ public function bulkupload() { $data = array(); $head = array(); $uid = $this->session->userdata('adid'); if(isset($_POST["submit"])) { $file = $_FILES['program_file']['tmp_name']; $handle = fopen($file, "r"); $c = 0; $postArray = array(); while(($filesop = fgetcsv($handle, 1000, ",")) !== false) { $bill_number = $filesop[0]; $PatientName = $filesop[1]; $Billed_Date = $filesop[2]; $department = $filesop[3]; $Doctor_Name = $filesop[4]; $UHID = $filesop[5]; $Contact_Number = $filesop[6]; $Pat_Type = $filesop[7]; $user_id = $uid->id; // Get All details if($c<>0){ /* SKIP THE FIRST ROW */ // Get Course Details $singleRow = $this->Survey_Model->getSingleRecord('tbl_pdms_op_patient_info','id', array('status'=>'1', 'is_deleted'=>'0','UHID'=>$UHID,'bill_number'=>$bill_number)); if($singleRow['id']>0) { $postArray = array(); $postArray['bill_number'] = $bill_number; $postArray['department'] = $department; $postArray['patient_name'] = $PatientName; $postArray['billed_date'] = date('Y-m-d',strtotime($Billed_Date)); $postArray['doctor_name'] = $Doctor_Name; $postArray['UHID'] = $UHID; $postArray['contact_number'] = $Contact_Number; $postArray['pat_type'] = $Pat_Type; $postArray['user_id'] = $user_id; $postArray['modifiedon'] = date('Y-m-d H:i:s'); $id = $singleRow['id']; // Set All records //print_r($postArray); die; $this->Survey_Model->updateinfo('tbl_pdms_op_patient_info',$postArray,'id',$id); } else { $postArray = array(); $postArray['slag_id'] = $this->getuniquerandomkey(); $postArray['bill_number'] = $bill_number; $postArray['department'] = $department; $postArray['patient_name'] = $PatientName; $postArray['billed_date'] = date('Y-m-d',strtotime($Billed_Date)); $postArray['doctor_name'] = $Doctor_Name; $postArray['UHID'] = $UHID; $postArray['contact_number'] = $Contact_Number; $postArray['pat_type'] = $Pat_Type; $postArray['user_id'] = $user_id; $postArray['createdon'] = date('Y-m-d H:i:s'); //print_r($postArray); die; // Save All records $this->Survey_Model->saveinfo('tbl_pdms_op_patient_info',$postArray); //die; } } $c = $c + 1; } $this->session->set_flashdata('success', '<span class="alert alert-success">All record added successfully</span>'); redirect('admin/manageop'); } } /* * * Function : sendSMS */ public function sendSMS() { $recordsArray = $this->Survey_Model->getCommonQuery('tbl_pdms_op_patient_info','id,contact_number,slag_id,patient_name', array('status'=>'1')); $i=0; //echo count($recordsArray);die; foreach($recordsArray as $row) { $mobile = '8920976831';//$row['contact_number']; $slag_id = $row['slag_id']; $UHID = $row['UHID']; $patient_name = ucwords($row['patient_name']); $url = base_url('feedback/'.base64_encode($row['slag_id'])); $sms_content = "Dear $patient_name, Thank you for your visit to Sharda Hospital, We would greatly appreciate it if you could fill in the feedback about your experience with us. $url Have a wonderful day."; //die; // SEND SMS sendNewsms($mobile, $sms_content); $postArray = array(); $postArray = array( 'mobile_no'=>$mobile, 'uhid'=>$UHID, 'patient_name'=>$patient_name, 'sms_content'=>$sms_content, 'custom_one'=>$slag_id, 'status'=>'1', 'createdon'=>date('Y-m-d H:i:s') ); $this->Survey_Model->saveinfo('tbl_pdms_message_master',$postArray); $i++; } $msg = $i." SMS send to patient registered mobile number."; $this->session->set_flashdata('success', $msg); redirect('admin/manageop'); } }