diff --git a/Apollo/api/application/models/Calltracking_model.php b/Apollo/api/application/models/Calltracking_model.php index 77ee765e..a253999b 100755 --- a/Apollo/api/application/models/Calltracking_model.php +++ b/Apollo/api/application/models/Calltracking_model.php @@ -177,6 +177,8 @@ class Calltracking_model extends CI_Model { public function getStaff($status=null,$branchID=null,$userType=null,$requestedBy) { + if($userType != SUPER_ADMIN){ + $this->db->select('LO.ID,ST.StaffID,ST.Firstname'); $this->db->from(LOGIN.' as LO'); $this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID'); @@ -202,10 +204,63 @@ class Calltracking_model extends CI_Model { else{ $result_staff[]=""; } + } + else{ + $this->db->select('BR.BranchCode,BR.BranchName'); + $this->db->from(BRANCH.' as BR'); + //$this->db->where('BR.IsActive',$status); + $branchDetails=$this->db->get(); + + if($branchDetails->result()){ + foreach ($branchDetails->result() as $branchRow){ + $branch_array['BranchCode'] = $branchRow->BranchCode; + $branch_array['BranchName'] = $branchRow->BranchName.'-'.$branchRow->BranchCode; + $branch_array['staffDetails'] = $this->superAdminBranch($branchRow->BranchCode,$status); + $result_staff[]=$branch_array; + } + + } + else{ + $result_staff[]=""; + } + + + } return $result_staff; } + /* + * get staff details based on branch id + * created by kms + * */ + public function superAdminBranch($branchID,$status){ + + $this->db->select('LO.ID,ST.StaffID,ST.Firstname'); + $this->db->from(LOGIN.' as LO'); + $this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID'); + $this->db->where('ST.IsActive',$status); + + $this->db->where('ST.BranchCode',$branchID); + $staffDetails=$this->db->get(); + if($staffDetails){ + $result_staff = array(); + foreach ($staffDetails->result() as $row) + { + $university_array['loginId'] = $row->ID; + $university_array['staffName'] = $row->Firstname.'-'.$row->StaffID; + $result_staff[]=$university_array; + } + + } + else{ + $result_staff[]=""; + } + + return $result_staff; + + } + /* * add lead details @@ -500,7 +555,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.StatusCode,LT.University,LT.Course,LT.AlternateMobile,LT.Address,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.StatusCode,LT.University,LT.Course,LT.AlternateMobile,LT.Address,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'); @@ -534,6 +589,7 @@ class Calltracking_model extends CI_Model { $tracking_array["TrackingID"]=$row->TrackingID; $tracking_array["ActivityStatus"]=$row->ActivityStatus; $tracking_array["AssignedTo"]=$row->AssignedTo; + $tracking_array["CreatedBranch"]=$row->CreatedBranch; $tracking_array["Firstname"]=$row->Firstname; $tracking_array["StatusCode"]=$row->StatusCode; $tracking_array["statusName"]=$row->statusListName;