Results
Annual Rental Income: ${ariText}
Gross Rental Yield: ${grossYieldText}
Net Annual Cash Flow: ${netCfText}
Net Rental Yield: ${netYieldText}
Generated on: ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}
`;
const printWindow = window.open('', '_blank');
if (printWindow) {
printWindow.document.write('
Rental Yield Report');
printWindow.document.write(pdfContent);
printWindow.document.write('');
printWindow.document.close();
printWindow.focus();
setTimeout(() => {
printWindow.print();
}, 250);
} else {
alert('Could not open print window. Please check your browser pop-up settings.');
}
});
// Clear error messages on input focus
[propertyValueInput, monthlyRentalIncomeInput, annualOperatingExpensesInput].forEach(inputEl => {
if (inputEl) {
inputEl.addEventListener('focus', function() {
const errorElId = `ryc${this.id.substring(3)}Error`; // e.g. rycPropertyValueError
const errorDisplay = document.getElementById(errorElId);
if (errorDisplay) errorDisplay.textContent = '';
});
}
});
});