new lead report added

This commit is contained in:
gandhimathi 2018-08-11 19:49:13 +05:30
parent e5b52e1c59
commit 1296275d2f
9 changed files with 758 additions and 1 deletions

View File

@ -318,4 +318,5 @@ $route['report_doc_pending'] = 'Report/doc_pending';
$route['report_wav_ref'] = 'Report/wav_ref';
$route['report_examfee'] = 'Report/examfee';
$route['report_balfee'] = 'Report/balfee';
$route['report_lead'] = 'Report/lead';

View File

@ -310,6 +310,31 @@ class Report extends REST_Controller {
}
}
public function lead_post()
{
$from = $this->post('from');
$to = $this->post('to');
$br = $this->post('branch');
$getStatus = $this->report_model->lead($from,$to,$br);
//print_r($getStatus);
if ($getStatus)
{
$getStatus['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records found!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function filters_post()
{

View File

@ -741,6 +741,48 @@ left join (SELECT StudentID as sid,UniversityID as uid,CourseID as cid,Enrollmen
return $results;
}
public function lead($from=null,$to=null,$br=null){
$sql = "select InteractionID,date_format(ltf.CreatedOn,'%d-%m-%Y') as date,ltf.TrackingID as tid,ltf.FollowupOn as fup,ld.LeadName as name,ld.MobileNumber as mobile,lt.University as univ,lt.Course as course,lt.Course as prvStatus,list.ListName as prsStatus,ltf.FollowupComments as cmnts,ifnull(am.ActivityName,'-') as activity,sd.FirstName as AssignTo
from T_Lead_Tracking_Followup as ltf
left join T_Lead_Tracking lt on lt.TrackingID=ltf.TrackingID
join T_Login l on l.ID=lt.AssignedTo
join T_StaffDetails sd on sd.StaffID=l.StaffID
left join T_Lead_Details ld on ld.LeadID=lt.LeadID
left join T_ActivityMaster am on am.ActivityID=lt.ActivityStatus
join T_PickListDetails list on list.ListCode=ltf.StatusName
where InteractionID in (select max(InteractionID) from T_Lead_Tracking_Followup group by TrackingID) and lt.CreatedBranch = '".$br."'
";
if ($from and $to != ''){
$fromd= date("Y-m-d",strtotime($from));
$tod=date("Y-m-d",strtotime($to));
$sql.=" and date(ltf.CreatedOn) >= '".$fromd."'
and date(ltf.CreatedOn) <= '".$tod."'";
}
$leadDet=$this->db->query($sql);
$answer = $leadDet->result();
//echo $sql;
if (count($answer) > 0) {
$results['leadList'] = true;
$results['lead_data'] = $answer;
} else {
$results['leadList'] = false;
$results['message'] = 'No record found';
}
return $results;
}
}

View File

@ -90,7 +90,8 @@
"doc_pending": "DOCUMENT PENDING STUDENT LIST REPORT",
"wav_ref": "WAIVER AND REFERAL REPORT",
"examfee": "EXAM WRITING FEE REPORT",
"balfee": "FEE BALANCE REPORT"
"balfee": "FEE BALANCE REPORT",
"lead": "LEAD TRACKING REPORT"
},
"student": {

View File

@ -216,6 +216,7 @@ app.constant('JS_REQUIRES', {
'report_waiver_referalCtrl':'assets/js/controllers/report_waiver_referalCtrl.js',
'report_examfeeCtrl':'assets/js/controllers/report_examfeeCtrl.js',
'report_balfeeCtrl':'assets/js/controllers/report_balfeeCtrl.js',
'report_leadCtrl':'assets/js/controllers/report_leadCtrl.js',
},
//*** angularJS Modules
modules: [{

View File

@ -651,6 +651,12 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com
resolve: loadSequence('ui.select','report_balfeeCtrl','ngTable', 'ladda', 'angular-ladda'),
title: 'Balance Fee Report',
}).state('app.reports.lead', {
url: '/report_leadCtrl',
templateUrl: "assets/views/report_lead.html",
resolve: loadSequence('ui.select','report_leadCtrl','ngTable', 'ladda', 'angular-ladda'),
title: 'Lead Details Report',
}).state('app.hallTicket', {
url: '/hallticket',
template: '<div ui-view class="fade-in-up"> <div style="margin: auto; width: 50%;padding: 10px;"> HALLTICKET</div> </div>',

View File

@ -0,0 +1,514 @@
'use strict';
/*** controller***/
app.controller('report_leadCtrl', ["$scope", "$filter","$rootScope","$modal", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', '$window',"dateListDescService",
function ($scope, $filter,$rootScope,$modal, apiPoint, $http, SweetAlert, $state, md5, ipCookie, $window, dateListDescService) {
/*
* auto call tracking/
*/
$scope.userType=JSON.parse(localStorage.getItem('localObj')).localType;
$scope.myModel = {
"date": new Date(),
"activity": "",
"assignedTo": "",
"status": "",
"referedBy": '',
"comments":'',
"enquiryStatus":'',
"important":false,
"branch":"",
};
//get current date
$scope.hideDateSearch=true;
$scope.modifyMinDate = moment();
//$scope.minDate = $filter('date')($scope.modifyMinDate, 'MM-dd-yyyy');
$scope.currentDate=$filter('date')(new Date(), 'dd-MM-yyyy');
// get 30 plus date for follwup details
$scope.modifyDate = moment();
$scope.modifyDate.add(30, 'days');
$scope.futureDate = $filter('date')($scope.modifyDate, 'dd-MM-yyyy');
$scope.myModel.date=$scope.currentDate;
// console.log($scope.currentDate);
/**
* End of the call tracking
*/
// DataTables configurable options
$scope.filters = {
"branch": "",
"from_date": "",
"to_date": "",
};
$scope.filters = function () {
var filterlist = {
method: 'POST',
url: apiPoint.url + 'report_filters/',
headers: {
'Content-Type': 'application/json'
},
data: {
branch : JSON.parse(localStorage.getItem('localObj')).localBranchID
}
};
$http(filterlist).then(function (response) {
if (response.data) {
$scope.batch=[];
$scope.batchlist = response.data.batch;
$scope.university = response.data.university;
//Desc order Batchlist
angular.forEach($scope.batchlist,function (values,key) {
var parts = values.BatchDate.split("-");
$scope.batch.push({
"batchcode":values.batchcode,
"batch":values.batch + '('+ values.batchcode + ')',
"BatchDate":values.BatchDate,
"givenDateObject":new Date(parts[2], parts[1] - 1, parts[0])
})
});
// call service for make a list in desc order based on date
$scope.batch=dateListDescService.getOrderByList($scope.batch);
//console.log($scope.branch);
} else {
}
});
}
$scope.onSubmit = function () {
//alert($scope.batch.name);
$scope.lead_data = '';
$scope.message = '';
var response_data = {
method: 'POST',
url: apiPoint.url + 'report_lead/',
headers: {
'Content-Type': 'application/json'
},
data: {
branch: JSON.parse(localStorage.getItem('localObj')).localBranchID,
from : $scope.filters.from_date,
to : $scope.filters.to_date
}
};
$http(response_data).then(function (response) {
if (response.data.leadList == true) {
$scope.lead_data = response.data.lead_data;
for(var i=0;i<$scope.lead_data.length;i++)
$scope.lead_data[i].SL_NO = i+1;
} else {
$scope.message = response.data.message;
}
});
}
var mystyle = {
sheetid: 'Lead REPORT',
headers: true,
caption: {
title:'Calls done on a Particular Day/Period - Report',
width: '300px',
style:'font-size:50px;'
},
// style:'background:#00FF00',
column: {
style:'font-size:10px'
},
};
$scope.exportData = function () {
alasql('SELECT CAST(SL_NO AS NUMBER) as SLNO,date as Date,CAST(tid AS NUMBER) as TrackingID,fup as FollowupDate,name as Name,CAST(mobile AS NUMBER) as MobileNo,univ as University,course as Course,prsStatus as PresentStatus,cmnts as Comments,activity as Activity,AssignTo as AssignTo INTO XLS("Lead_Report.xls",?) FROM ?',[mystyle,$scope.lead_data]);
};
/*modal controller
* */
app.controller('studentModalDemoCtrl', ["$scope","$rootScope", "$modal", "$log", "API_POINTS", "$http", function ($scope,$rootScope, $modal, $log, apiPoint, $http) {
//Tooltip for print button
$scope.dynamicTooltip = 'Student View';
// $scope.items = ['item1', 'item2', 'item3'];
$scope.open = function (studentDetails) {
// get student view details
var getcourse = {
method: 'POST',
url: apiPoint.url + 'getStudentBasicInfo/',
headers: {
'Content-Type': 'application/json'
},
data: {
requestedBy: studentDetails.Phone_number,
requestedFrom: 3,
branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID
}
};
$http(getcourse).then(function (response) {
if (response.data.status == 200 && response.data.studentStatus == true) {
$scope.courseEditLoading = false;
// $scope.studentDetails = response.data.studentDetails;
$scope.studentDetails = response.data;
// $scope.courseDetails = response.data.courseDetails;
var modalInstance = $modal.open({
templateUrl: 'assets/views/student/studentDetailsModal.html',
controller: 'ModalInstanceCtrl',
// size: size,
resolve: {
items: function () {
return $scope.studentDetails;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
} else {
swal("Failed!", "This student is not registerd", "warning");
$scope.courseEditLoading = false;
$scope.studentDetails = "";
$scope.courseDetails = "";
}
});
};
$scope.open1 = function (values,type) {
var modalInstance1 = $modal.open({
templateUrl: 'assets/views/student/studentPaymentModal.html',
controller: 'ModalInstanceCtrl1',
// size: size,
resolve: {
items1: function () {
var myvalues =
{
"values":values,
"type":type
};
return myvalues;
}
}
});
modalInstance1.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
$scope.printStudentDetails = function (details) {
$rootScope.pdfItems = details;
var printInstance = $modal.open({
templateUrl: 'assets/views/student/studentPdf.html',
controller: 'studentModalDemoCtrl',
});
};
// generate pdf for student view
$scope.export = function(getName) {
kendo.drawing.drawDOM($("#exportthis")).then(function(group) {
kendo.drawing.pdf.saveAs(group, getName+".pdf");
});
}
}]);
// Please note that $modalInstance represents a modal window (instance) dependency.
// It is not the same as the $modal service used above.
app.controller('ModalInstanceCtrl', ["$scope", "$modalInstance", "items", "WordsService", function ($scope, $modalInstance, items, WordsService) {
$scope.items = items;
$scope.selected = {
item: $scope.items[0]
};
$scope.ok = function () {
$modalInstance.close($scope.selected.item);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
}]);
app.controller('ModalInstanceCtrl1', ["$scope", "$modalInstance", "items1", "WordsService", function ($scope, $modalInstance, items1, WordsService) {
$scope.items1 = items1.values;
$scope.selectedtype = items1.type;
$scope.ok = function () {
$modalInstance.close($scope.selected.item);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
}]);
/**
* Auto Call Tracking Sriram
*/
$scope.selectedStudentsID = [];
$scope.isCheckAll = function(e){
var val = (e.target.checked ? true : false);
if(val)
{
// $scope.disable = false;
var len = $scope.lead_data.length;
var i = 0;
for(i=0;i<len;i++)
{
if($scope.selectedStudentsID.indexOf($scope.lead_data[i]) === -1)
{
$scope.selectedStudentsID.push($scope.lead_data[i]);
}
}
}
else
{
// $scope.disable = true;
$scope.selectedStudentsID = [];
}
if($scope.selectedStudentsID !=''){
$scope.disable = false;
}else{
$scope.disable = true;
}
console.log($scope.selectedStudentsID);
}
$scope.isClick = function(e){
var ide = e.target;
var val = (ide.checked ? true : false);
var sid = e.target.id;
// console.log("328");
// console.log($scope.balfee_data);
angular.forEach($scope.lead_data,function(value,key){
if(sid == value.Student_id)
{
sid = value;
}
});
console.log(sid);
var pos = $scope.selectedStudentsID.indexOf(sid);
//alert(val);
console.log($scope.selectedStudentsID.indexOf(sid));
if(val)
{
if( pos == -1)
{
//console.log("PUSH");
$scope.selectedStudentsID.push(sid);
}
}
else
{
//console.log("POP");
$scope.selectedStudentsID.splice(pos,1);
}
//
if(val){
$scope.disable = false;
}else{
$scope.disable = true;
}
//console.log($scope.selectedStudentsID);
}
$scope.calltracking = function(){
if($scope.selectedStudentsID ==''){
swal('Select Check box','','warning');
return false;
}else{
$scope.controller = 'ng-controller="report_leadCtrl"';
$scope.myModel.comments = 'Call Tracking for Lead Report';
var lead = {
method: 'POST',
url: apiPoint.url + 'getTrackingLeadDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
student:$scope.selectedStudentsID,
branchID:JSON.parse(localStorage.getItem('localObj')).localBranchID,
userType:JSON.parse(localStorage.getItem('localObj')).localType,
}
};
$http(lead).then(function (response) {
if (response.data.status==200) {
$rootScope.activity = response.data.activityDetails;
$rootScope.status = response.data.statusDetails;
$rootScope.staffDetails = response.data.staffDetails;
$rootScope.studentDetails = $scope.selectedStudentsID;
// $scope.modalopen($scope.activity);
var modalInstance = $modal.open({
templateUrl: 'assets/views/autoCalltracking.html',
controller: 'report_leadCtrl',
// size: size,
resolve: {
pdfitems: function () {
return $scope.activity;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
}
});
}
}
$scope.trackForm = {
submit: function (form, myModel,loading,selectedStudents) {
//console.log(selectedStudents);
if(isNaN(myModel.date)){
$scope.nextFollowupDate = myModel.date;
}
else{
$scope.getdate=new Date(myModel.date).toDateString();
$scope.nextFollowupDate = $filter('date')(new Date($scope.getdate), 'dd-MM-yyyy');
}
var firstError = null;
if (form.$invalid) {
var field = null, firstError = null;
for (field in form) {
if (field[0] != '$') {
if (firstError === null && !form[field].$valid) {
firstError = form[field].$name;
}
if (form[field].$pristine) {
form[field].$dirty = true;
}
}
}
angular.element('.ng-invalid[name=' + firstError + ']').focus();
// swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
} else {
$scope.ldloading1 = {};
$scope.ldloading1[loading.replace('-', '_')] = true;
/* hide this fun after branch level changes
if($scope.userType !='R004'){
$scope.updateBranchID = JSON.parse(localStorage.getItem('localObj')).localBranchID;
$scope.updateAssignTo = myModel.assignedTo;
}
else{
$scope.updateBranchID = myModel.branch.BranchCode;
$scope.updateAssignTo = myModel.assignedTo;
}*/
var addLead = {
method: 'POST',
url: apiPoint.url + 'autoAddlead/',
headers: {
'Content-Type': 'application/json'
},
data: {
student:selectedStudents,
date: $scope.nextFollowupDate,
activity: myModel.activity.activityID,
assignedTo: myModel.assignedTo,
status: myModel.status,
referedBy: myModel.referedBy,
comments:"Call Tracking For Report Certificate Details ",
enquiryStatus:myModel.enquiryStatus,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID
}
};
$http(addLead).then(function (response) {
console.log(response);
if (response.data.status==200 && response.data.leadDetails.leadStatus == true) {
swal(" ", response.data.leadDetails.message, "success");
window.location.reload();
} else {
swal(" ", response.data.leadDetails.message, "error");
window.location.reload();
}
});
}
},
reset: function (form) {
$scope.myModel = angular.copy($scope.master);
form.$setPristine(true);
$scope.myModel = {
"studentName": "",
"mobileNumber": "",
"universityName": "",
"courseName": "",
"activity": "",
"assignedTo": "",
"status": "",
"referedBy": '',
"comments":''
};
}
};
/**
* Call Tracking End
*/
}]);

View File

@ -466,6 +466,11 @@
<span class="title" translate="sidebar.nav.report.balfee">Balance Fee Report</span>
</a>
</li>
<li ui-sref-active="active">
<a ui-sref="app.reports.lead" ng-click="checkSuperAdmin()">
<span class="title" translate="sidebar.nav.report.lead">Lead Tracking Report</span>
</a>
</li>
@ -925,6 +930,11 @@
<span class="title" translate="sidebar.nav.report.balfee">Balance Fee Report</span>
</a>
</li>
<li ui-sref-active="active">
<a ui-sref="app.reports.lead" ng-click="checkAdmin()">
<span class="title" translate="sidebar.nav.report.lead">Lead Tracking Report</span>
</a>
</li>

View File

@ -0,0 +1,157 @@
<section id="page-title">
<div class="row">
<div class="col-sm-8">
<h1 class="mainTitle">Calls done on a Particular Day/Period - Report</h1>
</div>
<!-- <div ncy-breadcrumb></div> -->
</div>
</section>
<style>
td,th {
white-space: nowrap;
}
th{
text-align:center;
}
/* .sort-icon {
font-size: 9px;
margin-left: 5px;
}
th {
cursor: pointer;
} */
</style>
<script type="text/javascript" src="bower_components/ng-table-excel-export/ng-table-excel-export.min.js">
</script>
<div class="container-fluid container-fullw bg-white">
<div ng-controller="report_leadCtrl" ng-init="filters()">
<form name="Form" id="form" novalidate ng-submit="onSubmit()" method="post">
<fieldset>
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-4">
<!--<pre>{{searchData.date}}</pre>-->
<div data-ng-controller="DatepickerDemoCtrl">
<label>
From Date
</label>
<input type="text" tabindex="1" class="form-control " ng-click="startOpen = !startOpen" datepicker-popup="dd-MM-yyyy" ng-model="filters.from_date"
is-open="startOpen" ng-init="startOpen = false" name="addDate" datepicker-options="dateOptions"
placeholder="Select Date" close-text="Close" required="required" ng-change="changeDate()"
show-button-bar="true" />
</div>
</div>
<div class="col-md-4">
<!--<pre>{{searchData.date}}</pre>-->
<div data-ng-controller="DatepickerDemoCtrl">
<label>
To Date
</label>
<input type="text" tabindex="1" class="form-control " ng-click="startOpen = !startOpen" datepicker-popup="dd-MM-yyyy" ng-model="filters.to_date"
is-open="startOpen" ng-init="startOpen = false" name="addDate" datepicker-options="dateOptions"
placeholder="Select Date" close-text="Close" required="required" ng-change="changeToDate()"
show-button-bar="true" />
</div>
</div>
<!-- <div class="col-md-3">
<label for="form-field-select-2">
Batch
</label>
<select class="form-control" tabindex="3" class="cs-select cs-skin-elastic" name="batch" ng-model="searchData.Batch" ng-change="getValueChange()">
<option value="" selected>Select Batch</option>
<option ng-repeat="itemBatch in batchData" value="{{itemBatch.BatchCode}}">{{itemBatch.BatchName}}</option>
</select>
</div> -->
<div class="col-md-3" style="padding-top: 2.3%;">
<div >
<button type="submit" class="btn btn-success btn-o" tabindex="8">
Submit
</button>
</div>
</div>
</div>
</div>
</div>
</fieldset>
</form>
<!-- <pre>{{statusr | json}}</pre> -->
<div class="row" style="text-align: right;">
<div class="col-md-4">
<input class="form-control" type="text" ng-model="search" id="searchIn" autofocus tabindex="2" placeholder="Search" />
</div>
<div class="col-md-6">
</div>
<button class="btn btn-success btn-o" ng-click="exportData()">Export to Excel</button>
</div>
<div class="table-responsive">
<table id="datatable" class="table table-hover" style="font-size:0.9em;" ng-controller="studentModalDemoCtrl">
<thead>
<tr>
<th>SL.No</th>
<th>Date</th>
<th>Tracking ID</th>
<th>Followup Date</th>
<th>Name</th>
<th>Mobile No</th>
<th>University</th>
<th>Course</th>
<th>Present Status</th>
<th>Comments</th>
<th>Activity</th>
<th>Assigned To</th>
</tr>
</thead>
<tbody dir-paginate="p in lead_data|filter:search:strict|itemsPerPage:10">
<tr>
<td>{{p.SL_NO}}</td>
<td>{{p.date}}</td>
<td>{{p.tid}}</td>
<td>{{p.fup}}</td>
<td>{{p.name}}</td>
<td>{{p.mobile}}</td>
<td>{{p.univ}}</td>
<td>{{p.course}}</td>
<td>{{p.prsStatus}}</td>
<td>{{p.cmnts}}</td>
<td>{{p.activity}}</td>
<td>{{p.AssignTo}}</td>
</tr>
</tbody>
</table>
<h3 style="text-align:center;">{{message}}</h3>
</div>
<dir-pagination-controls direction-links="true" boundary-links="true">
</dir-pagination-controls>
</div>
</div>