From 2f83abe6f1819f5926e2c8ae5bef2fa5833d31af Mon Sep 17 00:00:00 2001 From: "cyril.tsui" Date: Wed, 4 Dec 2024 15:51:19 +0800 Subject: [PATCH] update cross team report --- .../modules/report/service/ReportService.kt | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt b/src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt index 16b7f21..3f1d849 100644 --- a/src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt +++ b/src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt @@ -3877,7 +3877,7 @@ open class ReportService( } println(_grade) val gradeCode = _grade!!.grade.code - val otMultiplier = 1.15 +// val otMultiplier = 1.15 val thisSE = salaryEffective.find { it.staff.id == ts.staff!!.id && it.startDate <= ts.recordDate && (it.endDate >= ts.recordDate || it.endDate == null) @@ -3886,18 +3886,19 @@ open class ReportService( val normalHour = ts.normalConsumed ?: 0.0 val otHour = ts.otConsumed ?: 0.0 val normalCost = normalHour.times(hourlyRate) - val otCost = otHour.times(hourlyRate).times(otMultiplier) +// val otCost = otHour.times(hourlyRate).times(otMultiplier) + val otCost = otHour.times(hourlyRate) //assigning data val projectTeam = ts.project!!.teamLead!!.team.code val staffTeam = ts.staff!!.team.code // write in var tsInData = teamsMap[projectTeam]!![gradeCode]!!.In tsInData.manhour += normalHour + otHour - tsInData.cost += normalCost + otCost + tsInData.cost += (normalCost + otCost) * chargeFee // write out val tsOutData = teamsMap[staffTeam]!!.get(gradeCode)!!.Out tsOutData.manhour += normalHour + otHour - tsOutData.cost += normalCost + otCost + tsOutData.cost += (normalCost + otCost) * chargeFee } return teamsMap @@ -4410,7 +4411,7 @@ open class ReportService( } } _timesheets.forEach { ts -> - val otMultiplier = 1.15 +// val otMultiplier = 1.15 val thisSE = salaryEffective.filter { it.staff.id == ts.staff!!.id && @@ -4419,7 +4420,8 @@ open class ReportService( val normalHour = ts.normalConsumed ?: 0.0 val otHour = ts.otConsumed ?: 0.0 val normalCost = normalHour.times(thisSE!!.salary.hourlyRate.toDouble()) - 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 staff = ts.staff!! val project = ts.project!! val projectNameCode = "${project.code}\n${project.name}" @@ -4440,7 +4442,7 @@ open class ReportService( tsInData[inOut_Key]!!.put(projectNameCode, TsData(0.0, 0.0)) } tsInData[inOut_Key]!![projectNameCode]!!.manhour += normalHour + otHour - tsInData[inOut_Key]!![projectNameCode]!!.cost += normalCost + otCost + tsInData[inOut_Key]!![projectNameCode]!!.cost += (normalCost + otCost) * chargeFee } return teamsMap @@ -4687,11 +4689,11 @@ open class ReportService( grade.id )]?.sumOf { it.getValue("manHour") } ?: 0.0) - totalSalary += groupedTimesheets[Triple( + totalSalary += (groupedTimesheets[Triple( team.id, chargedTeam.id, grade.id - )]?.sumOf { it.getValue("salary") } ?: 0.0 + )]?.sumOf { it.getValue("salary") } ?: 0.0) * chargeFee val cloneStyle = workbook.createCellStyle() cloneStyle.cloneStyleFrom(normalFontWithBorderStyle) @@ -4702,11 +4704,11 @@ open class ReportService( createCell(columnIndex++).apply { setCellValue( - groupedTimesheets[Triple( + (groupedTimesheets[Triple( team.id, chargedTeam.id, grade.id - )]?.sumOf { it.getValue("salary") } ?: 0.0) + )]?.sumOf { it.getValue("salary") } ?: 0.0) * chargeFee) val cloneStyle = workbook.createCellStyle() cloneStyle.cloneStyleFrom(normalFontWithBorderStyle)