PDF generation works again

This commit is contained in:
Tobias Herre 2021-06-12 19:54:45 +02:00
parent 8478eb1f94
commit cf2b7f75e1
2 changed files with 6 additions and 8 deletions

View file

@ -200,11 +200,11 @@ function getRow(rid,num) {
+ `<input name="desc[${rid}]" type="text" placeholder="Beschreibung"/>`
+ "</td>"
+ "<td>"
+ '<input type="text" placeholder="0.00"/>'
+ `<input name="amount[${rid}] type="text" placeholder="0.00"/>`
+ "</td>"
+ "<td>"
+
`<select id="a_currency" name="currency" >
`<select name="currency[${rid}]" >
<option value="EUR">EUR</option>
<option value="USD">USD</option>
<option value="CHF">CHF</option>

View file

@ -7,8 +7,6 @@ require "PHPMailer/SMTP.php";
require "PHPMailer/Exception.php";
var_dump($_POST);
die;
#$CONVERT_CMD = "/usr/bin/pdftk";
@ -232,7 +230,7 @@ function mkSnippedPdf($key){
$pdf->AddPage('L');
$pos = array_search($key,array_keys($_POST['description']))+1;
$pos = array_search($key,array_keys($_POST['desc']))+1;
@ -241,7 +239,7 @@ function mkSnippedPdf($key){
# $mydesk = $_POST[desc][$key];
#
$amount = $_POST['amount'][$key];
$desc = $_POST['description'][$key];
$desc = $_POST['desc'][$key];
$am = floatval(str_replace(",",".",$amount));
$am = str_replace(".",",",sprintf("%.2f",$am));
@ -319,7 +317,7 @@ function mkTable(){
$html .= "<td>$pos</td>";
$html .= "<td>".$_POST['date'][$key]."</td>";
$html .= "<td>".$_POST['description'][$key]."</td>";
$html .= "<td>".$_POST['desc'][$key]."</td>";
$am = floatval(str_replace(",",".",$val));
$am = str_replace(".",",",sprintf("%.2f",$am));
$html .= '<td align="right">'.$am." ".$_POST['currency'][$key]. "</td>";
@ -389,7 +387,7 @@ $file = $p;
array_push($pdfs,$p);
//var_dump($pdfs);
foreach ($_POST['description'] as $key => $val) {
foreach ($_POST['desc'] as $key => $val) {
// echo "DREESK KEY VAL $key --> $val<br>";
$p = mkSnippedPDF($key);
array_push($pdfs,$p);