瀏覽代碼

update cross team report

add_swagger
cyril.tsui 8 月之前
父節點
當前提交
2f83abe6f1
共有 1 個檔案被更改,包括 13 行新增11 行删除
  1. +13
    -11
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt

+ 13
- 11
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt 查看文件

@@ -3877,7 +3877,7 @@ open class ReportService(
} }
println(_grade) println(_grade)
val gradeCode = _grade!!.grade.code val gradeCode = _grade!!.grade.code
val otMultiplier = 1.15
// val otMultiplier = 1.15
val thisSE = salaryEffective.find { val thisSE = salaryEffective.find {
it.staff.id == ts.staff!!.id it.staff.id == ts.staff!!.id
&& it.startDate <= ts.recordDate && (it.endDate >= ts.recordDate || it.endDate == null) && 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 normalHour = ts.normalConsumed ?: 0.0
val otHour = ts.otConsumed ?: 0.0 val otHour = ts.otConsumed ?: 0.0
val normalCost = normalHour.times(hourlyRate) 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 //assigning data
val projectTeam = ts.project!!.teamLead!!.team.code val projectTeam = ts.project!!.teamLead!!.team.code
val staffTeam = ts.staff!!.team.code val staffTeam = ts.staff!!.team.code
// write in // write in
var tsInData = teamsMap[projectTeam]!![gradeCode]!!.In var tsInData = teamsMap[projectTeam]!![gradeCode]!!.In
tsInData.manhour += normalHour + otHour tsInData.manhour += normalHour + otHour
tsInData.cost += normalCost + otCost
tsInData.cost += (normalCost + otCost) * chargeFee
// write out // write out
val tsOutData = teamsMap[staffTeam]!!.get(gradeCode)!!.Out val tsOutData = teamsMap[staffTeam]!!.get(gradeCode)!!.Out
tsOutData.manhour += normalHour + otHour tsOutData.manhour += normalHour + otHour
tsOutData.cost += normalCost + otCost
tsOutData.cost += (normalCost + otCost) * chargeFee
} }


return teamsMap return teamsMap
@@ -4410,7 +4411,7 @@ open class ReportService(
} }
} }
_timesheets.forEach { ts -> _timesheets.forEach { ts ->
val otMultiplier = 1.15
// val otMultiplier = 1.15
val thisSE = salaryEffective.filter { val thisSE = salaryEffective.filter {
it.staff.id == ts.staff!!.id it.staff.id == ts.staff!!.id
&& &&
@@ -4419,7 +4420,8 @@ open class ReportService(
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 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 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}"
@@ -4440,7 +4442,7 @@ open class ReportService(
tsInData[inOut_Key]!!.put(projectNameCode, TsData(0.0, 0.0)) tsInData[inOut_Key]!!.put(projectNameCode, TsData(0.0, 0.0))
} }
tsInData[inOut_Key]!![projectNameCode]!!.manhour += normalHour + otHour tsInData[inOut_Key]!![projectNameCode]!!.manhour += normalHour + otHour
tsInData[inOut_Key]!![projectNameCode]!!.cost += normalCost + otCost
tsInData[inOut_Key]!![projectNameCode]!!.cost += (normalCost + otCost) * chargeFee
} }


return teamsMap return teamsMap
@@ -4687,11 +4689,11 @@ open class ReportService(
grade.id grade.id
)]?.sumOf { it.getValue("manHour") } ?: 0.0) )]?.sumOf { it.getValue("manHour") } ?: 0.0)


totalSalary += groupedTimesheets[Triple(
totalSalary += (groupedTimesheets[Triple(
team.id, team.id,
chargedTeam.id, chargedTeam.id,
grade.id grade.id
)]?.sumOf { it.getValue("salary") } ?: 0.0
)]?.sumOf { it.getValue("salary") } ?: 0.0) * chargeFee


val cloneStyle = workbook.createCellStyle() val cloneStyle = workbook.createCellStyle()
cloneStyle.cloneStyleFrom(normalFontWithBorderStyle) cloneStyle.cloneStyleFrom(normalFontWithBorderStyle)
@@ -4702,11 +4704,11 @@ open class ReportService(


createCell(columnIndex++).apply { createCell(columnIndex++).apply {
setCellValue( setCellValue(
groupedTimesheets[Triple(
(groupedTimesheets[Triple(
team.id, team.id,
chargedTeam.id, chargedTeam.id,
grade.id grade.id
)]?.sumOf { it.getValue("salary") } ?: 0.0)
)]?.sumOf { it.getValue("salary") } ?: 0.0) * chargeFee)


val cloneStyle = workbook.createCellStyle() val cloneStyle = workbook.createCellStyle()
cloneStyle.cloneStyleFrom(normalFontWithBorderStyle) cloneStyle.cloneStyleFrom(normalFontWithBorderStyle)


Loading…
取消
儲存