get_status_list_code($reqDetails); $subQuery = "SELECT P.ListCode , P.ListName FROM ".PICK_LIST_DETAILS." as P LEFT JOIN ".DEFAULTACTIVITY." as SM ON SM.StatusCode = P.ListCode WHERE SM.StudentActivityCode = '$statusCode' AND SM.IsActive = '1'"; $queryDetails = $this->db->query($subQuery); // $this->db->select('ListCode, ListName'); // $this->db->order_by('CreatedOn', 'DESC'); // $this->db->from('T_PickListDetails'); // $this->db->where('ListCode', 'S034'); // $staDetails = $this->db->get(); $statusDetails = $queryDetails->result(); if (count($statusDetails) > 0) { $results['statusList'] = true; $results['statusList_details'] = $statusDetails; } else { $results['statusList'] = false; $results['message'] = 'No record found'; } return $results; } public function get_couser_name($cours) { $this->db->select('t2.CourseName'); // $this->db->from('' . COURSE_FEES . ' as t1'); $this->db->from('' . COURSE . ' as t2'); $this->db->where('t2.CourseID', $cours); $roleDetails = $this->db->get()->first_row(); return "$roleDetails->CourseName"; } // update Application status public function update_applicationStatus($arr,$reqDetails) { $this->db->insert_batch(APPLICATION_STATUS, $arr); if ($this->db->affected_rows() >= 1) { if($this->get_ListCode_status($arr[0]['ListCode'])){ $dateToMsg = $arr[0]['AppDate']; $statuToMsg = $this->get_status_name_ListCode($arr[0]['ListCode']); $cerNamtToMsg = $this->get_certificate_name($arr[0]['CertificationType']); $getCourseName = $this->get_couser_name($arr[0]['CourseID']); $mesg = "Status Update : $cerNamtToMsg $getCourseName - $statuToMsg $dateToMsg."; $this->smssend($arr, $mesg); } // $result['addStatus'] = true; // $result['message'] = "Successfully Certification Status Updated"; $this->updateDocumentStatusInCallTrack($arr,$reqDetails); $result['addStatus'] = true; $result['message'] = "Successfully Documents Status Updated"; } else { $result['addStatus'] = false; $result['message'] = "Something went wrong.please try again"; } return $result; } // update certificate stauts public function update_certificateStatus($arr) { // $this->get_status_name_ListCode($arr[0]['ListCode']); // $dateToMsg = $arr[0]['CDate']; // print_r($arr);exit(); // echo $this->get_status_name_ListCode($arr[0]['ListCode']);exit(); $this->db->insert_batch(CERTIFICATION_STATUS, $arr); if ($this->db->affected_rows() >= 1) { // if( ($this->get_status_name_ListCode($arr[0]['ListCode']) == 'Received' || 'received' || 'RECEIVED') || ($this->get_status_name_ListCode($arr[0]['ListCode']) == 'Issued' || 'issued' || 'ISSUED')) { if($this->get_ListCode_status($arr[0]['ListCode'])){ $dateToMsg = $arr[0]['CDate']; $statuToMsg = $this->get_status_name_ListCode($arr[0]['ListCode']); // $cerNamtToMsg = $this->get_certificate_name($arr[0]['CertificationType']); $cerNamtToMsg = 'MARK CARD'; $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; // $mesg = "Status Update : $cerNamtToMsg - $statuToMsg $dateToMsg."; $this->smssend($arr, $mesg); } $result['addStatus'] = true; $result['message'] = "Successfully Mark Card Status Updated"; } else { $result['addStatus'] = false; $result['message'] = "Something went wrong.please try again"; } return $result; } // get certificate list public function get_certificate_list() { $this->db->select('*'); $this->db->order_by('CreatedOn', 'DESC'); $this->db->from(CERTIFICATION); $this->db->where('IsActive', 1); $cerfDetails = $this->db->get(); $certificateDetails = $cerfDetails->result(); if (count($certificateDetails) > 0) { $results['certificateStatus'] = true; $results['certificate_details'] = $certificateDetails; } else { $results['certificateStatus'] = false; $results['message'] = 'No record found'; } return $results; } // self function for getting registered mobile for sms public function get_registered_mobile($num) { $this->db->select('MobileNumber'); $this->db->from(STUDENTS); $this->db->where('StudentID', $num); $roleDetails = $this->db->get()->first_row(); return $roleDetails->MobileNumber; } // self function for getting the status for the LISTCODE public function get_ListCode_status($listCode) { // print_r ($listCode);exit(); $this->db->select('ListName'); $this->db->from(PICK_LIST_DETAILS); $this->db->where('ListCode', $listCode); // $this->db->or_like('ListName', 'RECEIVED'); // $this->db->or_like('ListName', 'ISSUED'); $statusDetails = $this->db->get()->first_row(); // echo $statusDetails->ListName;exit(); if ( $statusDetails->ListName == 'RECEIVED' || $statusDetails->ListName == 'ISSUED') { return true; } else { return false; } } public function get_prev_status_list($reqDetailsFor, $reqDetails){ if( $reqDetailsFor == 'STUDY_MATERIAL') { $searchFor = 'M001'; $searchTableFor = STUDY_MATERIAL_STATUS; $this->db->select('t1.*, t4.Firstname, t5.ListName, t2.Sem_Year'); $this->db->from(''. $searchTableFor . ' as t1'); $this->db->where('t1.StudentID', $reqDetails['student']); $this->db->join('' . COURSE_FEES . ' as t2', 't2.ID = t1.CourseID', 'LEFT'); $this->db->where('t2.CourseID', $reqDetails['CourseID']); $this->db->join('' . LOGIN . ' as t3', 't3.ID = t1.CreatedBy', 'LEFT'); $this->db->join('' . STAFF . ' as t4', 't4.StaffID = t3.StaffID', 'LEFT'); $this->db->join('' . PICK_LIST_DETAILS . ' as t5', 't5.ListCode = t1.ListCode', 'LEFT'); $this->db->order_by('t1.CreatedOn', 'DESC'); $statusDetails = $this->db->get(); $prevStatusDetails = $statusDetails->result(); if (count($prevStatusDetails) > 0) { $results['preStatusDetails'] = true; $results['preStatus_details_list'] = $prevStatusDetails; } else { $results['preStatusDetails'] = false; $results['message'] = 'No record found'; } } else if ( $reqDetailsFor == 'APPICATION_STATUS' ) { $searchFor = 'A001'; $searchTableFor = APPLICATION_STATUS; $this->db->select('t1.*, t4.Firstname, t5.ListName, t6.CertificateName'); $this->db->from(''. $searchTableFor . ' as t1'); $this->db->where('t1.StudentID', $reqDetails['student']); // $this->db->join('' . COURSE_FEES . ' as t2', 't2.ID = t1.CourseID', 'LEFT'); // $this->db->where('t2.CourseID', $reqDetails['CourseID']); $this->db->join('' . LOGIN . ' as t3', 't3.ID = t1.CreatedBy', 'LEFT'); $this->db->join('' . STAFF . ' as t4', 't4.StaffID = t3.StaffID', 'LEFT'); $this->db->join('' . PICK_LIST_DETAILS . ' as t5', 't5.ListCode = t1.ListCode', 'LEFT'); $this->db->join('' . CERTIFICATION . ' as t6', 't6.CertificationID = t1.CertificationType', 'LEFT'); $this->db->order_by('t1.CreatedOn', 'DESC'); $statusDetails = $this->db->get(); $prevStatusDetails = $statusDetails->result(); if (count($prevStatusDetails) > 0) { $results['preStatusDetails'] = true; $results['preStatus_details_list'] = $prevStatusDetails; } else { $results['preStatusDetails'] = false; $results['message'] = 'No record found'; } } else if ( $reqDetailsFor == 'CERTIFICATION_STATUS' ) { $searchFor = 'C001'; $searchTableFor = CERTIFICATION_STATUS; $this->db->select('t1.*, t4.Firstname, t5.ListName, t2.Sem_Year'); $this->db->from(''. $searchTableFor . ' as t1'); $this->db->where('t1.StudentID', $reqDetails['student']); $this->db->join('' . COURSE_FEES . ' as t2', 't2.ID = t1.CourseID', 'LEFT'); $this->db->where('t2.CourseID', $reqDetails['CourseID']); $this->db->join('' . LOGIN . ' as t3', 't3.ID = t1.CreatedBy', 'LEFT'); $this->db->join('' . STAFF . ' as t4', 't4.StaffID = t3.StaffID', 'LEFT'); $this->db->join('' . PICK_LIST_DETAILS . ' as t5', 't5.ListCode = t1.ListCode', 'LEFT'); // $this->db->join('' . CERTIFICATION . ' as t6', 't6.CertificationID = t1.CertificationType', 'LEFT'); $this->db->order_by('t1.CreatedOn', 'DESC'); $statusDetails = $this->db->get(); $prevStatusDetails = $statusDetails->result(); if (count($prevStatusDetails) > 0) { $results['preStatusDetails'] = true; $results['preStatus_details_list'] = $prevStatusDetails; } else { $results['preStatusDetails'] = false; $results['message'] = 'No record found'; } } else if ( $reqDetailsFor == 'ANSWERBOOKLET_STATUS' ) { $searchFor = 'B001'; $searchTableFor = ANSWER_BOOKLET; $this->db->select('t1.*, t4.Firstname, t5.ListName, t2.Sem_Year'); $this->db->from(''. $searchTableFor . ' as t1'); $this->db->where('t1.StudentID', $reqDetails['student']); $this->db->join('' . COURSE_FEES . ' as t2', 't2.ID = t1.CourseID', 'LEFT'); $this->db->where('t2.CourseID', $reqDetails['CourseID']); $this->db->join('' . LOGIN . ' as t3', 't3.ID = t1.CreatedBy', 'LEFT'); $this->db->join('' . STAFF . ' as t4', 't4.StaffID = t3.StaffID', 'LEFT'); $this->db->join('' . PICK_LIST_DETAILS . ' as t5', 't5.ListCode = t1.ListCode', 'LEFT'); $this->db->order_by('t1.CreatedOn', 'DESC'); $statusDetails = $this->db->get(); $prevStatusDetails = $statusDetails->result(); if (count($prevStatusDetails) > 0) { $results['preStatusDetails'] = true; $results['preStatus_details_list'] = $prevStatusDetails; } else { $results['preStatusDetails'] = false; $results['message'] = 'No record found'; } } return $results; } public function get_status_name_ListCode($listCode) { $this->db->select('ListName'); $this->db->from(PICK_LIST_DETAILS); $this->db->where('ListCode', $listCode); $statusDetails = $this->db->get()->first_row(); return $statusDetails->ListName; } // self function for getting certificate name for the CERTIFICATECODE public function get_certificate_name($listCode) { $this->db->select('CertificateName'); $this->db->from(CERTIFICATION); $this->db->where('CertificationID', $listCode); $cerfDetails = $this->db->get()->first_row(); return $cerfDetails->CertificateName; } // update answer booklet status public function update_answerbooklet($arr,$reqDetails) { // print_r($arr);exit(); $this->db->insert_batch(ANSWER_BOOKLET, $arr); if ($this->db->affected_rows() >= 1) { $this->updateBookletStatusInCallTrack($arr,$reqDetails); // $this->smssend($arr); $result['addStatus'] = true; $result['message'] = "Successfully Answer Booklet Status Updated"; } else { $result['addStatus'] = false; $result['message'] = "Something went wrong.please try again"; } return $result; } public function get_couser_sem_yr_msg($cours) { $this->db->select('t1.Sem_Year, t2.CourseName'); $this->db->from('' . COURSE_FEES . ' as t1'); $this->db->join('' . COURSE . ' as t2', 't2.CourseID = t1.CourseID', 'LEFT'); $this->db->where('ID', $cours); $roleDetails = $this->db->get()->first_row(); return "$roleDetails->Sem_Year $roleDetails->CourseName"; } // update study material status public function update_semyear($arr) { // echo $cours;exit(); // $this->get_status_name_ListCode($arr[0]['ListCode']); $this->db->insert_batch(STUDY_MATERIAL_STATUS, $arr); if ($this->db->affected_rows() >= 1) { // if(($this->get_status_name_ListCode($arr[0]['ListCode']) == 'Received' || 'received' || 'Active') || ($this->get_status_name_ListCode($arr[0]['ListCode']) == 'Issued' || 'issued')) { if($this->get_ListCode_status($arr[0]['ListCode']) == true) { $dateToMsg = $arr[0]['SDate']; $statuToMsg = $this->get_status_name_ListCode($arr[0]['ListCode']); $cerNamtToMsg = 'Study Material'; $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $this->smssend($arr, $mesg); } // $this->smssend($arr); $result['addStatus'] = true; $result['message'] = "Successfully Study Material Status Updated"; } else { $result['addStatus'] = false; $result['message'] = "Something went wrong.please try again"; } return $result; } // get sem/Year for the course public function get_semyear_result($reqData, $stuFor) { // echo $stuFor;exit(); $subQuery = "SELECT CF.Sem_Year, CF.ID FROM ".COURSE_FEES." as CF LEFT JOIN ".STUDENTS_FEES_STATUS." as SFS ON SFS.FeesType = CF.ID WHERE SFS.CourseID = '$reqData' AND SFS.StudentID = '$stuFor' AND CF.ProgramType ='Y001'"; $queryDetails = $this->db->query($subQuery); $results['semYearResult'] = true; $results['semYear_result_details'] = $queryDetails->result(); return $results; } // get serach result public function get_search_result($reqData, $req) { // print_r($reqData['University']); // print_r($req); // exit(); $University = $reqData['University']; $Course = $reqData['Course']; $Batch = $reqData['Batch']; $branch = $req['localBranchID']; if( $branch == 'All' ) { $subQuery = "SELECT S.* , SC.CourseID , C.CourseName , U.UniversityName FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON SC.CourseID = C.CourseID WHERE SC.UniversityID LIKE '%$University%' AND SC.CourseID LIKE '%$Course%' AND SC.BatchCode LIKE '%$Batch%' AND S.IsActive = '1' AND SC.IsActive = '1'"; $queryDetails = $this->db->query($subQuery); $results['searchResult'] = true; $results['search_result_details'] = $queryDetails->result(); } else { $subQuery = "SELECT S.* , SC.CourseID , C.CourseName , U.UniversityName FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON SC.CourseID = C.CourseID WHERE SC.UniversityID LIKE '%$University%' AND SC.CourseID LIKE '%$Course%' AND SC.BatchCode LIKE '%$Batch%' AND S.IsActive = '1' AND S.BranchCode = '$branch' AND SC.IsActive = '1'"; $queryDetails = $this->db->query($subQuery); $results['searchResult'] = true; $results['search_result_details'] = $queryDetails->result(); } return $results; } // get list of universities, course, batch public function get_university_course_batch() { $this->db->select('t1.UniversityID, t1.UniversityName'); $this->db->order_by('CreatedOn', 'DESC'); $this->db->from(''.UNIVERSITY. ' as t1'); $this->db->where('IsActive', 1); // $this->db->join('' . COURSE . ' as t2', 't2.UniversityID = t1.UniversityID', 'LEFT'); $univDetails = $this->db->get(); $universityDetails = $univDetails->result(); $endResult = []; foreach($universityDetails as $clip){ // University Details $resultArr['UniversityID'] = $clip->UniversityID; $resultArr['UniversityName'] = $clip->UniversityName; // Course Details $this->db->select('t2.CourseID, t2.CourseName'); $this->db->from(''.COURSE. ' as t2'); $this->db->where('t2.UniversityID', $clip->UniversityID); $this->db->where('t2.IsActive', 1); $courDetails = $this->db->get(); $courseDetails = $courDetails->result(); $resultArr['Course'] =$courseDetails; // Batch Details $this->db->select('t3.BatchName, t3.BatchCode'); $this->db->from(''.BATCH. ' as t3'); $this->db->where('t3.UniversityID', $clip->UniversityID); $this->db->where('t3.IsActive', 1); $batDetails = $this->db->get(); $batchDetails = $batDetails->result(); $resultArr['Batch'] =$batchDetails; array_push($endResult, $resultArr); } $results['univList'] = true; $results['university_details'] = $endResult; return $results; } // http://www.24x7sms.com/downloads/24X7SMS_http_API2.0.pdf // API Key : xegCdYUIMf3 // Your new password for logging into Apollo student portal is (Password). Please change the password as soon as you login. // This is the template to be used. public function smssend($arr, $msg) { $number =array(); foreach($arr as $ar){ $mobi = $this->get_registered_mobile($ar['StudentID']); array_push($number, "91$mobi"); } $mobile = implode(',', $number); // $message ="Your new password for logging into Apollo student portal is SAMPLE. Please change the password as soon as you login."; // $mobile = "91$mobile"; $message = urlencode($msg); // echo $mobile , $message; $ch=curl_init(); curl_setopt($ch,CURLOPT_URL,"https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=".$mobile."&SenderID=APOLLO&Message=".$message."&ServiceName=TEMPLATE_BASED"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $output =curl_exec($ch); // print_r($output);exit(); curl_close($ch); return $output; } // public function mailsend() { // //Load email library // $this->load->library('email'); // //SMTP & mail configuration // $config = array( // 'protocol' => 'smtp', // 'smtp_host' => 'ssl://smtp.example.com', // 'smtp_port' => 465, // 'smtp_user' => 'email@example.com', // 'smtp_pass' => 'email_password', // 'mailtype' => 'html', // 'charset' => 'utf-8' // ); // $this->email->initialize($config); // $this->email->set_mailtype("html"); // $this->email->set_newline("\r\n"); // //Email content // $htmlContent = '
This email has sent via SMTP server from CodeIgniter application.
'; // // Email body load the html template // // $body = $this->load->view('emails/anillabs.php',$data,TRUE); // $this->email->to('recipient@example.com'); // $this->email->from('sender@example.com','MyWebsite'); // $this->email->subject('How to send email via SMTP server in CodeIgniter'); // $this->email->message($htmlContent); // //Send email // $this->email->send(); // } /* * update followup details for booklet details in call tracking * created by kms * */ public function updateBookletStatusInCallTrack($fromDetails=null,$reqDetails=null){ // get student details $this->db->select('PLD.ListCode'); $this->db->from(PICK_LIST_DETAILS.' as PLD'); $this->db->where('PLD.ListName','ISSUED TO STUDENTS'); $this->db->where('PLD.ListCode',$fromDetails[0]['ListCode']); $this->db->where('PLD.IsActive','1'); $checkStatus=$this->db->get()->last_row(); if($checkStatus){ $studentDetails = $this->studentInfo($fromDetails); if($studentDetails){ $arrayDetails['MobileNumber']=$studentDetails->MobileNumber; $arrayDetails['LeadName']=$studentDetails->Firstname; $arrayDetails['University']=$studentDetails->UniversityName; $arrayDetails['Course']=$studentDetails->CourseName; $arrayDetails['StatusCode']=$fromDetails[0]['ListCode']; $arrayDetails['CreatedBranch']=$fromDetails[0]['BranchCode']; $arrayDetails['CreatedOn']=$fromDetails[0]['CreatedOn']; $arrayDetails['FollowupOn']=$fromDetails[0]['AnsDate']; $arrayDetails['FollowupComments']=$fromDetails[0]['Comments']; if($reqDetails['localType']==SUPER_ADMIN){ $this->db->select('LO.ID'); $this->db->from(STAFF_BRANCH.' as STB'); $this->db->join(LOGIN.' as LO', 'LO.StaffID = STB.StaffID'); $this->db->where('STB.BranchCode',$fromDetails[0]['BranchCode']); $this->db->where('LO.ListCode',ADMIN); $this->db->where('STB.IsActive','1'); $this->db->where('LO.IsActive','1'); $assignDet=$this->db->get()->last_row(); if($assignDet){ $arrayDetails['CreatedBy']=$assignDet->ID; } else{ $arrayDetails['CreatedBy']=$fromDetails[0]['CreatedBy']; } } else{ $arrayDetails['CreatedBy']=$fromDetails[0]['CreatedBy']; } // create activity in call tracking $this->db->select('ActivityID,ActivityName'); $this->db->like('ActivityName', 'Answer Booklet', 'after'); $this->db->where('IsActive', '1'); $activityDetails=$this->db->get(ACTIVITY)->last_row(); if($activityDetails){ $this->db->select('LD.LeadID,LT.TrackingID'); $this->db->from(LEAD_DETAILS.' as LD'); $this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID'); $this->db->where('LD.MobileNumber',$arrayDetails['MobileNumber']); $this->db->where('LT.ActivityStatus',$activityDetails->ActivityID); $this->db->like('LT.University',$arrayDetails['University'],'after'); $this->db->like('LT.Course',$arrayDetails['Course'],'after'); $leadDet=$this->db->get()->last_row(); if($leadDet){ $this->db->select('FollowupOn'); $this->db->where('TrackingID',$leadDet->TrackingID); // $this->db->order_by('InteractionId','DESC'); $existFollowupOn = $this->db->get(LEAD_TRACKING_FOLLOWUP)->last_row(); // upate tracking status $changeStatusCode['StatusCode'] = $arrayDetails['StatusCode']; $changeStatusCode['UpdatedBy'] = $arrayDetails['CreatedBy']; $changeStatusCode['UpdatedOn'] = $arrayDetails['CreatedOn']; $changeStatusCode['CreatedBranch']=$arrayDetails['CreatedBranch']; $this->db->where('TrackingID',$leadDet->TrackingID); $this->db->update(LEAD_TRACKING, $changeStatusCode); // end update status $updateTrackDetails['TrackingID'] = $leadDet->TrackingID; $updateTrackDetails['FollowupOn'] = $existFollowupOn->FollowupOn; $updateTrackDetails['FollowupComments'] = $arrayDetails['FollowupComments']; $updateTrackDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $updateTrackDetails['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $updateTrackDetails); } else{ $this->db->select('LeadID'); $this->db->where('MobileNumber',$arrayDetails['MobileNumber']); $checkLeadDet=$this->db->get(LEAD_DETAILS)->last_row(); if($checkLeadDet){ $updateLeadDetails['LeadID'] = $checkLeadDet->LeadID; $updateLeadDetails['ActivityStatus'] = $activityDetails->ActivityID; $updateLeadDetails['University'] = $arrayDetails['University']; $updateLeadDetails['Course'] = $arrayDetails['Course']; $updateLeadDetails['AssignedTo'] = $arrayDetails['CreatedBy']; $updateLeadDetails['StatusCode'] = $arrayDetails['StatusCode']; $updateLeadDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $updateLeadDetails['CreatedOn'] = $arrayDetails['CreatedOn']; $updateLeadDetails['CreatedBranch']=$arrayDetails['CreatedBranch']; $this->db->insert(LEAD_TRACKING, $updateLeadDetails); // this if for insert tracking details if($this->db->affected_rows() == '1'){ $followup_Details['TrackingID']=$this->db->insert_id(); $followup_Details['FollowupOn']=$arrayDetails['FollowupOn']; $followup_Details['FollowupComments']=$arrayDetails['FollowupComments']; $followup_Details['CreatedBy'] = $arrayDetails['CreatedBy']; $followup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $followup_Details); // this if for insert follow up details } } else{ $newLeadDetails['MobileNumber'] = $arrayDetails['MobileNumber']; $newLeadDetails['LeadName'] = $arrayDetails['LeadName']; $newLeadDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $newLeadDetails['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_DETAILS, $newLeadDetails); // this if for insert lead details if($this->db->affected_rows() == '1'){ // get and store insert id from db $track_Details['LeadID']=$this->db->insert_id(); $track_Details['ActivityStatus'] = $activityDetails->ActivityID; $track_Details['University'] = $arrayDetails['University']; $track_Details['Course'] = $arrayDetails['Course']; $track_Details['AssignedTo'] = $arrayDetails['CreatedBy']; $track_Details['StatusCode'] = $arrayDetails['StatusCode']; $track_Details['CreatedBy'] = $arrayDetails['CreatedBy']; $track_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $track_Details['CreatedBranch']=$arrayDetails['CreatedBranch']; $this->db->insert(LEAD_TRACKING, $track_Details); // this if for insert tracking details if($this->db->affected_rows() == '1'){ $insertfollowup_Details['TrackingID']=$this->db->insert_id(); $insertfollowup_Details['FollowupOn']=$arrayDetails['FollowupOn']; $insertfollowup_Details['FollowupComments']=$arrayDetails['FollowupComments']; $insertfollowup_Details['CreatedBy'] = $arrayDetails['CreatedBy']; $insertfollowup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertfollowup_Details); // this if for insert follow up details } } } } } } return true; } else{ return false; } } /* * update followup details for application status in call tracking * created by kms * */ public function updateDocumentStatusInCallTrack($fromDetails=null,$reqDetails=null){ // check certificate type $this->db->select('CFM.CertificationID'); $this->db->from(CERTIFICATION_MASTER.' as CFM'); $this->db->where('CFM.CertificateName','APPLICATION'); $this->db->where('CFM.CertificationID',$fromDetails[0]['CertificationType']); $this->db->where('CFM.IsActive','1'); $checkApplicationStatus=$this->db->get()->last_row(); if($checkApplicationStatus){ // get student details $this->db->select('PLD.ListCode'); $this->db->from(PICK_LIST_DETAILS.' as PLD'); $this->db->where('PLD.ListName','PENDING'); $this->db->where('PLD.ListCode',$fromDetails[0]['ListCode']); $this->db->where('PLD.IsActive','1'); $checkStatus=$this->db->get()->last_row(); if($checkStatus){ $studentDetails = $this->studentInfoForDocumentStatus($fromDetails); if($studentDetails){ $arrayDetails['MobileNumber']=$studentDetails->MobileNumber; $arrayDetails['LeadName']=$studentDetails->Firstname; $arrayDetails['University']=$studentDetails->UniversityName; $arrayDetails['Course']=$studentDetails->CourseName; $arrayDetails['StatusCode']=$fromDetails[0]['ListCode']; $arrayDetails['CreatedBranch']=$fromDetails[0]['BranchCode']; $arrayDetails['CreatedOn']=$fromDetails[0]['CreatedOn']; $arrayDetails['FollowupOn']=$fromDetails[0]['AppDate']; $arrayDetails['FollowupComments']=$fromDetails[0]['Comments']; if($reqDetails['localType']==SUPER_ADMIN){ $this->db->select('LO.ID'); $this->db->from(STAFF_BRANCH.' as STB'); $this->db->join(LOGIN.' as LO', 'LO.StaffID = STB.StaffID'); $this->db->where('STB.BranchCode',$fromDetails[0]['BranchCode']); $this->db->where('LO.ListCode',ADMIN); $this->db->where('STB.IsActive','1'); $this->db->where('LO.IsActive','1'); $assignDet=$this->db->get()->last_row(); if($assignDet){ $arrayDetails['CreatedBy']=$assignDet->ID; } else{ $arrayDetails['CreatedBy']=$fromDetails[0]['CreatedBy']; } } else{ $arrayDetails['CreatedBy']=$fromDetails[0]['CreatedBy']; } // create activity in call tracking $this->db->select('ActivityID,ActivityName'); $this->db->like('ActivityName', 'Application', 'after'); $this->db->where('IsActive', '1'); $activityDetails=$this->db->get(ACTIVITY)->last_row(); if($activityDetails){ $this->db->select('LD.LeadID,LT.TrackingID'); $this->db->from(LEAD_DETAILS.' as LD'); $this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID'); $this->db->where('LD.MobileNumber',$arrayDetails['MobileNumber']); $this->db->where('LT.ActivityStatus',$activityDetails->ActivityID); $this->db->like('LT.University',$arrayDetails['University'],'after'); $this->db->like('LT.Course',$arrayDetails['Course'],'after'); $leadDet=$this->db->get()->last_row(); if($leadDet){ $this->db->select('FollowupOn'); $this->db->where('TrackingID',$leadDet->TrackingID); // $this->db->order_by('InteractionId','DESC'); $existFollowupOn = $this->db->get(LEAD_TRACKING_FOLLOWUP)->last_row(); // upate tracking status $changeStatusCode['StatusCode'] = $arrayDetails['StatusCode']; $changeStatusCode['UpdatedBy'] = $arrayDetails['CreatedBy']; $changeStatusCode['UpdatedOn'] = $arrayDetails['CreatedOn']; $changeStatusCode['CreatedBranch']=$arrayDetails['CreatedBranch']; $this->db->where('TrackingID',$leadDet->TrackingID); $this->db->update(LEAD_TRACKING, $changeStatusCode); // end update status $updateTrackDetails['TrackingID'] = $leadDet->TrackingID; $updateTrackDetails['FollowupOn'] = $arrayDetails['FollowupOn']; $updateTrackDetails['FollowupComments'] = $arrayDetails['FollowupComments']; $updateTrackDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $updateTrackDetails['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $updateTrackDetails); } else{ $this->db->select('LeadID'); $this->db->where('MobileNumber',$arrayDetails['MobileNumber']); $checkLeadDet=$this->db->get(LEAD_DETAILS)->last_row(); if($checkLeadDet){ $updateLeadDetails['LeadID'] = $checkLeadDet->LeadID; $updateLeadDetails['ActivityStatus'] = $activityDetails->ActivityID; $updateLeadDetails['University'] = $arrayDetails['University']; $updateLeadDetails['Course'] = $arrayDetails['Course']; $updateLeadDetails['AssignedTo'] = $arrayDetails['CreatedBy']; $updateLeadDetails['StatusCode'] = $arrayDetails['StatusCode']; $updateLeadDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $updateLeadDetails['CreatedOn'] = $arrayDetails['CreatedOn']; $updateLeadDetails['CreatedBranch']=$arrayDetails['CreatedBranch']; $this->db->insert(LEAD_TRACKING, $updateLeadDetails); // this if for insert tracking details if($this->db->affected_rows() == '1'){ $followup_Details['TrackingID']=$this->db->insert_id(); $followup_Details['FollowupOn']=$arrayDetails['FollowupOn']; $followup_Details['FollowupComments']=$arrayDetails['FollowupComments']; $followup_Details['CreatedBy'] = $arrayDetails['CreatedBy']; $followup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $followup_Details); // this if for insert follow up details } } else{ $newLeadDetails['MobileNumber'] = $arrayDetails['MobileNumber']; $newLeadDetails['LeadName'] = $arrayDetails['LeadName']; $newLeadDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $newLeadDetails['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_DETAILS, $newLeadDetails); // this if for insert lead details if($this->db->affected_rows() == '1'){ // get and store insert id from db $track_Details['LeadID']=$this->db->insert_id(); $track_Details['ActivityStatus'] = $activityDetails->ActivityID; $track_Details['University'] = $arrayDetails['University']; $track_Details['Course'] = $arrayDetails['Course']; $track_Details['AssignedTo'] = $arrayDetails['CreatedBy']; $track_Details['StatusCode'] = $arrayDetails['StatusCode']; $track_Details['CreatedBy'] = $arrayDetails['CreatedBy']; $track_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $track_Details['CreatedBranch']=$arrayDetails['CreatedBranch']; $this->db->insert(LEAD_TRACKING, $track_Details); // this if for insert tracking details if($this->db->affected_rows() == '1'){ $insertfollowup_Details['TrackingID']=$this->db->insert_id(); $insertfollowup_Details['FollowupOn']=$arrayDetails['FollowupOn']; $insertfollowup_Details['FollowupComments']=$arrayDetails['FollowupComments']; $insertfollowup_Details['CreatedBy'] = $arrayDetails['CreatedBy']; $insertfollowup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertfollowup_Details); // this if for insert follow up details } } } } } } return true; } else{ return false; } } else{ return false; } } /* * get student info * created by kms * */ public function studentInfo($details=null){ $this->db->select('ST.Firstname,ST.MobileNumber,US.UniversityName,CU.CourseName'); $this->db->from(COURSE_FEES.' as CF'); $this->db->join(STUDENTCOURSE.' as STC', 'STC.CourseID = CF.CourseID'); $this->db->join(STUDENTS.' as ST', 'ST.StudentID = STC.StudentID'); $this->db->join(COURSE.' as CU', 'CU.CourseID = STC.CourseID'); $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = STC.UniversityID'); $this->db->where('ST.StudentID',$details[0]['StudentID']); $this->db->where('CF.ID',$details[0]['CourseID']); $leadDet=$this->db->get()->last_row(); if($leadDet){ return $leadDet; } else{ return false; } } /* * get student info for documet updates * created by kms * */ public function studentInfoForDocumentStatus($details=null){ $this->db->select('ST.Firstname,ST.MobileNumber,US.UniversityName,CU.CourseName'); $this->db->from(STUDENTCOURSE.' as STC'); $this->db->join(STUDENTS.' as ST', 'ST.StudentID = STC.StudentID'); $this->db->join(COURSE.' as CU', 'CU.CourseID = STC.CourseID'); $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = STC.UniversityID'); $this->db->where('ST.StudentID',$details[0]['StudentID']); $this->db->where('STC.CourseID',$details[0]['CourseID']); $leadDet=$this->db->get()->last_row(); if($leadDet){ return $leadDet; } else{ return false; } } }