This commit is contained in:
resicovenba 2017-11-30 18:18:14 +05:30
commit c3bd01a2d7
3 changed files with 249 additions and 28 deletions

View File

@ -118,7 +118,7 @@ class Calltracking_model extends CI_Model {
public function getStatus()
{
$this->db->select('ListCode,ListName');
$this->db->where('ListCode !=','S003');
$this->db->where('ListCode !=',REOPEN);
$this->db->where('ListGroup','1');
$this->db->order_by('ListCode','ASC');
$status = $this->db->get(PICK_LIST_DETAILS);
@ -407,7 +407,9 @@ class Calltracking_model extends CI_Model {
$now = new DateTime();
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
$todayFollowupDate=$now->format('d-m-Y');
$follouwpDetails=$this->todayFollowupDetails($todayFollowupDate,'S001');
$todayDateTime=$now->format('Y-m-d');
$follouwpDetails=$this->todayFollowupDetails($todayFollowupDate,CLOSE,'1');
if($follouwpDetails){
$result_array['todayStatus']=true;
$result_array['todayFolloupDetails']=$follouwpDetails;
@ -417,8 +419,28 @@ class Calltracking_model extends CI_Model {
$result_array['todayFolloupDetails']="";
}
/* $follouwpPendingDetails=$this->getPendingFollowupDetails($todayFollowupDate,'S001');
print_r($follouwpPendingDetails);die();*/
$follouwpPendingDetails=$this->todayFollowupDetails($todayFollowupDate,CLOSE,'2');
if($follouwpPendingDetails){
$result_array['todayPendingStatus']=true;
$result_array['PendingFolloupDetails']=$follouwpPendingDetails;
}
else{
$result_array['todayPendingStatus']=false;
$result_array['PendingFolloupDetails']="";
}
$todayLeadDetails=$this->todayFollowupDetails($todayDateTime,OPEN,'3');
if($todayLeadDetails){
$result_array['todayLeadStatus']=true;
$result_array['todayLeadDetails']=$todayLeadDetails;
}
else{
$result_array['todayLeadStatus']=false;
$result_array['todayLeadDetails']="";
}
return $result_array;
}
@ -426,19 +448,149 @@ print_r($follouwpPendingDetails);die();*/
* get date wise followup details
* @params date and status and check status
* */
public function todayFollowupDetails($todayDate=null,$status=null)
public function todayFollowupDetails($todayDate=null,$status=null,$check=null)
{
$this->db->distinct();
$this->db->select('LT.TrackingID');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->from(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->order_by('LT.TrackingID','ASC');
if($check!='3'){
$this->db->where('LT.StatusCode !=',$status);
}
else if($check=='3'){
$this->db->like('LD.CreatedOn', $todayDate, 'after');
}
$leadDetails=$this->db->get();
if($leadDetails){
$result_array = array();
foreach ($leadDetails->result() as $row){
$this->db->select('LTF.TrackingID,LTF.InteractionId');
$this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
$this->db->where('LTF.TrackingID',$row->TrackingID);
$lastFollowpID=$this->db->get()->last_row();
// get last followup details date wise
$this->db->distinct();
$this->db->select('LD.LeadName,LD.MobileNumber,LT.TrackingID,LT.LeadID,PLD.ListCode,PLD.ListName,LTF.FollowupOn,LT.StatusCode,PLD1.ListName as statusListName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(LEAD_TRACKING_FOLLOWUP.' as LTF', 'LTF.TrackingID = LT.TrackingID');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LTF.InteractionId',$lastFollowpID->InteractionId);
// check today date based follwup details
if($check=='1'){
$this->db->where('LTF.FollowupOn',$todayDate);
$this->db->where('LT.StatusCode !=',$status);
}
// check today date based pending followp details
else if($check=='2'){
$this->db->where('LTF.FollowupOn <= ',$todayDate);
$this->db->where('LT.StatusCode !=',$status);
}
else if($check=='3'){
$this->db->like('LD.CreatedOn', $todayDate, 'after');
}
$trackDetails=$this->db->get();
foreach ($trackDetails->result() as $row1)
{
$tracking_array["LeadID"]=$row1->LeadID;
$tracking_array["LeadName"]=$row1->LeadName;
$tracking_array["MobileNumber"]=$row1->MobileNumber;
$tracking_array["TrackingID"]=$row1->TrackingID;
$tracking_array["FollowupOn"]=$row1->FollowupOn;
$tracking_array["StatusCode"]=$row1->StatusCode;
$tracking_array["statusListName"]=$row1->statusListName;
$tracking_array["ListCode"]=$row1->ListCode;
$tracking_array["ListName"]=$row1->ListName;
$result[]=$tracking_array;
}
}
$result_array['trackingDetails']=$result;
return $result_array;
}
else{
return false;
}
}
/*
* get today created lead details for dashboard
* @params today date
* created by kms
* */
public function todayLeadDetails($todayDate=null)
{
/* $this->db->distinct();
$this->db->select('LD.LeadName,LD.MobileNumber,LT.TrackingID,LT.LeadID,PLD.ListCode,PLD.ListName,LTF.FollowupOn,LT.StatusCode,PLD1.ListName as statusListName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(LEAD_TRACKING_FOLLOWUP.' as LTF', 'LTF.TrackingID = LT.TrackingID');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LTF.FollowupOn',$todayDate);
$this->db->where('LT.StatusCode',$status);
$this->db->order_by('LT.TrackingID','ASC');
return $this->db->get()->result();
$this->db->like('LD.CreatedOn', $todayDate, 'after');
$this->db->order_by('LT.TrackingID','DESC');
return $this->db->get()->result();*/
$this->db->distinct();
$this->db->select('LT.TrackingID,LD.LeadID');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->from(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->order_by('LD.LeadID','DESC');
$this->db->like('LD.CreatedOn', $todayDate, 'after');
$leadDetails=$this->db->get();
if($leadDetails){
foreach ($leadDetails->result() as $row){
$this->db->select('LTF.TrackingID,LTF.InteractionId');
$this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
$this->db->where('LTF.TrackingID',$row->TrackingID);
$lastFollowpID=$this->db->get()->last_row();
// get last followup details date wise
$this->db->distinct();
$this->db->select('LD.LeadName,LD.MobileNumber,LT.TrackingID,LT.LeadID,PLD.ListCode,PLD.ListName,LTF.FollowupOn,LT.StatusCode,PLD1.ListName as statusListName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(LEAD_TRACKING_FOLLOWUP.' as LTF', 'LTF.TrackingID = LT.TrackingID');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LTF.InteractionId',$lastFollowpID->InteractionId);
foreach ($trackDetails->result() as $row1)
{
$tracking_array["LeadID"]=$row1->LeadID;
$tracking_array["LeadName"]=$row1->LeadName;
$tracking_array["MobileNumber"]=$row1->MobileNumber;
$tracking_array["TrackingID"]=$row1->TrackingID;
$tracking_array["FollowupOn"]=$row1->FollowupOn;
$tracking_array["StatusCode"]=$row1->StatusCode;
$tracking_array["statusListName"]=$row1->statusListName;
$tracking_array["ListCode"]=$row1->ListCode;
$tracking_array["ListName"]=$row1->ListName;
$result[]=$tracking_array;
}
}
}
else{
return false;
}
}
}

View File

@ -10,7 +10,7 @@ app.controller('dashboardCtrl', ["$scope","toaster", "$filter", "ngTableParams",
* this method called from view ng-init directive
* created by kms
* */
$scope.todayFolloupDetails="";
$scope.initCallTracking = function () {
var getCallTrack = {
method: 'POST',
@ -25,15 +25,38 @@ app.controller('dashboardCtrl', ["$scope","toaster", "$filter", "ngTableParams",
$http(getCallTrack).then(function (response) {
if (response.data.status==200) {
if(response.data.todayStatus){
$scope.todayFolloupDetails=response.data.todayFolloupDetails;
$scope.todayFolloupDetails=response.data.todayFolloupDetails.trackingDetails;
$scope.emptyDataToday=false;
}
else{
$scope.todayFolloupDetails='EMPTY';
$scope.todayFolloupDetails="";
$scope.emptyDataToday=true;
}
if(response.data.todayPendingStatus){
$scope.pendingFolloupDetails=response.data.PendingFolloupDetails.trackingDetails;
$scope.emptyDataPending=false;
}
else{
$scope.pendingFolloupDetails="";
$scope.emptyDataPending=true;
}
if(response.data.todayLeadStatus){
$scope.leadDetails=response.data.todayLeadDetails.trackingDetails;
$scope.emptyDataLead=false;
}
else{
$scope.leadDetails="";
$scope.emptyDataLead=true;
}
} else {
$scope.todayFolloupDetails='EMPTY';
$scope.emptyDataToday=true;
$scope.emptyDataPending=true;
}
});

View File

@ -16,17 +16,18 @@
<!-- start: FEATURED BOX LINKS -->
<div class="container-fluid container-fullw bg-white" ng-controller="dashboardCtrl">
<div class="row" data-ng-init="initCallTracking()">
<div class="row">
<div class="col-sm-6">
<div class="panel panel-white" id="panel6">
<div class="panel panel-white" id="panel1">
<div class="panel-heading panel-white">
<h4 class="panel-title text-green">Today Follow Up Details</h4>
<ct-paneltool class="panel-tools" tool-refresh="load1" ng-click="initCallTracking()"></ct-paneltool>
</div>
<div class="panel-body">
<div ng-hide="todayFolloupDetails!='EMPTY'">
<div ng-if="emptyDataToday==true">
<center><h5 class="text-dark">No Followup!</h5></center>
</div>
<div class="panel-scroll height-180" perfect-scrollbar wheel-propagation="false" suppress-scroll-x="true" ng-if="todayFolloupDetails!=''">
<div class="panel-scroll height-180" perfect-scrollbar wheel-propagation="false" suppress-scroll-x="true" ng-if="emptyDataToday==false">
<table class="table table-hover">
<thead>
<tr>
@ -59,13 +60,16 @@
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-white" id="panel6">
<div class="panel panel-white" id="panel2">
<div class="panel-heading panel-white">
<h4 class="panel-title text-red">Pending Follow Up Details</h4>
<ct-paneltool class="panel-tools" tool-refresh="load1" ng-click="initCallTracking()"></ct-paneltool>
</div>
<div class="panel-body">
<div class="panel-scroll height-180" perfect-scrollbar wheel-propagation="false" suppress-scroll-x="true">
<div ng-if="emptyDataPending==true">
<center><h5 class="text-dark">No Pending Followup!</h5></center>
</div>
<div class="panel-scroll height-180" perfect-scrollbar wheel-propagation="false" suppress-scroll-x="true" ng-if="emptyDataPending==false">
<table class="table table-hover">
<thead>
<tr>
@ -73,22 +77,20 @@
<th>Lead Name</th>
<th>Mobile No</th>
<th>Activity</th>
<th>Followup On</th>
<th>Status</th>
</tr>
</thead>
<tbody ng-repeat="today in todayFolloupDetails">
<tbody ng-repeat="pending in pendingFolloupDetails">
<tr>
<td>{{today.TrackingID}}</td>
<td>{{today.LeadName}}</td>
<td>{{today.MobileNumber}}</td>
<td>{{today.ListName}}</td>
<td class="hidden-xs" ng-if="today.StatusCode!='S001'"><span class="label label-sm label-success">{{today.statusListName}}</span></td>
<td class="hidden-xs" ng-if="today.StatusCode=='S001'"><span class="label label-sm label-warning">{{today.statusListName}}</span></td>
<td>{{pending.TrackingID}}</td>
<td>{{pending.LeadName}}</td>
<td>{{pending.MobileNumber}}</td>
<td>{{pending.ListName}}</td>
<td>{{pending.FollowupOn}}</td>
<td class="hidden-xs"><span class="label label-sm label-danger">{{pending.statusListName}}</span></td>
</tr>
</tbody>
@ -97,5 +99,49 @@
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="panel panel-white" id="panel3">
<div class="panel-heading panel-white">
<h4 class="panel-title text-purple">Today Created Lead Details</h4>
<ct-paneltool class="panel-tools" tool-refresh="load1" ng-click="initCallTracking()"></ct-paneltool>
</div>
<div class="panel-body">
<div ng-if="emptyDataLead==true">
<center><h5 class="text-dark">No Lead Created By Today!</h5></center>
</div>
<div class="panel-scroll height-180" perfect-scrollbar wheel-propagation="false" suppress-scroll-x="true" ng-if="emptyDataLead==false">
<table class="table table-hover">
<thead>
<tr>
<th>Tracking ID</th>
<th>Lead Name</th>
<th>Mobile No</th>
<th>Activity</th>
<th>Followup On</th>
<th>Status</th>
</tr>
</thead>
<tbody ng-repeat="lead in leadDetails">
<tr>
<td>{{lead.TrackingID}}</td>
<td>{{lead.LeadName}}</td>
<td>{{lead.MobileNumber}}</td>
<td>{{lead.ListName}}</td>
<td>{{lead.FollowupOn}}</td>
<td class="hidden-xs" ng-if="lead.StatusCode!='S001'"><span class="label label-sm label-info">{{lead.statusListName}}</span></td>
<td class="hidden-xs" ng-if="lead.StatusCode=='S001'"><span class="label label-sm label-info">{{lead.statusListName}}</span></td> </tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>