| @@ -575,14 +575,14 @@ open class DashboardService( | |||||
| + " coalesce(sum(i.paidAmount),0) as totalReceived," | + " coalesce(sum(i.paidAmount),0) as totalReceived," | ||||
| + " round(expenditure.cumulativeExpenditure,2) as cumulativeExpenditure," | + " round(expenditure.cumulativeExpenditure,2) as cumulativeExpenditure," | ||||
| + " case" | + " case" | ||||
| + " when coalesce(round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure),2),0) >= 1 then 'Positive'" | |||||
| + " when coalesce(round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure),2),0) < 1 then 'Negative'" | |||||
| + " when coalesce(round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure),3),0) >= 1 then 'Positive'" | |||||
| + " when coalesce(round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure),3),0) < 1 then 'Negative'" | |||||
| + " end as cashFlowStatus," | + " end as cashFlowStatus," | ||||
| + " coalesce(round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure),2),0) as cpi," | |||||
| + " coalesce(round(coalesce(pj.totalFee,0) / (expenditure.cumulativeExpenditure),2),0) as projectedCpi," | |||||
| + " coalesce(round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure),3),0) as cpi," | |||||
| + " coalesce(round(coalesce(pj.totalFee,0) / (expenditure.cumulativeExpenditure),3),0) as projectedCpi," | |||||
| + " case" | + " case" | ||||
| + " when coalesce(round(coalesce(pj.totalFee,0) / (expenditure.cumulativeExpenditure),2),0) >= 1 then 'Positive'" | |||||
| + " when coalesce(round(coalesce(pj.totalFee,0) / (expenditure.cumulativeExpenditure),2),0) < 1 then 'Negative'" | |||||
| + " when coalesce(round(coalesce(pj.totalFee,0) / (expenditure.cumulativeExpenditure),3),0) >= 1 then 'Positive'" | |||||
| + " when coalesce(round(coalesce(pj.totalFee,0) / (expenditure.cumulativeExpenditure),3),0) < 1 then 'Negative'" | |||||
| + " end as projectedCashFlowStatus" | + " end as projectedCashFlowStatus" | ||||
| + " from team t" | + " from team t" | ||||
| + " left join (" | + " left join (" | ||||
| @@ -657,14 +657,14 @@ open class DashboardService( | |||||
| + " sum(p.expectedTotalFee) - sum(i.issueAmount) as unInvoiced," | + " sum(p.expectedTotalFee) - sum(i.issueAmount) as unInvoiced," | ||||
| + " sum(i.paidAmount) as totalReceived," | + " sum(i.paidAmount) as totalReceived," | ||||
| + " case" | + " case" | ||||
| + " when round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure),2) >= 1 then 'Positive'" | |||||
| + " when round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure),2) < 1 then 'Negative'" | |||||
| + " when round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure),3) >= 1 then 'Positive'" | |||||
| + " when round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure),3) < 1 then 'Negative'" | |||||
| + " end as cashFlowStatus," | + " end as cashFlowStatus," | ||||
| + " round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure),2) as cpi," | |||||
| + " round(sum(p.expectedTotalFee) / (expenditure.cumulativeExpenditure),2) as projectedCpi," | |||||
| + " round(sum(i.issueAmount) / (expenditure.cumulativeExpenditure),3) as cpi," | |||||
| + " round(sum(p.expectedTotalFee) / (expenditure.cumulativeExpenditure),3) as projectedCpi," | |||||
| + " case" | + " case" | ||||
| + " when round(sum(p.expectedTotalFee) / (expenditure.cumulativeExpenditure),2) >= 1 then 'Positive'" | |||||
| + " when round(sum(p.expectedTotalFee) / (expenditure.cumulativeExpenditure),2) < 1 then 'Negative'" | |||||
| + " when round(sum(p.expectedTotalFee) / (expenditure.cumulativeExpenditure),3) >= 1 then 'Positive'" | |||||
| + " when round(sum(p.expectedTotalFee) / (expenditure.cumulativeExpenditure),3) < 1 then 'Negative'" | |||||
| + " end as projectedCashFlowStatus" | + " end as projectedCashFlowStatus" | ||||
| + " from project p" | + " from project p" | ||||
| + " left join (" | + " left join (" | ||||
| @@ -802,14 +802,14 @@ open class DashboardService( | |||||
| + " coalesce(sum(i.issueAmount),0) as totalInvoiced," | + " coalesce(sum(i.issueAmount),0) as totalInvoiced," | ||||
| + " coalesce(sum(i.paidAmount),0) as totalReceived," | + " coalesce(sum(i.paidAmount),0) as totalReceived," | ||||
| + " case" | + " case" | ||||
| + " when coalesce(round(sum(i.issueAmount) / (COALESCE(expenditure.cumulativeExpenditure,0)),2),0) >= 1 then 'Positive'" | |||||
| + " when coalesce(round(sum(i.issueAmount) / (COALESCE(expenditure.cumulativeExpenditure,0)),2),0) < 1 then 'Negative'" | |||||
| + " when coalesce(round(sum(i.issueAmount) / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) >= 1 then 'Positive'" | |||||
| + " when coalesce(round(sum(i.issueAmount) / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) < 1 then 'Negative'" | |||||
| + " end as cashFlowStatus," | + " end as cashFlowStatus," | ||||
| + " coalesce(round(sum(i.issueAmount) / (COALESCE(expenditure.cumulativeExpenditure,0)),2),0) as cpi," | |||||
| + " coalesce(round(p.totalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),2),0) as projectedCpi," | |||||
| + " coalesce(round(sum(i.issueAmount) / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) as cpi," | |||||
| + " coalesce(round(p.totalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) as projectedCpi," | |||||
| + " case" | + " case" | ||||
| + " when coalesce(round(p.totalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),2),0) >= 1 then 'Positive'" | |||||
| + " when coalesce(round(p.totalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),2),0) < 1 then 'Negative'" | |||||
| + " when coalesce(round(p.totalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) >= 1 then 'Positive'" | |||||
| + " when coalesce(round(p.totalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) < 1 then 'Negative'" | |||||
| + " end as projectedCashFlowStatus," | + " end as projectedCashFlowStatus," | ||||
| + " case" | + " case" | ||||
| + " when p.totalFee - sum(i.issueAmount) >= 0 then coalesce(round(p.totalFee - sum(i.issueAmount),2),0)" | + " when p.totalFee - sum(i.issueAmount) >= 0 then coalesce(round(p.totalFee - sum(i.issueAmount),2),0)" | ||||
| @@ -910,14 +910,14 @@ open class DashboardService( | |||||
| + " coalesce(sum(i.issueAmount),0) as totalInvoiced," | + " coalesce(sum(i.issueAmount),0) as totalInvoiced," | ||||
| + " coalesce(sum(i.paidAmount),0) as totalReceived," | + " coalesce(sum(i.paidAmount),0) as totalReceived," | ||||
| + " case" | + " case" | ||||
| + " when coalesce(round(sum(i.issueAmount) / (COALESCE(expenditure.cumulativeExpenditure,0)),2),0) >= 1 then 'Positive'" | |||||
| + " when coalesce(round(sum(i.issueAmount) / (COALESCE(expenditure.cumulativeExpenditure,0)),2),0) < 1 then 'Negative'" | |||||
| + " when coalesce(round(sum(i.issueAmount) / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) >= 1 then 'Positive'" | |||||
| + " when coalesce(round(sum(i.issueAmount) / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) < 1 then 'Negative'" | |||||
| + " end as cashFlowStatus," | + " end as cashFlowStatus," | ||||
| + " coalesce(round(sum(i.issueAmount) / (COALESCE(expenditure.cumulativeExpenditure,0)),2),0) as cpi," | |||||
| + " coalesce(round(p.expectedTotalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),2),0) as projectedCpi," | |||||
| + " coalesce(round(sum(i.issueAmount) / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) as cpi," | |||||
| + " coalesce(round(p.expectedTotalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) as projectedCpi," | |||||
| + " case" | + " case" | ||||
| + " when coalesce(round(p.expectedTotalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),2),0) >= 1 then 'Positive'" | |||||
| + " when coalesce(round(p.expectedTotalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),2),0) < 1 then 'Negative'" | |||||
| + " when coalesce(round(p.expectedTotalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) >= 1 then 'Positive'" | |||||
| + " when coalesce(round(p.expectedTotalFee / (COALESCE(expenditure.cumulativeExpenditure,0)),3),0) < 1 then 'Negative'" | |||||
| + " end as projectedCashFlowStatus," | + " end as projectedCashFlowStatus," | ||||
| // + " case" | // + " case" | ||||
| // + " when coalesce(round(sum(p.expectedTotalFee) * 0.8,2),0) <= COALESCE(expenditure.cumulativeExpenditure,0) then coalesce(round(sum(p.expectedTotalFee) * 0.8,2),0) - coalesce(sum(i.issueAmount),0)" | // + " when coalesce(round(sum(p.expectedTotalFee) * 0.8,2),0) <= COALESCE(expenditure.cumulativeExpenditure,0) then coalesce(round(sum(p.expectedTotalFee) * 0.8,2),0) - coalesce(sum(i.issueAmount),0)" | ||||