diff --git a/ka.php b/ka.php index 3152605..bfcb2e5 100644 --- a/ka.php +++ b/ka.php @@ -267,7 +267,7 @@ Grund für abweichende Kontoinhabende Person"> Höhe von:
- +

diff --git a/submit.php b/submit.php index bac6734..e3207a0 100644 --- a/submit.php +++ b/submit.php @@ -35,6 +35,18 @@ class kaformPDF extends TCPDF { // }; + +function get_adv() +{ + $aval = $_POST['advance']; + if (!$aval) + $aval = "0"; + $advance = floatval(str_replace(",",".",$aval)); + if ($advance < 0 ) + $advance = -$advance; + return $advance; +} + function mkFrontPDF(){ $comments = str_replace("\n","
",$_POST['comments']); $bankaddress = str_replace("\n","
",$_POST['n_bankaddress']); @@ -43,6 +55,9 @@ function mkFrontPDF(){ $account_owner = $_POST['owner']; if (!$account_owner) $account_owner = $_POST['realname']; +# $aval = $_POST['advance']; +# $advance = floatval(str_replace(",",".",$aval)); + $aw = $_POST; switch ($_POST['banktype']){ @@ -53,6 +68,7 @@ function mkFrontPDF(){ Kontoinhaber: $account_owner
IBAN: $_POST[iban]
BIC: $_POST[bic]
+ Anmerkungen:
$comments
"; break; case "bank-noneu": @@ -267,7 +283,9 @@ function calcSum(){ foreach ($_POST['amount'] as $val){ // var_dump($val); $sum += floatval(str_replace(",",".",$val)); + } + $sum -= get_adv(); return str_replace(".",",",sprintf("%0.2f",$sum)); // return sprintf("%.2f",$sum); } @@ -293,7 +311,7 @@ function mkTable(){ $html .= "".$_POST['description'][$key].""; $am = floatval(str_replace(",",".",$val)); $am = str_replace(".",",",sprintf("%.2f",$am)); - $html .= "".$am." ".$_POST['currency'][$key]. ""; + $html .= ''.$am." ".$_POST['currency'][$key]. ""; $html .=""; @@ -304,9 +322,31 @@ function mkTable(){ $pos ++; } + $adv = get_adv(); + if ($adv) { + $html .= ""; + $html .= ''; + $html .= "Bereits erhaltener Vorschuss:"; + $html .= ''; + $html .= ''; + $html .= sprintf("-%0.2f",$adv)." EUR"; + $html .= ''; + $html .= ""; + + } + + $html .= ''; + $html .= ''; + $html .= "Summe:"; + $html .= ''; + $html .= ''; + $html .= "".calcSum()." EUR"; + $html .= ''; + $html .= ''; + $html .= ""; - $html .="
 
"; - $html .="Summe: ".calcSum().""; +# $html .="
 
"; +# $html .="Summe: ".calcSum().""; return $html; // return str_replace(".",",",sprintf("%0.2f",$sum));