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

Added Billability by functional group service call

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