forked from tohe/wmdeit_kaform
Shows correct costs in advance in generated PDF
This commit is contained in:
parent
42d3126398
commit
d199e664c9
2
ka.php
2
ka.php
|
@ -267,7 +267,7 @@ Grund für abweichende Kontoinhabende Person"></textarea>
|
||||||
Höhe von:
|
Höhe von:
|
||||||
</div>
|
</div>
|
||||||
<div class="is-col">
|
<div class="is-col">
|
||||||
<input type="text" placeholder="0,00 EUR"/>
|
<input input name="advance" id="advance" type="text" placeholder="0,00 EUR"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
|
46
submit.php
46
submit.php
|
@ -35,6 +35,18 @@ class kaformPDF extends TCPDF {
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function get_adv()
|
||||||
|
{
|
||||||
|
$aval = $_POST['advance'];
|
||||||
|
if (!$aval)
|
||||||
|
$aval = "0";
|
||||||
|
$advance = floatval(str_replace(",",".",$aval));
|
||||||
|
if ($advance < 0 )
|
||||||
|
$advance = -$advance;
|
||||||
|
return $advance;
|
||||||
|
}
|
||||||
|
|
||||||
function mkFrontPDF(){
|
function mkFrontPDF(){
|
||||||
$comments = str_replace("\n","<BR>",$_POST['comments']);
|
$comments = str_replace("\n","<BR>",$_POST['comments']);
|
||||||
$bankaddress = str_replace("\n","<BR>",$_POST['n_bankaddress']);
|
$bankaddress = str_replace("\n","<BR>",$_POST['n_bankaddress']);
|
||||||
|
@ -43,6 +55,9 @@ function mkFrontPDF(){
|
||||||
$account_owner = $_POST['owner'];
|
$account_owner = $_POST['owner'];
|
||||||
if (!$account_owner) $account_owner = $_POST['realname'];
|
if (!$account_owner) $account_owner = $_POST['realname'];
|
||||||
|
|
||||||
|
# $aval = $_POST['advance'];
|
||||||
|
# $advance = floatval(str_replace(",",".",$aval));
|
||||||
|
|
||||||
$aw = $_POST;
|
$aw = $_POST;
|
||||||
|
|
||||||
switch ($_POST['banktype']){
|
switch ($_POST['banktype']){
|
||||||
|
@ -53,6 +68,7 @@ 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>
|
||||||
|
Anmerkungen:<br> $comments<br>
|
||||||
";
|
";
|
||||||
break;
|
break;
|
||||||
case "bank-noneu":
|
case "bank-noneu":
|
||||||
|
@ -267,7 +283,9 @@ function calcSum(){
|
||||||
foreach ($_POST['amount'] as $val){
|
foreach ($_POST['amount'] as $val){
|
||||||
// var_dump($val);
|
// var_dump($val);
|
||||||
$sum += floatval(str_replace(",",".",$val));
|
$sum += floatval(str_replace(",",".",$val));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$sum -= get_adv();
|
||||||
return str_replace(".",",",sprintf("%0.2f",$sum));
|
return str_replace(".",",",sprintf("%0.2f",$sum));
|
||||||
// return sprintf("%.2f",$sum);
|
// return sprintf("%.2f",$sum);
|
||||||
}
|
}
|
||||||
|
@ -293,7 +311,7 @@ function mkTable(){
|
||||||
$html .= "<td>".$_POST['description'][$key]."</td>";
|
$html .= "<td>".$_POST['description'][$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>".$am." ".$_POST['currency'][$key]. "</td>";
|
$html .= '<td align="right">'.$am." ".$_POST['currency'][$key]. "</td>";
|
||||||
|
|
||||||
|
|
||||||
$html .="</tr>";
|
$html .="</tr>";
|
||||||
|
@ -304,9 +322,31 @@ function mkTable(){
|
||||||
$pos ++;
|
$pos ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$adv = get_adv();
|
||||||
|
if ($adv) {
|
||||||
|
$html .= "<tr>";
|
||||||
|
$html .= '<td colspan="3">';
|
||||||
|
$html .= "Bereits erhaltener Vorschuss:";
|
||||||
|
$html .= '</td>';
|
||||||
|
$html .= '<td align="right">';
|
||||||
|
$html .= sprintf("-%0.2f",$adv)." EUR";
|
||||||
|
$html .= '</td>';
|
||||||
|
$html .= "</tr>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$html .= '<tr>';
|
||||||
|
$html .= '<td colspan="3">';
|
||||||
|
$html .= "<b>Summe:</b>";
|
||||||
|
$html .= '</td>';
|
||||||
|
$html .= '<td align="right">';
|
||||||
|
$html .= "<b>".calcSum()." EUR</b>";
|
||||||
|
$html .= '</td>';
|
||||||
|
$html .= '</tr>';
|
||||||
|
|
||||||
$html .= "</table>";
|
$html .= "</table>";
|
||||||
$html .="<br> <br>";
|
# $html .="<br> <br>";
|
||||||
$html .="<b>Summe: ".calcSum()."</b>";
|
# $html .="<b>Summe: ".calcSum()."</b>";
|
||||||
return $html;
|
return $html;
|
||||||
|
|
||||||
// return str_replace(".",",",sprintf("%0.2f",$sum));
|
// return str_replace(".",",",sprintf("%0.2f",$sum));
|
||||||
|
|
Loading…
Reference in New Issue