Files
startup/pdf/berechnung.php
2016-07-05 20:38:34 +00:00

59 lines
2.3 KiB
PHP

<?
$pdf->SetFont('Helvetica', '', 10);
$y = $pdf->GetY();
if ($y > 240) {
$pdf->AddPage();
}
$pdf->SetX(40);
$pdf->Cell(135, 4, "Gesamtpreis zuzüglich ".$nt['MwSt']."% gesetzlicher MwSt.");
if ("0" == $take_pos) {
if(isset($ntab['Preis_aus_Pos'])) {
$Gesamtpreis = $ntab['Auftrag_Preis'];
} elseif (isset($nt['Preis_aus_Pos'])) {
$Gesamtpreis = $nt['Auftrag_Preis'];
}
}
$pdf->Cell(25, 4, number_format($Gesamtpreis, '2', ',', '.')."", 0, 1, 'R');
if (isset($sqlr)) {
while ($ntr = $resultr->fetch_assoc()) {
$pdf->SetX(40);
if ($ntr['Vorkasse']) {
while (strlen($ntr['ID']) < $_SESSION['Firma']['Stellen']) {
$ntr['ID'] = "0".$ntr['ID'];
}
$pdf->Cell(135, 4, "- Vorkasse aus Rechnung-Nr. ".$ntr['Jahr']."_".$ntr['ID']." vom ".$ntr['Datum']);
} else {
$pdf->Cell(135, 4, "- Abschlag aus Rechnung-Nr. ".$ntr['Jahr']."_".$ntr['ID']." vom ".$ntr['Datum']);
}
$pdf->Cell(25, 4, number_format($ntr['Preis']* (1 - $ntr['Rabatt'] / 100), '2', ',', '.')."", 0, 1, 'R');
$Gesamtpreis = $Gesamtpreis - $ntr['Preis']* (1 - $ntr['Rabatt'] / 100);
}
$y = $pdf->GetY();
$pdf->Line(40,$y,200,$y);
$pdf->SetX(40);
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(135, 4, "Zwischensumme zuzüglich ".$nt['MwSt']."% gesetzlicher MwSt.");
$pdf->Cell(25, 4, number_format($Gesamtpreis, '2', ',', '.')."", 0, 1, 'R');
$pdf->SetFont('Helvetica', '', 10);
}
if ("rechnung" == $pdf_type) {
if (0 != $nt['Rabatt']) {
$pdf->SetX(40);
$pdf->Cell(135, 4, "- ".$nt['Rabatt']."% Rabatt auf ".number_format($Gesamtpreis, '2', ',', '.')."");
$pdf->Cell(25, 4, number_format($Gesamtpreis * $nt['Rabatt'] / 100, '2', ',', '.')."", 0, 1, 'R');
$Gesamtpreis = $Gesamtpreis * (1 - $nt['Rabatt'] / 100);
}
}
$pdf->SetX(40);
$pdf->Cell(135, 4, "+".$nt['MwSt']."% gesetzliche MwSt. auf ".number_format($Gesamtpreis, '2', ',', '.')."");
$pdf->Cell(25, 4, number_format($Gesamtpreis*$nt['MwSt']/100, '2', ',', '.')."", 0, 1, 'R');
$pdf->SetFont('Helvetica', 'B', 10);
$pdf->SetX(40);
$pdf->Cell(135, 4, "Gesamtpreis inklusive ".$nt['MwSt']."% gesetzlicher MwSt.");
$pdf->Cell(25, 4, number_format($Gesamtpreis*(1+$nt['MwSt']/100), '2', ',', '.')."", 0, 1, 'R');
$y = $pdf->GetY();
$pdf->Line(40,$y,200,$y);
$pdf->Write(4, "\n");
$pdf->SetFont('Helvetica', '', 10);
?>