Financial Recovery Budget Planner

Monthly Income Sources

Total Monthly Income: $0.00

Monthly Expenses

Total Monthly Expenses: $0.00

Outstanding Debts

Total Debt Load: $0.00

Total Minimum Monthly Payments: $0.00

Budget Summary

Total Monthly Income: $0.00

Total Monthly Expenses: $0.00

Total Minimum Debt Payments: $0.00


Remaining for Allocation (Surplus/Deficit): $0.00

Debt Repayment Strategy

Based on your surplus, you can make additional payments towards your debts.

Remaining after extra debt payment: $0.00

Consider the "Avalanche" (highest interest first) or "Snowball" (smallest balance first) method for prioritizing extra payments. This tool helps calculate your available amount.

No income sources listed.

`; } // Expenses htmlContent += `

Monthly Expenses

`; if (plannerData.expenseItems.length > 0) { htmlContent += ``; // Group expenses by category for PDF const expensesByCategory = plannerData.expenseItems.reduce((acc, item) => { if (!acc[item.category]) acc[item.category] = []; acc[item.category].push(item); return acc; }, {}); for (const category in expensesByCategory) { expensesByCategory[category].forEach(item => { htmlContent += ``; }); } htmlContent += ``; htmlContent += `
CategoryItemAmount
${item.category}${item.name}$${item.amount.toFixed(2)}
Total Expenses$${calculateTotalExpensesDrbp().toFixed(2)}
`; } else { htmlContent += `

No expenses listed.

`; } // Debts htmlContent += `

Debts

`; if (plannerData.debtItems.length > 0) { htmlContent += ``; plannerData.debtItems.forEach(item => { htmlContent += ``; }); const { totalLoad, totalMinPayments } = calculateTotalDebtsDrbp(); htmlContent += ``; htmlContent += `
CreditorTotal OwedAPR (%)Min. Payment
${item.name}$${item.totalAmount.toFixed(2)}${item.interestRate.toFixed(2)}%$${item.minPayment.toFixed(2)}
Total Debt Load$${totalLoad.toFixed(2)}$${totalMinPayments.toFixed(2)}
`; } else { htmlContent += `

No debts listed.

`; } // Budget Summary htmlContent += `

Budget Summary

`; const totalIncome = calculateTotalIncomeDrbp(); const totalExpenses = calculateTotalExpensesDrbp(); const { totalMinPayments } = calculateTotalDebtsDrbp(); const surplusDeficit = totalIncome - totalExpenses - totalMinPayments; const extraToDebtVal = parseFloat(document.getElementById('extraToDebtDrbp').value) || 0; const finalRemaining = surplusDeficit - extraToDebtVal; htmlContent += `
Total Monthly Income:$${totalIncome.toFixed(2)}
Total Monthly Expenses:$${totalExpenses.toFixed(2)}
Total Minimum Debt Payments:$${totalMinPayments.toFixed(2)}
Available Surplus / (Deficit):$${surplusDeficit.toFixed(2)}
Extra Allocated to Debt:$${extraToDebtVal.toFixed(2)}
Final Remaining Balance:$${finalRemaining.toFixed(2)}
`; htmlContent += `

Plan Notes:

Use any surplus to accelerate debt repayment. Prioritize debts strategically (e.g., highest interest rate first). This plan is a snapshot; review and adjust regularly.

`; pdfContentElement.innerHTML = htmlContent; document.body.appendChild(pdfContentElement); // Required for html2canvas to see the element html2canvas(pdfContentElement, { scale: 2, useCORS: true, windowWidth: pdfContentElement.scrollWidth, windowHeight: pdfContentElement.scrollHeight }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgProps = pdf.getImageProperties(imgData); const imgHeight = (imgProps.height * pdfWidth) / imgProps.width; let heightLeft = imgHeight; let position = 15; // Initial y position with margin pdf.addImage(imgData, 'PNG', 10, position, pdfWidth - 20, imgHeight); // Adjust x and width for margins heightLeft -= (pdf.internal.pageSize.getHeight() - 2 * position); // Subtract first page height (with margins) while (heightLeft > 0) { position = -heightLeft + 15; // Start new image from where it left off, plus margin pdf.addPage(); pdf.addImage(imgData, 'PNG', 10, position, pdfWidth - 20, imgHeight); heightLeft -= (pdf.internal.pageSize.getHeight() - 2 * 15); } pdf.save('Financial_Recovery_Budget_Plan.pdf'); document.body.removeChild(pdfContentElement); }).catch(error => { console.error("Error generating PDF:", error); alert("Could not generate PDF. Please ensure all inputs are reasonable. See console for details."); if (document.body.contains(pdfContentElement)) { document.body.removeChild(pdfContentElement); } }); }
Scroll to Top