Mail and Booking
This commit is contained in:
parent
62e84637b6
commit
5daea268f7
250 changed files with 5377 additions and 1473 deletions
175
app/Services/CreateCouponPDF.php
Normal file
175
app/Services/CreateCouponPDF.php
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
use App\Libraries\CouponPDF;
|
||||
use App\Models\Coupon;
|
||||
|
||||
class CreateCouponPDF {
|
||||
|
||||
protected $pdfRenderer;
|
||||
protected $coupon;
|
||||
protected $styles = array();
|
||||
protected $pdf;
|
||||
|
||||
|
||||
public function __construct(Coupon $coupon)
|
||||
{
|
||||
$this->coupon = $coupon;
|
||||
}
|
||||
|
||||
public function create(){
|
||||
|
||||
// initiate FPDI
|
||||
$pdf = new CouponPDF();
|
||||
if($this->coupon->text == NULL && $this->coupon->value == 50.00){
|
||||
$is_static_coupon = true;
|
||||
|
||||
$pdf->_set('is_static_coupon', true);
|
||||
}else{
|
||||
$is_static_coupon = false;
|
||||
$pdf->_set('is_static_coupon', false);
|
||||
}
|
||||
|
||||
$pdf->AddFont('Helvetica', '', 'helvetica.php');
|
||||
$pdf->AddPage('P', array(210, 297));
|
||||
if ($this->coupon->isLegal()) {
|
||||
$pdf->SetXY(20, 90);
|
||||
$pdf->SetTextColor(230, 10, 10);
|
||||
$pdf->SetFont('Helvetica', 'B', 28);
|
||||
$pdf->Cell(80, 20, utf8_decode('Der Gutschein ist nicht mehr gültig!'), 0, 0, 'L');
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!$is_static_coupon){
|
||||
$pdf->SetXY(30, 55);
|
||||
$pdf->SetTextColor(16, 77, 140);
|
||||
$pdf->SetFont('Helvetica', 'B', 50);
|
||||
$pdf->Cell(80, 20, Util::_number_format($this->coupon->value), 0, 0, 'L');
|
||||
}
|
||||
|
||||
$pdf->SetDrawColor(16, 77, 140);
|
||||
$pdf->SetFillColor(16, 77, 140);
|
||||
$pdf->SetLineWidth(0.4);
|
||||
$pdf->Rect(126, 31, 74, 20, 'DF');
|
||||
|
||||
$pdf->SetTextColor(255,255,255);
|
||||
$x = 128;
|
||||
$y = 32;
|
||||
$border = 0;
|
||||
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
$pdf->Cell(30, 6, "Nummer:", $border, 0, 'L');
|
||||
$pdf->SetFont('Helvetica', '', 10);
|
||||
$pdf->Cell(40, 6, $this->coupon->number, $border, 0, 'R');
|
||||
$y += 6;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
$pdf->Cell(30, 6, utf8_decode('Gültig vom:'), $border, 0, 'L');
|
||||
$pdf->SetFont('Helvetica', '', 10);
|
||||
$pdf->Cell(40, 6, Util::_format_date($this->coupon->issue_date), $border, 0, 'R');
|
||||
$y += 6;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
$pdf->Cell(30, 6, utf8_decode('Gültig bis:'), $border, 0, 'L');
|
||||
$pdf->SetFont('Helvetica', '', 10);
|
||||
$pdf->Cell(40, 6, Util::_format_date($this->coupon->valid_date), $border, 0, 'R');
|
||||
|
||||
|
||||
//$pdf->SetDrawColor(16, 77, 140);
|
||||
$pdf->SetFillColor(16, 77, 140);
|
||||
$pdf->Rect(126, 56, 74, 7.5, 'DF');
|
||||
$pdf->Rect(126, 56, 74, 35, 'D');
|
||||
|
||||
$x = 128;
|
||||
$y = 56;
|
||||
$pdf->SetXY($x, $y);
|
||||
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
$pdf->Cell(40, 7.5, utf8_decode('Ausgestellt für:'), $border, 0, 'L');
|
||||
|
||||
$pdf->SetTextColor(16, 77, 140);
|
||||
$pdf->SetFont('Helvetica', '', 10);
|
||||
|
||||
$customerName = ($this->coupon->customer && $this->coupon->customer->salutation ? $this->coupon->customer->salutation->name . ' ' : '' )
|
||||
. ($this->coupon->customer->title ? $$this->coupon->customer->title . ' ' : '' )
|
||||
. $this->coupon->customer->fullName();
|
||||
$customerStreet = $this->coupon->customer ? $this->coupon->customer->street : '';
|
||||
$customerRegion = $this->coupon->customer->zip ? $this->coupon->customer->zip." " : '';
|
||||
$customerRegion .= $this->coupon->customer->city ? $this->coupon->customer->city : '';
|
||||
|
||||
$y += 12;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->Cell(70, 5.5, utf8_decode($customerName), $border, 0, 'L');
|
||||
$y += 5.5;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->Cell(70, 5.5, utf8_decode($customerStreet), $border, 0, 'L');
|
||||
$y += 5.5;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->Cell(70, 5.5, utf8_decode($customerRegion), $border, 0, 'L');
|
||||
|
||||
$x = 128;
|
||||
$y = 106;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
|
||||
$sender = 'STERN TOURS GmbH'."\n".
|
||||
'Emser Straße 3'."\n".
|
||||
'10719 Berlin'."\n\n".
|
||||
'Fon: +49 (0) 30 700 9410 0'."\n".
|
||||
'Fax: +49 (0) 30 700 9410 44'."\n".
|
||||
'e-Mail: stern@sterntours.de'."\n".
|
||||
'Internet: www.sterntours.de'."\n";
|
||||
$pdf->MultiCell(70, 5.5, utf8_decode($sender), $border, 'L');
|
||||
|
||||
|
||||
if($is_static_coupon) {
|
||||
$x = 12;
|
||||
$y = 155.5;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont('Helvetica', 'B', 10);
|
||||
$pdf->Cell(130, 5.5, utf8_decode('Gutscheinbedingungen:'), $border, 0, 'L');
|
||||
$pdf->SetFont('Helvetica', '', 7);
|
||||
$terms = '- gültig bei Pauschalreisen, Last Minute & More, Hotel und Ferienhäuser'."\n".
|
||||
'- nur Einlösbar bei Buchungen mit einem Gesamtreisepreis von mind. Euro 750,-'."\n".
|
||||
'- Der Gutscheinbetrag wird Ihnen nach Reiseantritt der nächsten Reise per'."\n".
|
||||
' Banküberweisung zugestellt'."\n".
|
||||
'- der Reise-Gutschein kann bis einen Tag vor Abreise eingelöst werden'."\n".
|
||||
'- pro Buchung kann nur ein Reise-Gutschein eingelöst werden'."\n".
|
||||
'- der Reise-Gutschein kann nicht auf Stornokosten angerechnet werden'."\n".
|
||||
'- bei Stornierung der Reise wird der Reise-Gutschein ungültig und nicht ausgezahlt'."\n".
|
||||
'- der Reise-Gutschein ist nicht übertragbar'."\n";
|
||||
|
||||
$y += 5.5;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->MultiCell(130, 3.5, utf8_decode($terms), $border, 'L');
|
||||
|
||||
}else{
|
||||
$x = 12;
|
||||
$y = 157;
|
||||
$pdf->SetXY($x, $y);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont('Helvetica', '', 9);
|
||||
if( $this->coupon->text !== ""){
|
||||
$text = $this->coupon->text;
|
||||
$text = preg_replace("/\r\n|\n|\r/", "\n", $text);
|
||||
|
||||
$pdf->MultiCell(180, 4.2, utf8_decode($text), 0, 'L');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
$this->pdf = $pdf;
|
||||
}
|
||||
|
||||
public function output($filename, $cd){
|
||||
if($cd){
|
||||
return $this->pdf->Output($filename, 'D');
|
||||
}
|
||||
return $this->pdf->Output();
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue