|
|
@@ -1494,6 +1494,56 @@ open class DashboardService( |
|
|
|
|
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
|
} |
|
|
|
|
|
|
|
fun BeforeCurrentYearCashFlowMonthlyCumulativeExpenditure(args: Map<String, Any>): List<Map<String, Any>> { |
|
|
|
val sql = StringBuilder("" |
|
|
|
+ " select" |
|
|
|
+ " coalesce (sum(result.expenditure),0) as beforeCurrentYearCumulativeExpenditure" |
|
|
|
+ " from(" |
|
|
|
+ " select" |
|
|
|
+ " r.recordYearMonth as recordYearMonth," |
|
|
|
+ " r.recordYear as recordYear," |
|
|
|
+ " r.recordMonth as recordMonth," |
|
|
|
+ " sum(r.cumulativeExpenditure) as expenditure" |
|
|
|
+ " from(" |
|
|
|
+ " select" |
|
|
|
+ " se.recordYearMonth as recordYearMonth," |
|
|
|
+ " se.recordYear as recordYear," |
|
|
|
+ " se.recordMonth as recordMonth," |
|
|
|
+ " (coalesce(sum(t3.normalConsumed),0) * se.hourlyRate) + (coalesce(sum(t3.otConsumed),0) * se.hourlyRate * 1.0) as cumulativeExpenditure" |
|
|
|
+ " from(" |
|
|
|
+ " select" |
|
|
|
+ " DATE_FORMAT (t.recordDate, '%Y-%m') as recordYearMonth," |
|
|
|
+ " year(t.recordDate) as recordYear," |
|
|
|
+ " month(t.recordDate) as recordMonth," |
|
|
|
+ " t.id as tid," |
|
|
|
+ " t.recordDate as timesheet_record_date," |
|
|
|
+ " s.id as staff_id," |
|
|
|
+ " se.id as salary_effective_id," |
|
|
|
+ " se.salaryId," |
|
|
|
+ " se.startdate as salary_effective_start_date," |
|
|
|
+ " coalesce(se.enddate,now()) as salary_effective_end_date," |
|
|
|
+ " s2.hourlyRate as hourlyRate" |
|
|
|
+ " from project p" |
|
|
|
+ " left join project_task pt on p.id = pt.project_id" |
|
|
|
+ " left join timesheet t on pt.id = t.projectTaskId" |
|
|
|
+ " left join staff s on t.staffId = s.id" |
|
|
|
+ " left join salary_effective se on t.recordDate >= se.`date` and s.id = se.staffId" |
|
|
|
+ " left join salary s2 on se.salaryId = s2.salaryPoint" |
|
|
|
+ " where t.id is not null" |
|
|
|
+ " and p.id in (1)" |
|
|
|
+ " and year(t.recordDate) < :year" |
|
|
|
+ " group by t.id, s.id, se.id, se.salaryId,se.date, s2.hourlyRate" |
|
|
|
+ " ) as se" |
|
|
|
+ " left join timesheet t3 on se.tid = t3.id" |
|
|
|
+ " where t3.recordDate >= se.salary_effective_start_date and t3.recordDate <= se.salary_effective_end_date" |
|
|
|
+ " group by se.recordYearMonth, se.recordYear,se.recordMonth, se.hourlyRate" |
|
|
|
+ " ) as r" |
|
|
|
+ " group by r.recordYearMonth,r.recordMonth,r.recordYear" |
|
|
|
+ " ) as result" |
|
|
|
) |
|
|
|
return jdbcDao.queryForList(sql.toString(), args) |
|
|
|
} |
|
|
|
fun CashFlowReceivableAndExpenditure(args: Map<String, Any>): List<Map<String, Any>> { |
|
|
|
val sql = StringBuilder( |
|
|
|
// "select" |
|
|
|