Commit 9f4c0f11 authored by Prayas Jain's avatar Prayas Jain

Added Billability by functional group service call

parent 570708e6
package com.nisum.myteam.controller; package com.nisum.myteam.controller;
import static org.springframework.data.mongodb.core.aggregation.Aggregation.group; import static org.springframework.data.mongodb.core.aggregation.Aggregation.group;
...@@ -319,49 +320,63 @@ public class ReportsController { ...@@ -319,49 +320,63 @@ public class ReportsController {
return new ResponseEntity<>(empList, HttpStatus.OK); return new ResponseEntity<>(empList, HttpStatus.OK);
} }
@RequestMapping(value = "/billabilityByFunctionalGroup", @RequestMapping(value = "/billabilityByFunctionalGroup",
method = RequestMethod.GET, method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
public ReportVo billabilityReportByFunctionalGroup(){ public ReportVo billabilityReportByFunctionalGroup(){
ReportVo reportVo = new ReportVo(); ReportVo reportVo = new ReportVo();
Map<String,Object> billableData = new HashMap(); Map<String,Object> billableData = new HashMap();
Map<String,Object> nonBillableData = new HashMap(); Map<String,Object> nonBillableData = new HashMap();
List<Object> billableCount = new ArrayList<>(); Map<String,Object> traineeData = new HashMap();
List<Object> nonBillableCount = new ArrayList<>(); List<Object> billableCount = new ArrayList<>();
billableData.put("name","Billable"); List<Object> nonBillableCount = new ArrayList<>();
nonBillableData.put("name","Non Billable"); List<Object> traineeCount = new ArrayList<>();
for(String functionalGroup:reportVo.getCategoriesList()){ billableData.put("name","Billable");
Map<String,Object> billableObj = new HashMap(); nonBillableData.put("name","Non-Billable");
Map<String,Object> nonbillableObj = new HashMap(); traineeData.put("name", "Trainee");
Integer billableC=0; for(String functionalGroup:reportVo.getCategoriesList()){
Integer nonBillableC=0; Map<String,Object> billableObj = new HashMap();
float billper; Map<String,Object> nonbillableObj = new HashMap();
float nonBillPer; // Map<String,Object> traineeObj = new HashMap();
List<Employee> employeeList = employeeService.getAllEmployees().stream(). Integer billableC=0;
filter(e -> e.getFunctionalGroup().equals(functionalGroup)).collect(Collectors.toList()); Integer nonBillableC=0;
for(Employee employee:employeeList){ Integer traineeC=0;
Resource resource = resourceService.getLatestResourceByEmpId(employee.getEmployeeId()); // float traineePer;
if(resource!=null && resource.getBillableStatus().equals("Billable")){ float billper;
billableC++; float nonBillPer;
}else{ List<Employee> employeeList = employeeService.getAllEmployees().stream().
nonBillableC++; filter(e -> e.getFunctionalGroup().equals(functionalGroup)).collect(Collectors.toList());
} for(Employee employee:employeeList){
} Resource resource = resourceService.getLatestResourceByEmpId(employee.getEmployeeId());
billper = ((billableC / (float)employeeList.size())*100); if(resource!=null && resource.getBillableStatus().equals("Billable")){
nonBillPer = nonBillableC /(float) employeeList.size()*100; billableC++;
billableObj.put("percent", billper); }else if(resource!=null && resource.getBillableStatus().equals("Trainee")) {
billableObj.put("y", billableC); traineeC++;
nonbillableObj.put("percent", nonBillPer); } else{
nonbillableObj.put("y", nonBillableC); nonBillableC++;
billableCount.add(billableObj); }
nonBillableCount.add(nonbillableObj); }
} billper = ((billableC / (float)(employeeList.size() - traineeC))*100);
billableData.put("data",billableCount); nonBillPer = nonBillableC /(float) (employeeList.size()-traineeC)*100;
nonBillableData.put("data",nonBillableCount); // traineePer = traineeC / (float) employeeList.size()*100;
reportVo.getSeriesDataList().add(billableData); billableObj.put("percent", billper);
reportVo.getSeriesDataList().add(nonBillableData); billableObj.put("y", billableC);
return reportVo; nonbillableObj.put("percent", nonBillPer);
nonbillableObj.put("y", nonBillableC);
// traineeObj.put("percent", traineePer);
// traineeObj.put("y", traineeC);
billableCount.add(billableObj);
nonBillableCount.add(nonbillableObj);
traineeCount.add(traineeC);
}
billableData.put("data",billableCount);
nonBillableData.put("data",nonBillableCount);
traineeData.put("data", traineeCount);
reportVo.getSeriesDataList().add(billableData);
reportVo.getSeriesDataList().add(nonBillableData);
reportVo.getSeriesDataList().add(traineeData);
return reportVo;
} }
...@@ -436,9 +451,6 @@ public class ReportsController { ...@@ -436,9 +451,6 @@ public class ReportsController {
seriesDetails.add(reportSeriesRecord); seriesDetails.add(reportSeriesRecord);
} }
System.out.println(seriesDetails);
reportData.setCategoriesList(catagories); reportData.setCategoriesList(catagories);
reportData.setSeriesDataList(seriesDetails); reportData.setSeriesDataList(seriesDetails);
return new ResponseEntity<>(reportData, HttpStatus.OK); return new ResponseEntity<>(reportData, HttpStatus.OK);
......
...@@ -18,13 +18,13 @@ myApp.controller("allocationChangeReportController",function($scope,exportUiGrid ...@@ -18,13 +18,13 @@ myApp.controller("allocationChangeReportController",function($scope,exportUiGrid
enableFiltering: true, enableFiltering: true,
enableHorizontalScrollbar:1, enableHorizontalScrollbar:1,
columnDefs : [ columnDefs : [
{field : 'employeeId',displayName: 'Employee Id', enableColumnMenu: false, enableSorting: false,enableFiltering: true,width:100}, {field : 'employeeId',displayName: 'Emp Id', enableColumnMenu: false, enableSorting: false,enableFiltering: true,width:100},
{field : 'employeeName',displayName: 'Employee Name', enableColumnMenu: false, enableSorting: true,enableFiltering: true,width:200}, {field : 'employeeName',displayName: 'Emp Name', enableColumnMenu: false, enableSorting: true,enableFiltering: true,width:200},
{name : ' prevAccountName', displayName: 'Previous Client', enableColumnMenu: false, enableSorting: false, enableFiltering:false, width:100}, {name : ' prevAccountName', displayName: 'Prev Client', enableColumnMenu: false, enableSorting: false, enableFiltering:true, width:100},
{field : 'prevProjectName',displayName: 'Previous Project', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:150}, {field : 'prevProjectName',displayName: 'Prev Project', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:150},
{name : 'prevBillableStatus', displayName: 'Previous Billability', enableColumnMenu: false, enableSorting: false, enableFiltering:false, width:100}, {name : 'prevBillableStatus', displayName: 'Prev Billability', enableColumnMenu: false, enableSorting: false, enableFiltering:false, width:100},
{name : 'prevBillingStartDate', displayName: 'Previous Billing Start Date',cellFilter: 'date:"dd-MMM-yyyy"', enableColumnMenu: false, enableSorting: false, enableFiltering:false, width:150}, {name : 'prevBillingStartDate', displayName: 'Prev Billing Start Date',cellFilter: 'date:"dd-MMM-yyyy"', enableColumnMenu: false, enableSorting: false, enableFiltering:false, width:150},
{name : 'prevBillingEndDate', displayName: 'Previous Billing Start Date',cellFilter: 'date:"dd-MMM-yyyy"', enableColumnMenu: false, enableSorting: false, enableFiltering:false,width:150}, {name : 'prevBillingEndDate', displayName: 'Prev Billing Start Date',cellFilter: 'date:"dd-MMM-yyyy"', enableColumnMenu: false, enableSorting: false, enableFiltering:false,width:150},
{name : 'currentAccountName', displayName: 'Current Client', enableColumnMenu: false, enableSorting: false, enableFiltering:false,width:100}, {name : 'currentAccountName', displayName: 'Current Client', enableColumnMenu: false, enableSorting: false, enableFiltering:false,width:100},
{name : 'currentBillableStatus', displayName: 'Current Billability', enableColumnMenu: false, enableSorting: false, enableFiltering:false,width:100}, {name : 'currentBillableStatus', displayName: 'Current Billability', enableColumnMenu: false, enableSorting: false, enableFiltering:false,width:100},
{field : 'currentProjectName',displayName: 'Current Project', enableColumnMenu: false, enableSorting: true,enableFiltering: true,width:150}, {field : 'currentProjectName',displayName: 'Current Project', enableColumnMenu: false, enableSorting: true,enableFiltering: true,width:150},
......
...@@ -91,10 +91,13 @@ myApp.directive('hcPieChart', function () { ...@@ -91,10 +91,13 @@ myApp.directive('hcPieChart', function () {
$scope.getMyTeamDetails = function(seriesName, category, optionName,title){ $scope.getMyTeamDetails = function(seriesName, category, optionName,title){
if(title.trim() == 'Employees Overview Report'){ if(title.trim() == 'Billability By Functional Group'){
if(category=='I&A'){
category = 'I%26A';
}
$http({ $http({
method : "GET", method : "GET",
url : appConfig.appUri + "/reports/fetchEmployeeDetailsByFG?fGroup="+optionName url : appConfig.appUri + "reports/fetchEmployeeDetailsByFGAndBillability?fGroup="+category+"&billableStatus="+seriesName
}).then(function mySuccess(response) { }).then(function mySuccess(response) {
$scope.gridOptions.data = response.data; $scope.gridOptions.data = response.data;
if(response.data.length > 10){ if(response.data.length > 10){
......
...@@ -512,6 +512,9 @@ i.fa.fa-refresh:hover { ...@@ -512,6 +512,9 @@ i.fa.fa-refresh:hover {
height: auto !important; height: auto !important;
max-height: calc(350px - 20px); max-height: calc(350px - 20px);
} */ } */
.ui-grid-icon-cancel{
color:black;
}
md-toolbar._md-toolbar-transitions { md-toolbar._md-toolbar-transitions {
min-height: 50px !important; min-height: 50px !important;
} }
......
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