b (if c>0 the colors are interchanged) function vColoredPrint($a, $b, $c, $format) { $doColor = true; if ($a < $b) { if ($c == 0) { $color = "#00EE00"; } else { $color = "#FF0000"; } } elseif ($a > $b) { if ($c == 0) { $color = "#FF0000"; } else { $color = "#00EE00"; } } else { $doColor = false; // a = b } if ($doColor) { // a!=b echo(""); } printf($format, $a); if ($doColor) { // a!=b echo(""); } } function bArePositiveNumbers() { $rez = true; $n = func_num_args(); for ($f = 0; $f < $n; $f++) { if ((!is_numeric(func_get_arg($f))) || func_get_arg($f) < 0) $rez = false; } return $rez; }; if (isset($_GET['Submit'])) { $Curr = $_GET['Curr']; $MA = $_GET['MA']; // manufacturer A array $MB = $_GET['MB']; // manufacturer B array $I = array(); if (isset($_REQUEST["I"])) $I = $_REQUEST["I"]; // radio input array $MB[2] = $MA[2]; if (bArePositiveNumbers($MA[2], $MA[3], $MA[4], $MA[5], $MA[6], $MA[7], $MA[8], $MA[9], $MA[10], $MA[11], $MA[12], $MA[13], $MA[14], $MB[2], $MB[3], $MB[4], $MB[5], $MB[6], $MB[7], $MB[8], $MB[9], $MB[10], $MB[11], $MB[12], $MB[13], $MB[14])) { // everithing is ok start calculating $nInitialCostA = $MA[3] + $MA[6] + $MA[4] + $MA[5]; $nInitialCostB = $MB[3] + $MB[6] + $MB[4] + $MB[5]; $nInstallCostA = ($MA[2] * $MA[7]) + $MA[8] + $MA[11] + $MA[9] + $MA[10]; $nInstallCostB = ($MB[2] * $MB[7]) + $MB[8] + $MB[11] + $MB[9] + $MB[10]; $nOngoingCostA = $MA[12] + $MA[13] + $MA[14]; $nOngoingCostB = $MB[12] + $MB[13] + $MB[14]; $nTotalCostA = $nInitialCostA + $nInstallCostA + $nOngoingCostA; $nTotalCostB = $nInitialCostB + $nInstallCostB + $nOngoingCostB; $nICostA = 0; $nICostB = 0; for ($f = 0; $f < 12; $f++) { if ($I[$f] == "A") { $nICostA++; } elseif ($I[$f] == "B") { $nICostB++; } } } else { $ErrorMessage = "Please enter only positive values!"; } // send mail $sMessageBody = ""; //for ($f = 0; $f < 15; $f++) { // $sMessageBody = $sMessageBody . "MA[".$f."] = ".$MA[($f)]." / MB[".$f."] = ".$MB[($f)]."\n"; //} $sMessageBody = $sMessageBody . "Currency = \t\t\t" . $MA[0] . " (A) / " . $MB[0]. " (B)\n"; $sMessageBody = $sMessageBody . "Labor Cost Per Hour = \t\t\t" . $MA[1] . " (A) / " . $MB[1]. " (B)\n"; $sMessageBody = $sMessageBody . "Sensor Manufacturer = \t\t\t" . $MA[2] . " (A) / " . $MB[2]. " (B)\n"; $sMessageBody = $sMessageBody . "Sensor Part Number = \t\t\t" . $MA[3] . " (A) / " . $MB[3]. " (B)\n"; $sMessageBody = $sMessageBody . "------------------\n"; $sMessageBody = $sMessageBody . "Invoice Amount = \t\t\t" . $MA[4] . " (A) / " . $MB[4]. " (B)\n"; $sMessageBody = $sMessageBody . "Shipping and Handling = \t\t\t" . $MA[5] . " (A) / " . $MB[5]. " (B)\n"; $sMessageBody = $sMessageBody . "Taxes, Duties, Tariffs = \t\t\t" . $MA[6] . " (A) / " . $MB[6]. " (B)\n"; $sMessageBody = $sMessageBody . "Extended Warranty = \t\t\t" . $MA[7] . " (A) / " . $MB[7]. " (B)\n"; $sMessageBody = $sMessageBody . "------------------\n"; $sMessageBody = $sMessageBody . "Installation Time = \t\t\t" . $MA[8] . " (A) / " . $MB[8]. " (B)\n"; $sMessageBody = $sMessageBody . "Electrical Cable = \t\t\t" . $MA[9] . " (A) / " . $MB[9]. " (B)\n"; $sMessageBody = $sMessageBody . "Electrical Connector = \t\t\t" . $MA[10] . " (A) / " . $MB[10]. " (B)\n"; $sMessageBody = $sMessageBody . "Signal Conditioner = \t\t\t" . $MA[11] . " (A) / " . $MB[11]. " (B)\n"; $sMessageBody = $sMessageBody . "Power Supply = \t\t\t" . $MA[12] . " (A) / " . $MB[12]. " (B)\n"; $sMessageBody = $sMessageBody . "------------------\n"; $sMessageBody = $sMessageBody . "Calibration Cost = " . $MA[13] . " (A) / " . $MB[13]. " (B)\n"; $sMessageBody = $sMessageBody . "Repair and Maintenance Cost = \t\t\t" . $MA[14] . " (A) / " . $MB[14]. " (B)\n"; if (isset($MA[15])) $sMessageBody = $sMessageBody . "Replacement Cost = \t\t\t" . $MA[15] . " (A) / " . $MB[15]. " (B)\n"; $sMessageBody = $sMessageBody . "------------------\n\n"; $sMessageBody = $sMessageBody . "Reliability = \t\t\t" . $I[0]; $sMessageBody = $sMessageBody . "Accuracy = \t\t\t" . $I[0]; $sMessageBody = $sMessageBody . "Scheduled Down Time = \t\t\t" . $I[0]; $sMessageBody = $sMessageBody . "Usability = \t\t\t" . $I[0]; $sMessageBody = $sMessageBody . "Lead Time = \t\t\t" . $I[0]; $sMessageBody = $sMessageBody . "On-Time Performance = \t\t\t" . $I[0]; $sMessageBody = $sMessageBody . "Environmental Rating = \t\t\t" . $I[0]; $sMessageBody = $sMessageBody . "Stocking Requirements = \t\t\t" . $I[0]; $sMessageBody = $sMessageBody . "Training = \t\t\t" . $I[0]; $sMessageBody = $sMessageBody . "Documentation = \t\t\t" . $I[0]; $sMessageBody = $sMessageBody . "Customer Service = \t\t\t" . $I[0]; $sMessageBody = $sMessageBody . "Technical Support = \t\t\t" . $I[0]; //for ($f = 0; $f < 12; $f++) { // $sMessageBody = $sMessageBody . "I[".$f."] = ".$I[$f]."\n"; //} $sMessageBody = $sMessageBody . "\n\n------results-------\n\n"; if (isset($nInitialCostA) && isset($nInitialCostB) && isset($nOngoingCostA) && isset($nTotalCostB) && isset($nTotalCostA) && ($nTotalCostB)) $sMessageBody = $sMessageBody . "initial costs = \t\t\t $nInitialCostA (A) / $nInitialCostB (B) installation costs = \t\t\t $nInstallCostA (A) / $nInstallCostB (B) ongoing costs = \t\t\t $nOngoingCostA (A) / $nOngoingCostB (B) tangible costs = \t\t\t $nTotalCostA (A) / $nTotalCostB (B) intangibles = $nICostA (A) / $nICostB (B)"; if (isset($_ENV['HTTP_X_FORWARDED_FOR'])) { $user_domain = gethostbyaddr($_ENV['HTTP_X_FORWARDED_FOR']); } else if (isset($_SERVER['REMOTE_ADDR'])) { $user_domain= gethostbyaddr($_SERVER['REMOTE_ADDR']); } $sSubject = "calctco.htm access from ".$user_domain." (".$_SERVER['REMOTE_ADDR'].")"; mail("email@spaceagecontrol.com", $sSubject, $sMessageBody, ""); } else { $MA[0] = "Manufacturer A"; $MB[0] = "Manufacturer B"; $MA[1] = "Part Number A"; $MB[1] = "Part Number B"; } require('header1.php'); $page_title = "Sensor Total Cost of Ownership Calculator"; $tagid = "pt"; ?>
This calculator is based on the Sensor Total Cost of Ownership white paper (http://spaceagecontrol.com/s054a.htm). It allows you to compare the lifetime costs of ownership of two sensors or transducers.
This calculator provides insight into what the lifetime costs are in purchasing, maintaining, storing, replacing, and otherwise using a sensor or transducer. The results from the calculator can often indicate that the initial purchase costs are just a small fraction of the sensor's lifetime costs. The calculator is a model only that is subject to the assumptions above as well as factors unique to your application.
The calculator does not address the time value of money.
Other calculators:
No Warranties: This calculator and information are provided "as is" without any warranty, condition, or representation of any kind, either express or implied, including but not limited to, any warranty respecting non-infringement, and the implied warranties of conditions of merchantability and fitness for a particular purpose. In no event shall SpaceAge Control, Inc. be liable for any direct, indirect, special, incidental, consequential or other damages howsoever caused whether arising in contract, tort, or otherwise, arising out of or in connection with the use or performance of the information contained on this Web page.