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

AddingAccountIdForBench

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