| @@ -3448,9 +3448,9 @@ open class DashboardService( | |||||
| + " select " | + " select " | ||||
| + " projectId, " | + " projectId, " | ||||
| + " CASE WHEN tl.teamId = p.teamId " | + " 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 ( " | + " from ( " | ||||
| + " SELECT * " | + " SELECT * " | ||||
| + " FROM timesheet t " | + " 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 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_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 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 " | + " GROUP BY t.projectId, tl.teamId, p.teamId " | ||||
| + " ) " | + " ) " | ||||
| // invoice data | // invoice data | ||||