1
0
Fork 0

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"/>` + `<input name="desc[${rid}]" type="text" placeholder="Beschreibung"/>`
+ "</td>" + "</td>"
+ "<td>" + "<td>"
+ '<input type="text" placeholder="0.00"/>' + `<input name="amount[${rid}] type="text" placeholder="0.00"/>`
+ "</td>" + "</td>"
+ "<td>" + "<td>"
+ +
`<select id="a_currency" name="currency" > `<select name="currency[${rid}]" >
<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>

View File

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