<?php
class Pdf extends FPDF{
	//Page header
	//public $kas_masuk,$tgl1,$tgl2;
	function __construct() {
		//set Page 
		parent::__construct('L','mm',array(215 ,148 ));
		/*$this->AddFont("tahoma","","tahoma.php");
		$this->AddFont("tahoma","B","tahomabd.php");*/
    }
	function Header(){
        /*if($this->PageNo() == 1){
				$this->setFont('arial','',12);
                $this->setFillColor(255,255,255);
				
                $this->setFont('arial','B',12);
                $this->setFillColor(255,255,255);
                $this->cell(125,7,'PT. Wonojati Wijoyo',0,0,'L',1);
				$this->cell(156,7,'Laporan Kas / Bank Masuk',0,1,'R',1);
				
				$this->setFont('tahoma','B',10);
                $this->setFillColor(255,255,255);
                $this->cell(125,4,'',0,0,'L',1);
				$this->setFont('tahoma','',10);
                $this->setFillColor(255,255,255);
                $this->cell(156,4,"Tanggal : "/*.$this->tgl1." s.d ".$this->tgl2*//*,0,1,'R',1);
				
				$this->setFont('tahoma','B',10);
                $this->setFillColor(255,255,255);
                $this->cell(100,4,'',0,1,'L',1);
				$this->Ln(5);
        }   
				$this->setFont('Arial','B',9);
				$this->multicell(10,14,'No.',1,0,'C',1);
				$this->SetXY($this->GetX()+10,$this->GetY()-14);
				$this->cell(18,14,'Tanggal',1,0,'C',1);
				$this->cell(25,14,'No. Transaksi',1,0,'C',1);
				$this->cell(60,14,'Kas / Bank',1,0,'C',1);
				$this->cell(168,7,'Rincian Pemasukan',1,1,'C',1);
				$this->SetX($this->GetX()+113);
				$this->cell(65,7,'Nama Perkiraan',1,0,'C',1);
				$this->cell(73,7,'Keterangan',1,0,'C',1);
				$this->cell(30,7,'Jumlah (Rp)',1,1,'C',1);  */
				
				$this->setFont('arial','B',14);
                $this->setFillColor(255,255,255);
                $this->cell(10,125,'',1,0,'L',1);
				$this->cell(10,125,'',1,0,'R',1);
				$this->cell(1,125,'',1,0,'R',1);
				$this->setX($this->GetX());
				$this->cell(50,10,'',1,0,'R',1);
				$this->cell(75,10,'BUKTI KAS KELUAR',1,0,'C',1);
				$this->setFont('arial','B',10);
                $this->setFillColor(255,255,255);
				$this->cell(50,10,'    No. :',1,1,'L',1);
				$this->setX($this->GetX()+21);
				$this->cell(115,14,'',1,0,'L',1);
				$this->cell(60,7,'	Tanggal	:',1,1,'L',1);
				$this->setX($this->GetX()+136);
				$this->cell(60,7,'	Lampiran	:',1,1,'L',1);
				$this->setX($this->GetX()+21);
				$this->Line(31,$this->GetY(),205,$this->GetY());
				$this->cell(175,2,'',1,1,'R',1);
				$this->setX($this->GetX()+21);
				$this->cell(27.5,10,"Perkiraan",1,0,'C',1);
				$this->cell(107.5,10,"Uraian",1,0,'C',1);
				$this->cell(40,10,"Jumlah (Rp)",1,1,'C',1);
				$this->setXY($this->GetX(),$this->GetY());
	}
	
	function Content()
	{
			
	}
	
	function Footer()
	{
		/*$jumlah=0;
			foreach($this->kas_keluar as $key => $kas){
				$jumlah += $kas['jumlah'];
			}*/
		$this->setFont('arial','B',9);
        $this->setFillColor(255,255,255);
		$this->setXY($this->GetX()+21,$this->GetY());
		$this->cell(27.5,6,"",1,0,'C',1);
		$this->cell(107.5,6,"  Ch / G. B. No.                                                                       Jumlah ..........",1,0,'L',1);
		$this->cell(40,6,"",1,1,'R',1);
		$this->setFont('arial','BI',9);
        $this->setFillColor(255,255,255);
		$this->setX($this->GetX()+21);
		$this->cell(175,8,"      Terbilang :",1,1,'L',1);
		$this->setX($this->GetX()+21);
		$this->cell(175,1.5,"",1,1,'C',1);
		$this->setFont('arial','B',10);
        $this->setFillColor(255,255,255);
		$this->setX($this->GetX()+21);
		$this->cell(55,7,"Pembukuan",1,0,'C',1);
		$this->cell(30,7,"Mengetahui",1,0,'C',1);
		$this->cell(30,7,"Menyetujui",1,0,'C',1);
		$this->cell(30,7,"Kasir",1,0,'C',1);
		$this->cell(30,7,"Penyetor",1,1,'C',1);
		$this->setX($this->GetX()+21);
		$this->cell(27.5,18.5,"",1,0,'C',1);
		$this->cell(27.5,18.5,"",1,0,'C',1);
		$this->cell(30,18.5,"",1,0,'C',1);
		$this->cell(30,18.5,"",1,0,'C',1);
		$this->cell(30,18.5,"",1,0,'C',1);
		$this->cell(30,18.5,"",1,1,'C',1);
		//$this->Line(10,$this->GetY(),205,$this->GetY());
		//atur posisi 1.5 cm dari bawah
		/*$this->setFont('arial','B',9);
        $this->setFillColor(192,192,192);
		$this->setXY($this->GetX()+45,$this->GetY()-33);
		$this->cell(148,4,"",0,1,'L',1);
		$this->setFont('arial','B',9);
        $this->setFillColor(255,255,255);
		$this->setXY($this->GetX()+22,$this->GetY()-85);
		$this->cell(10,4,"Dibayarkan kepada :",0,1,'L',1);
		$this->setFont('arial','B',12);
        $this->setFillColor(255,255,255);
		$this->setXY($this->GetX()+55,$this->GetY());
		$this->cell(10,4,$this->kas_keluar_m['nama_perkiraan'],0,1,'L',1);
		$this->setFont('arial','',10);
        $this->setFillColor(255,255,255);
		$this->setXY($this->GetX()+160,$this->GetY()-16);
		$this->cell(10,4,$this->kas_keluar_m['no_trans'],0,1,'L',1);
		$this->setXY($this->GetX()+155,$this->GetY()+4.5);
		$this->cell(10,4,date_format(date_create($this->kas_keluar_m['tgl']),'d-m-Y'),0,1,'L',1);
		*/
		
		$this->SetY(-15);
		//buat garis horizontal
		
		//Arial italic 9
		$this->SetFont('Arial','B',9);
        $this->Cell(0,10,'',0,0,'L');
		//nomor halaman
		//$this->SetFont('tahoma','',9);
		//$this->Cell(0,10,'Halaman '.$this->PageNo().' dari {nb}',0,0,'R');
	}
	function MultiCells($w, $h, $txt, $border=0, $ln=0, $align='J', $fill=false)
{
    // Custom Tomaz Ahlin
    if($ln == 0) {
        $current_y = $this->GetY();
        $current_x = $this->GetX();
    }

    // Output text with automatic or explicit line breaks
    $cw = &$this->CurrentFont['cw'];
    if($w==0)
        $w = $this->w-$this->rMargin-$this->x;
    $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
    $s = str_replace("\r",'',$txt);
    $nb = strlen($s);
    if($nb>0 && $s[$nb-1]=="\n")
        $nb--;
    $b = 0;
    if($border)
    {
        if($border==1)
        {
            $border = 'LTRB';
            $b = 'LRT';
            $b2 = 'LR';
        }
        else
        {
            $b2 = '';
            if(strpos($border,'L')!==false)
                $b2 .= 'L';
            if(strpos($border,'R')!==false)
                $b2 .= 'R';
            $b = (strpos($border,'T')!==false) ? $b2.'T' : $b2;
        }
    }
    $sep = -1;
    $i = 0;
    $j = 0;
    $l = 0;
    $ns = 0;
    $nl = 1;
    while($i<$nb)
    {
        // Get next character
        $c = $s[$i];
        if($c=="\n")
        {
            // Explicit line break
            if($this->ws>0)
            {
                $this->ws = 0;
                $this->_out('0 Tw');
            }
            $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
            $i++;
            $sep = -1;
            $j = $i;
            $l = 0;
            $ns = 0;
            $nl++;
            if($border && $nl==2)
                $b = $b2;
            continue;
        }
        if($c==' ')
        {
            $sep = $i;
            $ls = $l;
            $ns++;
        }
        $l += $cw[$c];
        if($l>$wmax)
        {
            // Automatic line break
            if($sep==-1)
            {
                if($i==$j)
                    $i++;
                if($this->ws>0)
                {
                    $this->ws = 0;
                    $this->_out('0 Tw');
                }
                $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
            }
            else
            {
                if($align=='J')
                {
                    $this->ws = ($ns>1) ?     ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
                    $this->_out(sprintf('%.3F Tw',$this->ws*$this->k));
                }
                $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
                $i = $sep+1;
            }
            $sep = -1;
            $j = $i;
            $l = 0;
            $ns = 0;
            $nl++;
            if($border && $nl==2)
                $b = $b2;
        }
        else
            $i++;
    }
    // Last chunk
    if($this->ws>0)
    {
        $this->ws = 0;
        $this->_out('0 Tw');
    }
    if($border && strpos($border,'B')!==false)
        $b .= 'B';
    $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
    $this->x = $this->lMargin;

    // Custom Tomaz Ahlin
    if($ln == 0) {
        $this->SetXY($current_x + $w, $current_y);
    }
}
}
$Pdf = new Pdf();/*
$Pdf->kas_keluar=$kas_keluar;
$Pdf->kas_keluar_m=$kas_keluar_m;*/
$Pdf->SetAutoPageBreak(true ,15);

$Pdf->SetMargins(10,10,10);
$Pdf->AliasNbPages();
$Pdf->AddPage();
$Pdf->SetFont('Arial','',12);
$Pdf->Content();
$Pdf->Output("I");


?>