Commit b374ad62 authored by Sumith's avatar Sumith

MT-55[Sumith]: Added reports

parent ef3dd39a
......@@ -62,36 +62,6 @@ public class ReportsController {
@Autowired
private TeamMatesBillingRepo teamMatesBillingRepo;
@RequestMapping(value = "/functioNalGroup", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List> getEmployeeRole() throws MyTimeException {
Map m = new HashMap();
m.put("name", "ES");
m.put("y", "50");
Map m1 = new HashMap();
m1.put("name", "CI");
m1.put("y", "45");
Map m2 = new HashMap();
m2.put("name", "APPS");
m2.put("y", "5");
List l = new ArrayList();
l.add(m);
l.add(m1);
l.add(m2);
return new ResponseEntity<>(l, HttpStatus.OK);
}
/*
* [{ name: "ES", y: 20 }, { name: "CI", y: 12, sliced: true, selected: true
* }, { name: "APPS", y: 43 }]
*/
// [{"name":"ES","total":154},{"name":"ACI -
// QE","total":137},{"name":"","total":71},{"name":"ACI -
// Support","total":53},{"name":"APPS","total":46},{"name":"CI","total":40},{"name":"ACI
// - DevOps","total":37},{"name":"I&A","total":32},{"name":"PE","total":6}]
// [{ name: 'billable2222',data: [5, 3, 4, 7]}, {name: 'nonbillable',data:
// [2, 2, 3, 2]}, {name: 'Shadow', data: [3, 4, 4, 2]}]
@RequestMapping(value = "/getEmployeesByFunctionalGroup1",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
......@@ -356,14 +326,25 @@ public class ReportsController {
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<ProjectTeamMate>> fetchEmployeeDetailsByAccountBillability(
@RequestParam("account") String account,
@RequestParam("billabilityStatus") String billabilityStatus,
@RequestParam("reportDate") String reportDateString)
@RequestParam("billabilityStatus") String billabilityStatus)
throws MyTimeException {
List<ProjectTeamMate> empList = new ArrayList<>();
if (account != null && !account.isEmpty()) {
empList = projectService.findByAccountAndActiveAndBillableStatus(
account, true, billabilityStatus);
} else if (reportDateString != null && !reportDateString.isEmpty()) {
}
return new ResponseEntity<>(empList, HttpStatus.OK);
}
@RequestMapping(value = "/fetchEmployeeDetailsByDateBillability",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<BillingDetails>> fetchEmployeeDetailsByDateBillability(
@RequestParam("billabilityStatus") String billabilityStatus,
@RequestParam("reportDate") String reportDateString)
throws MyTimeException {
List<BillingDetails> empList = new ArrayList<>();
if (reportDateString != null && !reportDateString.isEmpty()) {
String pattern = "MM-dd-yyyy";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
Date reportDateValue = new Date();
......@@ -374,17 +355,20 @@ public class ReportsController {
e.printStackTrace();
}
Criteria status = Criteria.where("billableStatus")
.is(billabilityStatus);
Criteria criteriaV1 = Criteria.where("billingStartDate")
.lt(reportDateValue);
Criteria criteriaV21 = Criteria.where("billingEndDate").is(null);
Criteria criteriaV22 = Criteria.where("billingEndDate")
.gt(reportDateValue);
Criteria criteriaV221 = criteriaV1.orOperator(criteriaV21,
criteriaV22);
Criteria criteriaV221 = status.andOperator(
criteriaV1.orOperator(criteriaV21, criteriaV22));
Query query = new Query();
query.addCriteria(criteriaV221);
empList = mongoTemplate.find(query, ProjectTeamMate.class);
empList = mongoTemplate.find(query, BillingDetails.class);
}
return new ResponseEntity<>(empList, HttpStatus.OK);
}
}
\ No newline at end of file
......@@ -3,48 +3,30 @@ myApp.directive('hcPieChart', function () {
restrict: 'E',
template: '<div></div>',
link: function (scope, element) {
getEmployeeDetails(scope,element[0].baseURI+'reports/getBillabilityDetailsByMonth','line',element,"Employees By Functional Group");
getEmployeeDetails(scope,element[0].baseURI+'reports/getBillabilityDetailsByAccount','column',element,"Billability By Account");
scope.clickMe= function() {
// if(scope.reportId == 1234){
// scope.result = [{data:[{name:"ES", y:279},{name: "SAMP", y: 2},{name: "APPS", y: 1}]}]
// scope.drawChart(element,'column');
// }
if(scope.reportId == 123){
getEmployeeDetails(scope,element[0].baseURI+'reports/getEmployeesByFunctionalGroup','pie',element,"Employees By Functional Group");
}else {
if(scope.reportId == 1){
getEmployeeDetails(scope,element[0].baseURI+'reports/getBillabilityDetailsByAccount','column',element," Billability By Account");
}else if(scope.reportId == 2){
getEmployeeDetails(scope,element[0].baseURI+'reports/getEmployeesByFunctionalGroup','pie',element,"Employees Overview Report");
}else if(scope.reportId == 3){
getEmployeeDetails(scope,element[0].baseURI+'reports/getBillabilityDetailsByMonth','line',element," Billability Monthly Trends");
}
}
}
};
}).controller('chartsController', function ($scope, $http, myFactory, $mdDialog, appConfig) {
}).controller('chartsController', function ($scope, $http, myFactory,exportUiGridService, $mdDialog, appConfig) {
$scope.name = [];
$scope.records = [];
$scope.empSearchId = "";
//$scope.reports = $scope.reportId;
$scope.reports=[ {Name:"Employee Overview Report",Id:"1234"},{Name:"Employees By Functional Group",Id:"123"},{Name:"Billability Monthly Trends",Id:"12345"}];
$scope.reportId = "1"
$scope.reports = $scope.reportId;
$scope.reports=[ {Name:"Billability Report",Id:"1"},{Name:"Employees By Functional Group",Id:"2"},{Name:"Billability Monthly Trends",Id:"3"}];
$scope.parentData = {
"employeeId": "",
"employeeName": "",
"emailId":"",
"role": "",
"shift": "",
"projectId":"",
"projectName":"",
"managerId":"",
"managerName":"",
"experience":"",
"designation":"",
"action":""
};
$scope.employees = [];
$scope.projects = [];
var getCellTemplate = '<p class="col-lg-12"><i class="fa fa-pencil-square-o fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'Update\')"></i>'+
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-minus-circle fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'Delete\')"></i></p>';
$scope.gridOptions = {
paginationPageSizes : [ 10, 20, 30, 40, 50, 100],
paginationPageSize : 10,
......@@ -54,50 +36,113 @@ myApp.directive('hcPieChart', function () {
{field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true, width:120},
{field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false},
{field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false},
{field : 'projectName',displayName: 'Project', enableColumnMenu: false, enableSorting: false},
{field : 'mobileNumber',displayName: 'Mobile No', enableColumnMenu: false, enableSorting: false}
{field : 'projectName',displayName: 'Project Name', enableColumnMenu: false, enableSorting: false},
{field : 'billableStatus',displayName: 'Billable Status', enableColumnMenu: false, enableSorting: false},
{field : 'billingStartDate',displayName: 'Billing Start Data', enableColumnMenu: false, enableSorting: false,cellFilter: 'date:"dd-MMM-yyyy"'},
{field : 'billingEndDate',displayName: 'Billing End Data', enableColumnMenu: false, enableSorting: false,cellFilter: 'date:"dd-MMM-yyyy"'},
{field : 'functionalGroup',displayName: 'Functional Group', enableColumnMenu: false, enableSorting: false}
],
enableGridMenu: true,
enableSelectAll: true,
exporterMenuExcel:false,
exporterMenuCsv:false,
exporterCsvFilename: 'AbsentDetails.csv',
exporterExcelFilename:'AbsentDetails',
exporterPdfDefaultStyle: {fontSize: 9},
exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
exporterPdfHeader: { text: "Absent Details", style: 'headerStyle' },
exporterPdfFooter: function ( currentPage, pageCount ) {
return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
},
exporterPdfCustomFormatter: function ( docDefinition ) {
docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
return docDefinition;
},
exporterPdfOrientation: 'portrait',
exporterPdfPageSize: 'LETTER',
exporterPdfMaxGridWidth: 500,
exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
onRegisterApi: function(gridApi){
$scope.gridApi = gridApi;
},
gridMenuCustomItems: [{
title: 'Export all data as EXCEL',
action: function ($event) {
exportUiGridService.exportToExcel('sheet 1', $scope.gridApi, 'all', 'all');
},
order: 110
},
{
title: 'Export visible data as EXCEL',
action: function ($event) {
exportUiGridService.exportToExcel('sheet 1', $scope.gridApi, 'visible', 'visible');
},
order: 111
}
]
};
$scope.gridOptions.data = $scope.records;
$scope.getRowData = function(row, action){
$scope.parentData.employeeId = row.entity.employeeId;
$scope.parentData.employeeName = row.entity.employeeName;
$scope.parentData.emailId = row.entity.emailId;
$scope.parentData.role = row.entity.role;
$scope.parentData.shift = row.entity.shift;
$scope.parentData.projectId = row.entity.projectId;
$scope.parentData.projectName = row.entity.projectName;
$scope.parentData.managerId = row.entity.managerId;
$scope.parentData.managerName = row.entity.managerName;
$scope.parentData.experience = row.entity.experience;
$scope.parentData.designation = row.entity.designation;
}
$scope.getMyTeamDetails = function(empid){
$scope.getMyTeamDetails = function(seriesName, category, optionName,title){
if(title.trim() == 'Employees Overview Report'){
$http({
method : "GET",
url : appConfig.appUri + "/reports/fetchEmployeeDetailsByFG?fGroup="+optionName
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
});
}else if(title.trim() == 'Billability By Account'){
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getMyTeamDetails?employeeId="+empid
url : appConfig.appUri + "/reports/fetchEmployeeDetailsByAccountBillability?account="+category+"&billabilityStatus="+seriesName
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
});
}else if(title.trim() == 'Billability Monthly Trends'){
$http({
method : "GET",
url : appConfig.appUri + "/reports/fetchEmployeeDetailsByDateBillability?billabilityStatus="+seriesName+"&reportDate="+category
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
});
}
};
function showAlert(message) {
$mdDialog.show($mdDialog.alert().parent(
angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true).textContent(message).ariaLabel(
'Alert Dialog').ok('Ok'));
}
$scope.drawChart = function(element,chartName,result,title){
$scope.drawChart = function(element,chartName,result,title,categoriesList){
Highcharts.chart(element[0], {
chart: {
type: chartName
type: chartName,
height: (9 / 16 * 100) + '%'
},
title: {
text: title
},
credits: {
enabled: false
},
xAxis: {
categories: ['Plan', 'Retail', 'Buy', 'Sell'],
categories: categoriesList,
labels:{
formatter: function() {
if (chartName != 'pie' || chartName != 'line') {
......@@ -121,14 +166,24 @@ myApp.directive('hcPieChart', function () {
},
tooltip: {
headerFormat: '<b>{point.x}</b><br/>',
pointFormat: '{series.name}: {point.y}'
pointFormat: '{point.name}: {point.y}'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
},
series:{
events:{
click: function(event) {
$scope.custom(event);
$scope.getMyTeamDetails(event.point.series.name,event.point.category,event.point.options.name,title);
}
}
}
......@@ -136,27 +191,22 @@ myApp.directive('hcPieChart', function () {
series: result
});
}
$scope.custom = function(category){
alert('custome method')
$scope.getMyTeamDetails('16207');
}
});
function getEmployeeDetails(scope,uri,chart,element,title){
var result = [];
var categoriesList = [];
Highcharts.ajax({
url: uri,
success: function(data) {
if(chart=='line'){
if(chart=='line' || chart == 'column'){
result = data.seriesDataList;
scope.drawChart(element,chart,result,title);
categoriesList = data.categoriesList;
}else if(chart == 'pie'){
result = data;
scope.drawChart(element,chart,result,title);
categoriesList = data;
}
scope.drawChart(element,chart,result,title,categoriesList);
}
});
}
\ No newline at end of file
......@@ -300,6 +300,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
menuItems.push({"menu" : "My Org","icon" : "fa fa-address-card-o fa-2x","path" : "templates/myOrg.html"});
menuItems.push({"menu" : "My Profile","icon" : "fa fa-address-book-o fa-2x","path" : "templates/profile.html"});
menuItems.push({"menu" : "Import Data","icon" : "fa fa-upload fa-2x","path" : "templates/exportData.html"});
menuItems.push({"menu" : "Reports","icon" : "fa fa-address-book-o fa-2x","path" : "templates/charts.html"});
}else{
menuItems.push({"menu" : "My Details","icon" : "fa fa-indent fa-2x","path" : "templates/employee.html"});
menuItems.push({"menu" : "My Team","icon" : "fa fa-futbol-o fa-2x","path" : "templates/myTeam.html"});
......
<html>
<html>
<body>
<div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;"
id="popupContainer" ng-controller="chartsController" ng-init="getMyTeamDetails()">
<div style="margin: 4% 0% 3% 64%;">
Report Type:
<select ng-model="reportId" ng-change="clickMe()" ng-options="report.Id as report.Name for report in reports"></select>
id="popupContainer" ng-controller="chartsController">
<div style="margin: 6% 0% -8% 61%">
Report Type:<select ng-model="reportId" ng-change="clickMe()" ng-options="report.Id as report.Name for report in reports"></select>
</div>
<hc-pie-chart style="width: 100%; padding: 3px 0px 0px 0px;" title="Browser usage" data="pieData" options="chartOptions">Placeholder for pie chart</hc-pie-chart>
<div >
<div class="row">
<div class="col-lg-12">
<p align="right" class="col-xs-1"
style="vertical-align: middle; font-weight: bold; font-size: 1.5em; margin-top: 8px; cursor: pointer;">
</p>
</div>
</div>
</div>
<div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12">
<div class="col-lg-1" style="float: left;padding-left:20px;">
</div>
<div class="col-lg-1"
style="cursor: pointer; float: right; right: 75px;">
</div>
</div>
<div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12" style="padding-top: 4%;margin-left:0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid" style="width:99%;height:370px;margin-left:0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination ui-grid-exporter
class="myGrid" style="width:99%;height:224px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptions.data.length">No
data available</div>
</div>
</div>
</div>
</body>
......
<div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;"
id="popupContainer333" ng-controller="myController"
>
<md-button class="md-icon-button" ng-click="loadData(19)"> <i
class="fa fa-times fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left">ReportData</i> </md-button>
<hc-chart options="chartOptions">Placeholder for generic chart</hc-chart>
<hc-pie-chart1 title="Browser usage" data="pieData" callback-fn="loadData(45)" ">Placeholder for pie chart</hc-pie-chart>
</div>
\ No newline at end of file
<div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;"
id="popupContainer333" ng-controller="Ctrl"
ng-init="loadData(29)">
<div class="container-fluid mainDivHeaderClass">
<div class="row">
<div class="col-lg-12">
<p align="center" class="col-xs-11"
style="vertical-align: middle; font-weight: bold; font-size: 30px;">Reports</p>
<p align="right" class="col-xs-1"
style="vertical-align: middle; font-weight: bold; font-size: 1.5em; margin-top: 8px; cursor: pointer;">
<i class="fa fa-refresh" aria-hidden="true"
ng-click="refreshPage()"></i>
</p>
</div>
</div>
</div>
<div class="row col-lg-12 col-xs-12">
<div class="row col-lg-12 col-xs-12">
<div class="col-lg-5 col-xs-6">
<p>
<b>Report</b>
</p>
</div>
<div class="col-lg-7 col-xs-6">
<p>
<b>:</b><md-select ng-model="report" md-selected-text="getReport()" id="report" ng-change="triggerRport()">
<md-optgroup label="report"> <md-option ng-value="report"
ng-repeat="report in reports">{{report}}</md-option> </md-optgroup> </md-select>
</p>
</div>
</div>
<div class="row col-lg-12" style="padding-top: 4%;margin-left:0px;">
<div><highchartxyz chart='{{renderChart}}'></highchartxyz></div>
</div>
<div class="row col-lg-12" style="padding-top: 4%;margin-left:0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid" style="width:99%;height:370px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptions.data.length">No
data available</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment