Kostenerstattungsantrag über $sum EUR
Projekt: $_POST[project]
Nickname: $_POST[nickname]
Name: $_POST[realname]
Telefon: $_POST[phone]
E-Mail: $_POST[email]
Ansprechpartner: $_POST[wmdecontact]
Auszahlungsweg: $aw
$aw_details
EOD;
// WMDE Ansprechpartner: $_POST[wmdecontact]
// Telefon: $_POST[phone]
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
// ---------------------------------------------------------
$tn = tempnam("/tmp","kaform");
// Close and output PDF document
// This method has several options, check the source code
// documentation for more information.
$pdf->Output($tn, 'F');
return $tn;
}
function mkSnippedPdf($key){
$pageLayout = array(210,70);
// create new PDF document
# $pdf = new kaformPDF(
# PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT,
# true, 'UTF-8', false);
$pdf = new kaformPDF(
PDF_PAGE_ORIENTATION, PDF_UNIT, $pageLayout /*PDF_PAGE_FORMAT*/,
true, 'UTF-8', false);
$pdf->AddPage('L');
$pos = array_search($key,array_keys($_POST['description']))+1;
// echo "
Make Snipped for $key -> $pos
";
# $mydesk = $_POST[desc][$key];
#
$amount = $_POST['amount'][$key];
$desc = $_POST['description'][$key];
$html =
<<Position $pos
$desc
$amount EUR
EOD;
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
$tn = tempnam("/tmp","kaform");
// Close and output PDF document
// This method has several options, check the source code
// documentation for more information.
$pdf->Output("$tn", 'F');
return $tn;
}
//var_dump($_POST);
function convert($row) {
$r = array();
foreach ($_SESSION['files'] as $filename => $file){
if ($file['row'] != $row)
continue;
$tn = tempnam("/tmp","kaform");
file_put_contents("$tn",$file['content']);
array_push($r,"$tn");
}
return $r;
}
function calcSum(){
$sum =0;
if (!isset($_POST['amount'])) {
echo "wrong parameters";
die;
}
foreach ($_POST['amount'] as $val){
// var_dump($val);
$sum += floatval(str_replace(",",".",$val));
}
return $sum;
}
$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
";
#echo "Did Making Fromt PDF
";
array_push($pdfs,$p);
//var_dump($pdfs);
foreach ($_POST['description'] as $key => $val) {
// echo "DREESK KEY VAL $key --> $val
";
$p = mkSnippedPDF($key);
array_push($pdfs,$p);
$pr = convert($key);
$pdfs = array_merge($pdfs,$pr);
}
//var_dump($pdfs);
//
$resultnam = tempnam("/tmp","karesult");
$cmd = "$CONVERT_CMD";
foreach ($pdfs as $filename){
$cmd .= " $filename";
}
$cmd .= " cat output $resultnam.pdf";
exec ($cmd);
//var_dump($_POST);
#echo "CMD: $cmd
";
#die;
$file = "$resultnam.pdf";
header('Content-Disposition: attachment; filename="'. basename($file) . '"');
header('Content-Length: ' . filesize($file));
readfile($file);