From c5bdb749b6720d3ca2260a14dd56bf50d62602e2 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 29 Jan 2018 15:34:34 +0530 Subject: [PATCH 1/7] status update changes done in call tracking --- .../models/StatusUpdation_model.php | 383 +++++++++++++++++- 1 file changed, 381 insertions(+), 2 deletions(-) diff --git a/Apollo/api/application/models/StatusUpdation_model.php b/Apollo/api/application/models/StatusUpdation_model.php index dc9ac13f..b8b20613 100755 --- a/Apollo/api/application/models/StatusUpdation_model.php +++ b/Apollo/api/application/models/StatusUpdation_model.php @@ -65,7 +65,8 @@ class StatusUpdation_model extends CI_Model } // update Application status - public function update_applicationStatus($arr) { + 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'])){ @@ -78,6 +79,7 @@ class StatusUpdation_model extends CI_Model } // $result['addStatus'] = true; // $result['message'] = "Successfully Certification Status Updated"; + $this->updateDocumentStatusInCallTrack($arr,$reqDetails); $result['addStatus'] = true; $result['message'] = "Successfully Documents Status Updated"; } else { @@ -273,10 +275,13 @@ class StatusUpdation_model extends CI_Model } // update answer booklet status - public function update_answerbooklet($arr) { + 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"; @@ -491,6 +496,380 @@ class StatusUpdation_model extends CI_Model // //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->like('PLD.ListName','ISSUED'); + $this->db->like('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){ + + // get student details + $this->db->select('PLD.ListCode'); + $this->db->from(PICK_LIST_DETAILS.' as PLD'); + $this->db->like('PLD.ListName','PENDING'); + $this->db->like('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', 'Document', '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; + } + } + + /* + * 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; + } + + } + } \ No newline at end of file From a491ed1008b7015a87fe910c83c2e6d412ca8939 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 29 Jan 2018 15:34:53 +0530 Subject: [PATCH 2/7] course details changes done --- .../api/application/controllers/StatusUpdation_Controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Apollo/api/application/controllers/StatusUpdation_Controller.php b/Apollo/api/application/controllers/StatusUpdation_Controller.php index f13ef0be..7fb2fabf 100755 --- a/Apollo/api/application/controllers/StatusUpdation_Controller.php +++ b/Apollo/api/application/controllers/StatusUpdation_Controller.php @@ -170,7 +170,7 @@ class StatusUpdation_Controller extends REST_Controller { ); } - $updateAnswerBookletStat = $this->statusupdation_model->update_answerbooklet($data);// Check if the employee exist + $updateAnswerBookletStat = $this->statusupdation_model->update_answerbooklet($data,$reqDetails);// Check if the employee exist if ($updateAnswerBookletStat) { $updateAnswerBookletStat['status'] = REST_Controller::HTTP_OK; @@ -280,7 +280,7 @@ class StatusUpdation_Controller extends REST_Controller { ); } - $updateApplicationStatus = $this->statusupdation_model->update_applicationStatus($data);// Check if the employee exist + $updateApplicationStatus = $this->statusupdation_model->update_applicationStatus($data,$reqDetails);// Check if the employee exist if ($updateApplicationStatus) { $updateApplicationStatus['status'] = REST_Controller::HTTP_OK; From 111ffc68fcf7f5bd6ea4fa6ab503c7489115bbf9 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 29 Jan 2018 19:32:33 +0530 Subject: [PATCH 3/7] course details changes done --- .../application/models/Fees_status_model.php | 221 +++++++++++++++++- 1 file changed, 220 insertions(+), 1 deletion(-) diff --git a/Apollo/api/application/models/Fees_status_model.php b/Apollo/api/application/models/Fees_status_model.php index a58d9dd4..a0c0f837 100755 --- a/Apollo/api/application/models/Fees_status_model.php +++ b/Apollo/api/application/models/Fees_status_model.php @@ -988,13 +988,44 @@ class Fees_status_model extends CI_Model $this->db->where('SFS.CourseID',$row1->CourseID); $this->db->where('SFS.StudentID',$row1->StudentID); $getStudentPaiDetails1 = $this->db->get()->result(); - if($row->Amount < $getStudentPaiDetails1[0]->BillAmount){ + if($row1->Amount < $getStudentPaiDetails1[0]->BillAmount){ $this->smssend($row1->StudentID,$row1->DueDate); } } } + // this is for update details in call track after due date + $yesterdayDate = new DateTime(date("d-m-Y")); + $yesterdayDate->modify('-1 day'); + $preDATE = $yesterdayDate->format('d-m-Y'); + $this->db->distinct(); + $this->db->select('FIN.ID,FIN.Name,FIN.FeesID,FIN.Amount,FIN.DueDate,SFS.StudentID,SFS.CourseID'); + $this->db->from(FEES_INSTALLMENT.' as FIN'); + $this->db->join(STUDENTS_FEES_STATUS.' as SFS', 'FIN.FeesID = SFS.FeesID'); + $this->db->join(STUDENTS_FEES_PAID.' as SFP', 'SFP.FeesId = FIN.FeesID','left'); + $this->db->where('FIN.DueDate',$preDATE); + $getStudentDetails2 = $this->db->get(); + if ($getStudentDetails2->result()){ + foreach ($getStudentDetails2->result() as $row2){ + $this->db->select('ifnull(SUM((SFP.BillAmount)),0) as BillAmount'); + $this->db->from(STUDENTS_FEES_PAID.' as SFP'); + $this->db->join(STUDENTS_FEES_STATUS.' as SFS', 'SFP.FeesId = SFS.FeesID'); + $this->db->where('SFS.CourseID',$row2->CourseID); + $this->db->where('SFS.StudentID',$row2->StudentID); + $getStudentPaiDetails2 = $this->db->get()->result(); + + if($row2->Amount > $getStudentPaiDetails2[0]->BillAmount){ + + + $this->updateFeesStatusInCallTrack($row2->StudentID,$row2->CourseID); + } + + + } + } + + return true; } @@ -1033,6 +1064,194 @@ class Fees_status_model extends CI_Model $roleDetails = $this->db->get()->first_row(); return $roleDetails; } + /* + * update followup details for fees pending in call tracking + * created by kms + * */ + public function updateFeesStatusInCallTrack($studentID=null,$courseID=null){ + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $currentDate = new DateTime(date("d-m-Y")); + $afterFormatedDate = $currentDate->format('d-m-Y'); + // 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.IsActive','1'); + $checkStatus=$this->db->get()->last_row(); + if($checkStatus){ + + + $studentDetails = $this->studentInfoForFeesStatus($studentID,$courseID); + + if($studentDetails){ + $arrayDetails['MobileNumber']=$studentDetails->MobileNumber; + $arrayDetails['LeadName']=$studentDetails->Firstname; + $arrayDetails['University']=$studentDetails->UniversityName; + $arrayDetails['Course']=$studentDetails->CourseName; + $arrayDetails['StatusCode']=$checkStatus->ListCode; + $arrayDetails['CreatedBranch']=$studentDetails->BranchID; + $arrayDetails['CreatedOn']=$now->format('Y-m-d H:i:s'); + $arrayDetails['FollowupOn']=$afterFormatedDate; + $arrayDetails['FollowupComments']="Fees payment for your course is falling."; + // get created by with branch id + + $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',$studentDetails->BranchID); + $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']=''; + } + + // create activity in call tracking + $this->db->select('ActivityID,ActivityName'); + $this->db->like('ActivityName', 'Fees', '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); + $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; + } + } + + /* + * get student info for fees due updates + * created by kms + * */ + public function studentInfoForFeesStatus($studentID=null,$courseID=null){ + + $this->db->select('ST.Firstname,ST.MobileNumber,US.UniversityName,CU.CourseName,STC.BranchID'); + $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',$studentID); + $this->db->where('STC.CourseID',$courseID); + $leadDet=$this->db->get()->last_row(); + if($leadDet){ + return $leadDet; + } + else{ + return false; + } + + } } \ No newline at end of file From bd0827222ee254118172e870de62df2e2d92af23 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 29 Jan 2018 19:35:51 +0530 Subject: [PATCH 4/7] course details changes done --- Apollo/api/application/models/StatusUpdation_model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Apollo/api/application/models/StatusUpdation_model.php b/Apollo/api/application/models/StatusUpdation_model.php index b8b20613..ca3ed5df 100755 --- a/Apollo/api/application/models/StatusUpdation_model.php +++ b/Apollo/api/application/models/StatusUpdation_model.php @@ -562,7 +562,7 @@ class StatusUpdation_model extends CI_Model if($leadDet){ $this->db->select('FollowupOn'); $this->db->where('TrackingID',$leadDet->TrackingID); - $this->db->order_by('InteractionId','DESC'); + // $this->db->order_by('InteractionId','DESC'); $existFollowupOn = $this->db->get(LEAD_TRACKING_FOLLOWUP)->last_row(); // upate tracking status $changeStatusCode['StatusCode'] = $arrayDetails['StatusCode']; @@ -725,7 +725,7 @@ class StatusUpdation_model extends CI_Model if($leadDet){ $this->db->select('FollowupOn'); $this->db->where('TrackingID',$leadDet->TrackingID); - $this->db->order_by('InteractionId','DESC'); + // $this->db->order_by('InteractionId','DESC'); $existFollowupOn = $this->db->get(LEAD_TRACKING_FOLLOWUP)->last_row(); // upate tracking status $changeStatusCode['StatusCode'] = $arrayDetails['StatusCode']; From c0d607eac0d047140fc6b0e30f660bc394df18e6 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 29 Jan 2018 19:37:48 +0530 Subject: [PATCH 5/7] course details changes done --- Apollo/api/application/models/StatusUpdation_model.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Apollo/api/application/models/StatusUpdation_model.php b/Apollo/api/application/models/StatusUpdation_model.php index ca3ed5df..c943375f 100755 --- a/Apollo/api/application/models/StatusUpdation_model.php +++ b/Apollo/api/application/models/StatusUpdation_model.php @@ -505,8 +505,8 @@ class StatusUpdation_model extends CI_Model // get student details $this->db->select('PLD.ListCode'); $this->db->from(PICK_LIST_DETAILS.' as PLD'); - $this->db->like('PLD.ListName','ISSUED'); - $this->db->like('PLD.ListCode',$fromDetails[0]['ListCode']); + $this->db->where('PLD.ListName','ISSUED'); + $this->db->where('PLD.ListCode',$fromDetails[0]['ListCode']); $this->db->where('PLD.IsActive','1'); $checkStatus=$this->db->get()->last_row(); if($checkStatus){ @@ -669,8 +669,8 @@ class StatusUpdation_model extends CI_Model // get student details $this->db->select('PLD.ListCode'); $this->db->from(PICK_LIST_DETAILS.' as PLD'); - $this->db->like('PLD.ListName','PENDING'); - $this->db->like('PLD.ListCode',$fromDetails[0]['ListCode']); + $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){ From fed364ee45467ebb927cea9a493bc535e26ff1af Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 29 Jan 2018 19:42:29 +0530 Subject: [PATCH 6/7] course details changes done --- Apollo/api/application/models/Fees_status_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apollo/api/application/models/Fees_status_model.php b/Apollo/api/application/models/Fees_status_model.php index a0c0f837..5755eae6 100755 --- a/Apollo/api/application/models/Fees_status_model.php +++ b/Apollo/api/application/models/Fees_status_model.php @@ -1143,7 +1143,7 @@ class Fees_status_model extends CI_Model $this->db->update(LEAD_TRACKING, $changeStatusCode); // end update status $updateTrackDetails['TrackingID'] = $leadDet->TrackingID; - $updateTrackDetails['FollowupOn'] = $existFollowupOn->FollowupOn; + $updateTrackDetails['FollowupOn'] = $arrayDetails['FollowupOn']; $updateTrackDetails['FollowupComments'] = $arrayDetails['FollowupComments']; $updateTrackDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $updateTrackDetails['CreatedOn'] = $arrayDetails['CreatedOn']; From 1e053f9be3600428226d2da257493e49f66c3a9b Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 29 Jan 2018 19:44:33 +0530 Subject: [PATCH 7/7] course details changes done --- Apollo/api/application/models/StatusUpdation_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apollo/api/application/models/StatusUpdation_model.php b/Apollo/api/application/models/StatusUpdation_model.php index c943375f..15af4742 100755 --- a/Apollo/api/application/models/StatusUpdation_model.php +++ b/Apollo/api/application/models/StatusUpdation_model.php @@ -737,7 +737,7 @@ class StatusUpdation_model extends CI_Model $this->db->update(LEAD_TRACKING, $changeStatusCode); // end update status $updateTrackDetails['TrackingID'] = $leadDet->TrackingID; - $updateTrackDetails['FollowupOn'] = $existFollowupOn->FollowupOn; + $updateTrackDetails['FollowupOn'] = $arrayDetails['FollowupOn']; $updateTrackDetails['FollowupComments'] = $arrayDetails['FollowupComments']; $updateTrackDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $updateTrackDetails['CreatedOn'] = $arrayDetails['CreatedOn'];