Kaynağa Gözat

update cross team report

tags/Baseline_30082024_BACKEND_UAT
cyril.tsui 1 yıl önce
ebeveyn
işleme
8336c1f157
1 değiştirilmiş dosya ile 24 ekleme ve 6 silme
  1. +24
    -6
      src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt

+ 24
- 6
src/main/java/com/ffii/tsms/modules/report/service/ReportService.kt Dosyayı Görüntüle

@@ -65,6 +65,7 @@ open class ReportService(
private val COMPLETION_PROJECT = "templates/report/AR05_Project Completion Report.xlsx"
private val CROSS_TEAM_CHARGE_REPORT = "templates/report/Cross Team Charge Report.xlsx"

private val chargeFee = 1.15
private fun conditionalFormattingNegative(sheet: Sheet) {
// Create a conditional formatting rule
val sheetCF = sheet.sheetConditionalFormatting
@@ -3688,21 +3689,38 @@ open class ReportService(
rowIndex = 3
sortedTeams.forEach { team: Team ->
// not his/her team staffs
val staffs = timesheets
var staffs = timesheets
.filter { it.project?.teamLead?.team?.id == team.id && it.staff?.team?.id != team.id }
.mapNotNull { it.staff }
.sortedBy { it.staffId }
.distinct()



// his/her team projects
val projects = timesheets
.filter { it.project?.teamLead?.team?.id == team.id && it.project?.teamLead?.team?.id != it.staff?.team?.id }
var tempTimesheets = timesheets
.filter {
it.project?.teamLead?.team?.id == team.id
&& it.project?.teamLead?.team?.id != it.staff?.team?.id
}

if (teamId.lowercase() != "all" && teamId.toLong() != team.id) {
staffs = staffs.filter {
it.team.id == teamId.toLong()
}

tempTimesheets = tempTimesheets.filter {
it.staff?.team?.id == teamId.toLong()
}
}

val projects = tempTimesheets
.mapNotNull { it.project }
.sortedByDescending { it.code }
.distinct()

// Team
if (projects.isNotEmpty()) {
if (projects.isNotEmpty() && staffs.isNotEmpty()) {
sheet.createRow(rowIndex++).apply {
createCell(0).apply {
setCellValue("Team to be charged:")
@@ -3776,7 +3794,7 @@ open class ReportService(
val startRow = rowIndex + 1
var endRow = rowIndex
projects.forEach { project: Project ->
if (teamId.lowercase() == "all" || teamId.toLong() == project.teamLead?.team?.id || teamId.toLong() == team.id) {
if (teamId.lowercase() == "all" || teamId.toLong() == project.teamLead?.team?.id || teamId.toLong() == team.id || team.id == project.teamLead?.team?.id) {
// if (team.id == project.teamLead?.team?.id) {
endRow++
sheet.createRow(rowIndex++).apply {
@@ -3825,7 +3843,7 @@ open class ReportService(
}

createCell(columnIndex).apply {
setCellValue(totalSalary)
setCellValue(totalSalary * chargeFee)
val cloneStyle = workbook.createCellStyle()
cloneStyle.cloneStyleFrom(boldFontWithBorderStyle)
cellStyle = cloneStyle.apply {


Yükleniyor…
İptal
Kaydet