From dc489bba378ef0ebc42b305f18669a333560d255 Mon Sep 17 00:00:00 2001 From: 7u83 <7u83> Date: Tue, 25 Feb 2020 10:59:24 +0000 Subject: [PATCH] Download button creates PDF for download. But PDF contanis only the startpage. --- kaform.js | 16 ++++++++++++---- submit.php | 29 +++++++++++++++++++---------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/kaform.js b/kaform.js index 82beb63..d594877 100644 --- a/kaform.js +++ b/kaform.js @@ -146,18 +146,26 @@ function addTableRow(){ var e=""; // add column for position no - e += `${a_type}`; + e += `${a_type} + `; // add coluemn for a_type (Auslagenart) // e += ` `; - e += `${a_date}`; + e += `${a_date} + `; + // add column for date // e += ``; - e += `${a_description}`; + e += `${a_description} + `; + // add column for num - e += `${a_amount}`; + e += `${a_amount} + `; + + // add column for file upload /* e+= ` diff --git a/submit.php b/submit.php index ec37727..b4e9e5f 100644 --- a/submit.php +++ b/submit.php @@ -36,14 +36,14 @@ class kaformPDF extends TCPDF { }; function mkFrontPDF(){ - $comments = str_replace("\n","
",$_POST[comments]); - $bankaddress = str_replace("\n","
",$_POST[bankaddress]); - $address = str_replace("\n","
",$_POST[address]); + $comments = str_replace("\n","
",$_POST['comments']); + $bankaddress = str_replace("\n","
",$_POST['bankaddress']); + $address = str_replace("\n","
",$_POST['address']); - $account_owner = $_POST[owner]; - if (!$account_owner) $account_owner = $_POST[realname]; + $account_owner = $_POST['owner']; + if (!$account_owner) $account_owner = $_POST['realname']; - switch ($_POST[bank]){ + switch ($_POST['bank']){ case "EU": $aw = "EU-Banküberweisung"; $aw_details = " @@ -145,14 +145,12 @@ function mkFrontPDF(){ <<Kostenerstattungsantrag über $sum EUR

Projekt: $_POST[project]

-

WMDE Ansprechpartner: $_POST[wmdecontact]


 
Name: $_POST[realname]
E-Mail: $_POST[email]
- Telefon: $_POST[phone]



@@ -162,6 +160,8 @@ function mkFrontPDF(){

EOD; +//

WMDE Ansprechpartner: $_POST[wmdecontact]

+// Telefon: $_POST[phone] // Print text using writeHTMLCell() $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); @@ -249,7 +249,7 @@ function calcSum(){ } foreach ($_POST['amount'] as $val){ - var_dump($val); +// var_dump($val); $sum += floatval(str_replace(",",".",$val)); } return $sum; @@ -259,10 +259,19 @@ function calcSum(){ $pdfs = array(); // Applicatoin starts here +// +$p = mkFrontPDF(); + +$file = $p; +header('Content-Disposition: attachment; filename="'. basename($file) . '"'); +header('Content-Length: ' . filesize($file)); +readfile($file); + +var_dump($p); +die(); echo "Making Fromt PDF
"; -$p = mkFrontPDF(); echo "Did Making Fromt PDF
";