For Fiscal Year Ending: ${yearEndDate}
Key Deadlines
${deadlinesHtml}
Checklist Status
${checklistHtml}
`;
};
const downloadPdf = () => {
const { jsPDF } = window.jspdf;
const doc = new jsPDF();
const companyName = document.getElementById('company-name').value;
const yearEndDate = new Date(fiscalYearInput.value + 'T00:00:00').toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' });
doc.setFont('helvetica', 'bold');
doc.setFontSize(18);
doc.text(`${companyName} - Tax Compliance Summary`, 105, 20, { align: 'center' });
doc.setFontSize(11);
doc.setFont('helvetica', 'normal');
doc.text(`For Fiscal Year Ending: ${yearEndDate}`, 105, 27, { align: 'center' });
const deadlineElements = document.querySelectorAll('#deadlines-container > div');
const deadlineData = Array.from(deadlineElements).map(el => {
const title = el.querySelector('p:nth-child(1)').textContent;
const date = el.querySelector('p:nth-child(2)').textContent;
return [title, date];
});
doc.autoTable({
startY: 35,
head: [['Task/Filing', 'Due Date']],
body: deadlineData,
theme: 'grid',
headStyles: { fillColor: [45, 55, 72] }
});
const checklistData = getChecklistData().map(item => [item.checked ? 'Completed' : 'Pending', item.text]);
doc.autoTable({
startY: doc.autoTable.previous.finalY + 10,
head: [['Status', 'Compliance Task']],
body: checklistData,
theme: 'grid',
headStyles: { fillColor: [45, 55, 72] },
columnStyles: { 0: { cellWidth: 25 } },
didParseCell: function (data) {
if (data.column.index === 0 && data.cell.section === 'body') {
if (data.cell.raw === 'Completed') data.cell.styles.textColor = [34, 197, 94];
}
}
});
doc.save(`${companyName.replace(/ /g,"_")}_Tax_Summary.pdf`);
};
tabs.forEach(tab => tab.addEventListener('click', () => { currentTab = parseInt(tab.dataset.tab); updateTabs(); }));
prevBtn.addEventListener('click', () => { if (currentTab > 1) { currentTab--; updateTabs(); } });
nextBtn.addEventListener('click', () => { if (currentTab < totalTabs) { currentTab++; updateTabs(); } });
document.getElementById('download-pdf-btn').addEventListener('click', downloadPdf);
updateTabs();
});