From 67d602af8dbe773621c76d3837afadf29fe3a254 Mon Sep 17 00:00:00 2001 From: Tobias Herre Date: Fri, 17 Dec 2021 11:19:24 +0100 Subject: [PATCH] Currencies in PDF are displayed --- form.php | 2 +- submit.php | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/form.php b/form.php index e3be135..3881e5f 100644 --- a/form.php +++ b/form.php @@ -135,7 +135,7 @@
- diff --git a/submit.php b/submit.php index 2232edc..b2c9f0d 100644 --- a/submit.php +++ b/submit.php @@ -17,6 +17,9 @@ Kostenerstattungsantrag über $sum EUR +

Kostenerstattungsantrag über $sum $_POST[currency]

Projekt: $_POST[project]


@@ -260,7 +263,7 @@ function mkSnippedPdf($key){

Position $pos

$desc


-

$am EUR


+

$am $_POST[currency]


EOD; // Print text using writeHTMLCell() @@ -329,7 +332,7 @@ function mkTable(){ $html .= "".$_POST['desc'][$key].""; $am = floatval(str_replace(",",".",$val)); $am = str_replace(".",",",sprintf("%.2f",$am)); - $html .= ''.$am." ".$_POST['currency'][$key]. ""; + $html .= ''.$am." ".$_POST['currency']. ""; $html .=""; @@ -347,7 +350,7 @@ function mkTable(){ $html .= "Bereits erhaltener Vorschuss:"; $html .= ''; $html .= ''; - $html .= sprintf("-%0.2f",$adv)." EUR"; + $html .= sprintf("-%0.2f",$adv)." ".$_POST['currency']; $html .= ''; $html .= ""; @@ -358,7 +361,7 @@ function mkTable(){ $html .= "Summe:"; $html .= ''; $html .= ''; - $html .= "".calcSum()." EUR"; + $html .= "".calcSum()." ".$_POST['currency'].""; $html .= ''; $html .= ''; @@ -375,6 +378,7 @@ function mkTable(){ $pdfs = array(); +error_log("Making Front PDF"); // // Applicatoin starts here @@ -404,18 +408,20 @@ foreach ($_POST['desc'] as $key => $val) { $resultnam = tempnam("/tmp","karesult"); + $cmd = "$PDFTK_CMD"; foreach ($pdfs as $filename){ $cmd .= " $filename"; } $cmd .= " cat output $resultnam.pdf"; + +error_log("EXEC CMD $cmd"); exec ($cmd); -#var_dump($_POST); $file = "$resultnam.pdf"; if ($_POST['sendmail']=='yes'){ - $subj = "Kostenerstattungsantrag ueber".calcSum()." EUR"; + $subj = "Kostenerstattungsantrag ueber".calcSum()." ".$_POST['currency']; $mail = new PHPMailer\PHPMailer\PHPMailer(); @@ -453,17 +459,24 @@ if ($_POST['sendmail']=='yes'){ echo "Dein Antrag wurde versendet.
"; ?> -
+ Weiteren Antrag auf Kostenerstattung stellen
'; + die; } + +$file = "$resultnam.pdf"; +header('Content-Disposition: attachment; filename="'. basename($file) . '"'); +header('Content-Length: ' . filesize($file)); +readfile($file); + ?>