Przeglądaj źródła

cpi query update

tags/Baseline_30082024_BACKEND_UAT
Mac\David 1 rok temu
rodzic
commit
b6faef01c1
1 zmienionych plików z 24 dodań i 24 usunięć
  1. +24
    -24
      src/main/java/com/ffii/tsms/modules/data/service/DashboardService.kt

+ 24
- 24
src/main/java/com/ffii/tsms/modules/data/service/DashboardService.kt Wyświetl plik

@@ -575,14 +575,14 @@ open class DashboardService(
+ " coalesce(sum(i.paidAmount),0) as totalReceived,"
+ " round(expenditure.cumulativeExpenditure,2) as cumulativeExpenditure,"
+ " 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,"
+ " 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"
+ " 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"
+ " from team t"
+ " left join ("
@@ -657,14 +657,14 @@ open class DashboardService(
+ " sum(p.expectedTotalFee) - sum(i.issueAmount) as unInvoiced,"
+ " sum(i.paidAmount) as totalReceived,"
+ " 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,"
+ " 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"
+ " 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"
+ " from project p"
+ " left join ("
@@ -802,14 +802,14 @@ open class DashboardService(
+ " coalesce(sum(i.issueAmount),0) as totalInvoiced,"
+ " coalesce(sum(i.paidAmount),0) as totalReceived,"
+ " 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,"
+ " 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"
+ " 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,"
+ " case"
+ " 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.paidAmount),0) as totalReceived,"
+ " 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,"
+ " 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"
+ " 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,"
// + " 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)"


Ładowanie…
Anuluj
Zapisz