示例#1
0
 $f_may = $row['f_may'];
 $total_fees = $f_reg;
 if ($f_may == 0) {
     if ($f_april == 0) {
         $total_fees = $f_reg;
     } else {
         $total_fees = $f_april;
     }
 } else {
     $total_fees = $f_may;
 }
 $pdf = new FPDF('P', 'mm', array(210, 210));
 // Add a page to that object
 $pdf->AddPage();
 $pdf->setleftmargin(10);
 $pdf->setX(20);
 $pdf->setY(10);
 $pdf->SetFillColor(0, 0, 0);
 $pdf->Cell(190, 140, '', 1, 0, "C");
 $pdf->setX(20);
 $pdf->setY(15);
 $pdf->SetFillColor(0, 0, 0);
 $image1 = 'logo.png';
 // Add some text
 $pdf->SetFont('Arial', '', 20);
 // width, height, text, no border, next line - below & left margin, alignement
 // shree rang in centre
 $pdf->Cell(175, 10, '           Explora Academy of Design', 0, 0, "C");
 $pdf->Cell(15, 10, $pdf->Image($image1, $pdf->GetX(), $pdf->GetY(), 10), 0, 1, 'R', false);
 $pdf->SetFillColor(0, 0, 0);
 $pdf->Rect(20, 26, 175, 1, 'F');
示例#2
0
 $f_reg_date = $row['f_reg_date'];
 $f_april = $row['f_april'];
 $f_april_date = $row['f_april_date'];
 $f_may = $row['f_may'];
 $f_may_date = $row['f_may_date'];
 $dob = $row['dob'];
 $pimg = "../" . $row['img_path'];
 $email = $row['email'];
 $_SESSION['email'] = $email;
 $_SESSION['name'] = $firstname;
 $pdf = new FPDF();
 $image12 = "done2.png";
 // Add a page to that object
 $pdf->AddPage();
 $pdf->setleftmargin(10);
 $pdf->setX(10);
 $pdf->setY(10);
 // Add some text
 $pdf->SetFont('Arial', 'B', 10);
 $text = "hello";
 // width, height, text, no border, next line - below & left margin, alignement
 // shree rang in centre
 $pdf->Cell(200, 10, '|| Shree Rang ||', 0, 1, "C");
 //create rectangle and registration form
 $pdf->SetFillColor(0, 0, 0);
 $pdf->Rect(0, 20, 210, 10, 'F');
 $pdf->SetTextColor(255, 255, 255);
 $pdf->SetFont('Arial', 'B', 15);
 $pdf->Cell(200, 10, 'REGISTRATION FORM - 2016', 0, 1, "C");
 // space below registration form
 $pdf->Cell(210, 5, '', 0, 1, "C");
示例#3
0
 public function print_detail($id = '')
 {
     $servis = $this->general_mdl->get_from_field('servis', 'id', $id)->row();
     $servis_tipe = $this->general_mdl->get_from_field('servis_tipe', 'kode', $servis->tipe)->row();
     $kendaraan = $this->general_mdl->get_from_field('kendaraan', 'kode', $servis->kendaraan)->row();
     $kendaraan_tipe = $this->general_mdl->get_from_field('kendaraan_tipe', 'kode', $kendaraan->tipe)->row();
     require_once "./assets/lib/fpdf/fpdf.php";
     $pdf = new FPDF();
     $pdf->AliasNbPages();
     $pdf->AddPage('P', 'A4');
     $pdf->Image('./assets/img/logo.jpg', 12, 10, 25, 0);
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->setX(35);
     $pdf->Cell(0, 5, 'PEMERINTAH DAERAH KABUPATEN CIANJUR', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->setX(35);
     $pdf->Cell(0, 5, 'DINAS KEBERSIHAN DAN PERTAMANAN', 0, 0, 'C');
     $pdf->Ln(7);
     $pdf->setX(40);
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(20, 5, 'NOMOR', 1, 0, 'C');
     $pdf->Cell(75, 5, $servis->nomor, 1, 0, 'C');
     $pdf->Ln(7);
     $pdf->setX(40);
     $pdf->SetFont('Arial', 'B', 12);
     $pdf->Cell(95, 10, 'KARTU SEHAT KENDARAAN', 1, 0, 'C');
     $pdf->Ln(12);
     $pdf->SetFont('Arial', '', 8);
     $pdf->Cell(30, 5, 'NO. MESIN', 0, 0, 'L');
     $pdf->Cell(95, 5, ': ' . $kendaraan->nomes, 0, 0, 'L');
     $pdf->Ln(5);
     $pdf->Cell(30, 5, 'TYPE SERVIS', 0, 0, 'L');
     $pdf->Cell(95, 5, ': ' . $servis_tipe->nama, 0, 0, 'L');
     $pdf->Ln(5);
     $pdf->Cell(30, 5, 'TAHUN ANGGARAN', 0, 0, 'L');
     $pdf->Cell(95, 5, ': ' . date_format(date_create($servis->tanggal), 'Y'), 0, 0, 'L');
     $pdf->setXY(140, 22);
     $pdf->Cell(30, 5, 'NO KENDARAAN', 1, 0, 'L');
     $pdf->Cell(0, 5, $kendaraan->nopol, 1, 0, 'C');
     $pdf->setXY(140, 27);
     $pdf->Cell(30, 5, 'TIPE KENDARAAN', 1, 0, 'L');
     $pdf->Cell(0, 5, $kendaraan_tipe->nama, 1, 0, 'C');
     $pdf->setXY(140, 41);
     $pdf->Cell(30, 5, 'TANGGAL', 0, 0, 'L');
     $pdf->Cell(0, 5, ': ' . date_format(date_create($servis->tanggal), 'd'), 0, 0, 'L');
     $pdf->setXY(140, 46);
     $pdf->Cell(30, 5, 'BULAN', 0, 0, 'L');
     $pdf->Cell(0, 5, ': ' . date_format(date_create($servis->tanggal), 'M'), 0, 0, 'L');
     $pdf->setXY(140, 51);
     $pdf->Cell(30, 5, 'KILOMETER', 0, 0, 'L');
     $pdf->Cell(0, 5, ': ' . $servis->kilometer, 0, 0, 'L');
     $pdf->Ln(10);
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(70, 5, 'KOMPONEN DASAR MESIN', 1, 0, 'C');
     $pdf->Cell(30, 5, 'JENIS PERLAKUAN', 1, 0, 'C');
     $pdf->Cell(30, 5, 'SATUAN', 1, 0, 'C');
     $pdf->Cell(30, 5, 'HARGA SATUAN', 1, 0, 'C');
     $pdf->Cell(0, 5, 'TOTAL HARGA', 1, 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('Arial', '', 8);
     $result = $this->general_mdl->get_from_field('servis_detail', 'servis', $servis->nomor)->result();
     $total = 0;
     foreach ($result as $r) {
         $komponen = $this->general_mdl->get_from_field('komponen', 'kode', $r->komponen)->row();
         $komponen_satuan = $this->general_mdl->get_from_field('komponen_satuan', 'kode', $komponen->satuan)->row();
         $aksi = $this->general_mdl->get_from_field('servis_aksi', 'kode', $r->aksi)->row();
         $pdf->Cell(70, 5, $komponen->nama . ' ' . ($r->komponen_lain != '' ? ':' . $r->komponen_lain : ''), 1, 0, 'L');
         $pdf->Cell(30, 5, $aksi->nama, 1, 0, 'C');
         $pdf->Cell(30, 5, number_format($r->satuan) . ' ' . $komponen_satuan->nama, 1, 0, 'R');
         $pdf->Cell(30, 5, number_format($r->harga), 1, 0, 'R');
         $pdf->Cell(0, 5, number_format($r->satuan * $r->harga), 1, 0, 'R');
         $pdf->Ln(5);
         $total += $r->satuan * $r->harga;
     }
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(160, 5, 'Total', 1, 0, 'L');
     $pdf->Cell(0, 5, number_format($total), 1, 0, 'R');
     $pdf->Ln(10);
     $pdf->Cell(80, 5, '', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Mengetahui,', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(80, 5, 'Penanggung Jawab Bengkel', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Mandor Armada', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(80, 5, 'Dinas Kebersihan dan Pertamanan', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Dinas Kebersihan dan Pertamanan', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(80, 5, 'Kabupaten Cianjur', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Kabupaten Cianjur', 0, 0, 'C');
     $pdf->Ln(20);
     $pdf->SetFont('Arial', 'BU', 8);
     $pdf->Cell(80, 5, 'Rusdi Hermawan', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Deden Suparman, SIP', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(80, 5, 'NIP. 19610912 200701 1 002', 0, 0, 'C');
     $pdf->Cell(0, 5, 'NIP. 19710316 200901 1 003', 0, 0, 'C');
     $pdf->Output();
 }
示例#4
0
 public function pdf()
 {
     require_once "./assets/lib/fpdf/fpdf.php";
     $pdf = new FPDF();
     $pdf->AliasNbPages();
     $pdf->AddPage('L', 'A4');
     $pdf->Image('./assets/img/logo.jpg', 10, 10, 15, 0);
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->setX(30);
     $pdf->Cell(0, 5, 'PEMERINTAH DAERAH KABUPATEN CIANJUR', 0, 0, 'L');
     $pdf->Ln(5);
     $pdf->setX(30);
     $pdf->Cell(0, 5, 'DINAS KEBERSIHAN DAN PERTAMANAN', 0, 0, 'L');
     $pdf->SetFont('Arial', '', 8);
     if ($this->input->get('date_from') != '' && $this->input->get('date_to') != '') {
         $pdf->Ln(5);
         $pdf->setX(30);
         $pdf->Cell(0, 5, 'Periode : ' . $this->input->get('date_from') . ' s/d ' . $this->input->get('date_to'), 0, 0, 'L');
     }
     if ($this->input->get('kendaraan') != '') {
         $pdf->Ln(5);
         $pdf->setX(30);
         $pdf->Cell(0, 5, 'Nomor Polisi : ' . $this->general_mdl->get_from_field('kendaraan', 'id', $this->input->get('kendaraan'))->row()->nopol, 0, 0, 'L');
     }
     $pdf->Ln(15);
     $pdf->Cell(0, 1, '', 'T', 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->Cell(0, 5, 'REKAPITULASI SERVIS', 0, 0, 'C');
     $pdf->Ln(10);
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(10, 5, 'NO', 1, 0, 'C');
     $pdf->Cell(20, 5, 'TANGGAL', 1, 0, 'C');
     $pdf->Cell(20, 5, 'KENDARAAN', 1, 0, 'C');
     $pdf->Cell(40, 5, 'TIPE', 1, 0, 'C');
     $pdf->Cell(30, 5, 'KILOMETER', 1, 0, 'C');
     $pdf->Cell(60, 5, 'KOMPONEN', 1, 0, 'C');
     $pdf->Cell(20, 5, 'PERLAKUAN', 1, 0, 'C');
     $pdf->Cell(20, 5, 'SATUAN', 1, 0, 'C');
     $pdf->Cell(30, 5, 'HARGA SATUAN', 1, 0, 'C');
     $pdf->Cell(0, 5, 'TOTAL HARGA', 1, 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('Arial', '', 8);
     $result = $this->servis_rekap_mdl->pdf()->result();
     $i = 1;
     $total = 0;
     foreach ($result as $r) {
         $pdf->Cell(10, 5, $i++, 1, 0, 'C');
         $pdf->Cell(20, 5, format_dmy($r->tanggal), 1, 0, 'C');
         $pdf->Cell(20, 5, $r->nopol, 1, 0, 'C');
         $pdf->Cell(40, 5, $r->tipe, 1, 0, 'L');
         $pdf->Cell(30, 5, $r->kilometer, 1, 0, 'C');
         $pdf->Cell(60, 5, $r->komponen_lain != '' ? $r->komponen_lain : $r->komponen_nama, 1, 0, 'L');
         $pdf->Cell(20, 5, $r->servis_aksi_nama, 1, 0, 'C');
         $pdf->Cell(20, 5, number_format($r->satuan) . ' ' . $r->komponen_satuan_nama, 1, 0, 'R');
         $pdf->Cell(30, 5, number_format($r->harga), 1, 0, 'R');
         $pdf->Cell(0, 5, number_format($r->total), 1, 0, 'R');
         $pdf->Ln(5);
         $total += $r->satuan * $r->harga;
     }
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(250, 5, 'Total', 1, 0, 'L');
     $pdf->Cell(0, 5, number_format($total), 1, 0, 'R');
     $pdf->Ln(10);
     $pdf->Cell(140, 5, '', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Mengetahui,', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(140, 5, 'Penanggung Jawab Bengkel', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Mandor Armada', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(140, 5, 'Dinas Kebersihan dan Pertamanan', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Dinas Kebersihan dan Pertamanan', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(140, 5, 'Kabupaten Cianjur', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Kabupaten Cianjur', 0, 0, 'C');
     $pdf->Ln(20);
     $pdf->SetFont('Arial', 'BU', 8);
     $pdf->Cell(140, 5, 'Rusdi Hermawan', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Deden Suparman, SIP', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(140, 5, 'NIP. 19610912 200701 1 002', 0, 0, 'C');
     $pdf->Cell(0, 5, 'NIP. 19710316 200901 1 003', 0, 0, 'C');
     $pdf->Output();
 }
// Variable zur Aufsumierung der Umsätze anlegen
$umsatz_ges = 0.0;
foreach ($umsaetze['gesamtumsatz'] as $key => $val) {
    $pdf->Cell(20, 6, sprintf('%s %%', number_format($key, 2, ',', '')), 0, 0, 'R');
    $pdf->Cell(15, 6, $val['fluege'], 0, 0, 'C');
    $pdf->Cell(27, 6, sprintf('%s EUR', number_format($val['summe'], 2, ',', '')), 0, 0, 'R');
    // Umsatz aufsumieren
    $umsatz_ges += $val['summe'];
    // Zeilenumbruch einfügen
    $pdf->Ln();
}
// vertikale Y-Position ermitteln
$y = $pdf->getY();
// Linie(n) zeichnen
$pdf->Line(60, $y, 90, $y);
$pdf->Line(60, $y + 0.6, 90, $y + 0.6);
// neues X- und Y-Position festlegen
$pdf->setY($y + 1);
$pdf->setX(60);
// Aufsumierten Gesamtumsatz anzeigen
$pdf->Cell(27, 6, sprintf('%s EUR', number_format($umsatz_ges, 2, ',', '')), 0, 0, 'R');
// Position auf der X- und Y-Achse
$pdf->SetXY(20, 280);
// Schriftart und -farbe ändern
$pdf->SetTextColor(128, 128, 128);
$pdf->SetFont('Times', '', 8);
// Ausgabe des Fusszeilentext
$pdf->Cell(0, 10, 'Seite ' . $pdf->PageNo() . ' von {nb}', 0, 0, 'C');
// ******************************************************** SEITE ******************************************************** //
// PDF-Dokument ausgeben
$pdf->Output(sprintf('monatsumsaetze-%s-%s.pdf', $_GET['jahr'], $_GET['monat']), 'I');
示例#6
0
 function genCarpentras2()
 {
     global $options;
     # paramètres
     $mg = 3;
     // Marge de gauche =>  initial 17
     $mh = 13;
     // Marge du haut =>  initial 9
     $md = 0;
     // Marge de droite
     $mb = 11;
     // Marge du bas
     $largeur_etiquette = 70;
     // largeur_etiquette =>  initial 60
     $espace_etiquettes = 0;
     // =>  initial 7
     $nb_ligne_etiquettes = 11;
     $nb_etiquette_ligne = 3;
     $hauteur_etiquette = 25;
     // Préparation du document PDF.
     $pdf = new FPDF('P', 'mm', 'A4');
     $pdf->Open();
     $pdf->SetLeftMargin($mg);
     $pdf->SetTopMargin($mh);
     $pdf->SetAutoPageBreak(1, 0);
     $pdf->AddPage();
     // Gestion des fonts
     $pdf->AddFont('code39', '', 'IDAutomation_Code_39.php');
     $pdf->SetFont('times', '', 12);
     // Préparation des informations.
     $nom = strtoupper($this->patient->getNom());
     $prenom = strtoupper($this->patient->getPrenom());
     $date = new clDate($this->patient->getDateNaissance());
     $dateN = $date->getDate("d/m/Y");
     if ($this->patient->getSexe() == "F") {
         $sexe = "F";
         $e = "e";
     } elseif ($this->patient->getSexe() == "M") {
         $sexe = "M";
         $e = "";
     } else {
         $sexe = "Ind.";
         $e = "";
     }
     $date->setDate($this->patient->getDateAdmission());
     $led = $date->getDate("d/m/Y");
     $ipp = $this->patient->getILP();
     $nsej = $this->patient->getNSej();
     $uf = $this->patient->getUF();
     for ($i = 0; $i < $nb_ligne_etiquettes; $i++) {
         for ($j = 0; $j < $nb_etiquette_ligne; $j++) {
             $l = $j * $largeur_etiquette + $mg;
             $h = $i * $hauteur_etiquette + $mh;
             $le = $largeur_etiquette - $mg;
             $pdf->setY($h);
             $pdf->setX($l);
             $pdf->setFont('times', '', 9);
             $pdf->Cell($le, 4, "Dossier : ", 0, 0, L);
             $pdf->setY($h);
             $pdf->setX($l + 17);
             $pdf->setFont('times', 'b', 9);
             $pdf->cell($le - 10, 4, $nsej, 0, 0, L);
             //$pdf->setFont('times', '', 9 ) ;
             $pdf->setY($h);
             $pdf->setX($l);
             $pdf->cell($le - 10, 4, "U", 0, 0, R);
             $pdf->setY($h + 4);
             $pdf->setX($l);
             $pdf->setFont('times', '', 9);
             $pdf->cell($le, 4, $nom . " " . $prenom, 0, 0, L);
             $pdf->setY($h + 9);
             $pdf->setX($l);
             $pdf->cell($le, 4, "Né{$e} le : {$dateN}", 0, 0, L);
             $pdf->setY($h + 9);
             $pdf->setX($l);
             $pdf->cell($le - 10, 4, "Sexe : {$sexe}", 0, 0, R);
             $pdf->setY($h + 13);
             $pdf->setX($l);
             $pdf->cell($le, 4, "Le : {$led}", 0, 0, L);
             $pdf->setY($h + 13);
             $pdf->setX($l);
             $pdf->cell($le - 10, 4, "UF : {$uf}", 0, 0, R);
             $pdf->setY($h + 17);
             $pdf->setX($l);
             $pdf->cell($le - 10, 4, "NIP : {$ipp}", 0, 0, L);
         }
     }
     $pdf->Output();
 }
示例#7
0
function printFPDF($pdfobj){

	require('fpdf/fpdf.php');

	$DIRPATH = $_SERVER['SCRIPT_FILENAME'];

	// remove the file name and append the new directory name
	if (PHP_OS == "WINNT" || PHP_OS == "WIN32") {
		$pos1 = strrpos($DIRPATH,'\\');
		$DIRPATH= substr($DIRPATH,0,$pos1)."\\pdf\\";
	}else{
		$pos1 = strrpos($DIRPATH,'/');
		$DIRPATH= substr($DIRPATH,0,$pos1)."/pdf/";
	}
	$pdf_FILE_NAME = session_id(). "MapLocator.pdf";
	$pdf_FILE_PATH = $DIRPATH. $pdf_FILE_NAME ;

	$pdf = new FPDF('P', 'pt', array(640,450));
	$pdf->AddPage();
	$pdf->SetFont('Arial','B',10);

	$domain = getenv("HTTP_HOST");

	//base map
	$base_url = $pdfobj->BaseUrl;
	$base_url = str_replace(' and ','&' ,$base_url);

	if (strpos($base_url,'http://') === false) {
		//since client sends only relative path a full http url needs to constructed here
		$base_url = 'http://'. $domain. $base_url;
		//echo 'here';
	}


	$base_image = createImageForPDF($base_url,$DIRPATH.'base');
	$base_image_jpeg = $DIRPATH.'base'.session_id() .'.jpeg';
	png2jpg($base_image, $base_image_jpeg, 100);

	$layerURL = $pdfobj->LayerURL;

	$layerURL = str_replace(' and ','&' ,$layerURL );

	//since client sends only relative path a full http url needs to constructed here
	$layerURL = 'http://'. $domain. $layerURL;
	$layer = $pdfobj->Layer;
	$legendURL = $pdfobj->LegendURL;
	$legendURL = 'http://'. $domain. $legendURL;
	$legendURL = str_replace(' and ','&' ,$legendURL );

	$image = createImageForPDF($layerURL,$DIRPATH.$layer);

	$image_jpeg = $DIRPATH.$layer.session_id() .'.jpeg';
	png2jpg($image, $image_jpeg, 100);

	$url = 'http://'. $domain. base_path().'ImageMerge.php?baseimage='.$base_image_jpeg.'&overlayimage='.			$image_jpeg;

	$merged_image_buff = file_get_contents($url);

	$final_image =$DIRPATH.'merge.jpeg';

	$fh = fopen($final_image,"w");
  	fwrite($fh,$merged_image_buff);
	fclose($fh);


	$pdf->Image($final_image,0,30);

	$image = createImageForPDF($legendURL,$DIRPATH.$layer.'_legend');
	$image_jpeg = $DIRPATH.$layer.'_legend'.session_id() .'.jpeg';
	png2jpg($image, $image_jpeg, 100);
	$size = getimagesize($image);
	$width = $size[0];
	$height = $size[1];



	$pdf->sety(25);
	$pdf->Cell(0,0,"Layer Name: ". $pdfobj->LayerName);


	$top_scale = $pdfobj->TopScale;
	$bottom_scale = $pdfobj->BottomScale;


	$pdf->Text(0,430,"Scalebar: ");
	$pdf->Text(50,430,"| ".$top_scale." |");
	$pdf->Text(50,430,"  _____ ");
	$pdf->Text(50,440,"| ".$bottom_scale." |");
	$pdf->Text(475,445,"Created by Map Locator");


	if($width < 100){//show legend on the map/same page
		$pdf->Image($image_jpeg,640 - $width,30);
		$pdf->sety(20);
		$pdf->setX(-75);
		$pdf->Cell(20,10,"Legend ");
	}else{//show legend on the next page
		$pdf->AddPage();
		$pdf->Image($image_jpeg,0,30);
		$pdf->sety(20);
		$pdf->setX(5);
		$pdf->Cell(20,10,"Legend ");
	}



	$pdf->Output($pdf_FILE_PATH,'F');
	$pdf->Close();
	return $pdf_FILE_NAME;


}
示例#8
0
文件: sbr.php 项目: amage/fl-ru-damp
 /**
  * Генерирует PDF-документ на основании XML-файла.
  *
  * @param string $file          Файл для обработки
  * @param mixed $replacements   массив для подстановки значений
  * @return FPDF сформированный документ PDF или FALSE в случае неудачи
  */
 public static function xml2pdf($file, $replacements = false)
 {
     // Новая обработка PDF
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/odt2pdf.php';
     $tpl = basename($file, ".xml") . ".odt";
     $t = new odt2pdf($tpl);
     $t->convert($replacements);
     return $t;
     /**
      * @deprecated
      */
     if (!file_exists($file)) {
         return false;
     }
     require_once dirname(__FILE__) . '/fpdf/fpdf.php';
     define('FPDF_FONTPATH', dirname(__FILE__) . '/fpdf/font/');
     if (is_array($replacements)) {
         foreach ($replacements as &$val) {
             $val = htmlspecialchars_decode($val, ENT_QUOTES);
         }
     }
     $replacements['$tab'] = '    ';
     $xml = new DOMDocument('1.0', 'windows-1251');
     $xml->load($file);
     $pdf = new FPDF();
     // Загружаем шрифты
     $pdf->AddFont('ArialMT', '', 'c9bb7ceca00657d007d343f4e34b71a8_arial.php');
     $pdf->AddFont('Arial-BoldMT', '', '9cb9fc616ba50d7ecc7b816984f2ffda_arialbd.php');
     $pdf->AddFont('TimesNewRomanPSMT', '', '5f37f1915715e014ee2254b95c0b6cab_times.php');
     $pdf->AddFont('TimesNewRomanPS-BoldMT', '', 'e07f6c05a47ebec50a80f29789c7f1f6_timesbd.php');
     /*
             Загружаем XML-документ и читаем из него основные параметры лоя итогового PDF-документа
     */
     $root = $xml->documentElement;
     $title = $root->getAttribute('title') ? iconv('windows-1251', 'utf-8', $root->getAttribute('title')) : '';
     // заголовок документа
     $author = $root->getAttribute('author');
     // автор
     $margin_left = $root->getAttribute('margin-left') ? $root->getAttribute('margin-left') : 20;
     // отступ слева
     $margin_right = $root->getAttribute('margin-right') ? $root->getAttribute('margin-right') : 20;
     // отступ справа
     $margin_top = $root->getAttribute('margin-top') ? $root->getAttribute('margin-top') : 20;
     // отступ сверху
     $font_name = $root->getAttribute('font-name') ? $root->getAttribute('font-name') : 'ArialMT';
     // дефолтный шрифт (имя)
     $font_size = (int) $root->getAttribute('font-size') ? (int) $root->getAttribute('font-size') : 10;
     // дефолтный шрифт (размер)
     $text_width = (int) $root->getAttribute('width') ? (int) $root->getAttribute('width') : 170;
     // ширина печатной области документа
     $paragraph_indent = (int) $root->getAttribute('paragraph-indent') ? (int) $root->getAttribute('paragraph-indent') : 0;
     // отступ между параграфами
     $printable = $pdf->h - $margin_top - 20;
     $pdf->SetTitle($title, true);
     $pdf->SetAuthor($author);
     $pdf->SetLeftMargin($margin_left);
     $pdf->SetRightMargin($margin_right);
     $pdf->SetTopMargin($margin_top);
     $pdf->AddPage();
     $pdf->SetFont($font_name, '', $font_size);
     $pdf->SetX($margin_left);
     $locates = array();
     // разбор XML-документа
     $xpath = new DOMXPath($xml);
     $scale = $xpath->query('/document/page/*');
     if ($scale->length) {
         $footer = $xpath->query('//footer');
         $footer = $footer->length ? $footer->item(0) : NULL;
         $no_brake = $xpath->query('//nobreak');
         $no_brake = $no_brake->length ? TRUE : FALSE;
         // если есть теги <nobreak>, то расставляем разрывы страниц руками
         if ($no_brake) {
             $pdf->SetAutoPageBreak(false);
         }
         $last_y = 0;
         $pages = array();
         foreach ($scale as $node) {
             $last_y = intval($pdf->y);
             if ($node->tagName == 'nobreak' && $node->getAttribute('start')) {
                 $max_h = $last_y;
                 $loc_offset = 0;
                 foreach ($xpath->query('//cell|locate[(following::nobreak)]') as $i => $nd) {
                     if ($nd->tagName == 'nobreak' && $node->getAttribute('end')) {
                         break;
                     }
                     $_h = $nd->getAttribute('height');
                     if ($i > 0 && !$loc_offset) {
                         $_h = 0;
                     }
                     $max_h += intval($_h);
                     $loc_offset = $nd->getAttribute('x_offset');
                 }
                 $max_h += $last_y;
                 if ($max_h > $printable) {
                     if ($footer) {
                         $pdf->SetY(-20);
                         $pdf->SetFont($font_name, '', 9);
                         $pdf->Cell(0, 10, self::prepareNodeText($footer), 0, 0, 'C');
                         $pages[] = $pdf->PageNo();
                     }
                     $pdf->AddPage();
                 }
             }
             if ($no_brake && $pdf->y > $printable) {
                 if ($footer && !in_array($pdf->PageNo(), $pages)) {
                     $pdf->SetY(-20);
                     $pdf->SetFont($font_name, '', 9);
                     $pdf->Cell(0, 10, self::prepareNodeText($footer), 0, 0, 'C');
                     $pages[] = $pdf->PageNo();
                 }
                 $pdf->AddPage();
             }
             if (!(int) $node->getAttribute('keep-pos')) {
                 $pdf->SetX($margin_left);
             }
             // сброс позиции по X-оси если <node keep-pos="0" или не задан
             if ((int) $node->getAttribute('offset-left')) {
                 $pdf->SetX((int) $node->getAttribute('offset-left') + $margin_left);
             }
             if ($node->tagName == 'text') {
                 // вывод строки
                 if ($node->getAttribute('font-name')) {
                     $font_name = $node->getAttribute('font-name');
                 }
                 if ((int) $node->getAttribute('font-size')) {
                     $font_size = (int) $node->getAttribute('font-size');
                 }
                 $align = $node->getAttribute('align') ? strtoupper($node->getAttribute('align')) : 'C';
                 $width = (int) $node->getAttribute('width') ? (int) $node->getAttribute('width') : $text_width;
                 $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5;
                 $border = $node->getAttribute('border') ? strtoupper($node->getAttribute('border')) : 0;
                 $text = self::prepareNodeText($node, $replacements);
                 if (!($color = $node->getAttribute('color'))) {
                     $color = '000000';
                 }
                 $pdf->SetTextColor(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2)));
                 $pdf->SetFont($font_name, '', $font_size);
                 $skip_empty = (int) $node->getAttribute('skip-empty') ? (int) $node->getAttribute('skip-empty') : 0;
                 if ((int) $skip_empty) {
                     if (!trim($text)) {
                         continue;
                     }
                 }
                 $pdf->Cell($width, $height, trim($text), $border, 1, $align);
             } elseif ($node->tagName == 'paragraph') {
                 // выводит многострочный текстовый блок, можно указывать тип выравнивания текста (L, J, R, C)
                 if (($show_if = $node->getAttribute('show-if')) && !$replacements[$show_if]) {
                     continue;
                 }
                 if ($node->getAttribute('font-name')) {
                     $font_name = $node->getAttribute('font-name');
                 }
                 if ((int) $node->getAttribute('font-size')) {
                     $font_size = (int) $node->getAttribute('font-size');
                 }
                 $align = $node->getAttribute('align') ? strtoupper($node->getAttribute('align')) : 'J';
                 $width = (int) $node->getAttribute('width') ? (int) $node->getAttribute('width') : $text_width;
                 $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5;
                 $border = $node->getAttribute('border') ? strtoupper($node->getAttribute('border')) : 0;
                 $keep_text_wrap = (int) $node->getAttribute('keep-text-wrap') ? (int) $node->getAttribute('keep-text-wrap') : 0;
                 $text = self::prepareNodeText($node, $replacements, $keep_text_wrap);
                 if (!($color = $node->getAttribute('color'))) {
                     $color = '000000';
                 }
                 $pdf->SetTextColor(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2)));
                 $pdf->SetFont($font_name, '', $font_size);
                 $skip_empty = (int) $node->getAttribute('skip-empty') ? (int) $node->getAttribute('skip-empty') : 0;
                 if ((int) $skip_empty) {
                     if (!trim($text)) {
                         continue;
                     }
                 }
                 $pdf->MultiCell($width, $height, $text, $border, $align);
                 if ($paragraph_indent) {
                     $pdf->Ln($paragraph_indent);
                 }
             } elseif ($node->tagName == 'ln') {
                 // перевод строки
                 $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5;
                 $pdf->Ln($height);
             } elseif ($node->tagName == 'cell') {
                 // рисует ячейку
                 if ($node->getAttribute('font-name')) {
                     $font_name = $node->getAttribute('font-name');
                 }
                 if ((int) $node->getAttribute('font-size')) {
                     $font_size = (int) $node->getAttribute('font-size');
                 }
                 $align = $node->getAttribute('align') ? strtoupper($node->getAttribute('align')) : 'J';
                 $width = (int) $node->getAttribute('width') ? (int) $node->getAttribute('width') : $text_width;
                 $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5;
                 $border = $node->getAttribute('border') != '' ? (int) $node->getAttribute('border') : 1;
                 $keep_text_wrap = (int) $node->getAttribute('keep-text-wrap') ? (int) $node->getAttribute('keep-text-wrap') : 0;
                 $text = self::prepareNodeText($node, $replacements, $keep_text_wrap);
                 if (!($color = $node->getAttribute('color'))) {
                     $color = '000000';
                 }
                 $pdf->SetTextColor(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2)));
                 $pdf->SetFont($font_name, '', $font_size);
                 $pdf->Cell($width, $height, $text, $border, 0, $align);
             } elseif ($node->tagName == 'locate') {
                 // перемещает указатель в определенную позицию в документе
                 $x = $node->getAttribute('x') ? $node->getAttribute('x') : 0;
                 $y = $node->getAttribute('y') ? $node->getAttribute('y') : 0;
                 $x_offset = (int) $node->getAttribute('x_offset') ? (int) $node->getAttribute('x_offset') : 0;
                 $y_offset = (int) $node->getAttribute('y_offset') ? (int) $node->getAttribute('y_offset') : 0;
                 if (strpos($x, '@') !== false) {
                     $x = $locates['x'][$x] + $x_offset;
                 }
                 if (strpos($y, '@') !== false) {
                     $y = $locates['y'][$y] + $y_offset;
                 }
                 if (!$x) {
                     $x = $pdf->GetX() + $x_offset;
                 }
                 if (!$y) {
                     $y = $pdf->GetY() + $y_offset;
                 }
                 $pdf->SetXY($x, $y);
             } elseif ($node->tagName == 'fix-locate') {
                 // перемещает указатель в определенную позицию в документе
                 if ($x = $node->getAttribute('x')) {
                     $locates['x'][$x] = $pdf->GetX();
                 }
                 if ($y = $node->getAttribute('y')) {
                     $locates['y'][$y] = $pdf->GetY();
                 }
             } elseif ($node->tagName == 'line') {
                 // рисует простую горизонтальную линию
                 $x = (int) $node->getAttribute('x') ? (int) $node->getAttribute('x') : $margin_left;
                 $y = (int) $node->getAttribute('y') ? (int) $node->getAttribute('y') : $margin_top;
                 $len = (int) $node->getAttribute('len') ? (int) $node->getAttribute('len') : $text_width;
                 if ($x) {
                     $pdf->setX($x);
                 }
                 if ($y) {
                     $pdf->setY($y);
                 }
                 $pdf->Cell($len, 0, '', 1);
             } elseif ($node->tagName == 'newpage') {
                 //новая страница и перевод указателя на нее
                 $pdf->AddPage();
             }
         }
     }
     return $pdf;
 }
$pdf = new FPDF();
$pdf->Open();
$pdf->AliasNbPages();
$pdf->AddPage("L");
// monta cabecalho do relatório
$pdf->Image('imagens/files/logo_boleto.png', 140, 3, 20);
$pdf->SetFont('Times', '', 9);
$pdf->Text(118, 31, $nomeinst);
$pdf->Text(125, 34, $db12_extenso);
$pdf->SetFont('Courier', 'B', 12);
$pdf->Text(122, 38, "PLANILHA NÚMERO: " . $planilha . $situacao);
$pdf->SetFont('Courier', 'B', 9);
$pdf->Text(243, 38, "COMPETÊNCIA:" . $mesx . "/" . $q20_ano);
$pdf->SetFont('Courier', 'B', 10);
$pdf->setY(41);
$pdf->setX(5);
$pdf->SetFillColor(200, 200, 200);
$pdf->Cell(286, 5, "DADOS DO DECLARANTE", 1, 1, "C", 1);
$pdf->SetFont('Courier', '', 9);
$pdf->setY(47);
$pdf->setX(5);
$clquery->sql_query("cgm", "z01_nome", "", " z01_numcgm = {$q20_numcgm}");
$clquery->sql_record($clquery->sql);
db_fieldsmemory($clquery->result, 0);
$pdf->Cell(154, 5, "NOME OU RAZÃO SOCIAL:" . $z01_nome, "LTB", 0, "L", 0);
$pdf->Cell(52, 5, "INSCRIÇÃO MUNICIPAL:" . $q24_inscr, "TB", 0, "L", 0);
$pdf->Cell(80, 5, "CONTATO:" . $q20_nomecontri . " FONE:" . $q20_fonecontri, "TRB", 1, "L", 0);
$pdf->SetFont('Courier', 'B', 10);
$pdf->Ln(10);
$pdf->setX(5);
$pdf->Cell(286, 5, "DADOS DOS SERVIÇOS PRESTADOS", 1, 1, "C", 1);
示例#10
0
 public function pdf()
 {
     require_once "./assets/lib/fpdf/fpdf.php";
     $pdf = new FPDF();
     $pdf->AliasNbPages();
     $pdf->AddPage('P', 'A4');
     $pdf->Image('./assets/img/logo.jpg', 10, 10, 15, 0);
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->setX(30);
     $pdf->Cell(0, 5, 'PEMERINTAH DAERAH KABUPATEN CIANJUR', 0, 0, 'L');
     $pdf->Ln(5);
     $pdf->setX(30);
     $pdf->Cell(0, 5, 'DINAS KEBERSIHAN DAN PERTAMANAN', 0, 0, 'L');
     $pdf->SetFont('Arial', '', 8);
     if ($this->input->get('date_from') != '' && $this->input->get('date_to') != '') {
         $pdf->Ln(5);
         $pdf->setX(30);
         $pdf->Cell(0, 5, 'Periode : ' . $this->input->get('date_from') . ' s/d ' . $this->input->get('date_to'), 0, 0, 'L');
     }
     if ($this->input->get('kendaraan') != '') {
         $pdf->Ln(5);
         $pdf->setX(30);
         $pdf->Cell(0, 5, 'Nomor Polisi : ' . $this->general_mdl->get_from_field('kendaraan', 'kode', $this->input->get('kendaraan'))->row()->nopol, 0, 0, 'L');
     }
     $pdf->Ln(15);
     $pdf->Cell(0, 1, '', 'T', 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->Cell(0, 5, 'REKAPITULASI SERVIS KOMPONEN', 0, 0, 'C');
     $pdf->Ln(10);
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(10, 5, 'NO', 1, 0, 'C');
     $pdf->Cell(110, 5, 'KOMPONEN', 1, 0, 'C');
     $pdf->Cell(30, 5, 'SATUAN', 1, 0, 'C');
     $pdf->Cell(0, 5, 'TOTAL HARGA', 1, 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('Arial', '', 8);
     $result = $this->servis_komponen_rekap_mdl->pdf()->result();
     $i = 1;
     $total = 0;
     foreach ($result as $r) {
         $pdf->Cell(10, 5, $i++, 1, 0, 'C');
         $pdf->Cell(110, 5, $r->komponen_lain != '' ? $r->komponen_lain : $r->komponen_nama, 1, 0, 'L');
         $pdf->Cell(30, 5, number_format($r->satuan) . ' ' . $r->komponen_satuan_nama, 1, 0, 'R');
         $pdf->Cell(0, 5, number_format($r->total), 1, 0, 'R');
         $pdf->Ln(5);
         $total += $r->total;
     }
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(150, 5, 'Total', 1, 0, 'L');
     $pdf->Cell(0, 5, number_format($total), 1, 0, 'R');
     $pdf->Ln(10);
     $pdf->Cell(100, 5, '', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Mengetahui,', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(100, 5, 'Pengelola Teknis Pemeliharaan', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Pengendali Teknis Pemeliharaan', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(100, 5, 'Kasi Pengangkutan Sampah', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Kepala Bidang', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(100, 5, '', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Kebersihan Jalan dan Lingkungan', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(100, 5, 'Dinas Kebersihan dan Pertamanan', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Dinas Kebersihan dan Pertamanan', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(100, 5, 'Kabupaten Cianjur', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Kabupaten Cianjur', 0, 0, 'C');
     $pdf->Ln(20);
     $pdf->SetFont('Arial', 'BU', 8);
     $pdf->Cell(100, 5, 'Azani Anthonida, SP', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Pratama Nugraha E, SH, MSi', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(100, 5, 'NIP. 19700606 200312 1 007', 0, 0, 'C');
     $pdf->Cell(0, 5, 'NIP. 19690304 199503 1 007', 0, 0, 'C');
     $pdf->Output();
 }
示例#11
0
 public function pdf()
 {
     require_once "./assets/lib/fpdf/fpdf.php";
     $pdf = new FPDF();
     $pdf->AliasNbPages();
     $pdf->AddPage('P', 'A4');
     $pdf->Image('./assets/img/logo.jpg', 10, 10, 15, 0);
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->setX(30);
     $pdf->Cell(0, 5, 'PEMERINTAH DAERAH KABUPATEN CIANJUR', 0, 0, 'L');
     $pdf->Ln(5);
     $pdf->setX(30);
     $pdf->Cell(0, 5, 'DINAS KEBERSIHAN DAN PERTAMANAN', 0, 0, 'L');
     $pdf->SetFont('Arial', '', 8);
     if ($this->input->get('date_from') != '' && $this->input->get('date_to') != '') {
         $pdf->Ln(5);
         $pdf->setX(30);
         $pdf->Cell(0, 5, 'Periode : ' . $this->input->get('date_from') . ' s/d ' . $this->input->get('date_to'), 0, 0, 'L');
     }
     $pdf->Ln(15);
     $pdf->Cell(0, 1, '', 'T', 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->Cell(0, 5, 'REKAPITULASI ANGGARAN', 0, 0, 'C');
     $pdf->Ln(10);
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(10, 5, 'NO', 1, 0, 'C');
     $pdf->Cell(30, 5, 'BULAN', 1, 0, 'C');
     $pdf->Cell(50, 5, 'SALDO AWAL', 1, 0, 'C');
     $pdf->Cell(50, 5, 'TOTAL PENGELUARAN', 1, 0, 'C');
     $pdf->Cell(0, 5, 'SISA SALDO', 1, 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('Arial', '', 8);
     $result = $this->anggaran_rekap_mdl->pdf()->result();
     $i = 1;
     $total = 0;
     foreach ($result as $r) {
         $saldo_awal = $this->anggaran_rekap_mdl->get_anggaran_awal($r->tanggal) - $this->anggaran_rekap_mdl->get_pengeluaran_awal($r->tanggal);
         $pdf->Cell(10, 5, $i++, 1, 0, 'C');
         $pdf->Cell(30, 5, $r->bulan, 1, 0, 'L');
         $pdf->Cell(50, 5, number_format($saldo_awal), 1, 0, 'R');
         $pdf->Cell(50, 5, number_format($r->total), 1, 0, 'R');
         $pdf->Cell(0, 5, number_format($saldo_awal - $r->total), 1, 0, 'R');
         $pdf->Ln(5);
         $total = $saldo_awal - $r->total;
     }
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(140, 5, 'Saldo Akhir : ', 1, 0, 'R');
     $pdf->Cell(0, 5, number_format($total), 1, 0, 'R');
     $pdf->Ln(10);
     $pdf->Cell(100, 5, '', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Mengetahui,', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(100, 5, 'Pengelola Teknis Pemeliharaan', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Pengendali Teknis Pemeliharaan', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(100, 5, 'Kasi Pengangkutan Sampah', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Kepala Bidang', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(100, 5, '', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Kebersihan Jalan dan Lingkungan', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(100, 5, 'Dinas Kebersihan dan Pertamanan', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Dinas Kebersihan dan Pertamanan', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->Cell(100, 5, 'Kabupaten Cianjur', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Kabupaten Cianjur', 0, 0, 'C');
     $pdf->Ln(20);
     $pdf->SetFont('Arial', 'BU', 8);
     $pdf->Cell(100, 5, 'Azani Anthonida, SP', 0, 0, 'C');
     $pdf->Cell(0, 5, 'Pratama Nugraha E, SH, MSi', 0, 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell(100, 5, 'NIP. 19700606 200312 1 007', 0, 0, 'C');
     $pdf->Cell(0, 5, 'NIP. 19690304 199503 1 007', 0, 0, 'C');
     $pdf->Output();
 }
示例#12
0
 /**
  *   Print tickets as PDF documents
  *   Tickets can be printed for an event, a single occurrence,
  *   or all tickets for a user ID.
  *
  *   @param  string  $ev_id  Event ID
  *   @param  integer $rp_id  Repeat ID
  *   @param  integer $uid    User ID
  *   @return string          PDF Document containing tickets
  */
 public static function PrintTickets($ev_id = '', $rp_id = 0, $uid = 0)
 {
     global $_CONF;
     $checkin_url = $_CONF['site_admin_url'] . '/plugins/evlist/checkin.php?tic=';
     // get the tickets, paid and unpaid. Need event id and uid.
     $tickets = self::GetTickets($ev_id, $rp_id, $uid);
     // The PDF functions in lgLib are a recent addition. Make sure that
     // the lgLib version supports PDF creation since we can't yet check
     // the lglib version during installation
     if (empty($tickets) || !function_exists('USES_lglib_class_fpdf')) {
         return "There are no tickets available to print";
     }
     USES_lglib_class_fpdf();
     USES_evlist_class_repeat();
     USES_evlist_class_tickettype();
     $ev_id = NULL;
     // create params array for qrcode, if used
     $params = array('module_size' => 5);
     $pdf = new FPDF();
     $pdf->SetLeftMargin(20);
     $pdf->AddPage();
     $tic_types = array();
     foreach ($tickets as $tic_id => $ticket) {
         if (!isset($tick_types[$ticket->tic_type])) {
             $tick_types[$ticket->tic_type] = new evTicketType($ticket->tic_type);
         }
         // If we don't already have the event info, get it and construct
         // the address string
         if ($ev_id != $ticket->ev_id) {
             $Ev = new evEvent($ticket->ev_id);
             $ev_id = $Ev->id;
             $addr = array();
             if ($Ev->Detail->street != '') {
                 $addr[] = $Ev->Detail->street;
             }
             if ($Ev->Detail->city != '') {
                 $addr[] = $Ev->Detail->city;
             }
             if ($Ev->Detail->province != '') {
                 $addr[] = $Ev->Detail->province;
             }
             if ($Ev->Detail->country != '') {
                 $addr[] = $Ev->Detail->country;
             }
             if ($Ev->Detail->postal != '') {
                 $addr[] = $Ev->Detail->postal;
             }
             $address = implode(' ', $addr);
         }
         // Get the repeat(s) for the ticket(s) to print a ticket for each
         // occurrence.
         $repeats = evRepeat::GetRepeats($ticket->ev_id, $ticket->rp_id);
         foreach ($repeats as $rp_id => $event) {
             $ev_date = $event->date_start;
             $ev_time = $event->time_start1 . ' - ' . $event->time_end1;
             if (!empty($event->time_start2)) {
                 $ev_time .= '; ' . $event->time_start1 . ' - ' . $event->time_end2;
             }
             $fee = self::formatAmount($ticket->fee);
             // Get the veritcal position of the current ticket
             // for positioning the qrcode
             $y = $pdf->GetY();
             // Title
             $pdf->SetFont('Times', 'B', 12);
             $pdf->Cell(130, 10, "{$tick_types[$ticket->tic_type]->description}: {$Ev->Detail->title}", 1, 0, 'C');
             $pdf->Ln(13);
             $pdf->SetFont('Times', '', 12);
             $pdf->SetX(-40);
             $pdf->Cell(0, 30, 'Fee: ' . $fee);
             if ($ticket->fee > 0) {
                 $pdf->Ln(5);
                 if ($ticket->paid >= $ticket->fee) {
                     $pdf->SetX(-40);
                     $pdf->Cell(0, 30, 'Paid');
                 } else {
                     $pdf->SetX(-55);
                     $due = $ticket->fee - $ticket->paid;
                     $pdf->Cell(0, 30, 'Balance Due: ' . self::formatAmount($due));
                 }
             }
             $pdf->SetX(20);
             $pdf->Cell(0, 8, "Date:", 0, 0);
             $pdf->setX(40);
             $pdf->Cell(0, 8, $ev_date, 0, 1);
             $pdf->Cell(0, 6, "Time:", 0, 0);
             $pdf->SetX(40);
             $pdf->Cell(0, 6, $ev_time, 0, 1);
             if ($Ev->Detail->location != '') {
                 $pdf->Ln(5);
                 $pdf->Cell(0, 2, 'Where: ', 0, 0);
                 $pdf->SetX(40);
                 $pdf->Cell(0, 2, $Ev->Detail->location, 0, 1);
             }
             if (!empty($address)) {
                 if ($Ev->Detail->location == '') {
                     $pdf->Ln(5);
                     $pdf->Cell(0, 2, 'Where: ', 0, 0);
                 }
                 $pdf->Ln(4);
                 $pdf->SetX(40);
                 $pdf->Cell(0, 2, $address, 0, 1);
             }
             // Footer
             $pdf->Ln(6);
             $pdf->setFont('Times', 'I', 10);
             $pdf->Cell(0, 10, $_CONF['site_name'], 0, 0);
             $pdf->Ln(6);
             $pdf->Cell(0, 10, $ticket->tic_id);
             // print qrcode if possible
             $params['data'] = $checkin_url . $tic_id . '&rp=' . $rp_id;
             $qrc_status = LGLIB_invokeService('qrcode', 'getcode', $params, $qrcode, $svc_msg);
             if ($qrc_status == PLG_RET_OK) {
                 $pdf->SetX(-40);
                 $pdf->Image($qrcode['path'], null, $y, 25);
             }
             $pdf->Ln();
             $y = $pdf->GetY();
             $pdf->Line(10, $y, 200, $y);
             $pdf->Ln();
         }
     }
     $pdf->Output();
 }
示例#13
0
$idtps = $baris['21'];
$idtpp = $baris['24'];
$nm_tpp = $baris['25'];
$idtypecode = $baris['26'];
$idmanifest = $baris['27'];
$kd_manifest = $baris['28'];
$idseksi = $baris['29'];
$nm_seksi = $baris['30'];
$nip = $baris['31'];
$plh = $baris['32'];
$jabatan = $baris['33'];
$pdf->SetFont('Arial', '', 9);
$pdf->text(250, 4, 'BCF 1.5');
$header1 = "Kementrian Keuangan Republik Indonesia\nDirektorat Jenderal Bea dan Cukai\nKantor Pelayanan Utama Tipe B Batam.";
$pdf->Line(10, 17, 83, 17);
$pdf->setX(10);
$pdf->MultiCell(70, 5, $header1, 1, 'C');
$pdf->Ln(3);
$header2 = "DAFTAR BARANG-BARANG IMPOR\nYANG DINYATAKAN SEBAGAI BARANG YANG\nTIDAK DIKUASAI";
$pdf->Line(10, 17, 83, 17);
$pdf->setX(100);
$pdf->MultiCell(100, 4, $header2, 0, 'C');
$pdf->Ln(5);
$pdf->cell(15, 5, 'Nomor :', 0, 0, 'L', 0);
$pdf->cell(11, 5, $bcf15no, 0, 0, 'L', 0);
$pdf->cell(20, 5, $kd_manifest, 0, 0, 'L', 0);
$pdf->Ln(5);
$pdf->cell(10, 20, 'No', 1, 0, 'C', 0);
$posisi_x = $pdf->GetX();
$pdf->cell(60, 10, 'BC 1.1', 1, 1, 'C', 0);
$pdf->setX($posisi_x);