call track changes done

This commit is contained in:
gandhimathi 2018-05-17 15:36:46 +05:30
parent e59b3f5b60
commit 9df410037f

View File

@ -362,6 +362,7 @@ class Calltracking_model extends CI_Model {
$this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID');
$this->db->join(ACTIVITY.' as AV', 'AV.ActivityID = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('PLD1.ListName !=', 'CLOSE');
$this->db->where('LTF.IsActive', '1');
if($search['CreatedBranch'] !='All' AND $search['requestedDept'] != EMPLOYEE){
$this->db->where('LT.CreatedBranch', $search['CreatedBranch']);
@ -390,7 +391,6 @@ class Calltracking_model extends CI_Model {
$this->db->group_by('LT.TrackingID');
}
// $this->db->group_by('LD.MobileNumber');
$leadDet=$this->db->get();
if($this->db->affected_rows()==0){
@ -455,6 +455,7 @@ class Calltracking_model extends CI_Model {
$this->db->join(ACTIVITY.' as AV', 'AV.ActivityID = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LTF.IsActive', '1');
$this->db->where('PLD1.ListName !=', 'CLOSE');
if($search['CreatedBranch'] !='All' AND $search['requestedDept'] != EMPLOYEE){
$this->db->where('LT.CreatedBranch', $search['CreatedBranch']);
@ -468,7 +469,7 @@ class Calltracking_model extends CI_Model {
if(($search['searchDate']!='' OR $search['searchDate']!=null) AND sizeof($search['searchDate']) == '1'){
// $this->db->where('LTF.FollowupOn <= ', $search['searchDate'][0]);
$this->db->where('PLD1.ListName !=', 'CLOSE');
// $this->db->where('PLD1.ListName !=', 'CLOSE');
$leadDet=$this->db->get();
if($leadDet->result()){
@ -570,6 +571,17 @@ class Calltracking_model extends CI_Model {
$result['followupStatus'] = true;
$result['trackingID'] = $updateDetails['TrackingID'];
$result['message'] = "Successfully followup details updated";
// update pending doc status in student register
$this->db->select('ListCode,ListName');
$this->db->where('ListCode',$updateDetails['StatusCode']);
$statusDetails=$this->db->get(PICK_LIST_DETAILS)->last_row();
if($statusDetails AND $statusDetails->ListName=="CLOSE" AND $updateDetails['PendingDocStatus'] !='' AND $updateDetails['PendingDocStatus'] !=null){
$updateStudentPendingDocs['Status']=0;
$this->db->where('ID',$updateDetails['PendingDocStatus']);
$this->db->update(STUDENTDOCUMENTTRACKDETAILS, $updateStudentPendingDocs);
}
} else {
$result['followupStatus'] = false;
$result['message'] = "Something went wrong.please try again";
@ -598,7 +610,7 @@ class Calltracking_model extends CI_Model {
public function getLoadFollowupDetails($trackingID)
{
$this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.TrackingID,LT.ActivityStatus,LT.AssignedTo,LT.CreatedBranch,BR.BranchName,LT.StatusCode,LT.University,LT.Course,LT.AlternateMobile,LT.Address,LT.ReferredBy,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,AV.ActivityID,AV.ActivityName');
$this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.TrackingID,LT.ActivityStatus,LT.AssignedTo,LT.CreatedBranch,LT.PendingDocStatus,BR.BranchName,LT.StatusCode,LT.University,LT.Course,LT.AlternateMobile,LT.Address,LT.ReferredBy,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,AV.ActivityID,AV.ActivityName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(LOGIN.' as LO', 'LO.ID = LT.AssignedTo');
@ -648,6 +660,7 @@ class Calltracking_model extends CI_Model {
$tracking_array["AlternateMobile"]=$row->AlternateMobile;
$tracking_array["Address"]=$row->Address;
$tracking_array["ReferredBy"]=$row->ReferredBy;
$tracking_array["PendingDocStatus"]=$row->PendingDocStatus;
$tracking_array["followupDetails"]=$this->getTrackingFollowup($row->TrackingID);
$tracking_array["collectTrackedID"]=$this->getStudentTrackedID($row->MobileNumber,$trackingID['CreatedBranch'],$trackingID['requestedDept'],$trackingID['UpdatedBy']);
@ -1281,5 +1294,30 @@ class Calltracking_model extends CI_Model {
return $result;
}
/*
* delete pending doc details from call tracking
* created by kms
* */
public function deletePendingDocTrack($docID=null){
$this->db->select('TrackingID,LeadID');
$this->db->where('PendingDocStatus',$docID);
$getTrackingID=$this->db->get(LEAD_TRACKING)->last_row();
if($getTrackingID){
$this->db->where('TrackingID', $getTrackingID->TrackingID);
$this->db->delete(LEAD_TRACKING_FOLLOWUP);
if ($this->db->affected_rows() >= 1) {
$this->db->where('PendingDocStatus', $docID);
$this->db->where('TrackingID', $getTrackingID->TrackingID);
$this->db->delete(LEAD_TRACKING);
if ($this->db->affected_rows() >= 1) {
$this->db->where('LeadID', $getTrackingID->LeadID);
$this->db->delete(LEAD_DETAILS);
}
}
}
return true;
}
}