Industry-Specific Financial Ratio Benchmarking Tool

Industry-Specific Financial Ratio Benchmarking Tool

1. Enter Your Company's Financial Ratios

Profitability Ratios (%)

Liquidity Ratios (x)

Solvency & Efficiency

Return Ratios & Industry

Please fix input errors to see benchmarking results.

'; return; } } const selectedIndustry = industrySelectInput.value; const benchmarks = industryBenchmarks[selectedIndustry]; if (!benchmarks) { showMessage('Selected industry benchmarks not found. Please choose a valid industry.', 'error'); window.benchmarkingResults = null; return; } // 2. Perform Comparison const results = []; for (const ratioName in companyRatios) { const companyValue = companyRatios[ratioName]; const benchmarkData = benchmarks[ratioName]; if (!benchmarkData) { console.warn(`Benchmark data not found for ${ratioName} in ${selectedIndustry}.`); continue; } let status = 'Neutral'; // Default let statusClass = 'status-indicator-neutral'; // Determine performance relative to benchmark if (benchmarkData.higherIsBetter) { if (companyValue > benchmarkData.value) { status = 'Better'; statusClass = 'status-indicator-positive'; } else if (companyValue < benchmarkData.value) { status = 'Worse'; statusClass = 'status-indicator-negative'; } } else { // Lower is better (e.g., Debt-to-Equity) if (companyValue < benchmarkData.value) { status = 'Better'; statusClass = 'status-indicator-positive'; } else if (companyValue > benchmarkData.value) { status = 'Worse'; statusClass = 'status-indicator-negative'; } } results.push({ ratio: ratioName, companyValue: companyValue, benchmarkValue: benchmarkData.value, status: status, statusClass: statusClass, formatType: benchmarkData.format // Store format type for display/PDF }); } window.benchmarkingResults = { companyRatios: companyRatios, selectedIndustry: selectedIndustry, comparisonResults: results }; // 3. Display Results in UI displayComparisonResults(results, selectedIndustry); openTab('benchmarks'); showMessage('Benchmarking comparison complete!', 'success'); } /** * Displays the comparison results in a table format. * @param {Array} results The array of comparison results. * @param {string} industry The selected industry name. */ function displayComparisonResults(results, industry) { let tableHtml = `

Your Company vs. ${industry} Industry Benchmarks

`; results.forEach(row => { tableHtml += ` `; }); tableHtml += `
Financial Ratio Your Company Industry Benchmark Status
${row.ratio} ${formatRatio(row.companyValue, row.formatType)} ${formatRatio(row.benchmarkValue, row.formatType)} ${row.status}
`; comparisonResultsOutputDiv.innerHTML = tableHtml; } /** * Resets all input fields to their default values and clears output sections. */ function resetForm() { // Reset input values to defaults grossProfitMarginInput.value = "35"; netProfitMarginInput.value = "10"; currentRatioInput.value = "1.5"; quickRatioInput.value = "1.0"; debtToEquityRatioInput.value = "0.8"; inventoryTurnoverInput.value = "5"; assetTurnoverInput.value = "1.2"; returnOnAssetsInput.value = "7"; returnOnEquityInput.value = "15"; industrySelectInput.value = "Technology"; // Reset to default // Clear stored results window.benchmarkingResults = null; // Clear output div comparisonResultsOutputDiv.innerHTML = '

Enter your company data and click "Calculate Comparison" to see results.

'; // Reset to the first tab openTab('company-inputs'); hideMessage(); } /** * Downloads the financial ratio benchmarking results as a PDF. */ function downloadPDF() { if (!window.benchmarkingResults) { showMessage('Please calculate the benchmarking results first.', 'info'); return; } const { jsPDF } = window.jspdf; const pdf = new jsPDF('p', 'mm', 'a4'); // 'p' for portrait, 'mm' for millimeters, 'a4' size const BLACK_COLOR = [31, 41, 55]; // Tailwind gray-900 equivalent const BLUE_HEADER_COLOR = [29, 78, 216]; // Tailwind blue-700 equivalent const GREEN_TEXT_COLOR = [34, 197, 94]; // Tailwind green-500 equivalent const RED_TEXT_COLOR = [239, 68, 68]; // Tailwind red-500 equivalent const GRAY_TEXT_COLOR = [75, 85, 99]; // Tailwind gray-700 equivalent let y = 15; // Y-coordinate for placing content // Title pdf.setFontSize(22); pdf.setFont('helvetica', 'bold'); pdf.setTextColor(BLACK_COLOR[0], BLACK_COLOR[1], BLACK_COLOR[2]); pdf.text('Financial Ratio Benchmarking Results', 105, y, { align: 'center' }); y += 15; // --- Company Inputs Section --- pdf.setFontSize(16); pdf.setFont('helvetica', 'bold'); pdf.text('1. Your Company Data', 15, y); y += 8; const inputs = window.benchmarkingResults.companyRatios; const selectedIndustry = window.benchmarkingResults.selectedIndustry; const inputData = [ ['Industry Selected', selectedIndustry] ]; // Add ratios to inputData array using the formatRatio function for (const ratioName in inputs) { const formatType = industryBenchmarks[selectedIndustry][ratioName].format; inputData.push([ratioName, formatRatio(inputs[ratioName], formatType)]); } pdf.autoTable({ startY: y, head: [['Parameter', 'Value']], body: inputData, theme: 'grid', styles: { fontSize: 9, cellPadding: 2, overflow: 'linebreak', lineColor: 200, lineWidth: 0.1 }, headStyles: { fillColor: BLUE_HEADER_COLOR, textColor: 255, fontStyle: 'bold' }, margin: { left: 15, right: 15 }, columnStyles: { 0: { cellWidth: 70 }, 1: { cellWidth: 'auto' } } }); y = pdf.autoTable.previous.finalY + 15; // --- Benchmarking Results Section --- pdf.setFontSize(16); pdf.setFont('helvetica', 'bold'); pdf.text('2. Benchmarking Comparison', 15, y); y += 8; const comparisonResults = window.benchmarkingResults.comparisonResults; const tableBody = comparisonResults.map(row => { let statusColor = BLACK_COLOR; if (row.statusClass === 'status-indicator-positive') { statusColor = GREEN_TEXT_COLOR; } else if (row.statusClass === 'status-indicator-negative') { statusColor = RED_TEXT_COLOR; } else { statusColor = GRAY_TEXT_COLOR; // Neutral } return [ row.ratio, { content: formatRatio(row.companyValue, row.formatType), styles: { halign: 'right' } }, { content: formatRatio(row.benchmarkValue, row.formatType), styles: { halign: 'right' } }, { content: row.status, styles: { textColor: statusColor[0], textColor: statusColor[1], textColor: statusColor[2], fontStyle: 'bold' } } ]; }); pdf.autoTable({ startY: y, head: [['Financial Ratio', 'Your Company', 'Industry Benchmark', 'Status']], body: tableBody, theme: 'grid', styles: { fontSize: 9, cellPadding: 2, overflow: 'linebreak', lineColor: 200, lineWidth: 0.1 }, headStyles: { fillColor: BLUE_HEADER_COLOR, textColor: 255, fontStyle: 'bold' }, margin: { left: 15, right: 15 }, columnStyles: { 0: { cellWidth: 70 }, 1: { cellWidth: 35 }, 2: { cellWidth: 35 }, 3: { cellWidth: 'auto' } } }); pdf.save('Financial_Ratio_Benchmarking_Results.pdf'); } /** * Initializes DOM element references once the document is fully loaded. */ document.addEventListener('DOMContentLoaded', () => { // Input Elements grossProfitMarginInput = document.getElementById('grossProfitMargin'); netProfitMarginInput = document.getElementById('netProfitMargin'); currentRatioInput = document.getElementById('currentRatio'); quickRatioInput = document.getElementById('quickRatio'); debtToEquityRatioInput = document.getElementById('debtToEquityRatio'); inventoryTurnoverInput = document.getElementById('inventoryTurnover'); assetTurnoverInput = document.getElementById('assetTurnover'); returnOnAssetsInput = document.getElementById('returnOnAssets'); returnOnEquityInput = document.getElementById('returnOnEquity'); industrySelectInput = document.getElementById('industrySelect'); // Output Elements comparisonResultsOutputDiv = document.getElementById('comparisonResultsOutput'); messageBox = document.getElementById('messageBox'); // Initialize navigation button states updateNavigationButtons(); });
Scroll to Top