Future Cost of Living Projection Tool
1. Current Expenses & Setup
2. Future Cost Projection
3. Summary & PDF
Step 1: Your Current Expenses & Projection Parameters
Calculate Future Costs & Proceed
Previous
Next
Step 2: Projected Future Costs
Complete Step 1 and click "Calculate Future Costs" to see your projection.
Previous
Next
Step 3: Projection Summary & Download Report
Complete the projection on previous tabs to view the summary.
Download Projection Report as PDF
Previous
Next
No lifestyle adjustment applied. Projected future costs remain as calculated initially.
`;
adjOutputDiv.style.display = 'block';
}
else {
adjOutputDiv.style.display = 'none';
}
}
function displayOverallFCLPSummary() {
const container = document.getElementById('fclpOverallSummaryContainer');
if (futureCostReportData.projections.futureTotalAnnualSpending === 0 && futureCostReportData.projections.currentTotalAnnualSpending === 0) {
container.innerHTML = "
Complete the projection on previous tabs to view the summary.
";
document.getElementById('downloadFutureCostPdfButton').disabled = true;
return;
}
const { inputs, projections } = futureCostReportData;
let summaryHTML = `
Projection Summary for "${inputs.baseYearLabel}"
Projection Horizon: ${inputs.projectionYears} years
Overall Avg. Annual Inflation Rate Used (default): ${inputs.overallInflationRate.toFixed(1)}%
Total Current Annual Expenses: $${projections.currentTotalAnnualSpending.toFixed(2)}
Total Projected Future Annual Expenses: $${projections.futureTotalAnnualSpending.toFixed(2)}
Total Projected Future Monthly Expenses: $${projections.futureTotalMonthlySpending.toFixed(2)}
Overall Cost of Living Increase: ${isFinite(projections.overallPercentageIncrease) ? projections.overallPercentageIncrease.toFixed(1) + '%' : 'N/A'}
`;
if (projections.adjustedFutureTotalAnnualSpending !== null && projections.lifestyleAdjustmentPercent !== 0) {
summaryHTML += `
With ${projections.lifestyleAdjustmentPercent > 0 ? '+' : ''}${projections.lifestyleAdjustmentPercent}% Lifestyle Adjustment:
Adjusted Future Annual Expenses: $${projections.adjustedFutureTotalAnnualSpending.toFixed(2)}
Adjusted Future Monthly Expenses: $${(projections.adjustedFutureTotalAnnualSpending / 12).toFixed(2)}
`;
}
// Top categories by future cost
const topCategories = [...projections.detailedBreakdown].sort((a,b) => b.futureAnnualSpending - a.futureAnnualSpending).slice(0,3);
if(topCategories.length > 0){
summaryHTML += `
Top 3 Projected Future Spending Categories: `;
topCategories.forEach(cat => {
summaryHTML += `${cat.name}: $${cat.futureAnnualSpending.toFixed(2)}/year `;
});
summaryHTML += ` `;
}
container.innerHTML = summaryHTML;
document.getElementById('downloadFutureCostPdfButton').disabled = false;
}
function downloadFutureCostPdf() {
if (futureCostReportData.projections.futureTotalAnnualSpending === 0 && futureCostReportData.projections.currentTotalAnnualSpending === 0) {
alert("Please calculate a projection first."); return;
}
if (typeof window.jspdf === 'undefined' || typeof window.jspdf.jsPDF === 'undefined') {
alert('PDF generation library (jsPDF) is not loaded.'); return;
}
const jsPDFConstructor = window.jspdf.jsPDF;
const doc = new jsPDFConstructor();
if (typeof doc.autoTable !== 'function') {
alert('jsPDF AutoTable plugin not loaded.'); return;
}
calculateFutureCostsAndProceed(false); // Ensure data is freshest before PDF
const { inputs, projections } = futureCostReportData;
const primaryColor = '#007bff', textColor = '#212529', tableHeaderColor = '#e9ecef';
let yPos = 22;
const pageHeight = doc.internal.pageSize.height; const margin = 15;
function checkYPdf(increment = 10) { if (yPos + increment > pageHeight - margin) { doc.addPage(); yPos = margin; } }
doc.setFontSize(18); doc.setTextColor(primaryColor);
doc.text("Future Cost of Living Projection", margin, yPos); yPos += 8;
doc.setFontSize(10); doc.setTextColor(textColor);
doc.text(`Report Date: ${new Date().toLocaleDateString()}`, margin, yPos); yPos += 7;
doc.text(`Base Period: ${inputs.baseYearLabel}`, margin, yPos); yPos += 5;
doc.text(`Projection Horizon: ${inputs.projectionYears} years`, margin, yPos); yPos += 5;
doc.text(`Overall Avg. Annual Inflation Rate: ${inputs.overallInflationRate.toFixed(1)}%`, margin, yPos); yPos += 10;
checkYPdf(15);
doc.setFontSize(12); doc.setTextColor(primaryColor); doc.text("Current Spending Summary", margin, yPos); yPos += 6;
doc.setFontSize(10); doc.setFont(undefined,'bold');
doc.text(`Total Current Annual Expenses: $${projections.currentTotalAnnualSpending.toFixed(2)}`, margin, yPos); yPos += 7;
doc.setFont(undefined,'normal');
checkYPdf(20 + projections.detailedBreakdown.length * 6);
doc.setFontSize(12); doc.setTextColor(primaryColor); doc.text("Projected Future Spending Breakdown", margin, yPos); yPos += 6;
const head = [['Category', 'Current Ann. ($)', 'Inflation Used (%)', 'Future Ann. ($)', 'Future Mon. ($)', '% of Future Total']];
const body = projections.detailedBreakdown.map(cat => [
cat.name, cat.currentAnnualSpending.toFixed(2), `${cat.inflationRateUsed.toFixed(1)}%`,
cat.futureAnnualSpending.toFixed(2), cat.futureMonthlySpending.toFixed(2), `${cat.percentOfFutureTotal.toFixed(1)}%`
]);
doc.autoTable({
startY: yPos, head: head, body: body, theme: 'grid',
headStyles: {fillColor: tableHeaderColor, textColor:textColor, fontStyle:'bold', fontSize:8.5},
styles:{fontSize:8, cellPadding:1.5, halign:'right'},
columnStyles: {0:{halign:'left', cellWidth: 50}, 2:{halign:'center'}}
});
yPos = doc.lastAutoTable.finalY + 7;
checkYPdf(25);
doc.setFontSize(10); doc.setFont(undefined,'bold');
doc.text(`Total Projected Future Annual Expenses: $${projections.futureTotalAnnualSpending.toFixed(2)}`, margin, yPos); yPos +=5;
doc.text(`Total Projected Future Monthly Expenses: $${projections.futureTotalMonthlySpending.toFixed(2)}`, margin, yPos); yPos +=5;
doc.text(`Overall Cost of Living Increase: ${isFinite(projections.overallPercentageIncrease) ? projections.overallPercentageIncrease.toFixed(1) + '%' : 'N/A'}`, margin, yPos); yPos +=5;
doc.setFont(undefined,'normal');
if (projections.adjustedFutureTotalAnnualSpending !== null && projections.lifestyleAdjustmentPercent !== 0) {
checkYPdf(15);
doc.setFontSize(10); doc.setFont(undefined,'bold');
doc.text(`With ${projections.lifestyleAdjustmentPercent > 0 ? '+' : ''}${projections.lifestyleAdjustmentPercent}% Lifestyle Adjustment:`, margin, yPos); yPos +=5;
doc.setFont(undefined,'normal');
doc.text(`Adjusted Future Annual Expenses: $${projections.adjustedFutureTotalAnnualSpending.toFixed(2)}`, margin + 5, yPos); yPos +=5;
doc.text(`Adjusted Future Monthly Expenses: $${(projections.adjustedFutureTotalAnnualSpending / 12).toFixed(2)}`, margin + 5, yPos); yPos +=7;
}
checkYPdf(40);
doc.setFontSize(11); doc.setTextColor(primaryColor); doc.text("Important Considerations", margin, yPos); yPos += 6;
doc.setFontSize(8.5); doc.setTextColor(textColor);
const considerationsText = [
"- Projections are mathematical estimates based on the inflation rates provided. Actual future costs can vary significantly due to economic changes, personal choices, and unforeseen events.",
"- Inflation rates for specific categories (e.g., healthcare, education) can differ greatly from general inflation. Using category-specific rates where possible enhances accuracy.",
"- This tool is for planning and informational purposes. It's recommended to review and update financial plans and projections regularly.",
"- For comprehensive financial planning, especially for long-term goals like retirement, consider consulting with a qualified financial advisor."
];
considerationsText.forEach(line => {
const splitLine = doc.splitTextToSize(line, doc.internal.pageSize.width - (margin*2));
splitLine.forEach(l => { checkYPdf(4); doc.text(l, margin, yPos); yPos += 4; });
yPos += 1;
});
doc.save("Future_Cost_of_Living_Projection.pdf");
}
updateFCLPNavButtons(); // Initial call