| @@ -3633,23 +3633,29 @@ open class ReportService( | |||||
| sortedTeams.forEach { team -> | sortedTeams.forEach { team -> | ||||
| val currentTeam = team.code | val currentTeam = team.code | ||||
| val _timesheets = timesheets.filter { ts -> | val _timesheets = timesheets.filter { ts -> | ||||
| // for team log | |||||
| // val thisTeam = teamlog.filter { | |||||
| // for after team log is implemented | |||||
| // val thisStaffTeam = teamlog.filter { | |||||
| // it.from.isBefore(ts.recordDate) | // it.from.isBefore(ts.recordDate) | ||||
| // && it.to != null | // && it.to != null | ||||
| // && it.staff.id == ts.staff!!.id | // && it.staff.id == ts.staff!!.id | ||||
| // }.maxByOrNull { it.from } | // }.maxByOrNull { it.from } | ||||
| ts.project!!.teamLead!!.team.code == currentTeam // check isChargingTeam | |||||
| && | |||||
| ts.project!!.teamLead!!.team.code != ts.staff!!.team.code // check isCrossTeam | |||||
| // ts.project!!.teamLead!!.team.id != thisTeam!!.team.id // for team log | |||||
| // val thisProjectTeam = teamlog.filter { | |||||
| // it.from.isBefore(ts.recordDate) | |||||
| // && it.to != null | |||||
| // && it.staff.id == ts.project!!.teamLead!!.team.id | |||||
| // }.maxByOrNull { it.from } | |||||
| val staffTeam = ts.staff!!.team.code | |||||
| val projectTeam = ts.project!!.teamLead!!.team.code | |||||
| (staffTeam == currentTeam && projectTeam != staffTeam) | |||||
| || (projectTeam == currentTeam && projectTeam != staffTeam) // check isCrossTeam | |||||
| // ts.project!!.teamLead!!.team.id != thisStaffTeam!!.team.id // for team log | |||||
| } | } | ||||
| _timesheets.forEach {ts -> | _timesheets.forEach {ts -> | ||||
| // this team charging others | // this team charging others | ||||
| // get the grade and salary data of the record | // get the grade and salary data of the record | ||||
| val _grade = gradeLog.find { it.staff.id == ts.staff!!.id } | val _grade = gradeLog.find { it.staff.id == ts.staff!!.id } | ||||
| val gradeCode = _grade!!.grade.code | val gradeCode = _grade!!.grade.code | ||||
| val otMultiplier = 1 | |||||
| val otMultiplier = 1.15 | |||||
| val thisSE = salaryEffective.filter { | val thisSE = salaryEffective.filter { | ||||
| it.staff.id == ts.staff!!.id | it.staff.id == ts.staff!!.id | ||||
| && | && | ||||
| @@ -3889,9 +3895,9 @@ open class ReportService( | |||||
| grades: List<Grade>, | grades: List<Grade>, | ||||
| teamId: String, | teamId: String, | ||||
| gradeLog: List<GradeLog>, | gradeLog: List<GradeLog>, | ||||
| isTeamLead: Boolean, | |||||
| salaryEffective: List<SalaryEffective>, | |||||
| ) { | ) { | ||||
| val salaryEffective = salaryEffectiveRepository.findAll() | |||||
| // val salaryEffective = salaryEffectiveRepository.findAll() | |||||
| var sheet: Sheet = workbook.getSheetAt(2) | var sheet: Sheet = workbook.getSheetAt(2) | ||||
| val accountingStyle = workbook.createDataFormat().getFormat("_(* #,##0.00_);_(* (#,##0.00);_(* \"-\"??_);_(@_)") | val accountingStyle = workbook.createDataFormat().getFormat("_(* #,##0.00_);_(* (#,##0.00);_(* \"-\"??_);_(@_)") | ||||
| val rowIndex = 1 // Assuming the location is in (1,2), which is the report date field | val rowIndex = 1 // Assuming the location is in (1,2), which is the report date field | ||||
| @@ -3902,10 +3908,10 @@ open class ReportService( | |||||
| sheet.getRow(rowIndex).getCell(columnIndex).apply { | sheet.getRow(rowIndex).getCell(columnIndex).apply { | ||||
| setCellValue(convertReportMonth) | setCellValue(convertReportMonth) | ||||
| } | } | ||||
| var sortedTeams = teams.sortedBy { it.id }.toMutableList() | |||||
| var sortedTeams = teams.toMutableList() | |||||
| if (teamId.lowercase() != "all") { | if (teamId.lowercase() != "all") { | ||||
| // sortedTeams = teams.sortedWith(compareBy { if (it.id == teamId.toLong()) 0 else 1 }).toMutableList() | // sortedTeams = teams.sortedWith(compareBy { if (it.id == teamId.toLong()) 0 else 1 }).toMutableList() | ||||
| sortedTeams = mutableListOf(sortedTeams.find { teamId.toLong() == it.id }!!) | |||||
| sortedTeams = mutableListOf(teams.find { teamId.toLong() == it.id }!!) | |||||
| } | } | ||||
| //// generate info map ///// | //// generate info map ///// | ||||
| val teamsInOutMap: MutableMap<String, MutableMap<String, InOut>> = generateTeamBlock( | val teamsInOutMap: MutableMap<String, MutableMap<String, InOut>> = generateTeamBlock( | ||||
| @@ -4503,18 +4509,20 @@ open class ReportService( | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| val isTeamLead = false | |||||
| conditionalFormattingNegative(sheet) | conditionalFormattingNegative(sheet) | ||||
| conditionalFormattingPositive(sheet) | conditionalFormattingPositive(sheet) | ||||
| val _teams = teams.sortedBy { it.id } | |||||
| val salaryEffective = salaryEffectiveRepository.findAll() | |||||
| // page 3 | |||||
| createThirdSheetTeamChargeReport( | createThirdSheetTeamChargeReport( | ||||
| month, | month, | ||||
| workbook, | workbook, | ||||
| timesheets, | timesheets, | ||||
| teams, | |||||
| _teams, | |||||
| grades, | grades, | ||||
| teamId, | teamId, | ||||
| gradeLog, | gradeLog, | ||||
| isTeamLead, | |||||
| salaryEffective | |||||
| ) | ) | ||||
| return workbook | return workbook | ||||
| } | } | ||||