1
0
Fork 0

Improved the generated PDF

This commit is contained in:
7u83 2020-03-06 12:32:24 +00:00
parent 47aa9982c0
commit 43c1c13ee6
3 changed files with 59 additions and 8 deletions

2
ka.php
View File

@ -205,7 +205,7 @@ Grund für abweichende Kontoinhabende Person"></textarea>
<div class="is-col is-70"> <div class="is-col is-70">
<div class="is-row"> <div class="is-row">
<div class="is-col is-60"> <div class="is-col is-60">
<input id="a_date" type="date" name="type" placeholder="Datum*"/> <input id="a_date" type="date" name="a_date" placeholder="Datum*"/>
<!-- <input id="a_type" type="text" name="type" placeholder="Auslagenart*"/> --> <!-- <input id="a_type" type="text" name="type" placeholder="Auslagenart*"/> -->
</div> </div>

View File

@ -182,7 +182,9 @@ function addTableRow(){
</div> </div>
</td> </td>
*/ */
e += `<td>${a_currency}</td>`; e += `<td>${a_currency}
<input type="hidden" name="currency[${currentRowId}]" value="${a_currency}" /></td>
</td>`;
// `; // `;
// add delete bnutton // add delete bnutton

View File

@ -53,9 +53,6 @@ function mkFrontPDF(){
Kontoinhaber: $account_owner<br> Kontoinhaber: $account_owner<br>
IBAN: $_POST[iban]<br> IBAN: $_POST[iban]<br>
BIC: $_POST[bic]<br> BIC: $_POST[bic]<br>
Bank: $_POST[bankname]<br><br>
Verwendungszweck:<br> $_POST[purpose]<br>
"; ";
break; break;
case "bank-noneu": case "bank-noneu":
@ -78,6 +75,7 @@ function mkFrontPDF(){
} }
$thtml = mkTable();
// create new PDF document // create new PDF document
@ -156,7 +154,7 @@ function mkFrontPDF(){
<p> <p>
&nbsp; &nbsp;
<br> <br>
Nickname: $_POST[nickname]<br> <!-- Nickname: $_POST[nickname]<br> -->
Name: $_POST[realname]<br> Name: $_POST[realname]<br>
Telefon: $_POST[phone]<br> Telefon: $_POST[phone]<br>
E-Mail: $_POST[email]<br> E-Mail: $_POST[email]<br>
@ -168,8 +166,16 @@ function mkFrontPDF(){
Auszahlungsweg: $aw<br> Auszahlungsweg: $aw<br>
$aw_details $aw_details
</p> </p>
<hr>
$thtml
EOD; EOD;
#var_dump($thtml);
#die;
// <p>WMDE Ansprechpartner: $_POST[wmdecontact]</p> // <p>WMDE Ansprechpartner: $_POST[wmdecontact]</p>
// Telefon: $_POST[phone] // Telefon: $_POST[phone]
@ -262,7 +268,50 @@ function calcSum(){
// var_dump($val); // var_dump($val);
$sum += floatval(str_replace(",",".",$val)); $sum += floatval(str_replace(",",".",$val));
} }
return $sum; return str_replace(".",",",sprintf("%0.2f",$sum));
// return sprintf("%.2f",$sum);
}
function mkTable(){
$html = "<br>&nbsp;<br><table>";
$pos = 1;
$sum =0;
if (!isset($_POST['amount'])) {
echo "wrong parameters";
die;
}
foreach ($_POST['amount'] as $key=>$val){
$html .='<tr>';
$html .= "<td>$pos</td>";
$html .= "<td>".$_POST['date'][$key]."</td>";
$html .= "<td>".$_POST['description'][$key]."</td>";
$am = floatval(str_replace(",",".",$val));
$am = str_replace(".",",",sprintf("%.2f",$am));
$html .= "<td>".$am." ".$_POST['currency'][$key]. "</td>";
$html .="</tr>";
$sum += floatval(str_replace(",",".",$val));
$pos ++;
}
$html .= "</table>";
$html .="<br>&nbsp;<br>";
$html .="<b>Summe: ".calcSum()."</b>";
return $html;
// return str_replace(".",",",sprintf("%0.2f",$sum));
// return sprintf("%.2f",$sum);
} }
@ -310,7 +359,7 @@ foreach ($pdfs as $filename){
} }
$cmd .= " cat output $resultnam.pdf"; $cmd .= " cat output $resultnam.pdf";
exec ($cmd); exec ($cmd);
//var_dump($_POST); #var_dump($_POST);
#echo "CMD: $cmd<br>"; #echo "CMD: $cmd<br>";
#die; #die;