|
|
@@ -2250,12 +2250,12 @@ open class ReportService( |
|
|
|
+ " c.name as client, " |
|
|
|
+ " sum(coalesce(t.normalConsumed, 0) + coalesce(t.otConsumed,0)) as consumed " |
|
|
|
+ " from timesheet t " |
|
|
|
+ " left join team_log tl on tl.staffId = t.staffId and t.recordDate >= tl.`from` and (t.recordDate <= tl.`to` or tl.`to` is null) " |
|
|
|
// + " left join team_log tl on tl.staffId = t.staffId and t.recordDate >= tl.`from` and (t.recordDate <= tl.`to` or tl.`to` is null) " |
|
|
|
+ " left join staff s on s.id = t.staffId " |
|
|
|
+ " left join project p on p.id = t.projectId " |
|
|
|
+ " left join customer c on c.id = p.customerId " |
|
|
|
+ " where t.deleted = false " |
|
|
|
+ " and (tl.teamId is not null and s.teamId is not null) " |
|
|
|
// + " and (tl.teamId is not null and s.teamId is not null) " |
|
|
|
+ " and t.projectId is not null " |
|
|
|
) |
|
|
|
if (args.containsKey(("startDate"))) { |
|
|
@@ -2265,12 +2265,12 @@ open class ReportService( |
|
|
|
sql.append(" and t.recordDate < :endDate ") |
|
|
|
} |
|
|
|
if (args.containsKey(("teamId"))) { |
|
|
|
sql.append(" and coalesce(tl.teamId, s.teamId) = :teamId ") |
|
|
|
sql.append(" and p.teamlead = :teamId ") |
|
|
|
} |
|
|
|
if (args["groupBy"] == "staff") { |
|
|
|
sql.append(" group by recordMonth, t.staffId, t.projectId, tl.teamId ") |
|
|
|
sql.append(" group by recordMonth, t.staffId, t.projectId ") |
|
|
|
} else { |
|
|
|
sql.append(" group by recordMonth, t.projectId, tl.teamId ") |
|
|
|
sql.append(" group by recordMonth, t.projectId ") |
|
|
|
} |
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
|
} |
|
|
@@ -3785,8 +3785,8 @@ open class ReportService( |
|
|
|
tempRow2 = getOrCreateRow(sheet2, rowIndex) |
|
|
|
tempCell = getOrCreateCell(tempRow, columnIndex) |
|
|
|
tempCell2 = getOrCreateCell(tempRow2, columnIndex) |
|
|
|
tempCell.setCellValue("${args["startDate"].toString()} - ${args["endDate"].toString()}") |
|
|
|
tempCell2.setCellValue("${args["startDate"].toString()} - ${args["endDate"].toString()}") |
|
|
|
tempCell.setCellValue("${args["startDate"].toString()} - ${(args["endDate"] as LocalDate).minusDays(1.toLong()).toString()}") |
|
|
|
tempCell2.setCellValue("${args["startDate"].toString()} - ${(args["endDate"] as LocalDate).minusDays(1.toLong()).toString()}") |
|
|
|
// write months header |
|
|
|
rowIndex = 5 |
|
|
|
columnIndex = 3 |
|
|
|