|
|
@@ -89,6 +89,7 @@ const ProjectCashFlow: React.FC = () => { |
|
|
|
} |
|
|
|
const fetchChartData = async () => { |
|
|
|
const cashFlowMonthlyChartData = await fetchProjectsCashFlowMonthlyChart(selectedProjectIdList,cashFlowYear); |
|
|
|
console.log(cashFlowMonthlyChartData) |
|
|
|
const monthlyIncome = [] |
|
|
|
const cumulativeIncome = [] |
|
|
|
const monthlyExpenditure = [] |
|
|
@@ -104,11 +105,11 @@ const ProjectCashFlow: React.FC = () => { |
|
|
|
cumulativeIncome.push(cashFlowMonthlyChartData[0].incomeList[i].cumulativeIncome) |
|
|
|
} |
|
|
|
for (var i = 0; i < cashFlowMonthlyChartData[0].expenditureList.length; i++) { |
|
|
|
if (rightMax < cashFlowMonthlyChartData[0].incomeList[i].cumulativeIncome || rightMax < cashFlowMonthlyChartData[0].expenditureList[i].cumulativeExpenditure){ |
|
|
|
rightMax = Math.max(cashFlowMonthlyChartData[0].incomeList[i].cumulativeIncome,cashFlowMonthlyChartData[0].expenditureList[i].cumulativeExpenditure) |
|
|
|
if (rightMax < cashFlowMonthlyChartData[0].incomeList[i].cumulativeIncome || rightMax < cashFlowMonthlyChartData[0].beforeCurrentYearExpenditure[0].beforeCurrentYearCumulativeExpenditure +cashFlowMonthlyChartData[0].expenditureList[i].cumulativeExpenditure){ |
|
|
|
rightMax = Math.max(cashFlowMonthlyChartData[0].incomeList[i].cumulativeIncome,cashFlowMonthlyChartData[0].beforeCurrentYearExpenditure[0].beforeCurrentYearCumulativeExpenditure + cashFlowMonthlyChartData[0].expenditureList[i].cumulativeExpenditure) |
|
|
|
} |
|
|
|
monthlyExpenditure.push(cashFlowMonthlyChartData[0].expenditureList[i].expenditure) |
|
|
|
cumulativeExpenditure.push(cashFlowMonthlyChartData[0].expenditureList[i].cumulativeExpenditure) |
|
|
|
cumulativeExpenditure.push(cashFlowMonthlyChartData[0].beforeCurrentYearExpenditure[0].beforeCurrentYearCumulativeExpenditure + cashFlowMonthlyChartData[0].expenditureList[i].cumulativeExpenditure) |
|
|
|
} |
|
|
|
setMonthlyIncomeList(monthlyIncome) |
|
|
|
setMonthlyCumulativeIncomeList(cumulativeIncome) |
|
|
|