| @@ -3858,7 +3858,7 @@ open class ReportService( | |||
| // val staffTeam = ts.staff!!.team.code | |||
| val staffTeam = teamlog.find { | |||
| 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 | |||
| }?.team?.code ?: ts.staff?.team?.code | |||
| val projectTeam = ts.project!!.teamLead!!.team.code | |||
| @@ -3870,7 +3870,7 @@ open class ReportService( | |||
| // 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.from <= (ts.recordDate) && (it.to == null || it.to > (ts.recordDate)) | |||
| && it.deleted == false | |||
| }?.team?.code ?: ts.staff?.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 | |||
| val _grade = gradeLog.find { | |||
| 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 | |||
| } | |||
| println(_grade) | |||
| val gradeCode = _grade!!.grade.code | |||
| val crossTeamMultiplier = 1.15 | |||
| val thisSE = salaryEffective.find { | |||
| @@ -4399,7 +4398,7 @@ open class ReportService( | |||
| // 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.from <= (ts.recordDate) && (it.to == null || it.to > (ts.recordDate)) | |||
| && it.deleted == false | |||
| }?.team?.code ?: ts.staff?.team?.code | |||
| val projectTeam = ts.project!!.teamLead!!.team.code | |||
| @@ -4412,7 +4411,7 @@ open class ReportService( | |||
| val staffTeam = teamlog.find { | |||
| 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 | |||
| }?.team?.code ?: ts.staff?.team?.code | |||
| @@ -4422,16 +4421,18 @@ open class ReportService( | |||
| } | |||
| _timesheets.forEach { ts -> | |||
| // val otMultiplier = 1.15 | |||
| val thisSE = salaryEffective.filter { | |||
| val thisSE = salaryEffective.find { | |||
| 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 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()) | |||
| val otCost = otHour.times(hourlyRate) | |||
| val staff = ts.staff!! | |||
| val project = ts.project!! | |||
| val projectNameCode = "${project.code}\n${project.name}" | |||