course details changes done

This commit is contained in:
gandhimathi 2018-02-05 19:01:28 +05:30
parent 6fbe2bae97
commit 2cd8de31b1

View File

@ -666,162 +666,176 @@ class StatusUpdation_model extends CI_Model
* */ * */
public function updateDocumentStatusInCallTrack($fromDetails=null,$reqDetails=null){ 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->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); // check certificate type
if($studentDetails){ $this->db->select('CFM.CertificationID');
$arrayDetails['MobileNumber']=$studentDetails->MobileNumber; $this->db->from(CERTIFICATION_MASTER.' as CFM');
$arrayDetails['LeadName']=$studentDetails->Firstname; $this->db->where('CFM.CertificateName','APPLICATION');
$arrayDetails['University']=$studentDetails->UniversityName; $this->db->where('CFM.CertificationID',$fromDetails[0]['CertificationType']);
$arrayDetails['Course']=$studentDetails->CourseName; $this->db->where('CFM.IsActive','1');
$arrayDetails['StatusCode']=$fromDetails[0]['ListCode']; $checkApplicationStatus=$this->db->get()->last_row();
$arrayDetails['CreatedBranch']=$fromDetails[0]['BranchCode']; if($checkApplicationStatus){
$arrayDetails['CreatedOn']=$fromDetails[0]['CreatedOn']; // get student details
$arrayDetails['FollowupOn']=$fromDetails[0]['AppDate']; $this->db->select('PLD.ListCode');
$arrayDetails['FollowupComments']=$fromDetails[0]['Comments']; $this->db->from(PICK_LIST_DETAILS.' as PLD');
if($reqDetails['localType']==SUPER_ADMIN){ $this->db->where('PLD.ListName','PENDING');
$this->db->select('LO.ID'); $this->db->where('PLD.ListCode',$fromDetails[0]['ListCode']);
$this->db->from(STAFF_BRANCH.' as STB'); $this->db->where('PLD.IsActive','1');
$this->db->join(LOGIN.' as LO', 'LO.StaffID = STB.StaffID'); $checkStatus=$this->db->get()->last_row();
$this->db->where('STB.BranchCode',$fromDetails[0]['BranchCode']); if($checkStatus){
$this->db->where('LO.ListCode',ADMIN);
$this->db->where('STB.IsActive','1'); $studentDetails = $this->studentInfoForDocumentStatus($fromDetails);
$this->db->where('LO.IsActive','1'); if($studentDetails){
$assignDet=$this->db->get()->last_row(); $arrayDetails['MobileNumber']=$studentDetails->MobileNumber;
if($assignDet){ $arrayDetails['LeadName']=$studentDetails->Firstname;
$arrayDetails['CreatedBy']=$assignDet->ID; $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{ else{
$arrayDetails['CreatedBy']=$fromDetails[0]['CreatedBy']; $arrayDetails['CreatedBy']=$fromDetails[0]['CreatedBy'];
} }
} // create activity in call tracking
else{ $this->db->select('ActivityID,ActivityName');
$arrayDetails['CreatedBy']=$fromDetails[0]['CreatedBy']; $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();
// create activity in call tracking if($leadDet){
$this->db->select('ActivityID,ActivityName'); $this->db->select('FollowupOn');
$this->db->like('ActivityName', 'Document', 'after'); $this->db->where('TrackingID',$leadDet->TrackingID);
$this->db->where('IsActive', '1'); // $this->db->order_by('InteractionId','DESC');
$activityDetails=$this->db->get(ACTIVITY)->last_row(); $existFollowupOn = $this->db->get(LEAD_TRACKING_FOLLOWUP)->last_row();
if($activityDetails){ // upate tracking status
$this->db->select('LD.LeadID,LT.TrackingID'); $changeStatusCode['StatusCode'] = $arrayDetails['StatusCode'];
$this->db->from(LEAD_DETAILS.' as LD'); $changeStatusCode['UpdatedBy'] = $arrayDetails['CreatedBy'];
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID'); $changeStatusCode['UpdatedOn'] = $arrayDetails['CreatedOn'];
$this->db->where('LD.MobileNumber',$arrayDetails['MobileNumber']); $changeStatusCode['CreatedBranch']=$arrayDetails['CreatedBranch'];
$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->where('TrackingID',$leadDet->TrackingID);
$this->db->select('FollowupOn'); $this->db->update(LEAD_TRACKING, $changeStatusCode);
$this->db->where('TrackingID',$leadDet->TrackingID); // end update status
// $this->db->order_by('InteractionId','DESC'); $updateTrackDetails['TrackingID'] = $leadDet->TrackingID;
$existFollowupOn = $this->db->get(LEAD_TRACKING_FOLLOWUP)->last_row(); $updateTrackDetails['FollowupOn'] = $arrayDetails['FollowupOn'];
// upate tracking status $updateTrackDetails['FollowupComments'] = $arrayDetails['FollowupComments'];
$changeStatusCode['StatusCode'] = $arrayDetails['StatusCode']; $updateTrackDetails['CreatedBy'] = $arrayDetails['CreatedBy'];
$changeStatusCode['UpdatedBy'] = $arrayDetails['CreatedBy']; $updateTrackDetails['CreatedOn'] = $arrayDetails['CreatedOn'];
$changeStatusCode['UpdatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $updateTrackDetails);
$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{ else{
$newLeadDetails['MobileNumber'] = $arrayDetails['MobileNumber']; $this->db->select('LeadID');
$newLeadDetails['LeadName'] = $arrayDetails['LeadName']; $this->db->where('MobileNumber',$arrayDetails['MobileNumber']);
$newLeadDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $checkLeadDet=$this->db->get(LEAD_DETAILS)->last_row();
$newLeadDetails['CreatedOn'] = $arrayDetails['CreatedOn']; if($checkLeadDet){
$this->db->insert(LEAD_DETAILS, $newLeadDetails); $updateLeadDetails['LeadID'] = $checkLeadDet->LeadID;
// this if for insert lead details $updateLeadDetails['ActivityStatus'] = $activityDetails->ActivityID;
if($this->db->affected_rows() == '1'){ $updateLeadDetails['University'] = $arrayDetails['University'];
// get and store insert id from db $updateLeadDetails['Course'] = $arrayDetails['Course'];
$track_Details['LeadID']=$this->db->insert_id(); $updateLeadDetails['AssignedTo'] = $arrayDetails['CreatedBy'];
$track_Details['ActivityStatus'] = $activityDetails->ActivityID; $updateLeadDetails['StatusCode'] = $arrayDetails['StatusCode'];
$track_Details['University'] = $arrayDetails['University']; $updateLeadDetails['CreatedBy'] = $arrayDetails['CreatedBy'];
$track_Details['Course'] = $arrayDetails['Course']; $updateLeadDetails['CreatedOn'] = $arrayDetails['CreatedOn'];
$track_Details['AssignedTo'] = $arrayDetails['CreatedBy']; $updateLeadDetails['CreatedBranch']=$arrayDetails['CreatedBranch'];
$track_Details['StatusCode'] = $arrayDetails['StatusCode']; $this->db->insert(LEAD_TRACKING, $updateLeadDetails);
$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 // this if for insert tracking details
if($this->db->affected_rows() == '1'){ if($this->db->affected_rows() == '1'){
$insertfollowup_Details['TrackingID']=$this->db->insert_id(); $followup_Details['TrackingID']=$this->db->insert_id();
$insertfollowup_Details['FollowupOn']=$arrayDetails['FollowupOn']; $followup_Details['FollowupOn']=$arrayDetails['FollowupOn'];
$insertfollowup_Details['FollowupComments']=$arrayDetails['FollowupComments']; $followup_Details['FollowupComments']=$arrayDetails['FollowupComments'];
$insertfollowup_Details['CreatedBy'] = $arrayDetails['CreatedBy']; $followup_Details['CreatedBy'] = $arrayDetails['CreatedBy'];
$insertfollowup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $followup_Details['CreatedOn'] = $arrayDetails['CreatedOn'];
$this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertfollowup_Details); $this->db->insert(LEAD_TRACKING_FOLLOWUP, $followup_Details);
// this if for insert follow up 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;
} }
return true;
} }
else{ else{
return false; return false;
} }
} }
/* /*