Download button creates PDF for download. But PDF contanis only the startpage.
This commit is contained in:
parent
0a3a0f68be
commit
dc489bba37
2 changed files with 31 additions and 14 deletions
16
kaform.js
16
kaform.js
|
@ -146,18 +146,26 @@ function addTableRow(){
|
|||
var e="";
|
||||
|
||||
// add column for position no
|
||||
e += `<td>${a_type}</td>`;
|
||||
e += `<td>${a_type}
|
||||
<input type="hidden" name="type[${currentRowId}]" value="${a_type}" /></td>`;
|
||||
|
||||
// add coluemn for a_type (Auslagenart)
|
||||
// e += `<td><textarea name="desc[${nextRowId}]" rows="2"></textarea> </td>`;
|
||||
e += `<td>${a_date}</td>`;
|
||||
e += `<td>${a_date}
|
||||
<input type="hidden" name="date[${currentRowId}]" value="${a_date}" /></td>`;
|
||||
|
||||
|
||||
// add column for date
|
||||
// e += `<td><input name="date[${nextRowId}]" type="date"/></td>`;
|
||||
e += `<td>${a_description}</td>`;
|
||||
e += `<td>${a_description}
|
||||
<input type="hidden" name="description[${currentRowId}]" value="${a_description}" /></td>`;
|
||||
|
||||
|
||||
// add column for num
|
||||
e += `<td>${a_amount}</td>`;
|
||||
e += `<td>${a_amount}
|
||||
<input type="hidden" name="amount[${currentRowId}]" value="${a_amount}" /></td>`;
|
||||
|
||||
|
||||
|
||||
// add column for file upload
|
||||
/* e+= `
|
||||
|
|
29
submit.php
29
submit.php
|
@ -36,14 +36,14 @@ class kaformPDF extends TCPDF {
|
|||
};
|
||||
|
||||
function mkFrontPDF(){
|
||||
$comments = str_replace("\n","<BR>",$_POST[comments]);
|
||||
$bankaddress = str_replace("\n","<BR>",$_POST[bankaddress]);
|
||||
$address = str_replace("\n","<BR>",$_POST[address]);
|
||||
$comments = str_replace("\n","<BR>",$_POST['comments']);
|
||||
$bankaddress = str_replace("\n","<BR>",$_POST['bankaddress']);
|
||||
$address = str_replace("\n","<BR>",$_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(){
|
|||
<<<EOD
|
||||
<h1>Kostenerstattungsantrag über $sum EUR</h1>
|
||||
<p><b>Projekt: $_POST[project]</b></p>
|
||||
<p>WMDE Ansprechpartner: $_POST[wmdecontact]</p>
|
||||
<hr>
|
||||
<p>
|
||||
|
||||
<br>
|
||||
Name: $_POST[realname]<br>
|
||||
E-Mail: $_POST[email]<br>
|
||||
Telefon: $_POST[phone]
|
||||
</p>
|
||||
<hr>
|
||||
<br>
|
||||
|
@ -162,6 +160,8 @@ function mkFrontPDF(){
|
|||
</p>
|
||||
|
||||
EOD;
|
||||
// <p>WMDE Ansprechpartner: $_POST[wmdecontact]</p>
|
||||
// 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<BR>";
|
||||
|
||||
$p = mkFrontPDF();
|
||||
|
||||
echo "Did Making Fromt PDF<BR>";
|
||||
|
||||
|
|
Loading…
Reference in a new issue