<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class PDF extends PDF_MC_Table {

    public $judul;
    public $periode;
    public $profile = [];

    function Header()
    {
        if ($this->PageNo() == 1) {
            // Logo + Profile
            if ($this->profile) {
                $this->image(base_url('assets/img/logo.png'),12,10,26,21);
                $this->SetFont('Arial','B',10);
                $this->SetX(40);
                $this->Cell(0,6,$this->profile['nama'],0,1,'L');
                $this->SetX(40);
                $this->Cell(0,6,$this->profile['almt'],0,1,'L');
                $this->SetX(40);
                $this->Cell(0,6,$this->profile['notelp'],0,1,'L');
            }

            $this->Ln(3);
            $this->SetLineWidth(1);
            $this->Line(10,$this->GetY(),290,$this->GetY());
            $this->SetLineWidth(0);
            $this->Ln(3);

            // Judul laporan
            if ($this->judul) {
                $this->SetFont('Arial','B',12);
                $this->Cell(0,6,$this->judul,0,1,'C');
            }
            if ($this->periode) {
                $this->SetFont('Arial','B',9);
                $this->Cell(0,6,$this->periode,0,1,'C');
            }
            // $this->Ln();
        }
    }

    function Footer()
    {
        $this->SetY(-15);
        $this->SetFont('Arial','I',8);
        $this->Cell(0,10,'Halaman '.$this->PageNo().'/{nb}',0,0,'C');
    }
}
