Commit 2d03c66b authored by Sridhar Sathu's avatar Sridhar Sathu

AddingAccountIdForBench

parent df3921de
......@@ -352,7 +352,6 @@ public class ProjectServiceImpl implements ProjectService {
@Override
public ProjectTeamMate updateTeammate(ProjectTeamMate projectTeamMate) {
//ProjectTeamMate existingTeammate1 = projectTeamMatesRepo.findById(projectTeamMate.getId());
ProjectTeamMate existingTeammate = projectTeamMatesRepo
.findByEmployeeIdAndProjectId(projectTeamMate.getEmployeeId(),
projectTeamMate.getProjectId());
......@@ -367,19 +366,12 @@ public class ProjectServiceImpl implements ProjectService {
billingDetails.setBillableStatus(MyTimeUtils.BENCH_BILLABILITY_STATUS);
if (listBD != null && !listBD.isEmpty()) {
BillingDetails billingDetailsExisting = listBD.get(0);
/*Date d = new Date();
d.setDate(d.getDate() - 1);
billingDetailsExisting.setBillingEndDate(d);*/
Date actualEndDate=projectTeamMate.getEndDate();
billingDetailsExisting.setBillingEndDate(actualEndDate);
billingDetailsExisting.setActive(false);
updateEmployeeBilling(billingDetailsExisting);
}
//billingDetails.setBillingStartDate(new Date());
Date sd=projectTeamMate.getEndDate();
//sd.setDate(sd.getDate()+1);
billingDetails.setBillingStartDate(sd);
billingDetails.setAccount(MyTimeUtils.BENCH_ACCOUNT);
billingDetails.setActive(true);
......@@ -392,7 +384,9 @@ public class ProjectServiceImpl implements ProjectService {
projectTeamMatesRepo.save(existingTeammate);
ProjectTeamMate newBenchAllocation = new ProjectTeamMate();
newBenchAllocation.setAccountId(projectTeamMate.getAccountId());
Project project=projectRepo.findByProjectId(MyTimeUtils.BENCH_PROJECT_ID);
if(project!=null)
newBenchAllocation.setAccountId(project.getAccountId());
newBenchAllocation.setBillableStatus(MyTimeUtils.BENCH_BILLABILITY_STATUS);
newBenchAllocation.setDesignation(existingTeammate.getDesignation());
newBenchAllocation.setEmailId(existingTeammate.getEmailId());
......@@ -400,12 +394,9 @@ public class ProjectServiceImpl implements ProjectService {
newBenchAllocation.setActive(true);
newBenchAllocation.setEmployeeName(existingTeammate.getEmployeeName());
newBenchAllocation.setProjectId(MyTimeUtils.BENCH_PROJECT_ID);
//newBenchAllocation.setStartDate(new Date());
newBenchAllocation.setStartDate(sd);
Project p = projectRepo.findByProjectId(MyTimeUtils.BENCH_PROJECT_ID);
newBenchAllocation.setProjectName(p.getProjectName());
// newBenchAllocation.setManagerId(p.getManagerId());
// newBenchAllocation.setManagerName(p.getManagerName());
projectTeamMatesRepo.save(newBenchAllocation);
updateShiftDetails(existingTeammate);
return existingTeammate;
......@@ -413,9 +404,6 @@ public class ProjectServiceImpl implements ProjectService {
}else
{
/*ProjectTeamMate existingTeammate = projectTeamMatesRepo
.findByEmployeeIdAndProjectId(projectTeamMate.getEmployeeId(),
projectTeamMate.getProjectId());*/
existingTeammate.setProjectId(projectTeamMate.getProjectId());
existingTeammate.setProjectName(projectTeamMate.getProjectName());
existingTeammate.setRole(projectTeamMate.getRole());
......@@ -428,12 +416,7 @@ public class ProjectServiceImpl implements ProjectService {
projectTeamMate.getBillableStatus())) {
if (listBD != null && !listBD.isEmpty()) {
BillingDetails billingDetails = listBD.get(0);
/*
* Date d = new Date(); d.setDate(d.getDate() - 1);
*/
Date d = projectTeamMate.getNewBillingStartDate();
//d.setDate(d.getDate() - 1);
Calendar cal = Calendar.getInstance();
cal.setTime(d);
cal.add(Calendar.DAY_OF_MONTH, -1);
......@@ -457,11 +440,7 @@ public class ProjectServiceImpl implements ProjectService {
billings.setProjectName(projectTeamMate.getProjectName());
billings.setBillableStatus(projectTeamMate.getBillableStatus());
billings.setActive(true);
// TODO
Date d = projectTeamMate.getNewBillingStartDate();
// d.setDate(d.getDate() + 1);
//billings.setBillingStartDate(DateUtils.truncate(d, Calendar.DATE));
//billings.setBillingStartDate(DateUtils.truncate(projectTeamMate.getStartDate(), Calendar.DATE)); // checking
billings.setBillingStartDate(DateUtils.truncate(d, Calendar.DATE));
existingTeammate.setNewBillingStartDate(
DateUtils.truncate(d, Calendar.DATE));
......@@ -469,7 +448,6 @@ public class ProjectServiceImpl implements ProjectService {
.truncate(projectTeamMate.getEndDate(), Calendar.DATE));
billings.setCreateDate(new Date());
addEmployeeBillingDetails(billings);
// TODO
}else //without changing the Billability status
{
if (listBD != null && !listBD.isEmpty()) {
......
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