<?php

/*
 * *************************************************
 * Copyright (C) 2021 Earworks.                    *
 * Codeigniter Project Template Modification       *
 * Please contact our email for more information : *
 * contact@earworks.co.id                          *
 * *************************************************
 */

defined('BASEPATH') OR exit('No direct script access allowed');
require_once realpath(dirname(__DIR__) . '/third_party/fpdf/fpdf.php');

/**
 * Description of MY_PDF
 *
 * @author Andhy Taslin <andhy@earworks.co.id>
 * @since 1.0
 */
class MY_PDF extends FPDF {

    public $pt_name = null;

    public function __construct($orientation = 'P', $unit = 'pt', $format = 'Letter', $margin = 40) {
        parent::__construct($orientation, $unit, $format);
        $this->SetTopMargin($margin);
        $this->SetLeftMargin($margin);
        $this->SetRightMargin($margin);
        $this->SetAutoPageBreak(true, $margin);
    }

    function Header() {
        // fix header 1
        $this->SetFont('Arial', 'B', 12);
        $this->SetFillColor(255, 255, 255);
        $this->SetTextColor(0);
        $this->Cell(180, 1, "KOPERASI KARYAWAN", 0,0,'L');
        // PT NAME
        $this->SetFont('Arial', 'B', 12);
        $this->SetFillColor(255, 255, 255);
        $this->SetTextColor(0);
        $this->Cell(180,1,$this->pt_name,0,0,'C');
        $this->Ln(13);
        // fix header 2
        $this->SetFont('Arial', 'B', 12);
        $this->SetFillColor(255, 255, 255);
        $this->SetTextColor(0);
        $this->Cell(180, 1, "ALAMINDO KONSORSIUM", 0,0,'L');
        // fix header 3
        $this->SetFont('Arial', 'B', 12);
        $this->SetFillColor(255, 255, 255);
        $this->SetTextColor(0);
        $this->Cell(180,1,"PEMOTONGAN ATAS",0,0,'C');
        $this->Ln(13);
        // fix header 4
         $this->Cell(180, 1, "", 0,0,'L'); // blank left column
        $this->SetFont('Arial', 'B', 12);
        $this->SetFillColor(255, 255, 255);
        $this->SetTextColor(0);
        $this->Cell(180,1,"Pinjaman",0,0,'C');
        // date header
        $this->SetFont('Arial', 'B', 12);
        $this->SetFillColor(255, 255, 255);
        $this->SetTextColor(0);
        $this->Cell(180,1,"12/12/2020",0,0,'R');
         // Line break
    $this->Ln(20);
    }

//    function Footer() {
//        $this->SetFont('Arial', '', 12);
//        $this->SetTextColor(0);
//        $this->SetXY(0, -60);
//        $this->Cell(0, 20, "Thank you for shopping at Nettuts+!", 'T', 0, 'C');
//    }
}
