Debt Repayment Optimization Tool

Debt Repayment Optimization Tool

Compare the Avalanche and Snowball methods to pay off your debts faster.

Enter Your Debts

Set Your Strategy

How much extra can you pay each month towards your debts? This amount will be targeted at one debt at a time to accelerate your payoff.

$

Your Optimized Plan

Debt Balance Over Time

Generated on ${new Date().toLocaleDateString('en-US', { dateStyle: 'long' })}

Your Financial Snapshot

Projected Debt-Free Date
${debtFreeDate.toLocaleDateString('en-US', {month: 'long', year: 'numeric'})}
Total Interest Paid
$${result.totalInterest.toFixed(2)}
Total Amount Paid
$${totalPaid.toFixed(2)}

Debt Payoff Timeline (${selectedStrategy.charAt(0).toUpperCase() + selectedStrategy.slice(1)} Method)

Debt Repayment Chart
`; const pdfTemplate = document.getElementById('pdf-template'); pdfTemplate.innerHTML = reportHtml; pdfTemplate.classList.remove('invisible'); try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(pdfTemplate.querySelector('.pdf-report-container'), { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('Debt_Repayment_Plan.pdf'); } catch(e) { console.error('PDF Generation Error:', e); } finally { downloadPdfBtn.disabled = false; downloadPdfBtn.textContent = 'Download Action Plan PDF'; pdfTemplate.classList.add('invisible'); } } downloadPdfBtn.addEventListener('click', generatePdfReport); // --- INITIALIZATION --- renderDebtInputs(); extraPaymentInput.value = extraPayment; switchTab(0); });
Scroll to Top