From 43c1c13ee6d4ebd44ead2481d5c270ef466038e5 Mon Sep 17 00:00:00 2001 From: 7u83 <7u83> Date: Fri, 6 Mar 2020 12:32:24 +0000 Subject: [PATCH] Improved the generated PDF --- ka.php | 2 +- kaform.js | 4 +++- submit.php | 61 ++++++++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/ka.php b/ka.php index 9375f6c..eef1eea 100644 --- a/ka.php +++ b/ka.php @@ -205,7 +205,7 @@ Grund für abweichende Kontoinhabende Person">
- +
diff --git a/kaform.js b/kaform.js index 3138246..1fad96a 100644 --- a/kaform.js +++ b/kaform.js @@ -182,7 +182,9 @@ function addTableRow(){
*/ - e += `${a_currency}`; + e += `${a_currency} + + `; // `; // add delete bnutton diff --git a/submit.php b/submit.php index fe7bfb3..bac6734 100644 --- a/submit.php +++ b/submit.php @@ -53,9 +53,6 @@ function mkFrontPDF(){ Kontoinhaber: $account_owner
IBAN: $_POST[iban]
BIC: $_POST[bic]
- Bank: $_POST[bankname]

- Verwendungszweck:
$_POST[purpose]
- "; break; case "bank-noneu": @@ -78,6 +75,7 @@ function mkFrontPDF(){ } + $thtml = mkTable(); // create new PDF document @@ -156,7 +154,7 @@ function mkFrontPDF(){

 
- Nickname: $_POST[nickname]
+ Name: $_POST[realname]
Telefon: $_POST[phone]
E-Mail: $_POST[email]
@@ -168,8 +166,16 @@ function mkFrontPDF(){ Auszahlungsweg: $aw
$aw_details

+
+ $thtml + + EOD; + +#var_dump($thtml); +#die; + //

WMDE Ansprechpartner: $_POST[wmdecontact]

// Telefon: $_POST[phone] @@ -262,7 +268,50 @@ function calcSum(){ // var_dump($val); $sum += floatval(str_replace(",",".",$val)); } - return $sum; + return str_replace(".",",",sprintf("%0.2f",$sum)); +// return sprintf("%.2f",$sum); +} + + +function mkTable(){ + $html = "
 
"; + $pos = 1; + $sum =0; + if (!isset($_POST['amount'])) { + echo "wrong parameters"; + die; + } + + + + foreach ($_POST['amount'] as $key=>$val){ + $html .=''; + + $html .= ""; + + $html .= ""; + $html .= ""; + $am = floatval(str_replace(",",".",$val)); + $am = str_replace(".",",",sprintf("%.2f",$am)); + $html .= ""; + + + $html .=""; + + + + $sum += floatval(str_replace(",",".",$val)); + $pos ++; + } + + $html .= "
$pos".$_POST['date'][$key]."".$_POST['description'][$key]."".$am." ".$_POST['currency'][$key]. "
"; + $html .="
 
"; + $html .="Summe: ".calcSum().""; + return $html; + +// return str_replace(".",",",sprintf("%0.2f",$sum)); +// return sprintf("%.2f",$sum); + } @@ -310,7 +359,7 @@ foreach ($pdfs as $filename){ } $cmd .= " cat output $resultnam.pdf"; exec ($cmd); -//var_dump($_POST); +#var_dump($_POST); #echo "CMD: $cmd
"; #die;