Interest Rate Differentials Calculator

Interest Rate Differentials Calculator

Item 1 Rate: ${item1Rate}

Item 2 Name: ${item2Name}

Item 2 Rate: ${item2Rate}

Principal Amount: ${principal}

Results

Interest Rate Differential: ${diffPercent}

Differential Amount: ${diffAmountText}


Generated on: ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}

`; const printWindow = window.open('', '_blank'); if (printWindow) { printWindow.document.write('Interest Rate Differentials Report'); printWindow.document.write(pdfContent); printWindow.document.write(''); printWindow.document.close(); // Necessary for IE >= 10 printWindow.focus(); // Necessary for IE >= 10 // Timeout to ensure content is loaded before printing setTimeout(() => { printWindow.print(); // printWindow.close(); // Optional: close window after print dialog }, 250); } else { alert('Could not open print window. Please check your browser pop-up settings.'); } }); // Helper function to clear input errors on focus function clearErrorOnFocus(inputElement, errorElement) { if (inputElement && errorElement) { inputElement.addEventListener('focus', function() { errorElement.textContent = ''; }); } } clearErrorOnFocus(item1RateInput, item1RateError); clearErrorOnFocus(item2RateInput, item2RateError); clearErrorOnFocus(principalAmountInput, principalAmountError); });
Scroll to Top