示例#1
0
 function line($x1, $y1, $x2, $y2)
 {
     FPDF::line($x1, $this->h - $y1, $x2, $this->h - $y2);
 }
while ($row = mysqli_fetch_assoc($sql)) {
    array_push($data, $row);
}
#setting judul laporan dan header tabel
$judul = "LAPORAN DATA PENJUALAN";
$header = array(array("label" => "No Polis", "length" => 15, "align" => "L"), array("label" => "Tgl Penjualan", "length" => 20, "align" => "L"), array("label" => "No Identitas", "length" => 30, "align" => "L"), array("label" => "Jumlah Premi", "length" => 20, "align" => "L"), array("label" => "Masa Asuransi(/thn)", "length" => 25, "align" => "L"), array("label" => "ID Agen", "length" => 15, "align" => "L"), array("label" => "Tipe", "length" => 15, "align" => "L"));
#sertakan library FPDF dan bentuk objek
ob_start();
require_once "fpdf16/fpdf.php";
$pdf = new FPDF();
$pdf->AddPage();
#tampilkan judul laporan
$pdf->SetMargins(35, 20, 20, 20);
$pdf->SetFont('Arial', 'B', '12');
$pdf->Cell(0, 20, $judul, '0', 1, 'C');
$pdf->line(31, 770, 565, 770);
#buat header tabel
$pdf->SetFont('Arial', 'B', '7');
$pdf->SetFillColor(255, 255, 255);
$pdf->SetTextColor(0);
$pdf->SetDrawColor(0, 0, 0);
foreach ($header as $kolom) {
    $pdf->Cell($kolom['length'], 5, $kolom['label'], 1, '0', $kolom['align'], true);
}
$pdf->Ln();
#tampilkan data tabelnya
$pdf->SetFillColor(224, 225, 255);
$pdf->SetTextColor(0);
$pdf->SetFont('');
$fill = false;
foreach ($data as $baris) {
示例#3
0
$db->_DEBUG = 1;
$pdf = new FPDF("L", 'mm', "A4");
$pdf->open();
$pdf->AddPage();
$fonte = 'times';
$pdf->SetLeftMargin(5);
$pdf->SetAutoPageBreak("on", 2);
$pdf->SetFont($fonte, "", 12);
$pdf->sety(15);
$pdf->SetFont($fonte, "b", 12);
$pdf->setx(5);
$pdf->ln();
$pdf->SetFont($fonte, "", 14);
$pdf->setx(5);
$pdf->cell(50, 5, "Controle de Entregas", 0, 1);
$pdf->line(5, $pdf->GetY(), 290, $pdf->GetY());
$pdf->ln(10);
$pdf->setfont($fonte, "B", "14");
$pdf->cell(0, 5, $_GET["dtvenda"], 0, 1, "C");
$pdf->setfillcolor(235);
$pdf->SetFont($fonte, "b", 10);
$total = $db->entregas["total"];
$sql = " SELECT fun_nome,count(*) as total\n         FROM   comandas inner join comandaentrega \n                on cet_comid = com_id\n                inner join funcionarios on fun_id = cet_funid\n         WHERE com_dtcomanda = '" . strformat($_GET["dtvenda"], "dten") . "' group by fun_nome order by fun_nome";
$rs = $db->executa($sql);
$pdf->cell(140, 5, "Funcionário", "B", 0, "C", 1);
$pdf->cell(45, 5, "Qtde", "B", 1, "C", 1);
$pdf->SetFont($fonte, "", 10);
while ($ln = $db->fetch_array($rs)) {
    if ($pdf->getY() >= $pdf->h - 15) {
        $pdf->addpage();
        $pdf->SetFont($fonte, "b", 10);
 $y_aqui = $y_aqui - 10;
 $pdf->SetXY(14, $y_aqui);
 $pdf->Cell(178, 5, "", "LR", 0, 'L');
 //if ($ExtDominio==True){
 $pdf->Ln();
 //}
 $pdf->SetX(14);
 $pdf->MultiCell(178, 5, $texto_Principal3, "LR", 'J');
 //Se agregan celdas para rellenar espacios en el margen
 if ($ExtDominio == False) {
     $pdf->Ln();
     $pdf->SetX(14);
     $pdf->MultiCell(178, 5, "Los gastos originados por el lanzamiento o toma de posesión del inmueble después de que se obtengan las órdenes judiciales correspondientes, serán cubiertos por El Prestador hasta la cantidad indicada en este contrato, en caso de que por las características del inmueble sea necesario cubrir un gasto mayor, El Prestatario acepta cubrir esa diferencia.", "LR", 'J');
     $pdf->SetXY(14, 234);
     $pdf->Cell(178, 10, "", "LRB", 0, 'L');
     $pdf->line(14, 212, 14, 224);
     $pdf->line(192, 212, 192, 224);
 } else {
     $pdf->SetXY(14, 230);
     $pdf->Cell(178, 5, "", "LRB", 0, 'L');
     //$pdf->line(15,238,14,242);
     if ($GJudiciales == true) {
         //            $pdf->SetXY(14,194);
         //            $pdf->Cell(178,5,"","LR",0,'L');
         //            $pdf->SetXY(14,254);
         //            $pdf->Cell(178,10,"","LR",0,'L');
     }
 }
 //Rellenos
 $pdf->SetXY(14, 30);
 $pdf->Cell(178, 10, "", "LR", 0, 'L');