Browse Source

update cross team

add_swagger
MSI\derek 8 months ago
parent
commit
8a0f926a57
1 changed files with 12 additions and 11 deletions
  1. +12
    -11
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt

+ 12
- 11
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt View File

@@ -3858,7 +3858,7 @@ open class ReportService(
// val staffTeam = ts.staff!!.team.code // val staffTeam = ts.staff!!.team.code
val staffTeam = teamlog.find { val staffTeam = teamlog.find {
it.staff.id == ts.staff!!.id it.staff.id == ts.staff!!.id
&& it.from <= ts.recordDate && (it.to == null || it.to >= ts.recordDate)
&& it.from <= ts.recordDate && (it.to == null || it.to > ts.recordDate)
&& it.deleted == false && it.deleted == false
}?.team?.code ?: ts.staff?.team?.code }?.team?.code ?: ts.staff?.team?.code
val projectTeam = ts.project!!.teamLead!!.team.code val projectTeam = ts.project!!.teamLead!!.team.code
@@ -3870,7 +3870,7 @@ open class ReportService(
// val staffTeam = ts.staff!!.team.code // val staffTeam = ts.staff!!.team.code
val staffTeam = teamlog.find { val staffTeam = teamlog.find {
it.staff.id == ts.staff!!.id it.staff.id == ts.staff!!.id
&& it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate))
&& it.from <= (ts.recordDate) && (it.to == null || it.to > (ts.recordDate))
&& it.deleted == false && it.deleted == false
}?.team?.code ?: ts.staff?.team?.code }?.team?.code ?: ts.staff?.team?.code
val projectTeam = ts.project!!.teamLead!!.team.code val projectTeam = ts.project!!.teamLead!!.team.code
@@ -3882,10 +3882,9 @@ open class ReportService(
// get the grade and salary data of the record // get the grade and salary data of the record
val _grade = gradeLog.find { val _grade = gradeLog.find {
it.staff != null && it.staff.id == ts.staff!!.id it.staff != null && it.staff.id == ts.staff!!.id
&& it.from <= ts.recordDate && (it.to == null || it.to >=ts.recordDate)
&& it.from <= ts.recordDate && (it.to == null || it.to > ts.recordDate)
&& it.deleted == false && it.deleted == false
} }
println(_grade)
val gradeCode = _grade!!.grade.code val gradeCode = _grade!!.grade.code
val crossTeamMultiplier = 1.15 val crossTeamMultiplier = 1.15
val thisSE = salaryEffective.find { val thisSE = salaryEffective.find {
@@ -4399,7 +4398,7 @@ open class ReportService(
// val staffTeam = ts.staff!!.team.code // val staffTeam = ts.staff!!.team.code
val staffTeam = teamlog.find { val staffTeam = teamlog.find {
it.staff.id == ts.staff!!.id it.staff.id == ts.staff!!.id
&& it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate))
&& it.from <= (ts.recordDate) && (it.to == null || it.to > (ts.recordDate))
&& it.deleted == false && it.deleted == false
}?.team?.code ?: ts.staff?.team?.code }?.team?.code ?: ts.staff?.team?.code
val projectTeam = ts.project!!.teamLead!!.team.code val projectTeam = ts.project!!.teamLead!!.team.code
@@ -4412,7 +4411,7 @@ open class ReportService(
val staffTeam = teamlog.find { val staffTeam = teamlog.find {
it.staff.id == ts.staff!!.id it.staff.id == ts.staff!!.id
&& &&
it.from.isBefore(ts.recordDate) && (it.to == null || it.to.isAfter(ts.recordDate))
it.from <= (ts.recordDate) && (it.to == null || it.to > (ts.recordDate))
&& &&
it.deleted == false it.deleted == false
}?.team?.code ?: ts.staff?.team?.code }?.team?.code ?: ts.staff?.team?.code
@@ -4422,16 +4421,18 @@ open class ReportService(
} }
_timesheets.forEach { ts -> _timesheets.forEach { ts ->
// val otMultiplier = 1.15 // val otMultiplier = 1.15
val thisSE = salaryEffective.filter {
val thisSE = salaryEffective.find {
it.staff.id == ts.staff!!.id it.staff.id == ts.staff!!.id
&& &&
it.date.isBefore(ts.recordDate)
}.maxByOrNull { it.date }
it.startDate <= ts.recordDate && it.endDate > ts.recordDate
}
val normalHour = ts.normalConsumed ?: 0.0 val normalHour = ts.normalConsumed ?: 0.0
val otHour = ts.otConsumed ?: 0.0 val otHour = ts.otConsumed ?: 0.0
val normalCost = normalHour.times(thisSE!!.salary.hourlyRate.toDouble())
val crossTeamMultiplier = 1.15
val hourlyRate = thisSE!!.salary.hourlyRate.toDouble().times(crossTeamMultiplier)
val normalCost = normalHour.times(hourlyRate)
// val otCost = otHour.times(thisSE.salary.hourlyRate.toDouble()).times(otMultiplier) // val otCost = otHour.times(thisSE.salary.hourlyRate.toDouble()).times(otMultiplier)
val otCost = otHour.times(thisSE.salary.hourlyRate.toDouble())
val otCost = otHour.times(hourlyRate)
val staff = ts.staff!! val staff = ts.staff!!
val project = ts.project!! val project = ts.project!!
val projectNameCode = "${project.code}\n${project.name}" val projectNameCode = "${project.code}\n${project.name}"


Loading…
Cancel
Save