|
|
@@ -80,7 +80,7 @@ open class DashboardService( |
|
|
|
+ " 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," |
|
|
|
+ " DATE_FORMAT(milestonePayment.comingPaymentMilestone, '%Y-%m-%d') as comingPaymentMilestone" |
|
|
|
+ " COALESCE (DATE_FORMAT(milestonePayment.comingPaymentMilestone, '%Y-%m-%d'),'NA') as comingPaymentMilestone" |
|
|
|
+ " from project p" |
|
|
|
+ " left join project_task pt on p.id = pt.project_id" |
|
|
|
+ " left join timesheet t on pt.id = t.projectTaskId" |
|
|
@@ -89,17 +89,19 @@ open class DashboardService( |
|
|
|
+ " left join milestone m on p.id = m.projectId and curdate() >= m.startDate and curdate() <= m.endDate" |
|
|
|
+ " left join task_group tg on m.taskGroupId = tg.id" |
|
|
|
+ " left join (" |
|
|
|
+ " select" |
|
|
|
+ " mp.date as comingPaymentMilestone" |
|
|
|
+ " from project p" |
|
|
|
+ " left join milestone m on p.id = m.projectId" |
|
|
|
+ " left join milestone_payment mp on m.id = mp.milestoneId" |
|
|
|
+ " where p.customerId = :customerId" |
|
|
|
+ " and p.customerSubsidiaryId = :subsidiaryId" |
|
|
|
+ " and mp.date >= curdate()" |
|
|
|
+ " order by date asc" |
|
|
|
+ " limit 1" |
|
|
|
+ " ) milestonePayment on 1=1" |
|
|
|
+ " SELECT pid, MAX(comingPaymentMilestone) AS comingPaymentMilestone" |
|
|
|
+ " FROM (" |
|
|
|
+ " SELECT p.id AS pid, mp.date AS comingPaymentMilestone" |
|
|
|
+ " FROM project p" |
|
|
|
+ " LEFT JOIN milestone m ON p.id = m.projectId" |
|
|
|
+ " LEFT JOIN milestone_payment mp ON m.id = mp.milestoneId" |
|
|
|
+ " WHERE p.teamLead = :teamLeadId" |
|
|
|
+ " AND p.status NOT IN ('Pending to Start', 'Completed', 'Deleted')" |
|
|
|
+ " AND mp.date >= CURDATE()" |
|
|
|
+ " ) AS subquery" |
|
|
|
+ " GROUP BY pid" |
|
|
|
+ " ORDER BY comingPaymentMilestone ASC" |
|
|
|
+ " ) milestonePayment on milestonePayment.pid = p.id" |
|
|
|
+ " where p.customerId = :customerId" |
|
|
|
+ " and p.customerSubsidiaryId = :subsidiaryId" |
|
|
|
+ " and (tg.name != '5. Miscellaneous' or tg.name is null)" |
|
|
@@ -131,7 +133,7 @@ open class DashboardService( |
|
|
|
+ " 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," |
|
|
|
+ " DATE_FORMAT(milestonePayment.comingPaymentMilestone, '%Y-%m-%d') as comingPaymentMilestone" |
|
|
|
+ " COALESCE (DATE_FORMAT(milestonePayment.comingPaymentMilestone, '%Y-%m-%d'),'NA') as comingPaymentMilestone" |
|
|
|
+ " from project p" |
|
|
|
+ " left join project_task pt on p.id = pt.project_id" |
|
|
|
+ " left join timesheet t on pt.id = t.projectTaskId" |
|
|
@@ -140,17 +142,19 @@ open class DashboardService( |
|
|
|
+ " left join milestone m on p.id = m.projectId and curdate() >= m.startDate and curdate() <= m.endDate" |
|
|
|
+ " left join task_group tg on m.taskGroupId = tg.id" |
|
|
|
+ " left join (" |
|
|
|
+ " select" |
|
|
|
+ " mp.date as comingPaymentMilestone" |
|
|
|
+ " from project p" |
|
|
|
+ " left join milestone m on p.id = m.projectId" |
|
|
|
+ " left join milestone_payment mp on m.id = mp.milestoneId" |
|
|
|
+ " where p.customerId = :customerId" |
|
|
|
+ " and isNull(p.customerSubsidiaryId)" |
|
|
|
+ " and mp.date >= curdate()" |
|
|
|
+ " order by date asc" |
|
|
|
+ " limit 1" |
|
|
|
+ " ) milestonePayment on 1=1" |
|
|
|
+ " SELECT pid, MAX(comingPaymentMilestone) AS comingPaymentMilestone" |
|
|
|
+ " FROM (" |
|
|
|
+ " SELECT p.id AS pid, mp.date AS comingPaymentMilestone" |
|
|
|
+ " FROM project p" |
|
|
|
+ " LEFT JOIN milestone m ON p.id = m.projectId" |
|
|
|
+ " LEFT JOIN milestone_payment mp ON m.id = mp.milestoneId" |
|
|
|
+ " WHERE p.teamLead = :teamLeadId" |
|
|
|
+ " AND p.status NOT IN ('Pending to Start', 'Completed', 'Deleted')" |
|
|
|
+ " AND mp.date >= CURDATE()" |
|
|
|
+ " ) AS subquery" |
|
|
|
+ " GROUP BY pid" |
|
|
|
+ " ORDER BY comingPaymentMilestone ASC" |
|
|
|
+ " ) milestonePayment on milestonePayment.pid = p.id" |
|
|
|
+ " where p.customerId = :customerId" |
|
|
|
+ " and isNull(p.customerSubsidiaryId)" |
|
|
|
+ " and p.status not in (\"Pending to Start\",\"Completed\",\"Deleted\")" |
|
|
@@ -283,7 +287,7 @@ open class DashboardService( |
|
|
|
+ " 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," |
|
|
|
+ " DATE_FORMAT(milestonePayment.comingPaymentMilestone, '%Y-%m-%d') as comingPaymentMilestone" |
|
|
|
+ " COALESCE (DATE_FORMAT(milestonePayment.comingPaymentMilestone, '%Y-%m-%d'),'NA') as comingPaymentMilestone" |
|
|
|
+ " from project p" |
|
|
|
+ " left join project_task pt on p.id = pt.project_id" |
|
|
|
+ " left join timesheet t on pt.id = t.projectTaskId" |
|
|
@@ -292,16 +296,19 @@ open class DashboardService( |
|
|
|
+ " left join milestone m on p.id = m.projectId and curdate() >= m.startDate and curdate() <= m.endDate" |
|
|
|
+ " left join task_group tg on m.taskGroupId = tg.id" |
|
|
|
+ " left join (" |
|
|
|
+ " select" |
|
|
|
+ " mp.date as comingPaymentMilestone" |
|
|
|
+ " from project p" |
|
|
|
+ " left join milestone m on p.id = m.projectId" |
|
|
|
+ " left join milestone_payment mp on m.id = mp.milestoneId" |
|
|
|
+ " where p.teamLead = :teamLeadId" |
|
|
|
+ " and mp.date >= curdate()" |
|
|
|
+ " order by date asc" |
|
|
|
+ " limit 1" |
|
|
|
+ " ) milestonePayment on 1=1" |
|
|
|
+ " SELECT pid, MAX(comingPaymentMilestone) AS comingPaymentMilestone" |
|
|
|
+ " FROM (" |
|
|
|
+ " SELECT p.id AS pid, mp.date AS comingPaymentMilestone" |
|
|
|
+ " FROM project p" |
|
|
|
+ " LEFT JOIN milestone m ON p.id = m.projectId" |
|
|
|
+ " LEFT JOIN milestone_payment mp ON m.id = mp.milestoneId" |
|
|
|
+ " WHERE p.teamLead = :teamLeadId" |
|
|
|
+ " AND p.status NOT IN ('Pending to Start', 'Completed', 'Deleted')" |
|
|
|
+ " AND mp.date >= CURDATE()" |
|
|
|
+ " ) AS subquery" |
|
|
|
+ " GROUP BY pid" |
|
|
|
+ " ORDER BY comingPaymentMilestone ASC" |
|
|
|
+ " ) milestonePayment on milestonePayment.pid = p.id" |
|
|
|
+ " where p.teamLead = :teamLeadId" |
|
|
|
+ " and p.status not in (\"Pending to Start\",\"Completed\",\"Deleted\")" |
|
|
|
+ " and (tg.name != '5. Miscellaneous' or tg.name is null)" |
|
|
|