| @@ -704,18 +704,18 @@ open class DashboardService( | |||
| + " coalesce(sum(i.issueAmount),0) as totalInvoiced," | |||
| + " coalesce(pj.totalFee,0) - coalesce(sum(i.issueAmount),0) as unInvoiced," | |||
| + " coalesce(sum(i.paidAmount),0) as totalReceived," | |||
| + " round(expenditure.cumulativeExpenditure + projectExpense.amount,2) as totalExpenditure," | |||
| + " round(expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0),2) as totalExpenditure," | |||
| + " round(expenditure.cumulativeExpenditure,2) as manhoursExpenditure," | |||
| + " round(projectExpense.amount,2) as projectExpense," | |||
| + " round(coalesce(projectExpense.amount, 0),2) as projectExpense," | |||
| + " case" | |||
| + " when coalesce(round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure + projectExpense.amount),3),0) >= 1 then 'Positive'" | |||
| + " when coalesce(round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure + projectExpense.amount),3),0) < 1 then 'Negative'" | |||
| + " when coalesce(round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0)),3),0) >= 1 then 'Positive'" | |||
| + " when coalesce(round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0)),3),0) < 1 then 'Negative'" | |||
| + " end as cashFlowStatus," | |||
| + " coalesce(format(sum(i.issueAmount) / (expenditure.cumulativeExpenditure + projectExpense.amount),3),0) as cpi," | |||
| + " coalesce(format(coalesce(pj.totalFee,0) / (expenditure.cumulativeExpenditure + projectExpense.amount),3),0) as projectedCpi," | |||
| + " coalesce(format(sum(i.issueAmount) / (expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0)),3),0) as cpi," | |||
| + " coalesce(format(coalesce(pj.totalFee,0) / (expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0)),3),0) as projectedCpi," | |||
| + " case" | |||
| + " when coalesce(round(coalesce(pj.totalFee,0) / (expenditure.cumulativeExpenditure + projectExpense.amount),3),0) >= 1 then 'Positive'" | |||
| + " when coalesce(round(coalesce(pj.totalFee,0) / (expenditure.cumulativeExpenditure + projectExpense.amount),3),0) < 1 then 'Negative'" | |||
| + " when coalesce(round(coalesce(pj.totalFee,0) / (expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0)),3),0) >= 1 then 'Positive'" | |||
| + " when coalesce(round(coalesce(pj.totalFee,0) / (expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0)),3),0) < 1 then 'Negative'" | |||
| + " end as projectedCashFlowStatus" | |||
| + " from team t" | |||
| + " left join (" | |||
| @@ -863,21 +863,21 @@ open class DashboardService( | |||
| + " count(p.code) as projectNo," | |||
| + " sum(p.expectedTotalFee) as totalFee," | |||
| + " round((sum(p.expectedTotalFee) - sum(ifnull(p.subContractFee, 0))) * 0.8,2) as totalBudget," | |||
| + " round((expenditure.cumulativeExpenditure + projectExpense.amount),2) as totalExpenditure," | |||
| + " round((expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0)),2) as totalExpenditure," | |||
| + " round(expenditure.cumulativeExpenditure,2) as manhoursExpenditure," | |||
| + " round(projectExpense.amount,2) as projectExpense," | |||
| + " round(coalesce(projectExpense.amount, 0),2) as projectExpense," | |||
| + " sum(i.issueAmount) as totalInvoiced," | |||
| + " sum(p.expectedTotalFee) - sum(i.issueAmount) as unInvoiced," | |||
| + " sum(i.paidAmount) as totalReceived," | |||
| + " case" | |||
| + " when round(sum(i.issueAmount) / ((expenditure.cumulativeExpenditure + projectExpense.amount)),3) >= 1 then 'Positive'" | |||
| + " when round(sum(i.issueAmount) / ((expenditure.cumulativeExpenditure + projectExpense.amount)),3) < 1 then 'Negative'" | |||
| + " when round(sum(i.issueAmount) / ((expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0))),3) >= 1 then 'Positive'" | |||
| + " when round(sum(i.issueAmount) / ((expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0))),3) < 1 then 'Negative'" | |||
| + " end as cashFlowStatus," | |||
| + " format(sum(i.issueAmount) / ((expenditure.cumulativeExpenditure + projectExpense.amount)),3) as cpi," | |||
| + " format(sum(p.expectedTotalFee) / ((expenditure.cumulativeExpenditure + projectExpense.amount)),3) as projectedCpi," | |||
| + " format(sum(i.issueAmount) / ((expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0))),3) as cpi," | |||
| + " format(sum(p.expectedTotalFee) / ((expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0))),3) as projectedCpi," | |||
| + " case" | |||
| + " when round(sum(p.expectedTotalFee) / ((expenditure.cumulativeExpenditure + projectExpense.amount)),3) >= 1 then 'Positive'" | |||
| + " when round(sum(p.expectedTotalFee) / ((expenditure.cumulativeExpenditure + projectExpense.amount)),3) < 1 then 'Negative'" | |||
| + " when round(sum(p.expectedTotalFee) / ((expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0))),3) >= 1 then 'Positive'" | |||
| + " when round(sum(p.expectedTotalFee) / ((expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0))),3) < 1 then 'Negative'" | |||
| + " end as projectedCashFlowStatus" | |||
| + " from project p" | |||
| + " left join (" | |||
| @@ -1003,7 +1003,7 @@ open class DashboardService( | |||
| + " p.totalBudget as totalBudget," | |||
| + " COALESCE(round((expenditure.cumulativeExpenditure + coalesce(projectExpense.amount, 0)),2),0) as totalExpenditure," | |||
| + " COALESCE(round(expenditure.cumulativeExpenditure,2),0) as manhoursExpenditure," | |||
| + " COALESCE(round(projectExpense.amount,2),0) as projectExpense," | |||
| + " round(coalesce(projectExpense.amount, 0),2) as projectExpense," | |||
| + " coalesce(sum(i.issueAmount),0) as totalInvoiced," | |||
| + " coalesce(sum(i.paidAmount),0) as totalReceived," | |||
| + " case" | |||