%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 Booking extends CI_Controller { function __construct(){ parent::__construct(); $this->load->model(array('Home_Model')); $userData = $this->session->userdata('user_data'); if($userData->id==''){ //redirect('home'); } } /* * Function : index * * */ public function index() { $data = array(); $header = array(); $userData = $this->session->userdata('user_data'); $data['userInfo'] = $userData; //$data['userData'] = $this->Home_Model->getAllRecords('tbl_user_registration', '*', array('user_id'=>$userData->id)); $header['title'] = 'Confirm Your Details - COVID19 Vaccination Online Portal'; $this->load->view('_parts/header', $header); $this->load->view('payment-confirmation',$data); $this->load->view('_parts/footer'); } /* * Function : reschedule * * */ public function details() { $data = array(); $header = array(); $userData = $this->session->userdata('user_data'); $data['userInfo'] = $userData; //$data['userData'] = $this->Home_Model->getAllRecords('tbl_user_registration', '*', array('user_id'=>$userData->id)); $header['title'] = 'View Your Appointment'; $this->load->view('_parts/header', $header); $this->load->view('view-details',$data); $this->load->view('_parts/footer'); } /* * Function : reschedule * * */ public function reschedule() { $data = array(); $header = array(); $userData = $this->session->userdata('user_data'); $data['userInfo'] = $userData; $record_num = end($this->uri->segment_array()); $order_no = base64_decode($record_num); $data['orderDetails'] = $orderDetails = $this->Home_Model->getSingleObjRecord('tbl_booking_confirmation', '*', array('id'=>$order_no)); $data['doctorDetails'] = $this->Home_Model->getSingleObjRecord('tbl_doctor_master', '*', array('dr_id'=>$orderDetails->dr_id)); if($_POST['submit']){ $RegistrationNo = $_POST['RegistrationNo']; $id = $_POST['id']; $appointmentId = $_POST['appointmentId']; $slot_id = $_POST['available_slots']; $DoctorId = $_POST['DoctorId']; //print_r($_POST); $resp = $this->getRescheduleAppointment('RescheduleAppointment',$RegistrationNo, $appointmentId, $slot_id, $DoctorId); //print_r($resp->Msg); die; if($resp->Status=='success'){ $updateParams = array('slot_id'=>$slot_id,'modifiedon'=>date('Y-m-d H:i:s')); $this->Home_Model->updateinfo('tbl_booking_confirmation',$updateParams,'id',$id); $this->session->set_flashdata('msg', '<span class="alert alert-success">'.$resp->Msg.'.</span>'); } else { $this->session->set_flashdata('msg', '<span class="alert alert-danger">'.$resp->Msg.'.</span>'); } redirect('booking/reschedule/'.base64_encode($id)); } $header['title'] = 'Reschedule Your Appointment'; $this->load->view('_parts/header', $header); $this->load->view('reschedule',$data); $this->load->view('_parts/footer'); } /* * Function : getRescheduleAppointment * */ function getRescheduleAppointment($api, $RegistrationNo, $appointmentId, $slot_id, $DoctorId) { $slotArray = explode("::",$slot_id); $startDate = $slotArray[0]; $endDate = $slotArray[1]; $post = ["FacilityCode"=> FACILITY_ID,"RegistrationNo"=> $RegistrationNo,"AppointmentId"=> $appointmentId,"AppointmentFromTime"=>$startDate, "AppointmentToTime"=>$endDate, "DoctorId"=>$DoctorId]; //print_r($post); die; $response = postExistingRequest($api,json_encode($post)); //print_r($response); die; return json_decode($response); } /* * Function : cancled * * */ public function cancled() { $data = array(); $header = array(); $userData = $this->session->userdata('user_data'); $data['userInfo'] = $userData; $record_num = end($this->uri->segment_array()); $order_no = base64_decode($record_num); $data['orderDetails'] = $this->Home_Model->getSingleRecord('tbl_booking_confirmation', '*', array('id'=>$order_no)); if($_POST['appointmentId']>0) { $id = $_POST['id']; $appointmentId = $_POST['appointmentId']; $reason = $_POST['cancellation_reason'].'<br/>'.$_POST['c_remarks']; $cancellation_reason = $_POST['cancellation_reason']; $c_remarks = $_POST['c_remarks']; //CancelAppointment $resp = $this->getCancelAppointment('CancelAppointment',$appointmentId, $reason); // Update Status In Booking Table if($resp->Status=='success'){ $updateParams = array('status'=>'4', 'order_status'=>'CANCLED BY USER', 'cancellation_date'=>date('Y-m-d H:i:s'),'cancellation_reason '=>$cancellation_reason,'c_remarks'=>$c_remarks); $this->Home_Model->updateinfo('tbl_booking_confirmation',$updateParams,'id',$id); $this->session->set_flashdata('msg', '<span class="alert alert-success">'.$resp->Msg.'</span>'); } else { $this->session->set_flashdata('msg', '<span class="alert alert-danger">'.$resp->Msg.'</span>'); } redirect('booking/cancled/'.base64_encode($id)); } //$data['userData'] = $this->Home_Model->getAllRecords('tbl_user_registration', '*', array('user_id'=>$userData->id)); $header['title'] = 'Cancled Your Appointment'; $this->load->view('_parts/header', $header); $this->load->view('cancled',$data); $this->load->view('_parts/footer'); } /* * Function : getSpecialityList * */ function getCancelAppointment($api, $appointmentId, $reason) { $post = ["FacilityCode"=> FACILITY_ID,"AppointmentId"=> $appointmentId,"Reason"=> $reason ]; //print_r($post); die; $response = postExistingRequest($api,json_encode($post)); //print_r($response); die; return json_decode($response); } /* * Function : confirmation * * */ public function confirmation($id='') { $data = array(); $header = array(); $record_num = end($this->uri->segment_array()); $uid = base64_decode($record_num); $userData = $this->session->userdata('user_data'); $data['userInfo'] = $userData; if($uid==''){ redirect('dashboard'); } $data['userData'] = $this->Home_Model->getSingleRecord('tbl_user_registration', '*', array('id'=>$uid)); $data['bookingData'] = $bookingData = $this->Home_Model->getSingleRecord('tbl_booking_confirmation', '*', array('user_id'=>$uid,'status'=>'1')); $data['testData'] = $this->Home_Model->getSingleRecord('tbl_test_master', '*', array('id'=>$bookingData['test_id'])); // Get Test List $data['testArray'] = $this->Home_Model->getAllRecords('tbl_test_master', '*', array('status'=>'1')); $data['slotArray'] = $this->Home_Model->getAllRecords('tbl_slot_master', '*', array('status'=>'1')); $header['title'] = 'Confirm & Pay Now - COVID19 Vaccination'; $this->load->view('_parts/header', $header); $this->load->view('booking-confirmation',$data); $this->load->view('_parts/footer'); } /* * Function : generateRandomNumber */ function generateRandomNumber($length = 5) { $number = '1234567890'; $numberLength = strlen($number); $randomNumber = ''; for ($i = 0; $i < $length; $i++) { $randomNumber .= $number[rand(0, $numberLength - 1)]; } return $randomNumber; } /* * Function : confirmcompanypaynow */ public function confirmcompanypaynow() { $payment_method = $this->input->post('payment_method'); if($payment_method=='COD') { $this->codpayment($_POST); } else { $this->onlinecompanypayment($_POST); } } /* * Get Client IP Address */ function get_client_ip() { $ipaddress = ''; if (isset($_SERVER['HTTP_CLIENT_IP'])) $ipaddress = $_SERVER['HTTP_CLIENT_IP']; else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; else if(isset($_SERVER['HTTP_X_FORWARDED'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED']; else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_FORWARDED_FOR']; else if(isset($_SERVER['HTTP_FORWARDED'])) $ipaddress = $_SERVER['HTTP_FORWARDED']; else if(isset($_SERVER['REMOTE_ADDR'])) $ipaddress = $_SERVER['REMOTE_ADDR']; else $ipaddress = 'UNKNOWN'; return $ipaddress; } /* * function : Paymentconfirmation * */ public function Paymentconfirmation() { $data = $this->input->post(); // Get User Details $getRecord = $this->Home_Model->getSingleRecord('tbl_payment_transactions', '*', array('transaction_id'=>$data['TXNID'])); // Order ID $order_id = base64_decode($_GET['resp']); if(empty($getRecord)){ $bookingRecord = $this->Home_Model->getSingleRecord('tbl_booking_confirmation', '*', array('order_id'=>$order_id)); $crResponse = $this->createAppointment('CreateAppointment',$bookingRecord); $order_status = $data['STATUS']; if(($order_status=='TXN_SUCCESS')) { $status = '4'; } else { $status = '3'; } $TXNDATE = date('Y-m-d H:i:s'); $order_id = $data['ORDERID']; $update_data = array(); $update_data = array( 'order_status'=> $order_status, 'amount'=> $data['TXNAMOUNT'], 'order_date'=> $TXNDATE, 'status'=> $status, 'bank_ref_number' => $data['MID'], 'payment_tracking_number' => $data['BANKTXNID'], 'modifiedon' => date('Y-m-d H:i:s'), 'payment_failure_msg' => $data['RESPMSG'] ); $slotTrns = array(); $slotTrns = array('status'=>'1', 'modifiedon'=>date('y-m-d H:i:s')); $AppointmentId = $crResponse->AppointmentId; $response = $this->Home_Model->updateinfo($tbl_name='tbl_slot_transaction_master',$slotTrns,'order_id', $order_id); if($AppointmentId>0 && $bookingRecord['appointment_id']=='0') { $update_data['appointment_id'] = $AppointmentId; } $success = $this->Home_Model->updateinfo('tbl_booking_confirmation',$update_data,'order_id',$order_id); $user_id = $bookingRecord['user_id']; // Add records to transaction table $params = array('order_id'=>$order_id, 'bank_ref_no'=>$data['MID'], 'transaction_id'=>$data['TXNID'], 'transaction_amount'=>$data['TXNAMOUNT'], 'payment_mode'=> 'Online/Paytm', 'currency'=>$data['CURRENCY'], 'transaction_date'=>$TXNDATE, 'transaction_status'=>$data['STATUS'], 'response_code'=>$data['RESPCODE'], 'response_msg'=>$data['RESPMSG'], 'gateway_name'=>'Paytm', 'bank_transaction_id'=>$data['BANKTXNID'], 'bank_name'=>$data['BANKNAME'], 'checksumhash'=>$data['CHECKSUMHASH'], 'ip_address'=>$this->get_client_ip(), 'status'=>'1', 'is_deleted'=>'0'); $rowDetails = $this->Home_Model->getSingleRecord('tbl_payment_transactions', '*', array('transaction_id'=>$data['TXNID'])); if(empty($rowDetails)){ $this->Home_Model->saveinfo('tbl_payment_transactions', $params); } if($data['STATUS']=='TXN_SUCCESS') { $order_status = 'Approved'; $OPstatus = '4'; } else { $order_status = $data['STATUS']; $OPstatus = '6'; } $oparams['booking_confirmation_id'] = $bookingRecord['id']; //$userData['bid']; $oparams['transaction_id'] = $data['TXNID']; $oparams['reg_id'] = $userProfile['id']; $oparams['slot_id'] = $bookingRecord['slot_id']; $oparams['dr_id'] = $bookingRecord['dr_id']; $oparams['status'] = $OPstatus; $oparams['token_number'] = date('Ymd',strtotime($TXNDATE)).'03'.$bookingRecord['id'].$bookingRecord['dr_id']; $oparams['ip_address'] = $this->get_client_ip(); $oparams['payment_method'] = 'Paytm'; // Save data in order master $this->Home_Model->saveinfo('tbl_order_master', $oparams); //print_r($oparams); die; $response = $this->Home_Model->getSingleRecord('tbl_payment_transactions', '', array('order_id'=>$order_id,'status'=>'1')); // Create Response Array $nResponseArray = array(); //$nResponseArray['order_id'] = $response['order_id']; //$nResponseArray['oid'] = $response['order_id']; $nResponseArray['payment_tracking_number'] = $response['transaction_id']; $nResponseArray['amount'] = $response['transaction_amount']; $nResponseArray['chargetotal'] = $response['transaction_amount']; $nResponseArray['trans_date'] = $response['transaction_date']; $nResponseArray['order_status'] = $userData['order_status']; $nResponseArray['test_id'] = $bookingData['test_id']; $nResponseArray['slot_id'] = $bookingData['slot_id']; $nResponseArray['slot_date'] = $bookingData['slot_date']; $nResponseArray['ipgTransactionId'] = $response['transaction_id']; $nResponseArray['endpointTransactionId'] = $response['mid']; $nResponseArray['bank_ref_no'] = $response['bank_ref_no']; $nResponseArray['txndatetime'] = $response['transaction_date']; $nResponseArray['status'] = $response['transaction_status']; $nResponseArray['endpointTransactionId'] = $response['bank_ref_no']; $data['response'] = $nResponseArray; } $bookingRecord = $this->Home_Model->getSingleRecord('tbl_booking_confirmation', '*', array('order_id'=>$order_id)); $data['bookingData'] = $bookingRecord; // Get Doctor Details $doctorRecord = $this->Home_Model->getSingleRecord('tbl_doctor_master', '*', array('dr_id'=>$bookingRecord['dr_id'])); $data['doctorRecord'] = $doctorRecord; if($bookingRecord['email_status']==0) { // Send Confirmation Email after payment Approval //$this->sendUserEmail($bookingRecord,$nResponseArray); // Chnage Email Status $this->Home_Model->updateinfo('tbl_booking_confirmation',array('email_status'=>'1'),'order_id',$order_id); } $header['title'] = 'Booking Confirmation - Doctor Appointment Portal'; $this->load->view('_parts/header',$header); $this->load->view('payment-confirmation',$data); $this->load->view('_parts/footer'); } /* * Function : sendUserEmail * */ public function sendUserEmail($userData,$results) { //Get User Details $full_name = $userData['full_name']; $full_name = trim($full_name); $toemail = $userData['email_id']; $subject = 'Sharda Doctor Slot Appointment Details'; $data['userData'] = $userData; $data['results'] = $results; //$this->load->view('home/home_view',$data); echo $message = $this->load->view('email_template/booking_confirmation_alert',$data); die; if($toemail<>'') { $this->Home_Model->sendSMTPCommonEmail($toemail, $subject, $message); } return true; } /* * Function : cowinTemplate * */ public function cowinTemplate($userData,$results,$query) { $slotArray = getSlotDetails($query['slot_id']); $testDetails = getTestDetails($query['test_id']); $does = $query['does_type']=='2' ? '2nd Does' : '1st Does'; $template = ''; $template = ' '; return $template; } /* * Function : CreateAppointment * */ public function createAppointment($api='CreateAppointment', $data) { $dob = str_replace(array('-','/'),'-',$data['dob']); $slotArray = explode("::",$data['slot_id']); $startDate = $slotArray[0]; $endDate = $slotArray[1]; $nameArray = explode(" ",$data['full_name']); $first_name = $nameArray[0]; $last_name = $nameArray[1].$nameArray[2].$nameArray[3].$nameArray[4]; $titleRow = $this->Home_Model->getSingleRecord('tbl_title_master', '*', array('id'=>$data['title_id'])); //print_r($data); $post = ["FacilityCode"=> FACILITY_ID, "RegistrationNo"=> $data['his_id'], "FirstName"=> $first_name, "MiddleName"=> "", "LastName"=> $last_name, "DoctorId"=> $data['dr_id'], "AppFromDateTime"=> $startDate, "AppToDateTime"=> $endDate, "WalkInPatient"=> "1", "Dob"=> $dob, "Gender"=> $titleRow['gender_code'], "MobileNo"=> $data['mobile_number'], "Remarks"=> "Doctor Appointment", "Address1"=> $data['address'], "Address2"=> "", "CityCode"=> $data['city_id'], "StateCode"=> $data['state_id'], "CountryCode"=> $data['country_id'], "PinCode"=> "0", "IsTeleConsultation"=> "0", "Message"=> "" ]; ///print_r($post); die; $response = postExistingRequest($api,json_encode($post)); //print_r($response); die; return json_decode($response); } /* * Function : getNextAvailabeSlot * */ function getNextAvailabeSlot($data) { $explodeArray = explode('::',$data['slot_id']); $appointmentdate = date('Y-m-d',strtotime($explodeArray[0])); $dravailableSlots = $this->getDoctorSlots('GetDoctorSlots',$appointmentdate, $appointmentdate); echo '<pre/>'; $slotnArray = array(); foreach($dravailableSlots->DoctorSlotsList as $row){ if($row->StatusText=='Available') { $slotnArray[$row->StartTime] = $row; } } print_r($dravailableSlots->DoctorSlotsList); die; } /* * Function : getDoctorSlots * */ public function getDoctorSlots($api='GetDoctorSlots', $fromDate = '2022-05-20', $toDate= '2022-05-20') { $post = ["AppointmentStartDate"=> "$fromDate","AppointmentEndDate"=> "$toDate","FacilityCode"=> '2',"DoctorId"=> '3430',"isTeleConsultation"=> false]; //print_r($post); //die; $response = postExistingRequest($api,json_encode($post)); //print_r($response); die; return json_decode($response); } }