Telecommuting vs. Commuting Cost Calculator
Commuting Costs
Car Commute Details
Public Transport Details
Ride-Sharing Details
Other Commuting Expenses
Telecommuting Costs
Home Office Expenses
Other Telecommuting Expenses
Comparison Summary
Please fill in the details on the previous tabs. The summary will be calculated here.
Additional Monthly Electricity: ${tccFormat(tccAllInputElements['tccWfhElectricityMonthly'].value || 0)}
`; inputsHTML += `Additional Monthly Heating/Cooling: ${tccFormat(tccAllInputElements['tccWfhHeatingCoolingMonthly'].value || 0)}
`; inputsHTML += `Additional Monthly Internet: ${tccFormat(tccAllInputElements['tccWfhInternetMonthly'].value || 0)}
`; inputsHTML += `Annual Home Office Supplies: ${tccFormat(tccAllInputElements['tccWfhSuppliesAnnual'].value || 0)}
`; inputsHTML += `Annualized Home Office Setup: ${tccFormat(tccAllInputElements['tccWfhEquipmentAnnualized'].value || 0)}
`; inputsHTML += `Daily Lunch/Coffee (WFH): ${tccFormat(tccGetNum('tccWfhLunchDaily', true))}
`; inputsHTML += `Other Monthly WFH Costs: ${tccFormat(tccAllInputElements['tccWfhOtherMonthly'].value || 0)}
Telecommuting vs. Commuting Cost Analysis
${inputsHTML}Summary Table
| Period | Commuting Cost | Telecommuting Cost | Difference (Savings if WFH) |
|---|---|---|---|
| Daily | ${tccFormat(commuteDailyCost)} | ${tccFormat(wfhDailyCost)} | ${tccFormat(commuteDailyCost - wfhDailyCost)} |
| Weekly | ${tccFormat(commuteWeeklyCost)} | ${tccFormat(wfhWeeklyCost)} | ${tccFormat(commuteWeeklyCost - wfhWeeklyCost)} |
| Monthly | ${tccFormat(commuteMonthlyCost)} | ${tccFormat(wfhMonthlyCost)} | ${tccFormat(commuteMonthlyCost - wfhMonthlyCost)} |
| Annual | ${tccFormat(commuteAnnualCost)} | ${tccFormat(wfhAnnualCost)} | ${tccFormat(diffAnnual)} |
Report generated on: ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}
`; document.body.appendChild(pdfContentWrapper); try { const canvas = await html2canvas(pdfContentWrapper, { scale: 2, useCORS: true, backgroundColor: '#ffffff' }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const imgProps = pdf.getImageProperties(imgData); const ratio = Math.min((pdfWidth - 40) / imgProps.width, (pdfHeight - 40) / imgProps.height); pdf.addImage(imgData, 'PNG', (pdfWidth - imgProps.width * ratio) / 2, 20, imgProps.width * ratio, imgProps.height * ratio); pdf.save('Telecommuting_vs_Commuting_Costs.pdf'); } catch (error) { console.error("Error during PDF generation:", error); alert("An error occurred while generating the PDF."); } finally { document.body.removeChild(pdfContentWrapper); } }