Property Rental Yield Comparison Tool

Property Rental Yield Comparison Tool

No properties entered for comparison.

'; return; } // Find best property const bestProperty = results.reduce((max, prop) => prop.rentalYield > max.rentalYield ? prop : max, results[0]); recommendationCard.innerHTML = `

${bestProperty.name}

shows the highest potential rental yield at ${bestProperty.rentalYield.toFixed(2)}%.

`; results.forEach(prop => { const isBest = prop.name === bestProperty.name; const cardHtml = `

${prop.name}

Rental Yield (Cap Rate)

${prop.rentalYield.toFixed(2)}%

Gross Annual Rent: ${formatter.format(prop.grossAnnualRent)}
Total Annual Expenses: (${formatter.format(prop.totalExpenses)})
Net Operating Income (NOI): ${formatter.format(prop.noi)}
`; resultsList.innerHTML += cardHtml; }); } // --- PDF GENERATION --- function generatePdf() { const { jsPDF } = window.jspdf; const content = document.getElementById('pdf-content'); html2canvas(content, { scale: 2, backgroundColor: '#ffffff' }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const canvasWidth = canvas.width; const canvasHeight = canvas.height; const ratio = canvasWidth / canvasHeight; const imgHeight = (pdfWidth - 40) / ratio; pdf.addImage(imgData, 'PNG', 20, 20, pdfWidth - 40, imgHeight); pdf.save('Rental-Yield-Comparison.pdf'); }).catch(err => { console.error("PDF generation failed:", err); }); } pdfDownloadButton.addEventListener('click', generatePdf); });
Scroll to Top