multi-currency support in roi calculator

This commit is contained in:
Tobias Brunner 2025-07-23 14:50:53 +02:00
parent adc3a6b905
commit 5cc6b779c5
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ
7 changed files with 231 additions and 45 deletions

View file

@ -35,6 +35,11 @@ function updateServalaShare(value) { window.ROICalculatorApp?.updateServalaShare
function updateGracePeriod(value) { window.ROICalculatorApp?.updateGracePeriod(value); }
function updateLoanRate(value) { window.ROICalculatorApp?.updateLoanRate(value); }
function updateCoreServiceRevenue(value) { window.ROICalculatorApp?.updateCoreServiceRevenue(value); }
function updateCurrency() {
const currencyElement = document.getElementById('currency');
const value = currencyElement ? currencyElement.value : 'CHF';
window.ROICalculatorApp?.updateCurrency(value);
}
function updateScenarioChurn(scenarioKey, churnRate) { window.ROICalculatorApp?.updateScenarioChurn(scenarioKey, churnRate); }
function updateScenarioPhase(scenarioKey, phaseIndex, newInstancesPerMonth) { window.ROICalculatorApp?.updateScenarioPhase(scenarioKey, phaseIndex, newInstancesPerMonth); }
function resetAdvancedParameters() { window.ROICalculatorApp?.resetAdvancedParameters(); }
@ -137,7 +142,7 @@ document.addEventListener('DOMContentLoaded', function() {
<div class="mb-4">
<label class="form-label fw-semibold mb-2">Initial Investment</label>
<div class="input-group input-group-lg">
<span class="input-group-text">CHF</span>
<span class="input-group-text" id="investment-currency-prefix">CHF</span>
<input type="text" class="form-control" id="investment-amount"
data-value="500000" value="500,000"
oninput="handleInvestmentAmountInput(this)"
@ -149,14 +154,21 @@ document.addEventListener('DOMContentLoaded', function() {
min="100000" max="2000000" step="50000" value="500000"
onchange="updateInvestmentAmount(this.value)">
<div class="d-flex justify-content-between mt-1">
<small class="text-muted">CHF 100K</small>
<small class="text-muted">CHF 2M</small>
<small class="text-muted" id="investment-min-label">CHF 100K</small>
<small class="text-muted" id="investment-max-label">CHF 2M</small>
</div>
</div>
<!-- Analysis Period & Service Revenue Row -->
<!-- Currency, Analysis Period & Service Revenue Row -->
<div class="row mb-4">
<div class="col-md-6">
<div class="col-md-3">
<label class="form-label fw-semibold mb-2">Currency</label>
<select class="form-select form-select-lg" id="currency" onchange="updateCurrency()">
<option value="CHF" selected>CHF (Swiss Franc)</option>
<option value="EUR">EUR (Euro)</option>
</select>
</div>
<div class="col-md-3">
<label class="form-label fw-semibold mb-2">Analysis Period</label>
<select class="form-select form-select-lg" id="timeframe" onchange="updateCalculations()">
<option value="1">1 Year</option>
@ -171,14 +183,14 @@ document.addEventListener('DOMContentLoaded', function() {
<div class="input-group input-group-lg">
<input type="number" class="form-control" id="revenue-per-instance"
min="20" max="200" step="5" value="50" onchange="updateCalculations()">
<span class="input-group-text">CHF/month</span>
<span class="input-group-text" id="revenue-currency-suffix">CHF/month</span>
</div>
<input type="range" class="form-range mt-3" id="revenue-slider"
min="20" max="200" step="5" value="50"
onchange="updateRevenuePerInstance(this.value)">
<div class="d-flex justify-content-between mt-1">
<small class="text-muted">CHF 20</small>
<small class="text-muted">CHF 200</small>
<small class="text-muted" id="revenue-min-label">CHF 20</small>
<small class="text-muted" id="revenue-max-label">CHF 200</small>
</div>
</div>
</div>

View file

@ -114,6 +114,9 @@ html {
<a class="list-group-item list-group-item-action" href="#calculator-guide">
<i class="bi bi-calculator me-2"></i>Using the Calculator
</a>
<a class="list-group-item list-group-item-action" href="#currency-support">
<i class="bi bi-cash-stack me-2"></i>Currency Support
</a>
<a class="list-group-item list-group-item-action" href="#scenarios">
<i class="bi bi-speedometer2 me-2"></i>Growth Scenarios
</a>
@ -153,6 +156,58 @@ html {
</div>
</div>
<!-- Currency Support Section -->
<div class="help-section" id="currency-support">
<h2><i class="bi bi-cash-stack"></i> Currency Support</h2>
<p>The ROI Calculator supports multiple currencies to accommodate different regional markets and business requirements.</p>
<h3>Supported Currencies</h3>
<div class="row">
<div class="col-md-6">
<div class="model-card">
<h5><i class="bi bi-cash"></i> Swiss Franc (CHF)</h5>
<p><strong>Default Currency</strong></p>
<ul>
<li>Swiss locale formatting (de-CH)</li>
<li>Standard decimal separators</li>
<li>Traditional Swiss business format</li>
</ul>
</div>
</div>
<div class="col-md-6">
<div class="model-card">
<h5><i class="bi bi-currency-euro"></i> Euro (EUR)</h5>
<p><strong>European Markets</strong></p>
<ul>
<li>European locale formatting (de-DE)</li>
<li>Standard European decimal separators</li>
<li>EU business format compliance</li>
</ul>
</div>
</div>
</div>
<h3>How Currency Selection Works</h3>
<p>Currency can be selected in the main configuration section of the calculator. When you change currency:</p>
<ul>
<li><strong>All displays update automatically:</strong> Investment amounts, revenue figures, and results</li>
<li><strong>Proper localization:</strong> Numbers are formatted according to the selected currency's regional standards</li>
<li><strong>Export consistency:</strong> PDF and CSV exports use the selected currency throughout</li>
<li><strong>Real-time conversion:</strong> All calculations maintain the same values while updating display format</li>
</ul>
<h3>Important Notes</h3>
<div class="alert alert-info">
<h6><i class="bi bi-info-circle"></i> Currency Display Only</h6>
<p>The calculator displays amounts in your selected currency but does not perform currency conversion. All input values should be entered in your chosen currency. For example, if you select EUR, enter your investment amounts in Euros.</p>
</div>
<div class="alert alert-warning">
<h6><i class="bi bi-exclamation-triangle"></i> Consistency Important</h6>
<p>Ensure all your inputs (investment amount, revenue per instance, etc.) are in the same currency for accurate calculations. Mixing currencies will produce incorrect results.</p>
</div>
</div>
<!-- Loan Model Section -->
<div class="help-section" id="loan-model">
<h2><i class="bi bi-bank"></i> Loan Model (3-7% Returns)</h2>
@ -162,7 +217,7 @@ html {
<h4>Key Features</h4>
<ul>
<li><strong>Investment Range:</strong> CHF 100,000 - CHF 2,000,000</li>
<li><strong>Investment Range:</strong> 100,000 - 2,000,000 (in your selected currency)</li>
<li><strong>Interest Rates:</strong> 3-8% annually</li>
<li><strong>Payment Schedule:</strong> Fixed monthly payments</li>
<li><strong>Risk Level:</strong> Very low - contractually guaranteed</li>
@ -306,9 +361,9 @@ html {
<div class="col-md-6">
<h5>Primary Settings</h5>
<ul>
<li><strong>Initial Investment:</strong> CHF 100K - 2M (with slider)</li>
<li><strong>Initial Investment:</strong> 100K - 2M in selected currency (with slider)</li>
<li><strong>Timeframe:</strong> 1-5 years</li>
<li><strong>Service Revenue/Instance:</strong> Monthly Servala service fee per managed instance (CHF 20-200)</li>
<li><strong>Service Revenue/Instance:</strong> Monthly Servala service fee per managed instance (20-200 in selected currency)</li>
<li><strong>Growth Scenarios:</strong> Conservative, Moderate, Aggressive</li>
</ul>
</div>