<?php
class Pdf extends PDF_MC_Table{
    //Page header
    public $paper_w = 210, $paper_h = 297;
    function __construct() {
        //set Page 
        parent::__construct('L','mm',array($this->paper_w ,$this->paper_h));
        /*$this->AddFont("tahoma","","tahoma.php");
        $this->AddFont("tahoma","B","tahomabd.php");*/
    }

    function Header(){
        
        if($this->PageNo() != 0){       
                $this->setFont('Arial','',14);
                $this->setFillColor(255,255,255);
                $this->setTextColor(0,0,0);
                
                $this->cell(100, 5, $this->judul, 0, 0, "L");
                $this->Ln();

                $this->setFont('Arial','',12);
                $this->cell(20, 5, "Periode", 0, 0, "L");
                $this->cell(5, 5, ":", 0, 0, "L");
                $this->MultiCell(100, 5, $this->periode, "FJ");
                $this->Ln();
            }
    }
    
    function Content()
    {
        $this->SetWidths(array(
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100,
            $this->paper_h*5/100
        ));
        $this->SetAligns(array("C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C"));
        $this->setFont('Arial','B',11);
        $this->Row(array("No", "Tanggal", "Nama Karyawan", "Bagian", "Hari Normal", "Absen (Hari)", "Hari Kerja", "Upah Perhari", "Jml. Jam Lembur", "Upah Lembur/Jam", "Jml. Hari Lembur", "Upah Lembur/Hari", "Jml. Jam UM Lembur", "UM Lembur/Jam", "Jml. Hari UM Lembur", "UM Lembur/Hari", "Jml. Hari UM/Desa", "UM/Desa", "Jml. Hari UM/Kediri", "UM/Kediri", "Jml. Jam Keterlamtan", "Ptg. Keterlamtan", "Ptg. Kas Bon", "Upah Yg Diterima"), 7);
        // if ($row < 4) {
        //     if ($row == 1) {
        //         for ($i=1; $i < 3; $i++) { 
        //             $this->RowBorderCustom(array(
        //                 "",
        //                 "",
        //                 "",
        //                 ""
        //             ), 6, "LR");
        //         }
        //     } else if ($row == 2) {
        //         for ($i=1; $i < 2; $i++) { 
        //             $this->RowBorderCustom(array(
        //                 "",
        //                 "",
        //                 "",
        //                 ""
        //             ), 6, "LR");
        //         }
        //     } else if ($row == 3) {
        //         $this->RowBorderCustom(array(
        //                 "",
        //                 "",
        //                 "",
        //                 ""
        //             ), 6, "LR");
        //     }
        // }
    }
    
    function Footer()
    {
        $this->SetY(-15);
        $this->SetFont('Arial','',9);
        $this->Cell(0,10, $this->PageNo(),0,0,'C'); 
    }
}
$Pdf = new Pdf();
$Pdf->judul=$data['judul'];
$Pdf->periode=$data['periode'];

$Pdf->SetAutoPageBreak(true ,15);

$Pdf->SetMargins(10,10,10);
$Pdf->AliasNbPages();
$Pdf->AddPage();
$Pdf->SetFont('Arial','',12);
$Pdf->Content();
$Pdf->SetTitle($data['judul']);
$Pdf->Output($data['judul']." (".$data['periode'].")".".pdf", "I");

?>