apollodec/Apollo/assets/js/controllers/newreg_reportCtrl.js
venbatechnologies@gmail.com 5f4ea6b0da new registration report
2018-08-20 17:35:15 +05:30

194 lines
4.5 KiB
JavaScript

'use strict';
/*** controller***/
app.controller('newreg_reportCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage" ,"$http", "$state","$modal","$log",
function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http,ipCookie ,$state,$modal,$log){
//function ($scope, apiPoint, $http, SweetAlert, $state,$modal, md5, ipCookie, $window, dateListDescService) {
// DataTables configurable options
$scope.filters = {
"from_date": "",
"to_date": "",
};
var localDetails = JSON.parse(localStorage.getItem('localObj'));
//var localDetails = ipCookie('cookiechk');
console.log(localDetails);
// $scope.initHead = function() {
//console.log('rfd');
var logcheck = JSON.parse(localStorage.getItem('localObj'));
const LOCALTYPE = logcheck.localType;
if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' || LOCALTYPE == 'R002' || LOCALTYPE == 'R005')) {
console.log("if");
}else {
if(logcheck != null && LOCALTYPE !='R001') {
console.log("else if");
$state.go('app.dashboard');
} else {
console.log("else else");
//ipCookie.remove('cookiechk');
window.localStorage.clear();
$state.go('login.signin');
}
}
// }
$scope.universitySearchData = '';
$scope.init = function()
{
// alert()
var getuniv = {
method: 'POST',
url: apiPoint.url + 'AllgetUniversity/',
headers: {
'Content-Type': 'application/json'
},
data: {
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID,
}
};
$http(getuniv).then(function (response) {
if(response.status == 200)
{
$scope.universitySearchData=response.data.details;
}
});
};
//$scope.opinctotal='';
$scope.newreglist='';
$scope.isLoaderShow ='';
$scope.getDetails = function (form,myModel)
{
// alert('in')
console.log(form.$dirty);
var from = $scope.filters.from_date;
var to = $scope.filters.to_date;
var university = myModel.myUnivSearch
// console.log(from)
var getstudentdetails = {
method: 'POST',
url: apiPoint.url + 'NewregDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
university: university,
from : $scope.filters.from_date,
to : $scope.filters.to_date
}
}
$http(getstudentdetails).then(function (response) {
if(response.data.status == 200)
{
$scope.newreglist = response.data.details;
$scope.isLoaderShow = true;
}
else
{
$scope.isLoaderShow=false;
}
});
}
var mystyle = {
sheetid: 'New Registration List',
headers: true,
caption: {
title:'New Registration List',
width: '500px',
style:'font-size:50px;bold:true'
},
// style:'background:#00FF00',
column: {
style:'font-size:12px'
},
};
$scope.exportData = function ()
{
//alert()
//console.log($scope.fullincomedetail);
alasql('SELECT Firstname as Name,Fathername,CourseName,BatchName,UniversityName,DOJ as RegistrationDate,MobileNumber INTO XLS("New Registration report.xls",?) FROM ?',[mystyle,$scope.newreglist]);
};
$scope.OpenWindowStatus = false;
$scope.editId = -1;
$scope.setEditId = function (P)
{
//alert(P);
$scope.editId = P;
}
$scope.close = function ()
{
$scope.editId = -1;
}
$scope.fdate ='';
$scope.tdate ='';
//$scope.Subtypes = '';
}]);