瀏覽代碼

dashboard support invoice deletable

tags/Baseline_30082024_BACKEND_UAT
MSI\User 1 年之前
父節點
當前提交
b9b6324334
共有 1 個文件被更改,包括 9 次插入4 次删除
  1. +9
    -4
      src/main/java/com/ffii/tsms/modules/data/service/DashboardService.kt

+ 9
- 4
src/main/java/com/ffii/tsms/modules/data/service/DashboardService.kt 查看文件

@@ -243,6 +243,7 @@ open class DashboardService(
+ " select p.code, sum(i.issueAmount) as sumIssuedAmount , sum(i.paidAmount) as sumPaidAmount" + " select p.code, sum(i.issueAmount) as sumIssuedAmount , sum(i.paidAmount) as sumPaidAmount"
+ " from invoice i" + " from invoice i"
+ " left join project p on p.code = i.projectCode" + " left join project p on p.code = i.projectCode"
+ " where i.deleted = 0" //update invoice deletable
+ " group by p.code" + " group by p.code"
+ " )" + " )"
+ " select p.code, p.description, c.name as client, concat(t.code, \' - \', t.name) as teamLead, p.planStart , p.planEnd , p.expectedTotalFee," + " select p.code, p.description, c.name as client, concat(t.code, \' - \', t.name) as teamLead, p.planStart , p.planEnd , p.expectedTotalFee,"
@@ -674,6 +675,7 @@ open class DashboardService(
+ " left join project p3 on t3.teamLead = p3.teamLead" + " left join project p3 on t3.teamLead = p3.teamLead"
+ " left join invoice i3 on p3.code = i3.projectCode" + " left join invoice i3 on p3.code = i3.projectCode"
+ " where t3.deleted = 0" + " where t3.deleted = 0"
+ " and i3.deleted = 0" //update invoiced deletable
+ " and p3.status = 'On-going'" + " and p3.status = 'On-going'"
+ " group by t3.id" + " group by t3.id"
+ " ) as i on i.tid = t.id" + " ) as i on i.tid = t.id"
@@ -811,6 +813,7 @@ open class DashboardService(
+ " from project p3" + " from project p3"
+ " left join invoice i3 on p3.code = i3.projectCode" + " left join invoice i3 on p3.code = i3.projectCode"
+ " where p3.deleted = 0" + " where p3.deleted = 0"
+ " and i3.deleted = 0" //update invoice deletable
+ " and p3.status = 'On-going'" + " and p3.status = 'On-going'"
+ " group by p3.id" + " group by p3.id"
+ " ) as i on i.pid = p.id" + " ) as i on i.pid = p.id"
@@ -947,6 +950,7 @@ open class DashboardService(
+ " left join customer c3 on p3.customerId = c3.id" + " left join customer c3 on p3.customerId = c3.id"
+ " left join invoice i3 on p3.code = i3.projectCode" + " left join invoice i3 on p3.code = i3.projectCode"
+ " where t3.deleted = 0" + " where t3.deleted = 0"
+ " and i3.deleted = 0" //update invoice deletable
+ " and p3.status = 'On-going'" + " and p3.status = 'On-going'"
) )
if (args != null) { if (args != null) {
@@ -1170,7 +1174,7 @@ open class DashboardService(
+ " left join project p on t.teamLead = p.teamLead" + " left join project p on t.teamLead = p.teamLead"
+ " left join subsidiary s3 on p.customerSubsidiaryId = s3.id" + " left join subsidiary s3 on p.customerSubsidiaryId = s3.id"
+ " left join customer c on p.customerId = c.id" + " left join customer c on p.customerId = c.id"
+ " left join invoice i on p.code = i.projectCode"
+ " left join invoice i on p.code = i.projectCode and and i.deleted = 0" //update invoice deletable
+ " left join (" + " left join ("
+ " select" + " select"
+ " r.teamId as teamId," + " r.teamId as teamId,"
@@ -1296,7 +1300,7 @@ open class DashboardService(
+ " month(i.receiptDate) as invoiceMonth," + " month(i.receiptDate) as invoiceMonth,"
+ " coalesce(sum(i.paidAmount),0) as income" + " coalesce(sum(i.paidAmount),0) as income"
+ " from project p" + " from project p"
+ " left join invoice i on p.code = i.projectCode"
+ " left join invoice i on p.code = i.projectCode and i.deleted = 0" //update invoice deletable
+ " where p.status = 'On-going'" + " where p.status = 'On-going'"
+ " and p.id in (:projectIds)" + " and p.id in (:projectIds)"
+ " and year(i.receiptDate) = :year" + " and year(i.receiptDate) = :year"
@@ -1494,6 +1498,7 @@ open class DashboardService(
+ " left join invoice i3 on p3.code = i3.projectCode" + " left join invoice i3 on p3.code = i3.projectCode"
+ " where p3.deleted = 0" + " where p3.deleted = 0"
+ " and p3.status = 'On-going'" + " and p3.status = 'On-going'"
+ " and i3.deleted = 0" //update invoice deletable
+ " group by p3.id" + " group by p3.id"
+ " ) as i on i.pid = p.id" + " ) as i on i.pid = p.id"
+ " left join(" + " left join("
@@ -1686,7 +1691,7 @@ open class DashboardService(
+ " i.invoiceNo AS invoiceNo" + " i.invoiceNo AS invoiceNo"
+ " FROM" + " FROM"
+ " project p" + " project p"
+ " LEFT JOIN invoice i ON p.code = i.projectCode"
+ " LEFT JOIN invoice i ON p.code = i.projectCode and i.deleted = 0" //update invoice deletable
+ " WHERE" + " WHERE"
+ " p.id IN (:projectIds)" + " p.id IN (:projectIds)"
+ " AND i.paidAmount IS NOT NULL" + " AND i.paidAmount IS NOT NULL"
@@ -1777,7 +1782,7 @@ open class DashboardService(
+ " coalesce(sum(i.paidAmount),0) as income" + " coalesce(sum(i.paidAmount),0) as income"
+ " from project p" + " from project p"
+ " left join team t on p.teamLead = t.teamLead" + " left join team t on p.teamLead = t.teamLead"
+ " left join invoice i on p.code = i.projectCode"
+ " left join invoice i on p.code = i.projectCode and i.deleted = 0" //update invoice deletable
+ " where p.status = 'On-going'" + " where p.status = 'On-going'"


) )


Loading…
取消
儲存