call tracking changes done

This commit is contained in:
gandhimathi 2018-01-18 17:48:48 +05:30
parent 8de1eb6702
commit d0aa8f0c07

View File

@ -13,7 +13,7 @@ class Calltracking_model extends CI_Model {
* @params mobile number,requestedby
* created by kms
* */
public function getLeadDetails($requestedBy=null,$mobileNumber=null)
public function getLeadDetails($requestedBy=null,$mobileNumber=null,$branchID=null,$userType=null)
{
$this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,LT.University,LT.Course,LT.AlternateMobile,LT.Address');
$this->db->from(LEAD_DETAILS.' as LD');
@ -63,7 +63,7 @@ class Calltracking_model extends CI_Model {
//$result_array['universityDetails']=$this->getUniversityDetails();
$result_array['activityDetails']=$this->getActivityDetails();
// $result_array['statusDetails']=$this->getStatus();
$result_array['staffDetails']=$this->getStaff("1");
$result_array['staffDetails']=$this->getStaff("1",$branchID,$userType,$requestedBy);
return $result_array;
}
@ -175,12 +175,19 @@ class Calltracking_model extends CI_Model {
*
* */
public function getStaff($status=null)
public function getStaff($status=null,$branchID=null,$userType=null,$requestedBy)
{
$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);
if($userType== ADMIN){
$this->db->where('ST.BranchCode',$branchID);
$this->db->where('LO.ListCode !=',SUPER_ADMIN);
}
if($userType== EMPLOYEE){
$this->db->where('LO.ID',$requestedBy);
}
$staffDetails=$this->db->get();
if($staffDetails){
$result_staff = array();
@ -264,6 +271,11 @@ class Calltracking_model extends CI_Model {
$this->db->where('LT.CreatedBranch', $search['CreatedBranch']);
}
if ($search['requestedDept'] == EMPLOYEE){
$this->db->where('LT.AssignedTo', $search['requestedBy']);
}
if($search['searchDate']!='' OR $search['searchDate']!=null){
/* if(sizeof($search['searchDate']) == '1'){
$this->db->where('LTF.FollowupOn <= ', $search['searchDate'][0]);
@ -348,6 +360,11 @@ class Calltracking_model extends CI_Model {
if($search['CreatedBranch'] !='All'){
$this->db->where('LT.CreatedBranch', $search['CreatedBranch']);
}
if ($search['requestedDept'] == EMPLOYEE){
$this->db->where('LT.AssignedTo', $search['requestedBy']);
}
if(($search['searchDate']!='' OR $search['searchDate']!=null) AND sizeof($search['searchDate']) == '1'){
@ -492,6 +509,11 @@ class Calltracking_model extends CI_Model {
if($trackingID['CreatedBranch'] !='All'){
$this->db->where('LT.CreatedBranch', $trackingID['CreatedBranch']);
}
if ($trackingID['requestedDept'] == EMPLOYEE){
$this->db->where('LT.AssignedTo', $trackingID['UpdatedBy']);
}
$leadDet=$this->db->get();
@ -520,7 +542,7 @@ class Calltracking_model extends CI_Model {
$tracking_array["AlternateMobile"]=$row->AlternateMobile;
$tracking_array["Address"]=$row->Address;
$tracking_array["followupDetails"]=$this->getTrackingFollowup($row->TrackingID);
$tracking_array["collectTrackedID"]=$this->getStudentTrackedID($row->MobileNumber,$trackingID['CreatedBranch']);
$tracking_array["collectTrackedID"]=$this->getStudentTrackedID($row->MobileNumber,$trackingID['CreatedBranch'],$trackingID['requestedDept'],$trackingID['UpdatedBy']);
$result[]=$tracking_array;
@ -528,6 +550,9 @@ class Calltracking_model extends CI_Model {
}
$result_array['trackingDetails']=$result;
$result_array['statusDetails']=$this->getStatus($activityID);
$result_array['staffDetails']=$this->getStaff("1",$trackingID['CreatedBranch'],$trackingID['requestedDept'],$trackingID['UpdatedBy']);
$result_array['trackingDetails']=$result;
}
@ -546,7 +571,7 @@ class Calltracking_model extends CI_Model {
* @params mobile number
* created by kms
* */
public function getStudentTrackedID($stuMobile=null,$branchId=null)
public function getStudentTrackedID($stuMobile=null,$branchId=null,$reqDept=null,$updatedBy=null)
{
$this->db->distinct();
$this->db->select('LT.TrackingID,LT.LeadID,AV.ActivityID,AV.ActivityName,PLD.ListName');
@ -555,9 +580,15 @@ class Calltracking_model extends CI_Model {
$this->db->join(ACTIVITY.' as AV', 'AV.ActivityID = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.StatusCode');
$this->db->where('LD.MobileNumber',$stuMobile);
if($branchId !='All'){
$this->db->where('LT.CreatedBranch', $branchId);
}
if ($reqDept == EMPLOYEE){
$this->db->where('LT.AssignedTo', $updatedBy);
}
$this->db->order_by('LT.TrackingID','ASC');