Historic Home Restoration ROI Analyzer

Historic Home Restoration ROI Analyzer

Analyze the financial viability of your historic restoration project.

$${kpis.totalInvestment.toLocaleString()}

Estimated Net Profit:

$${kpis.netProfit.toLocaleString()}

Return on Investment (ROI):

${kpis.roi.toFixed(2)}%

`; } function updateChart(costs) { const ctx = document.getElementById('roi-chart').getContext('2d'); const data = { labels: Object.keys(costs), datasets: [{ data: Object.values(costs), backgroundColor: ['#78716c', '#a16207', '#ca8a04', '#eab308', '#facc15'] }] }; if (roiChart) { roiChart.data = data; roiChart.update(); } else { roiChart = new Chart(ctx, { type: 'pie', data, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { position: 'bottom' } } } }); } } function updateTabs() { tabs.forEach((tab, i) => tab.classList.toggle('active', i === currentTabIndex)); tabContents.forEach((c, i) => c.classList.toggle('active', i === currentTabIndex)); prevBtn.disabled = currentTabIndex === 0; nextBtn.disabled = currentTabIndex === tabs.length - 1; prevBtn.classList.toggle('opacity-50', currentTabIndex === 0); nextBtn.classList.toggle('opacity-50', currentTabIndex === tabs.length - 1); } function setupEventListeners() { tabsContainer.addEventListener('click', (e) => { if (e.target.classList.contains('tab')) { currentTabIndex = parseInt(e.target.dataset.index); updateTabs(); } }); prevBtn.addEventListener('click', () => { if (currentTabIndex > 0) { currentTabIndex--; updateTabs(); } }); nextBtn.addEventListener('click', () => { if (currentTabIndex < tabs.length - 1) { currentTabIndex++; updateTabs(); } }); tabContentsContainer.addEventListener('input', (e) => { if (e.target.tagName === 'INPUT') { const category = e.target.dataset.category; const key = e.target.dataset.key; if (appData[category] && appData[category][key]) { appData[category][key].value = e.target.value; calculateAll(); } } }); document.getElementById('pdf-download-btn').addEventListener('click', generatePdf); } function generatePdf() { const { jsPDF } = jspdf; const pdf = new jsPDF(); const dashboardContent = document.getElementById('Dashboard-content'); pdf.setFontSize(22); pdf.text("Historic Restoration ROI Analysis", 105, 20, { align: 'center' }); html2canvas(dashboardContent, { scale: 2 }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const { width, height } = pdf.internal.pageSize; const imgHeight = canvas.height * width / canvas.width; pdf.addImage(imgData, 'PNG', 15, 30, width - 30, imgHeight * ((width - 30) / width)); pdf.save('historic-roi-analysis.pdf'); }); } initialize(); });
Scroll to Top