diff --git a/src/components/ProjectCashFlow/ProjectCashFlow.tsx b/src/components/ProjectCashFlow/ProjectCashFlow.tsx index 854531c..0fd9df5 100644 --- a/src/components/ProjectCashFlow/ProjectCashFlow.tsx +++ b/src/components/ProjectCashFlow/ProjectCashFlow.tsx @@ -121,18 +121,31 @@ const ProjectCashFlow: React.FC = () => { } const fetchReceivableAndExpenditureData = async () => { - const cashFlowReceivableAndExpenditureData = await fetchProjectsCashFlowReceivableAndExpenditure(selectedProjectIdList); - if(cashFlowReceivableAndExpenditureData.length !== 0){ - setReceivedPercentage(cashFlowReceivableAndExpenditureData[0].receivedPercentage) - setInvoicedPercentage(cashFlowReceivableAndExpenditureData[0].invoicedPercentage) - setTotalFee(cashFlowReceivableAndExpenditureData[0].totalProjectFee) - setTotalInvoiced(cashFlowReceivableAndExpenditureData[0].totalInvoiced) - setTotalReceived(cashFlowReceivableAndExpenditureData[0].totalReceived) - setReceivable(cashFlowReceivableAndExpenditureData[0].receivable) - setExpenditurePercentage(cashFlowReceivableAndExpenditureData[0].expenditurePercentage) - setTotalBudget(cashFlowReceivableAndExpenditureData[0].totalBudget) - setTotalExpenditure(cashFlowReceivableAndExpenditureData[0].totalExpenditure) - setExpenditureReceivable(cashFlowReceivableAndExpenditureData[0].expenditureReceivable) + if (selectedProjectIdList.length === 0) { + setReceivedPercentage(0) + setInvoicedPercentage(0) + setTotalFee(0) + setTotalInvoiced(0) + setTotalReceived(0) + setReceivable(0) + setExpenditurePercentage(0) + setTotalBudget(0) + setTotalExpenditure(0) + setExpenditureReceivable(0) + } else { + const cashFlowReceivableAndExpenditureData = await fetchProjectsCashFlowReceivableAndExpenditure(selectedProjectIdList); + if(cashFlowReceivableAndExpenditureData.length !== 0){ + setReceivedPercentage(cashFlowReceivableAndExpenditureData[0].receivedPercentage) + setInvoicedPercentage(cashFlowReceivableAndExpenditureData[0].invoicedPercentage) + setTotalFee(cashFlowReceivableAndExpenditureData[0].totalProjectFee) + setTotalInvoiced(cashFlowReceivableAndExpenditureData[0].totalInvoiced) + setTotalReceived(cashFlowReceivableAndExpenditureData[0].totalReceived) + setReceivable(cashFlowReceivableAndExpenditureData[0].receivable) + setExpenditurePercentage(cashFlowReceivableAndExpenditureData[0].expenditurePercentage) + setTotalBudget(cashFlowReceivableAndExpenditureData[0].totalBudget) + setTotalExpenditure(cashFlowReceivableAndExpenditureData[0].totalExpenditure) + setExpenditureReceivable(cashFlowReceivableAndExpenditureData[0].expenditureReceivable) + } } } const fetchAnticipateData = async () => { diff --git a/src/components/ProjectFinancialSummary/ProjectFinancialSummary.tsx b/src/components/ProjectFinancialSummary/ProjectFinancialSummary.tsx index cab3985..5e2d08d 100644 --- a/src/components/ProjectFinancialSummary/ProjectFinancialSummary.tsx +++ b/src/components/ProjectFinancialSummary/ProjectFinancialSummary.tsx @@ -458,6 +458,14 @@ const columns2 = [ fetchProjectTableData(params.row.teamId,params.row.cid) }; + const handleExportByClient = () => { + console.log(clientFinancialRows) + }; + + const handleExportByProject = () => { + console.log(projectFinancialRows) + }; + return ( @@ -471,14 +479,32 @@ const columns2 = [ - +
+ +
+
+ {clientFinancialRows.length > 0 && ( + + )} +
{/* */}
- +
+ +
+
+ {projectFinancialRows.length > 0 && ( + + )} +