Fehler in einem File finden

Marcs

Legendäres Mitglied
Ich verwende WHMCS 5.2.2 und habe folgendes Problem.
-> Single Export eines PDF funktioniert mit diesem Template
-> Mehrfach Export funktioniert nicht.

Wer findet den Fehler und kann ihn korrigieren?

Belohnung 50 Euro.

CODE <?php
// Paginaberekening
$paginanummer = 1;
$paginatotaal = ceil(count($invoiceitems) / 22);

if($opgeroepen !== 1)
{
// Custom header & footer
class MYPDF extends TCPDF
{
// Header
public function Header($direct=0,$clientsdetails=0,$invoicenum=0,$datecreated=0,$paginanummer=0,$paginatotaal=0)
{
if($direct == 1)
{
$this->Image(ROOTDIR.'/templates/portal/xxxx.png',115,15,80,'','','',true);

$this->Ln(35);

$this->SetFont('arial','',7);
$this->Cell(0,0,'xxxx AG',0);

$this->Ln(5);

if($clientsdetails["companyname"])
{
$v1 = $clientsdetails["companyname"];
$v2 = $clientsdetails["firstname"]." ".$clientsdetails["lastname"];
$v3 = $clientsdetails["address1"]." ".$clientsdetails["address2"];
$v4 = $clientsdetails["postcode"]." ".$clientsdetails["city"];
$v5 = $clientsdetails["country"];
}
else
{
$v1 = $clientsdetails["firstname"]." ".$clientsdetails["lastname"];
$v2 = $clientsdetails["address1"]." ".$clientsdetails["address2"];
$v3 = $clientsdetails["postcode"]." ".$clientsdetails["city"];
$v4 = $clientsdetails["country"];
$v5 = "";
}

$this->SetFont('arial','','9.5');
$this->Cell(110,'',$v1,'','','L');
$this->Cell(30,'','Rechnungsdatum','','','R');
$this->Cell(5,'','','','','');
$this->Cell(35,'',str_replace('/','.',$datecreated),'','','L');
$this->Ln();
$this->Cell(110,'',$v2,'','','L');
$this->Cell(30,'','Rechnungs-Nr.','','','R');
$this->Cell(5,'','','','','');
$this->Cell(35,'',$invoicenum,'','','L');
$this->Ln();
$this->Cell(110,'',$v3,'','','L');
$this->Cell(30,'','Kundennummer','','','R');
$this->Cell(5,'','','','','');
$this->Cell(35,'',$clientsdetails["id"],'','','L');
$this->Ln();
$this->Cell(110,'',$v4,'','','L');
$this->Cell(30,'','E-Mail','','','R');
$this->Cell(5,'','','','','');
$this->Cell(35,'','info@xxxxxx.com','','','L');
$this->Ln();
$this->Cell(110,'',$v5,'','','L');
$this->Cell(30,'','Seite','','','R');
$this->Cell(5,'','','','','');
$this->Cell(35,'',$paginanummer.'/'.$paginatotaal.'','','L');

$this->Ln(40);
}
}

// Footer
public function Footer()
{
$this->SetFont('arial','','6.5');
$this->Cell(40,'','xxxx AG','','','L');
$this->Cell(35,'','Kontakt Buchhaltung:','','','L');
$this->Cell(35,'','xxxx@xxxx.com','','','L');
$this->Cell(20,'','Konto (EURO):','','','L');
$this->Cell(30,'','xxxxxx / xxxxxx
','','','L');
$this->Cell(20,'','','','','L');
$this->Cell(30,'','','','','L');
$this->Ln();
$this->Cell(40,'','xxxxxx','','','L');
$this->Cell(35,'','MWST-Nummer:','','','L');
$this->Cell(35,'','xxxxxx','','','L');
$this->Cell(20,'','Konto (CHF):','','','L');
$this->Cell(30,'','xxxxxx
','','','L');
$this->Cell(20,'',' ','','','L');
$this->Cell(30,'','','','','L');
$this->Ln();
$this->Cell(40,'','xxxxxx','','','L');
$this->Cell(35,'','Zahlungszweck:','','','L');
$this->Cell(35,'','Rechnungsnummer eintragen','','','L');
$this->Cell(20,'','Bank:','','','L');
$this->Cell(30,'','xxxxxxxx','','','L');
$this->Cell(20,'','','','','L');
$this->Cell(30,'','','','','L');
$this->Ln();
}
}

$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(PDF_MARGIN_LEFT, 115, PDF_MARGIN_RIGHT,60);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(20);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setLanguageArray($l);

$pdf->AddPage();
}
$opgeroepen = 1;

$pdf->header(1,$clientsdetails,$invoicenum,$datecreated,$paginanummer,$paginatotaal);

$pdf->SetFont('arial','B','11.5');
$pdf->Cell('','','Rechnung','','','L');

$pdf->Ln(10);

$pdf->SetFont('arial','B','9.5');
$pdf->Cell(145,'','Artikelbeschreibung','','','L');
$pdf->Cell(35,'','Preis','','','C');

$pdf->Ln(6);

$pdf->WriteHTML('<hr>');

$pdf->Ln(-2);

$pdf->SetFont('arial','','9.5');

$a = 0;

foreach ($invoiceitems AS $item)
{
$a++;

$pdf->Cell(145,'',$item["description"],'','','L');
$pdf->Cell(35,'',$item["amount"],'','','C');
$pdf->Ln(6);

if($a == 22)
{
$paginanummer++;
$pdf->WriteHTML('<hr>');
$pdf->AddPage();
$pdf->header(1,$clientsdetails,$invoicenum,$datecreated,$paginanummer,$paginatotaal);
$pdf->SetFont('arial','B','9.5');
$pdf->Cell(145,'','Artikelbeschreibung','','','L');
$pdf->Cell(35,'','Preis','','','C');
$pdf->Ln(6);
$pdf->WriteHTML('<hr>');
$pdf->Ln(-2);
$pdf->SetFont('arial','','9.5');

$a = 0;
}
}

$pdf->WriteHTML('<hr>');

$pdf->Ln(-2);

$pdf->Ln();

if ($taxname) {
$pdf->Cell(145,'',$taxrate."% ".$taxname,'','','R');
$pdf->Cell(35,'',$tax,'','','C');
$pdf->Ln();
}

if ($taxname2) {
$pdf->Cell(145,'',$taxrate2."% ".$taxname2,'','','R');
$pdf->Cell(35,'',$tax2,'','','C');
$pdf->Ln();
}

$pdf->Cell(145,'',$_LANG["invoicescredit"],'','','R');
$pdf->Cell(35,'',$credit,'','','C');
$pdf->Ln();

$pdf->Cell(145,'',$_LANG["invoicestotal"],'','','R');
$pdf->Cell(35,'',$total,'','','C');

$pdf->SetFont('arial','B','9.5');
$pdf->Cell(145,'','Gesamt','','','R');
$pdf->SetFont('arial','','9.5');
$pdf->Cell(35,'',$total,'','','C');

$pdf->Ln(15);

$pdf->SetFont('arial','B','9.5');
$pdf->Cell('','','Angaben für Ihre Bezahlung:','','','L');
$pdf->Ln(6);
$pdf->WriteHTML('<hr>');

$pdf->Ln(-2);

if ($notes)
$notities = $notes;
else
$notities = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.";

$pdf->SetFont('arial','','9.5');
$pdf->Cell('','',$notities,'','','L');

$startpage = $pdf->GetPage();
$endpage = $pdf->GetPage();
$pdf->setPage($endpage);

$paginanummer = 1;

?>
 
Zurück
Oben