1. Import

This commit is contained in:
2026-03-29 10:34:57 +02:00
parent b0e00c1259
commit a1129565af
4899 changed files with 3007593 additions and 0 deletions

151
html/tools/mc_math.php Normal file
View File

@@ -0,0 +1,151 @@
<?php
/*=======================================================================
*
* mc_math.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/html.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "credit_amount", "rate_percent", "duration", "decimals"));
// Formats the output of a number
function formatNumber ($value, $decimals = 2) {
return number_format(round($value, $decimals), $decimals, ",", ".");
}
// Berechnet die (jährliche) Annuität bei einer Kreditsumme
// $credit_amount : credit amount (Kreditbetrag)
// $rate_percent : rate_percent (Zinssatz)
// $duration : duration (Laufzeit)
function mc_math_annuity ($credit_amount, $rate_percent, $duration, $decimals = 2) {
$q = 1 + ($rate_percent / 100);
$a = $credit_amount * ($rate_percent / 100) * pow($q, $duration) / (pow($q, $duration) - 1);
return $a;
}
$pageTitel = "ANNUITÄTENBERECHNUNG";
$credit_amount = str_replace(",", ".", $credit_amount);
$rate_percent = str_replace(",", ".", $rate_percent);
$duration = str_replace(",", ".", $duration);
if ($decimals == "") : $decimals = 2; endif;
$result = "";
$resultPerMonth = "";
$errOut = "";
if (is_numeric($credit_amount) && is_numeric($rate_percent) && is_numeric($duration)) :
if ($f_act == "mc_math_annuity") :
$result = mc_math_annuity($credit_amount, $rate_percent, $duration, $decimals);
$resultPerMonth = $result / 12;
$result = formatNumber ($result, $decimals);
$resultPerMonth = formatNumber ($resultPerMonth, $decimals);
endif;
else :
if ($credit_amount != "" || $rate_percent != "" || $duration != "") :
$errOut = "Bitte nur Zahlen eingeben!";
endif;
endif;
/*
1. Zinssatz 3% => i = 0,03 und q = 1,03
2. Laufzeit 10 Jahre => n = 10
3. Restschuld 125.000,- € (Anfangsbasis)
Jährliche Annuität für vollständige Tilgung nach 10 Jahren: 14.653,- € (pro Jahr)
Monatlich also ca. 1221,- €
echo mc_math_annuity(125000, 3, 10, 2);
*/
?>
<html>
<head>
<title><?php echo $pageTitel ?></title>
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<style type="text/css">
<?php include_once ("../css/navigation.css.php"); ?>
</style>
<script src="../include/checkFormTags.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
function finishPage(f_act) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
-->
</script>
</head>
<body onLoad="">
<div class="maincontent" name="maincontent" id="maincontent">
<form action="../tools/mc_math.php" method="post">
<input type="hidden" name="f_act" value="">
<div class="f12bp1_blue">
<br>
<?php echo $pageTitel ?>
<br><br>
</div>
<div>
<table>
<tr>
<td>Kreditsumme:</td><td>&nbsp;&nbsp;&nbsp;</td><td><input class="f8np1" type="text" name="credit_amount" value="<?php echo $credit_amount ?>" maxlength="10" size="10"></td>
</tr>
<tr>
<td>Zinssatz:</td><td>&nbsp;&nbsp;&nbsp;</td><td><input class="f8np1" type="text" name="rate_percent" value="<?php echo $rate_percent ?>" maxlength="5" size="5"></td>
</tr>
<tr>
<td>Laufzeit:</td><td>&nbsp;&nbsp;&nbsp;</td><td><select name="duration"><?php echo addOptionsFromRange("1","30",$duration,"YES") ?></select></td>
</tr>
<tr>
<td>Dezimalstellen:</td><td>&nbsp;&nbsp;&nbsp;</td><td><select name="decimals"><?php echo addOptionsFromRange("0","4",$decimals,"") ?></select></td>
</tr>
</table>
<br><br>
</div>
<?php echo defineButtonType08(getLngt("Berechnen"), "action_compute", "finishPage('mc_math_annuity');", "90", "left", "3"); ?>
<?php if ($result != "") : ?>
<div class="f10bp1">
<br><br><br><br>
Über die Laufzeit von <?php echo $duration ?> Jahren wären jährlich <span class="f10bp1_blue"><?php echo $result ?> €</span> zu entrichten. (Mtl.: <span class="f10bp1_blue"><?php echo $resultPerMonth ?> €</span>)
</div>
<?php endif; ?>
<?php if ($errOut != "") : ?>
<div class="f10bp1">
<br><br><br><br>
<?php echo $errOut ?>
</div>
<?php endif; ?>
</form>
</div>
</body>
</html>