Currencies in PDF are displayed
This commit is contained in:
parent
70a1e04176
commit
67d602af8d
2 changed files with 23 additions and 10 deletions
2
form.php
2
form.php
|
@ -135,7 +135,7 @@
|
||||||
<?=_("Währung:")?>
|
<?=_("Währung:")?>
|
||||||
</div>
|
</div>
|
||||||
<div class="is-col">
|
<div class="is-col">
|
||||||
<select onchange="renumberTableRows()" id="currency" >
|
<select onchange="renumberTableRows()" name='currency' id="currency" >
|
||||||
<option value="EUR">EUR</option>
|
<option value="EUR">EUR</option>
|
||||||
<option value="USD">USD</option>
|
<option value="USD">USD</option>
|
||||||
<option value="CHF">CHF</option>
|
<option value="CHF">CHF</option>
|
||||||
|
|
31
submit.php
31
submit.php
|
@ -17,6 +17,9 @@
|
||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
|
||||||
|
error_log("SUBMIT\n");
|
||||||
|
|
||||||
require "config.php";
|
require "config.php";
|
||||||
require "PHPMailer/PHPMailer.php";
|
require "PHPMailer/PHPMailer.php";
|
||||||
require "PHPMailer/SMTP.php";
|
require "PHPMailer/SMTP.php";
|
||||||
|
@ -185,7 +188,7 @@ function mkFrontPDF(){
|
||||||
// Set some content to print
|
// Set some content to print
|
||||||
$html =
|
$html =
|
||||||
<<<EOD
|
<<<EOD
|
||||||
<h1>Kostenerstattungsantrag über $sum EUR</h1>
|
<h1>Kostenerstattungsantrag über $sum $_POST[currency]</h1>
|
||||||
<p><b>Projekt: $_POST[project]</b></p>
|
<p><b>Projekt: $_POST[project]</b></p>
|
||||||
<hr>
|
<hr>
|
||||||
<p>
|
<p>
|
||||||
|
@ -260,7 +263,7 @@ function mkSnippedPdf($key){
|
||||||
|
|
||||||
<h1>Position $pos</h1>
|
<h1>Position $pos</h1>
|
||||||
<p>$desc</p><br>
|
<p>$desc</p><br>
|
||||||
<p>$am EUR</p><br>
|
<p>$am $_POST[currency]</p><br>
|
||||||
EOD;
|
EOD;
|
||||||
|
|
||||||
// Print text using writeHTMLCell()
|
// Print text using writeHTMLCell()
|
||||||
|
@ -329,7 +332,7 @@ function mkTable(){
|
||||||
$html .= "<td>".$_POST['desc'][$key]."</td>";
|
$html .= "<td>".$_POST['desc'][$key]."</td>";
|
||||||
$am = floatval(str_replace(",",".",$val));
|
$am = floatval(str_replace(",",".",$val));
|
||||||
$am = str_replace(".",",",sprintf("%.2f",$am));
|
$am = str_replace(".",",",sprintf("%.2f",$am));
|
||||||
$html .= '<td align="right">'.$am." ".$_POST['currency'][$key]. "</td>";
|
$html .= '<td align="right">'.$am." ".$_POST['currency']. "</td>";
|
||||||
|
|
||||||
|
|
||||||
$html .="</tr>";
|
$html .="</tr>";
|
||||||
|
@ -347,7 +350,7 @@ function mkTable(){
|
||||||
$html .= "Bereits erhaltener Vorschuss:";
|
$html .= "Bereits erhaltener Vorschuss:";
|
||||||
$html .= '</td>';
|
$html .= '</td>';
|
||||||
$html .= '<td align="right">';
|
$html .= '<td align="right">';
|
||||||
$html .= sprintf("-%0.2f",$adv)." EUR";
|
$html .= sprintf("-%0.2f",$adv)." ".$_POST['currency'];
|
||||||
$html .= '</td>';
|
$html .= '</td>';
|
||||||
$html .= "</tr>";
|
$html .= "</tr>";
|
||||||
|
|
||||||
|
@ -358,7 +361,7 @@ function mkTable(){
|
||||||
$html .= "<b>Summe:</b>";
|
$html .= "<b>Summe:</b>";
|
||||||
$html .= '</td>';
|
$html .= '</td>';
|
||||||
$html .= '<td align="right">';
|
$html .= '<td align="right">';
|
||||||
$html .= "<b>".calcSum()." EUR</b>";
|
$html .= "<b>".calcSum()." ".$_POST['currency']."</b>";
|
||||||
$html .= '</td>';
|
$html .= '</td>';
|
||||||
$html .= '</tr>';
|
$html .= '</tr>';
|
||||||
|
|
||||||
|
@ -375,6 +378,7 @@ function mkTable(){
|
||||||
|
|
||||||
$pdfs = array();
|
$pdfs = array();
|
||||||
|
|
||||||
|
error_log("Making Front PDF");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Applicatoin starts here
|
// Applicatoin starts here
|
||||||
|
@ -404,18 +408,20 @@ foreach ($_POST['desc'] as $key => $val) {
|
||||||
$resultnam = tempnam("/tmp","karesult");
|
$resultnam = tempnam("/tmp","karesult");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$cmd = "$PDFTK_CMD";
|
$cmd = "$PDFTK_CMD";
|
||||||
foreach ($pdfs as $filename){
|
foreach ($pdfs as $filename){
|
||||||
$cmd .= " $filename";
|
$cmd .= " $filename";
|
||||||
}
|
}
|
||||||
$cmd .= " cat output $resultnam.pdf";
|
$cmd .= " cat output $resultnam.pdf";
|
||||||
|
|
||||||
|
error_log("EXEC CMD $cmd");
|
||||||
exec ($cmd);
|
exec ($cmd);
|
||||||
#var_dump($_POST);
|
|
||||||
|
|
||||||
$file = "$resultnam.pdf";
|
$file = "$resultnam.pdf";
|
||||||
|
|
||||||
if ($_POST['sendmail']=='yes'){
|
if ($_POST['sendmail']=='yes'){
|
||||||
$subj = "Kostenerstattungsantrag ueber".calcSum()." EUR";
|
$subj = "Kostenerstattungsantrag ueber".calcSum()." ".$_POST['currency'];
|
||||||
|
|
||||||
|
|
||||||
$mail = new PHPMailer\PHPMailer\PHPMailer();
|
$mail = new PHPMailer\PHPMailer\PHPMailer();
|
||||||
|
@ -453,17 +459,24 @@ if ($_POST['sendmail']=='yes'){
|
||||||
echo "Dein Antrag wurde versendet.<BR>";
|
echo "Dein Antrag wurde versendet.<BR>";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="is-col">
|
<!-- <div class="is-col">
|
||||||
<button type="button" onclick="downloadDocument(false);"
|
<button type="button" onclick="downloadDocument(false);"
|
||||||
class="button is-orange"><?=_("Kopie des Antrags herunterladen")?></button>
|
class="button is-orange"><?=_("Kopie des Antrags herunterladen")?></button>
|
||||||
</div>
|
</div> -->
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo '<a href="./">
|
echo '<a href="./">
|
||||||
Weiteren Antrag auf Kostenerstattung stellen</a><BR>';
|
Weiteren Antrag auf Kostenerstattung stellen</a><BR>';
|
||||||
|
die;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$file = "$resultnam.pdf";
|
||||||
|
header('Content-Disposition: attachment; filename="'. basename($file) . '"');
|
||||||
|
header('Content-Length: ' . filesize($file));
|
||||||
|
readfile($file);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script src="js/kube.min.js"></script>
|
<script src="js/kube.min.js"></script>
|
||||||
<script src="addons/upload/kube.upload.min.js"></script>
|
<script src="addons/upload/kube.upload.min.js"></script>
|
||||||
|
|
Loading…
Reference in a new issue