-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
53 lines (43 loc) · 2.05 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
function calculatePricing() {
// Get user inputs
const numCores = parseInt(document.getElementById('numCores').value);
const numHosts = parseInt(document.getElementById('numHosts').value);
const openshiftSupport = document.getElementById('openshiftSupport').value;
const vmwareProduct = document.getElementById('vmwareProduct').value;
const duration = parseInt(document.getElementById('duration').value);
const margin = parseInt(document.getElementById('margin').value);
// Define pricing per core per year for OpenShift OVE
const openshiftPricing = {
standard: 2180, // Example price per core per year
premium: 3270 // Example price per core per year
};
// Define pricing per core per year for VMware products
const vmwarePricing = {
vvf: 219.67, // Example price per core per year
vcf: 250, // Example price per core per year
entPlus: 242.97 // Example price per core per year
};
// Calculate total pricing for OpenShift OVE
const openshiftPrice = openshiftPricing[openshiftSupport] * numHosts * duration;
// Calculate total pricing for VMware
const vmwarePrice = vmwarePricing[vmwareProduct] * numCores * duration;
//Calculate the difference
const difference = vmwarePrice - openshiftPrice;
//MArkup calculator Sell Price = Buy Price / (1 - Margin Percentage / 100)
//calculate Openshift margin
const openshiftmargin = openshiftPrice / (1 - margin /100);
//calculate VMware margin
const vmwaremargin = vmwarePrice / (1 - margin /100);
// Display the results
const resultDiv = document.getElementById('result');
resultDiv.innerHTML = `
<h2>Pricing Comparison</h2>
<p>OpenShift OVE (${openshiftSupport}): $${openshiftPrice}</p>
<p>VMware (${vmwareProduct}): $${vmwarePrice}</p>
<br>
<p>Our Buy Price Difference: $${difference}</p>
<br>
<p>Openshift Sell Price: $${openshiftmargin.toFixed(2)}</p>
<p>VMware Sell Price: $${vmwaremargin.toFixed(2)}</p>
`;
}