|
|
@@ -3619,7 +3619,9 @@ open class ReportService( |
|
|
|
) |
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
|
} |
|
|
|
// private fun binarySearch(Any[], ) { |
|
|
|
|
|
|
|
// } |
|
|
|
private fun generateTeamsInOutMap( |
|
|
|
teams: List<Team>, |
|
|
|
desiredTeam: MutableList<Team>, |
|
|
@@ -3628,7 +3630,7 @@ open class ReportService( |
|
|
|
gradeLog: List<GradeLog>, |
|
|
|
salaryEffective: List<SalaryEffective>, |
|
|
|
): MutableMap<String, MutableMap<String, InOut>> { |
|
|
|
// val teamlog = teamLogRepository.findAll().filter { it.deleted == false } |
|
|
|
val teamlog = teamLogRepository.findAll().filter { it.deleted == false } |
|
|
|
val gradeMap: MutableMap<String, InOut> = mutableMapOf() |
|
|
|
var teamsMap: MutableMap<String, MutableMap<String, InOut>> = mutableMapOf() |
|
|
|
grades.forEach { |
|
|
@@ -3658,14 +3660,24 @@ open class ReportService( |
|
|
|
val team = desiredTeam[0] |
|
|
|
val targetTeam = team.code |
|
|
|
_timesheets = timesheets.filter { ts -> |
|
|
|
val staffTeam = ts.staff!!.team.code |
|
|
|
// val staffTeam = ts.staff!!.team.code |
|
|
|
val staffTeam = teamlog.find { |
|
|
|
it.staff.id == ts.staff!!.id |
|
|
|
&& it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate)) |
|
|
|
&& it.deleted == false |
|
|
|
}!!.team.code |
|
|
|
val projectTeam = ts.project!!.teamLead!!.team.code |
|
|
|
projectTeam != staffTeam && |
|
|
|
(staffTeam == targetTeam || projectTeam == targetTeam ) |
|
|
|
} |
|
|
|
} else { |
|
|
|
_timesheets = timesheets.filter { ts -> |
|
|
|
val staffTeam = ts.staff!!.team.code |
|
|
|
// val staffTeam = ts.staff!!.team.code |
|
|
|
val staffTeam = teamlog.find { |
|
|
|
it.staff.id == ts.staff!!.id |
|
|
|
&& it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate)) |
|
|
|
&& it.deleted == false |
|
|
|
}!!.team.code |
|
|
|
val projectTeam = ts.project!!.teamLead!!.team.code |
|
|
|
projectTeam != staffTeam |
|
|
|
} |
|
|
@@ -3673,19 +3685,17 @@ open class ReportService( |
|
|
|
_timesheets.forEach {ts -> |
|
|
|
// this team charging others |
|
|
|
// get the grade and salary data of the record |
|
|
|
|
|
|
|
val _grade = gradeLog.find { |
|
|
|
it.staff.id == ts.staff!!.id |
|
|
|
&& |
|
|
|
it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate)) |
|
|
|
&& |
|
|
|
it.deleted == false |
|
|
|
&& it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate)) |
|
|
|
&& it.deleted == false |
|
|
|
} |
|
|
|
val gradeCode = _grade!!.grade.code |
|
|
|
val otMultiplier = 1.15 |
|
|
|
val thisSE = salaryEffective.find { |
|
|
|
it.staff.id == ts.staff!!.id |
|
|
|
&& |
|
|
|
it.startDate.isBefore(ts.recordDate) && (it.endDate.isAfter(ts.recordDate) || it.endDate == null) |
|
|
|
&& it.startDate.isBefore(ts.recordDate) && (it.endDate.isAfter(ts.recordDate) || it.endDate == null) |
|
|
|
} |
|
|
|
val normalHour = ts.normalConsumed ?: 0.0 |
|
|
|
val otHour = ts.otConsumed ?: 0.0 |
|
|
@@ -4118,7 +4128,7 @@ open class ReportService( |
|
|
|
columnIndex++ |
|
|
|
tempCell = getOrCreateCell(tempRow, columnIndex) |
|
|
|
CellUtil.setCellStyleProperties(tempCell, |
|
|
|
cellBorderArgs(1,1,1,1) |
|
|
|
cellBorderArgs(1,1,1,2) |
|
|
|
+ fontArgs("Times New Roman", false, false) |
|
|
|
+ dataFormatArgs(accountingStyle) |
|
|
|
) |
|
|
@@ -4145,14 +4155,17 @@ open class ReportService( |
|
|
|
var i = 0 |
|
|
|
while (i < numberOfColumns) { |
|
|
|
var leftBorder = 1 |
|
|
|
var rightBorder = 1 |
|
|
|
if (i == numberOfColumns - 2) { |
|
|
|
leftBorder = 2 |
|
|
|
} else if (i == numberOfColumns - 1) { |
|
|
|
rightBorder = 2 |
|
|
|
} |
|
|
|
tempCell = getOrCreateCell(tempRow, columnIndex) |
|
|
|
val columnLetter = CellReference.convertNumToColString(columnIndex) |
|
|
|
tempCell.cellFormula = "SUM(${columnLetter}${startingRow+1}:${columnLetter}${rowIndex})" |
|
|
|
CellUtil.setCellStyleProperties(tempCell, |
|
|
|
cellBorderArgs(1,2,leftBorder,1) |
|
|
|
cellBorderArgs(2,2,leftBorder,rightBorder) |
|
|
|
+ fontArgs("Times New Roman", false, false) |
|
|
|
+ dataFormatArgs(accountingStyle) |
|
|
|
) |
|
|
@@ -4172,6 +4185,7 @@ open class ReportService( |
|
|
|
gradeLog: List<GradeLog>, |
|
|
|
salaryEffective: List<SalaryEffective>, |
|
|
|
): MutableMap<String, CrossTeamP4InOut> { |
|
|
|
val teamlog = teamLogRepository.findAll().filter { it.deleted == false } |
|
|
|
var teamsMap: MutableMap<String, CrossTeamP4InOut> = mutableMapOf() |
|
|
|
// teams.forEach { team -> |
|
|
|
// val key = team.code |
|
|
@@ -4187,14 +4201,26 @@ open class ReportService( |
|
|
|
val team = desiredTeams[0] |
|
|
|
val targetTeam = team.code |
|
|
|
_timesheets = timesheets.filter { ts -> |
|
|
|
val staffTeam = ts.staff!!.team.code |
|
|
|
// val staffTeam = ts.staff!!.team.code |
|
|
|
val staffTeam = teamlog.find { |
|
|
|
it.staff.id == ts.staff!!.id |
|
|
|
&& it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate)) |
|
|
|
&& it.deleted == false |
|
|
|
}!!.team.code |
|
|
|
val projectTeam = ts.project!!.teamLead!!.team.code |
|
|
|
projectTeam != staffTeam && |
|
|
|
(staffTeam == targetTeam || projectTeam == targetTeam ) |
|
|
|
} |
|
|
|
} else { |
|
|
|
_timesheets = timesheets.filter { ts -> |
|
|
|
val staffTeam = ts.staff!!.team.code |
|
|
|
// val staffTeam = ts.staff!!.team.code |
|
|
|
val staffTeam = teamlog.find { |
|
|
|
it.staff.id == ts.staff!!.id |
|
|
|
&& |
|
|
|
it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate)) |
|
|
|
&& |
|
|
|
it.deleted == false |
|
|
|
}!!.team.code |
|
|
|
val projectTeam = ts.project!!.teamLead!!.team.code |
|
|
|
projectTeam != staffTeam |
|
|
|
} |
|
|
|