forked from tohe/wmdeit_kaform
Download button creates PDF for download. But PDF contanis only the startpage.
This commit is contained in:
parent
0a3a0f68be
commit
dc489bba37
16
kaform.js
16
kaform.js
|
@ -146,18 +146,26 @@ function addTableRow(){
|
||||||
var e="";
|
var e="";
|
||||||
|
|
||||||
// add column for position no
|
// 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)
|
// add coluemn for a_type (Auslagenart)
|
||||||
// e += `<td><textarea name="desc[${nextRowId}]" rows="2"></textarea> </td>`;
|
// 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
|
// add column for date
|
||||||
// e += `<td><input name="date[${nextRowId}]" type="date"/></td>`;
|
// 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
|
// 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
|
// add column for file upload
|
||||||
/* e+= `
|
/* e+= `
|
||||||
|
|
29
submit.php
29
submit.php
|
@ -36,14 +36,14 @@ class kaformPDF extends TCPDF {
|
||||||
};
|
};
|
||||||
|
|
||||||
function mkFrontPDF(){
|
function mkFrontPDF(){
|
||||||
$comments = str_replace("\n","<BR>",$_POST[comments]);
|
$comments = str_replace("\n","<BR>",$_POST['comments']);
|
||||||
$bankaddress = str_replace("\n","<BR>",$_POST[bankaddress]);
|
$bankaddress = str_replace("\n","<BR>",$_POST['bankaddress']);
|
||||||
$address = str_replace("\n","<BR>",$_POST[address]);
|
$address = str_replace("\n","<BR>",$_POST['address']);
|
||||||
|
|
||||||
$account_owner = $_POST[owner];
|
$account_owner = $_POST['owner'];
|
||||||
if (!$account_owner) $account_owner = $_POST[realname];
|
if (!$account_owner) $account_owner = $_POST['realname'];
|
||||||
|
|
||||||
switch ($_POST[bank]){
|
switch ($_POST['bank']){
|
||||||
case "EU":
|
case "EU":
|
||||||
$aw = "EU-Banküberweisung";
|
$aw = "EU-Banküberweisung";
|
||||||
$aw_details = "
|
$aw_details = "
|
||||||
|
@ -145,14 +145,12 @@ function mkFrontPDF(){
|
||||||
<<<EOD
|
<<<EOD
|
||||||
<h1>Kostenerstattungsantrag über $sum EUR</h1>
|
<h1>Kostenerstattungsantrag über $sum EUR</h1>
|
||||||
<p><b>Projekt: $_POST[project]</b></p>
|
<p><b>Projekt: $_POST[project]</b></p>
|
||||||
<p>WMDE Ansprechpartner: $_POST[wmdecontact]</p>
|
|
||||||
<hr>
|
<hr>
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
Name: $_POST[realname]<br>
|
Name: $_POST[realname]<br>
|
||||||
E-Mail: $_POST[email]<br>
|
E-Mail: $_POST[email]<br>
|
||||||
Telefon: $_POST[phone]
|
|
||||||
</p>
|
</p>
|
||||||
<hr>
|
<hr>
|
||||||
<br>
|
<br>
|
||||||
|
@ -162,6 +160,8 @@ function mkFrontPDF(){
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
EOD;
|
EOD;
|
||||||
|
// <p>WMDE Ansprechpartner: $_POST[wmdecontact]</p>
|
||||||
|
// Telefon: $_POST[phone]
|
||||||
|
|
||||||
// Print text using writeHTMLCell()
|
// Print text using writeHTMLCell()
|
||||||
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
|
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
|
||||||
|
@ -249,7 +249,7 @@ function calcSum(){
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($_POST['amount'] as $val){
|
foreach ($_POST['amount'] as $val){
|
||||||
var_dump($val);
|
// var_dump($val);
|
||||||
$sum += floatval(str_replace(",",".",$val));
|
$sum += floatval(str_replace(",",".",$val));
|
||||||
}
|
}
|
||||||
return $sum;
|
return $sum;
|
||||||
|
@ -259,10 +259,19 @@ function calcSum(){
|
||||||
$pdfs = array();
|
$pdfs = array();
|
||||||
|
|
||||||
// Applicatoin starts here
|
// 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>";
|
echo "Making Fromt PDF<BR>";
|
||||||
|
|
||||||
$p = mkFrontPDF();
|
|
||||||
|
|
||||||
echo "Did Making Fromt PDF<BR>";
|
echo "Did Making Fromt PDF<BR>";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue