Online Automated Time Audit Tool

Automated Time Audit Tool

Track your time across different activities to understand where your day goes.

Define & Track


00:00:00

No activity selected

Today's Log

${formatDuration(entry.duration)}

`; todaysLogList.appendChild(logEl); }); }; // --- ANALYSIS & PDF --- const renderAnalysis = () => { analysisSummaryContainer.innerHTML = ''; if (appData.timeLog.length === 0) { analysisSummaryContainer.innerHTML = '

No data to analyze. Start tracking your time!

'; return; } const analysis = {}; let totalTime = 0; appData.timeLog.forEach(entry => { totalTime += entry.duration; if (!analysis[entry.activityId]) { analysis[entry.activityId] = 0; } analysis[entry.activityId] += entry.duration; }); let analysisHtml = `

Total Time Tracked: ${formatDuration(totalTime)}

`; Object.keys(analysis).forEach(activityId => { const activity = appData.activities.find(a => a.id == activityId); const timeSpent = analysis[activityId]; const percentage = ((timeSpent / totalTime) * 100).toFixed(1); analysisHtml += `

${activity ? activity.name : 'Deleted Activity'}

${formatDuration(timeSpent)}
${percentage}%
`; }); analysisSummaryContainer.innerHTML = analysisHtml; }; downloadPdfBtn.addEventListener('click', () => { if (appData.timeLog.length === 0) { showMessage('No data to export.'); return; } showMessage('Preparing PDF...', false); const { jsPDF } = window.jspdf; const element = document.getElementById('pdf-export-area'); html2canvas(element, { scale: 2, useCORS: true }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'in', format: 'letter' }); const pdfWidth = pdf.internal.pageSize.getWidth() - 1; const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.text('Time Audit Analysis', 0.5, 0.5); pdf.addImage(imgData, 'PNG', 0.5, 0.8, pdfWidth, pdfHeight); pdf.save('Time_Audit_Analysis.pdf'); showMessage('PDF downloaded successfully!', false); }).catch(err => { console.error("PDF Generation Error:", err); showMessage("An error occurred during PDF generation."); }); }); // --- INITIALIZATION --- const initializeApp = () => { loadData(); renderActivitySelector(); renderTodaysLog(); switchTab('tab1'); }; initializeApp(); });
Scroll to Top