Capital Flow & FDI Tracker

Capital Flow & FDI Tracker

Enter Capital Flow Data by Period

Enter positive for surplus, negative for deficit.

Note: This report provides a summary of capital flow and FDI data based on user inputs. Analysis of capital flows and FDI requires a deeper understanding of economic fundamentals, policy environment, and global financial conditions. This tool is for informational and illustrative purposes only.

`; console.log('Report output generated.'); } // PDF Download Functionality downloadPdfBtn.addEventListener('click', function() { console.log('Download PDF button clicked.'); const { jsPDF } = window.jspdf; const doc = new jsPDF('landscape'); // Use landscape for wider table if (allPeriodData.length === 0) { showMessageBox('No Data for PDF', 'There is no valid data to generate a PDF report. Please ensure you have entered data and clicked "Analyze Data".'); return; } doc.setFontSize(22); doc.setTextColor(30, 64, 138); // Dark Blue doc.text("Capital Flow & FDI Analysis Report", doc.internal.pageSize.getWidth() / 2, 20, null, null, "center"); doc.setFontSize(12); doc.setTextColor(55, 65, 81); // Gray-700 let y = 30; doc.text("Detailed Analysis by Period:", 15, y += 15); const tableHeaders = [ 'Period', 'GDP ($)', 'Net FDI ($)', 'Net Portfolio Inv. ($)', 'Net Other Inv. ($)', 'Total Net Capital Flow ($)', 'FDI (% GDP)', 'Capital Flow (% GDP)', 'Current Account Balance ($)', 'CA (% GDP)' ]; const tableRows = allPeriodData.map(data => [ data.period, data.gdp.toLocaleString('en-US', { maximumFractionDigits: 0 }), data.netFDI.toLocaleString('en-US', { maximumFractionDigits: 0 }), data.netPortfolioInvestment.toLocaleString('en-US', { maximumFractionDigits: 0 }), data.netOtherInvestment.toLocaleString('en-US', { maximumFractionDigits: 0 }), data.totalNetCapitalFlow.toLocaleString('en-US', { maximumFractionDigits: 0 }), data.fdiToGdp.toFixed(2) + '%', data.totalCapitalFlowToGdp.toFixed(2) + '%', data.currentAccountBalance.toLocaleString('en-US', { maximumFractionDigits: 0 }), data.currentAccountToGdp.toFixed(2) + '%' ]); doc.autoTable({ startY: y + 5, head: [tableHeaders], body: tableRows, theme: 'grid', styles: { fillColor: [243, 244, 246], fontSize: 8, cellPadding: 1, overflow: 'linebreak' }, headStyles: { fillColor: [59, 130, 246], textColor: [255, 255, 255], fontSize: 9 }, margin: { left: 10, right: 10 }, columnStyles: { 0: { cellWidth: 25 }, // Period 1: { cellWidth: 25 }, // GDP 2: { cellWidth: 25 }, // Net FDI 3: { cellWidth: 25 }, // Net Portfolio Inv. 4: { cellWidth: 25 }, // Net Other Inv. 5: { cellWidth: 25 }, // Total Net Capital Flow 6: { cellWidth: 15 }, // FDI (% GDP) 7: { cellWidth: 15 }, // Capital Flow (% GDP) 8: { cellWidth: 25 }, // Current Account Balance 9: { cellWidth: 15 } // CA (% GDP) } }); y = doc.autoTable.previous.finalY; doc.setFontSize(10); doc.setTextColor(107, 114, 128); const disclaimer = "Note: This report provides a summary of capital flow and FDI data based on user inputs. Analysis of capital flows and FDI requires a deeper understanding of economic fundamentals, policy environment, and global financial conditions. This tool is for informational and illustrative purposes only."; const splitDisclaimer = doc.splitTextToSize(disclaimer, doc.internal.pageSize.getWidth() - 40); // 40 = left+right margin doc.text(splitDisclaimer, 20, y += 15); doc.save('Capital_Flow_FDI_Report.pdf'); }); // Initialize the first tab as active on load activateTab(0); });
Scroll to Top