{"id":1494,"date":"2025-07-26T17:54:00","date_gmt":"2025-07-26T17:54:00","guid":{"rendered":"https:\/\/samansari.com\/?page_id=1494"},"modified":"2025-07-26T18:58:09","modified_gmt":"2025-07-26T18:58:09","slug":"managing-debt","status":"publish","type":"page","link":"https:\/\/samansari.com\/index.php\/managing-debt\/","title":{"rendered":"Managing debt"},"content":{"rendered":"\nfunction debt_repayment_calculator() {\n  ob_start(); ?>\n  <div id=\"debt-calculator\">\n    <h2>Debt Repayment Calculator<\/h2>\n    <label>Total Debt Amount (CAD): <input type=\"number\" id=\"debtAmount\"><\/label><br>\n    <label>Annual Interest Rate (%): <input type=\"number\" step=\"0.01\" id=\"interestRate\"><\/label><br>\n    <label>Monthly Payment (CAD): <input type=\"number\" id=\"monthlyPayment\"><\/label><br>\n    <button onclick=\"calculateDebtRepayment()\">Calculate<\/button>\n    <p id=\"debtResult\"><\/p>\n  <\/div>\n\n  <script>\n    function calculateDebtRepayment() {\n      const debt = parseFloat(document.getElementById('debtAmount').value);\n      const rate = parseFloat(document.getElementById('interestRate').value) \/ 100 \/ 12;\n      const payment = parseFloat(document.getElementById('monthlyPayment').value);\n\n      if (payment <= debt * rate) {\n        document.getElementById('debtResult').innerHTML = \"\u26a0\ufe0f Monthly payment is too low to cover interest. Increase your payment.\";\n        return;\n      }\n\n      let months = 0;\n      let balance = debt;\n\n      while (balance > 0 && months < 600) {\n        balance = balance * (1 + rate) - payment;\n        months++;\n      }\n\n      const years = Math.floor(months \/ 12);\n      const remMonths = months % 12;\n\n      document.getElementById('debtResult').innerHTML =\n        `\ud83d\uddd3\ufe0f Estimated Payoff Time: ${years} years and ${remMonths} months<br>` +\n        `\ud83d\udcb0 Total Paid: $${(payment * months).toFixed(2)}<br>` +\n        `\ud83d\udcc9 Interest Paid: $${(payment * months - debt).toFixed(2)}`;\n    }\n  <\/script>\n  <?php\n  return ob_get_clean();\n}\nadd_shortcode('debt_calculator', 'debt_repayment_calculator');\n\n\n\n\n<div class=\"sa-author-bio\" style=\"border-top:1px solid #ddd; padding:20px; margin-top:40px;\">\n          <h3>About Sam Ansari<\/h3>\n          <p><strong>Sam Ansari<\/strong><br>\n          Mortgage Broker<br>\n          CENTUM Financial Services LP, Brokerage #13054<br>\n          Office: (416) 356-6310 | Mobile: (416) 356-6310<br>\n          11160 Yonge St, Richmond Hill, ON L4S 1H5<\/p>\n         <p>I guide you through every step of purchasing, renewing or refinancing your mortgage\u2014ensuring a seamless, stress-free process.<\/p>&#8216;\n\n","protected":false},"excerpt":{"rendered":"<p>function debt_repayment_calculator() { ob_start(); ?> Debt Repayment Calculator Total Debt Amount (CAD): Annual Interest Rate (%): Monthly Payment (CAD): Calculate<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"_links":{"self":[{"href":"https:\/\/samansari.com\/index.php\/wp-json\/wp\/v2\/pages\/1494"}],"collection":[{"href":"https:\/\/samansari.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/samansari.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/samansari.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/samansari.com\/index.php\/wp-json\/wp\/v2\/comments?post=1494"}],"version-history":[{"count":2,"href":"https:\/\/samansari.com\/index.php\/wp-json\/wp\/v2\/pages\/1494\/revisions"}],"predecessor-version":[{"id":1520,"href":"https:\/\/samansari.com\/index.php\/wp-json\/wp\/v2\/pages\/1494\/revisions\/1520"}],"wp:attachment":[{"href":"https:\/\/samansari.com\/index.php\/wp-json\/wp\/v2\/media?parent=1494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}