From a2a51beb15af9cd071886bf5230f0214b76a4ee8 Mon Sep 17 00:00:00 2001 From: uroszajc <42989364+uroszajc@users.noreply.github.com> Date: Fri, 17 Jan 2025 15:34:19 +0800 Subject: [PATCH] Create script.js --- dev/script.js | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 dev/script.js diff --git a/dev/script.js b/dev/script.js new file mode 100644 index 0000000..2dca454 --- /dev/null +++ b/dev/script.js @@ -0,0 +1,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 = ` +
OpenShift OVE (${openshiftSupport}): $${openshiftPrice}
+VMware (${vmwareProduct}): $${vmwarePrice}
+Our Buy Price Difference: $${difference}
+Openshift Sell Price: $${openshiftmargin.toFixed(2)}
+VMware Sell Price: $${vmwaremargin.toFixed(2)}
+ `; +}