浏览代码

update sql

add_swagger
MSI\derek 10 个月前
父节点
当前提交
81713333dc
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. +5
    -3
      src/main/java/com/ffii/tsms/modules/data/service/DashboardService.kt

+ 5
- 3
src/main/java/com/ffii/tsms/modules/data/service/DashboardService.kt 查看文件

@@ -3448,9 +3448,9 @@ open class DashboardService(
+ " select "
+ " projectId, "
+ " CASE WHEN tl.teamId = p.teamId "
+ " THEN SUM((COALESCE(t.normalConsumed, 0) + COALESCE(t.otConsumed, 0)) * COALESCE(sal.hourlyRate, 0)) "
+ " ELSE SUM((COALESCE(t.normalConsumed, 0) + COALESCE(t.otConsumed, 0)) * COALESCE(sal.hourlyRate, 0) * 1) " // cross team multiplier
+ " END AS manhourExpense "
+ " then sum((coalesce(t.normalConsumed, 0) + coalesce(t.otConsumed, 0)) * coalesce(sal.hourlyRate, sal2.hourlyRate)) "
+ " else sum((coalesce(t.normalConsumed, 0) + coalesce(t.otConsumed, 0)) * coalesce(sal.hourlyRate, sal2.hourlyRate)) "
+ " end as manhourExpense "
+ " from ( "
+ " SELECT * "
+ " FROM timesheet t "
@@ -3464,6 +3464,8 @@ open class DashboardService(
+ " left join team_log tl on tl.staffId = t.staffId and t.recordDate between tl.`from` AND tl.`to` "
+ " left JOIN salary_effective se ON se.staffId = t.staffId and t.recordDate between se.startDate AND se.endDate "
+ " left join salary sal on sal.salaryPoint = se.salaryId "
+ " left join staff s on s.id = t.staffId and se.id is null "
+ " left join salary sal2 on sal2.salaryPoint = s.salaryId "
+ " GROUP BY t.projectId, tl.teamId, p.teamId "
+ " ) "
// invoice data


正在加载...
取消
保存