[insert_php]
require('https://alcast.nl/wp-content/plugins/fpdf181/fpdf.php');
// get input from form
$dealer = $_POST['dealer'];
$dealermail = $_POST['dealermail'];
$dealertel = $_POST['dealertel'];
$dealerref = $_POST['dealerref'];
$daksoort = $_POST['daksoort'];
$breedte = $_POST['breedte'];
$diepte = $_POST['diepte'];
$aluprijs = round($_POST['aluprijs'],0);
$verfkleur = $_POST['verfkleur'];
$ralcolor = $_POST['ralcolor'];
$verftoeslag = round($_POST['verfkosten'],0);
$glassoort = $_POST['glassoort'];
$glaskosten = round($_POST['glaskosten'],0);
$glasoppervlak = $_POST['glasoppervlak'];
$vakken = $_POST['vakken'];
$extraraam = $_POST['extraraam'];
$extraraamprijs = $_POST['extraraamprijs'];
$extraaantal = $_POST['extraaantal'];
$raamtoeslag = $_POST['extraraamprijs']*$_POST['extraaantal'];
$totaal = round($glaskosten + $aluprijs + ($extraraamprijs*$extraaantal) + $verftoeslag,0);
// fpdf object
$pdf = new FPDF();
// generate PDF (for more info, see http://fpdf.org/en/tutorial/)
$pdf->AddPage();
$pdf->Image('Logo-Alcast-300.png',11,8,-175);
$pdf->Ln(5);
$pdf->SetFont("Arial","",12);
$pdf->Cell("22","40", "Tel. nr.");
$pdf->Cell("22","40", "(+31) 478-53 11 44");
$pdf->Ln(3);
$pdf->Cell("22","45", "Website");
$pdf->Cell("22","45", "www.alcast.nl");
$pdf->Ln(3);
$pdf->Cell("22","50", "E-mail");
$pdf->Cell("22","50", "offerte@alcast.nl");
$pdf->Ln(3);
$pdf->Line(10, 50, 200, 50);
$pdf->Cell("22","60", "Datum");
$pdf->Cell("22","60", date("d-m-Y (H:i:s)", time()) );
$pdf->Ln(3);
$pdf->Cell("22","65", "Dealer");
$pdf->Cell("22","65", $dealer);
$pdf->Ln(3);
$pdf->Cell("22","70", "Tel. nr.");
$pdf->Cell("22","70", $dealertel);
$pdf->Ln(3);
$pdf->Cell("22","75", "E-mail");
$pdf->Cell("22","75", $dealermail);
$pdf->Ln(3);
$pdf->Cell("22","80", "Referentie");
$pdf->Cell("22","80", $dealerref);
$pdf->Ln(3);
$pdf->Line(10, 80, 200, 80);
$pdf->SetFont("Arial","B",12);
$pdf->Ln(3);
$pdf->Cell("22","90", "OFFERTE");
$pdf->Ln(5);
$pdf->SetFont("Arial","",12);
$pdf->Cell("22","95", "$daksoort.");
$pdf->Ln(3);
$pdf->Cell("22","100", "Sparingmaat, recht gemeten, breedte x diepte ".$breedte." x ".$diepte." mm.");
$pdf->Ln(5);
$pdf->Cell("22","105", "Dak verdeeld in ".$vakken." vakken.");
$pdf->Ln(5);
$pdf->Cell("150","145","$aluprijs");
$pdf->Ln(7);
$pdf->SetFont("Arial","B",12);
$pdf->Cell("22","110", "Kleur");
$pdf->SetFont("Arial","",12);
$pdf->Ln(3);
$pdf->Cell("22","115", "Profielen:");
if ($verfkleur != "Wit (ca. RAL 9016) (Standaard)") {
$pdf->Cell("75","115", "$ralcolor$verfkleur");
$pdf->Cell("150","115", "$verftoeslag");
} else {
$pdf->Cell("22","115", "$verfkleur");
}
$pdf->Ln(7);
if($glassoort == "Standaard glas") {
$pdf->SetFont("Arial","B",12);
$pdf->Cell("22","120", "Glas");
$pdf->SetFont("Arial","",12);
$pdf->Ln(3);
$pdf->Cell("22","125", "$vakken Stuks");
$pdf->Cell("75","125", "$glassoort");
$pdf->Cell("175","125", "$glaskosten");
}
if($glassoort == "Zonwerend") {
$pdf->SetFont("Arial","B",12);
$pdf->Cell("22","120", "Glas");
$pdf->SetFont("Arial","",12);
$pdf->Ln(3);
$pdf->Cell("22","125", "$vakken Stuks");
$pdf->Cell("75","125", "$glassoort");
$pdf->Cell("175","125", "$glaskosten");
}
$pdf->Ln(7);
if($extraraam == "Spindelraam") {
$pdf->SetFont("Arial","B",12);
$pdf->Cell("22","130","Raam");
$pdf->Ln(3);
$pdf->SetFont("Arial","",12);
$pdf->Cell("22","135", "$extraaantal Stuks");
$pdf->Cell("75","135", "$extraraam");
$pdf->Cell("175","135", "$raamtoeslag");
$pdf->Ln(2);
}
if($extraraam == "Electrisch raam") {
$pdf->SetFont("Arial","B",12);
$pdf->Cell("22","130","Raam");
$pdf->Ln(3);
$pdf->SetFont("Arial","",12);
$pdf->Cell("22","135", "$extraaantal Stuks");
$pdf->Cell("75","135", "$extraraam");
$pdf->Cell("175","135", "$raamtoeslag");
$pdf->Ln(2);
}
$pdf->SetFont("Arial","B",12);
$pdf->Cell("150","145","Totaalprijs (excl. btw)");
$pdf->Cell("150","145","$totaal");
// email stuff (change data below)
$to = "info@tienplushosting.nl, voorzitter@ttcnederweert.nl";
$from = "voorzitter@ttcnederweert.nl";
$subject = "Uw offerte van ALCAST";
$message = "
Zie bijlage, uw offerte van ALCAST
"; // a random hash will be necessary to send mixed content $separator = md5(time()); // carriage return type (we use a PHP end of line constant) $eol = PHP_EOL; // attachment name $filename = "offerte-".date("d-m-Y (H:i:s)", time()).".pdf"; // encode data (puts attachment in proper format) $pdfdoc = $pdf->Output("", "S"); $attachment = chunk_split(base64_encode($pdfdoc)); // main header (multipart mandatory) $headers = "From: ".$from.$eol; $headers .= "MIME-Version: 1.0".$eol; $headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol; $body .= "Content-Transfer-Encoding: 7bit".$eol; $body .= "This is a MIME encoded message.".$eol; //had one more .$eol // message $body .= "--".$separator.$eol; $body .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol; $body .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $body .= $message.$eol; //had one more .$eol // attachment $body .= "--".$separator.$eol; $body .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol; $body .= "Content-Transfer-Encoding: base64".$eol; $body .= "Content-Disposition: attachment".$eol.$eol; $body .= $attachment.$eol; $body .= "--".$separator."--"; // send message mail($to, $subject, $body, $headers); $output = $pdf->Output(); echo $output; [/insert_php]