|
|
@@ -69,7 +69,7 @@ open class DashboardService( |
|
|
|
+ " p.totalManhour as budgetedManhour," |
|
|
|
+ " sum(t.normalConsumed) + sum(t.otConsumed) as spentManhour," |
|
|
|
+ " p.totalManhour - sum(t.normalConsumed) - sum(t.otConsumed) as remainedManhour," |
|
|
|
+ " coalesce (round(((sum(t.normalConsumed) - sum(t.otConsumed))/p.totalManhour)*100,2),0) as manhourConsumptionPercentage," |
|
|
|
+ " coalesce (round(((sum(t.normalConsumed) + sum(t.otConsumed))/p.totalManhour)*100,2),0) as manhourConsumptionPercentage," |
|
|
|
+ " DATE_FORMAT(milestonePayment.comingPaymentMilestone, '%Y-%m-%d') as comingPaymentMilestone" |
|
|
|
+ " from project p" |
|
|
|
+ " left join project_task pt on p.id = pt.project_id" |
|
|
@@ -112,7 +112,7 @@ open class DashboardService( |
|
|
|
+ " p.totalManhour as budgetedManhour," |
|
|
|
+ " COALESCE (sum(t.normalConsumed) + sum(t.otConsumed),0) as spentManhour," |
|
|
|
+ " COALESCE (p.totalManhour - sum(t.normalConsumed) - sum(t.otConsumed),0) as remainedManhour," |
|
|
|
+ " coalesce (round(((sum(t.normalConsumed) - sum(t.otConsumed))/p.totalManhour)*100,2),0) as manhourConsumptionPercentage," |
|
|
|
+ " coalesce (round(((sum(t.normalConsumed) + sum(t.otConsumed))/p.totalManhour)*100,2),0) as manhourConsumptionPercentage," |
|
|
|
+ " DATE_FORMAT(milestonePayment.comingPaymentMilestone, '%Y-%m-%d') as comingPaymentMilestone" |
|
|
|
+ " from project p" |
|
|
|
+ " left join project_task pt on p.id = pt.project_id" |
|
|
@@ -256,7 +256,7 @@ open class DashboardService( |
|
|
|
+ " p.totalManhour as budgetedManhour," |
|
|
|
+ " COALESCE (sum(t.normalConsumed) + sum(t.otConsumed),0) as spentManhour," |
|
|
|
+ " COALESCE (p.totalManhour - sum(t.normalConsumed) - sum(t.otConsumed),0) as remainedManhour," |
|
|
|
+ " coalesce (round(((sum(t.normalConsumed) - sum(t.otConsumed))/p.totalManhour)*100,2),0) as manhourConsumptionPercentage," |
|
|
|
+ " coalesce (round(((sum(t.normalConsumed) + sum(t.otConsumed))/p.totalManhour)*100,2),0) as manhourConsumptionPercentage," |
|
|
|
+ " DATE_FORMAT(milestonePayment.comingPaymentMilestone, '%Y-%m-%d') as comingPaymentMilestone" |
|
|
|
+ " from project p" |
|
|
|
+ " left join project_task pt on p.id = pt.project_id" |
|
|
@@ -483,6 +483,7 @@ open class DashboardService( |
|
|
|
+ " p.code as projectCode," |
|
|
|
+ " p.name as projectName," |
|
|
|
+ " c.name as customerName," |
|
|
|
+ " s3.name as subsidiaryName," |
|
|
|
+ " p.expectedTotalFee as totalFee," |
|
|
|
+ " round(p.expectedTotalFee * 0.8,2) as totalBudget," |
|
|
|
+ " COALESCE(round(expenditure.cumulativeExpenditure,2),0) as cumulativeExpenditure," |
|
|
@@ -500,6 +501,7 @@ open class DashboardService( |
|
|
|
+ " end as totalUninvoiced" |
|
|
|
+ " from team t" |
|
|
|
+ " left join project p on t.teamLead = p.teamLead" |
|
|
|
+ " left join subsidiary s3 on p.customerSubsidiaryId = s3.id" |
|
|
|
+ " left join customer c on p.customerId = c.id" |
|
|
|
+ " left join invoice i on p.code = i.projectCode" |
|
|
|
+ " left join (" |
|
|
@@ -1434,7 +1436,7 @@ open class DashboardService( |
|
|
|
+ " select" |
|
|
|
+ " p.id as pid," |
|
|
|
+ " p.name as projectName," |
|
|
|
+ " coalesce (sum(t.normalConsumed)+sum(t.otConsumed),0) as manhours" |
|
|
|
+ " coalesce (coalesce(sum(t.normalConsumed),0)+coalesce(sum(t.otConsumed),0),0) as manhours" |
|
|
|
+ " from staff s" |
|
|
|
+ " left join staff_allocation sa on sa.staff_id = s.id" |
|
|
|
+ " left join project p on sa.project_id = p.id" |
|
|
@@ -1445,6 +1447,7 @@ open class DashboardService( |
|
|
|
+ " group by p.id, p.name" |
|
|
|
+ " ) as result on result.pid = p2.id" |
|
|
|
+ " where s2.id = :staffId" |
|
|
|
+ " group by p2.id, p2.name, result.manhours" |
|
|
|
) |
|
|
|
|
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
@@ -1463,7 +1466,7 @@ open class DashboardService( |
|
|
|
+ " select" |
|
|
|
+ " p.id as pid," |
|
|
|
+ " p.name as projectName," |
|
|
|
+ " coalesce (sum(t.normalConsumed)+sum(t.otConsumed),0) as manhours" |
|
|
|
+ " coalesce (coalesce(sum(t.normalConsumed),0)+coalesce(sum(t.otConsumed),0),0) as manhours" |
|
|
|
+ " from staff s" |
|
|
|
+ " left join staff_allocation sa on sa.staff_id = s.id" |
|
|
|
+ " left join project p on sa.project_id = p.id" |
|
|
@@ -1474,6 +1477,7 @@ open class DashboardService( |
|
|
|
+ " group by p.id, p.name" |
|
|
|
+ " ) as result on result.pid = p2.id" |
|
|
|
+ " where s2.id = :staffId" |
|
|
|
+ " group by p2.id, p2.name, result.manhours" |
|
|
|
) |
|
|
|
|
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
@@ -1492,7 +1496,7 @@ open class DashboardService( |
|
|
|
+ " select" |
|
|
|
+ " p.id as pid," |
|
|
|
+ " p.name as projectName," |
|
|
|
+ " coalesce (sum(t.normalConsumed)+sum(t.otConsumed),0) as manhours" |
|
|
|
+ " coalesce (coalesce(sum(t.normalConsumed),0)+coalesce(sum(t.otConsumed),0),0) as manhours" |
|
|
|
+ " from staff s" |
|
|
|
+ " left join staff_allocation sa on sa.staff_id = s.id" |
|
|
|
+ " left join project p on sa.project_id = p.id" |
|
|
@@ -1502,6 +1506,7 @@ open class DashboardService( |
|
|
|
+ " group by p.id, p.name" |
|
|
|
+ " ) as result on result.pid = p2.id" |
|
|
|
+ " where s2.id = :staffId" |
|
|
|
+ " group by p2.id, p2.name, result.manhours" |
|
|
|
) |
|
|
|
|
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
@@ -1521,6 +1526,18 @@ open class DashboardService( |
|
|
|
|
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
|
} |
|
|
|
fun IndividualStaffTotalLeaveHoursByDay(args: Map<String, Any>): List<Map<String, Any>> { |
|
|
|
val sql = StringBuilder( |
|
|
|
"select" |
|
|
|
+ " coalesce (sum(l.leaveHours),0) as leaveHours" |
|
|
|
+ " from staff s2" |
|
|
|
+ " left join `leave` l on s2.id = l.staffId" |
|
|
|
+ " where l.recordDate = :startdate" |
|
|
|
+ " and s2.id = :staffId" |
|
|
|
) |
|
|
|
|
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
|
} |
|
|
|
fun IndividualStaffTotalManhoursSpentWeekly(args: Map<String, Any>): List<Map<String, Any>> { |
|
|
|
val sql = StringBuilder( |
|
|
|
"select" |
|
|
@@ -1537,6 +1554,19 @@ open class DashboardService( |
|
|
|
|
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
|
} |
|
|
|
fun IndividualStaffTotalLeaveHoursWeekly(args: Map<String, Any>): List<Map<String, Any>> { |
|
|
|
val sql = StringBuilder( |
|
|
|
"select" |
|
|
|
+ " coalesce (sum(l.leaveHours),0) as leaveHours" |
|
|
|
+ " from staff s2" |
|
|
|
+ " left join `leave` l on s2.id = l.staffId" |
|
|
|
+ " where l.recordDate >= :startdate" |
|
|
|
+ " and l.recordDate <= :enddate" |
|
|
|
+ " and s2.id = :staffId" |
|
|
|
) |
|
|
|
|
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
|
} |
|
|
|
fun IndividualStaffTotalManhoursSpentByMonthly(args: Map<String, Any>): List<Map<String, Any>> { |
|
|
|
val sql = StringBuilder( |
|
|
|
"select" |
|
|
@@ -1551,6 +1581,31 @@ open class DashboardService( |
|
|
|
+ " and t.recordDate <= last_day(:startdate)" |
|
|
|
) |
|
|
|
|
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
|
} |
|
|
|
fun IndividualStaffTotalLeaveHoursMonthly(args: Map<String, Any>): List<Map<String, Any>> { |
|
|
|
val sql = StringBuilder( |
|
|
|
"select" |
|
|
|
+ " coalesce (sum(l.leaveHours),0) as leaveHours" |
|
|
|
+ " from staff s2" |
|
|
|
+ " left join `leave` l on s2.id = l.staffId" |
|
|
|
+ " where l.recordDate >= :startdate" |
|
|
|
+ " and l.recordDate <= last_day(:startdate)" |
|
|
|
+ " and s2.id = :staffId" |
|
|
|
) |
|
|
|
|
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
|
} |
|
|
|
fun staffCombo(args: Map<String, Any>): List<Map<String, Any>> { |
|
|
|
val sql = StringBuilder( |
|
|
|
"select" |
|
|
|
+ " s.id as id," |
|
|
|
+ " s.name as name," |
|
|
|
+ " concat(s.staffId ,'-',s.name) as label" |
|
|
|
+ " from staff s" |
|
|
|
+ " where s.deleted = 0" |
|
|
|
) |
|
|
|
|
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
|
} |
|
|
|
} |
|
|
|