apollodec/Apollo/assets/js/controllers/report_balfeeCtrl.js

98 lines
2.8 KiB
JavaScript
Executable File

'use strict';
/*** controller***/
app.controller('report_balfeeCtrl', ["$scope", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', '$window',
function ($scope, apiPoint, $http, SweetAlert, $state, md5, ipCookie, $window) {
// to generate serial number
// $scope.serial = 1;
// $scope.itemPerPage=10
// $scope.indexCount = function(newPageNumber){
// $scope.serial = newPageNumber * $scope.itemPerPage - ($scope.itemPerPage-1);
// }
//to filter labels
$scope.filters = {
"branch": "",
"university": "",
"batch": "",
};
$scope.filters = function () {
var filterlist = {
method: 'POST',
url: apiPoint.url + 'report_filters/',
headers: {
'Content-Type': 'application/json'
}
};
$http(filterlist).then(function (response) {
if (response.data) {
$scope.batch = response.data.batch;
$scope.branch = response.data.branch;
$scope.university = response.data.university;
//console.log($scope.branch);
} else {
}
});
}
// response data
$scope.onSubmit = function () {
$scope.balfee_data = '';
$scope.message = '';
var response_data = {
method: 'POST',
url: apiPoint.url + 'report_balfee/',
headers: {
'Content-Type': 'application/json'
},
data: {
branch: $scope.filters.branch,
university: $scope.filters.university,
batch: $scope.filters.batch
}
};
$http(response_data).then(function (response) {
if (response.data.balfeeList == true) {
$scope.balfee_data = response.data.balfee_data;
} else {
$scope.message = response.data.message;
}
});
}
var mystyle = {
sheetid: 'BALANCE FEE STATUS REPORT',
headers: true,
caption: {
title:'BALANCE FEE STATUS REPORT',
width: '300px',
style:'font-size:50px;'
},
// style:'background:#00FF00',
column: {
style:'font-size:10px'
},
};
$scope.exportData = function () {
alasql('SELECT * INTO XLS("Balancefee_status.xls",?) FROM ?',[mystyle,$scope.balfee_data]);
};
}]);