Tax Deduction | Funeral Expenses

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Funeral expenses calculator

Tax Deduction | Funeral Expenses

Invalid. Please check your data and try again.

Results

Total tax deduction:

Details:

` } data.innerHTML = res } function readPeopleInput() { let res = "" for (let i = 1; i<= people; i++) { let elem = document.getElementById(`fee-${i}`) res += `e${i}=${elem.value}&` } return res } let people = 0 const number = document.getElementById('number-ppl'); number.oninput = (e) => { people = e.target.value; generatePeopleInput(people) } const errormsg = document.querySelector('.error-msg'); const resy = document.getElementById('res'); const interests = document.getElementById('interests'); const button = document.getElementById('calculate'); const total = document.getElementById('total'); const deduction = document.getElementById('deduction'); button.addEventListener('click', calculate); function call(path, callback) { const BASE_URL = 'https://us-central1-income-tax-calculator-nicola.cloudfunctions.net/'; var request = new XMLHttpRequest(); var url = `${BASE_URL}/${path}`; request.open("GET", url, true); request.onreadystatechange = function () { if (request.readyState === 4) { callback(JSON.parse(request.response)); } }; request.onerror = function(e) { error({err: "Something went wrong. Please try again later"}) } request.send(); } function calculate(e) { e.preventDefault(); errormsg.style.display = 'none'; results.style.display = 'none'; const res = readPeopleInput() const path = `funeral_exp?num=${number.value}&${res}` call(path, r => { if (!r.res) { return error(r) } success(r.res) }); } function error(data) { errormsg.style.display = 'block'; errormsg.innerText = data.err; } function getEuro(value) { let options = { style: 'currency', currency: 'EUR' }; return new Intl.NumberFormat('en-US', options).format(value); } function success(data) { total.innerText = getEuro(data.t); let details = "" for (let i = 1; i <= parseFloat(data.n); i++) { details += ` Person ${i} Tax Deduction: ${getEuro(data.r[i].d)} ` } deduction.innerText = details; results.style.display = 'block'; }

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Scroll to Top