 <?php
class Pdf extends PDF_MC_Table{

    public $height_p = 330;
    public $width_p = 210;
    public $height = 7;
	function __construct() {
		//set Page 
		parent::__construct('P','mm',array($this->width_p , $this->height_p ));
		/*$this->AddFont("tahoma","","tahoma.php");
		$this->AddFont("tahoma","B","tahomabd.php");*/
    }
	function Header(){
        
				
        $this->setFont('Arial','B',12);
        $this->setFillColor(255,255,255);

        if($this->data->is_cv == 1){
            $this->cell(0,$this->height,'CV. KETJUBUNG',0, 0,'L',1);
            $this->Ln();
        }
        
        $this->setFont('Arial','B',14);
        $this->cell(0,$this->height, 'TANDA KELUAR BARANG',0, 0,'C',1);
        $this->Ln(15);
				
	}
	
	function Content()
	{        
        $this->setFillColor(255,255,255);

        $y = $this->getY();
        $this->setFont('Arial','',10);

        $this->SetWidths(array($this->width_p*17/100, $this->width_p*2/100, $this->width_p*25/100, $this->width_p*19/100, $this->width_p*2/100, $this->width_p*25/100));
        $this->SetAligns(array('L', 'C', 'L', 'L','C', 'L'));
        $this->Row_noborder(array("NOMOR", ":", $this->data->no_faktur.$this->data->faktur, "NO. PERMINTAAN", ":", $this->data->nomor_minta), $this->height);
        $this->Row_noborder(array("TANGGAL", ":", tgl_full($this->data->tanggal, '0'), "TANGGAL", ":", tgl_full($this->data->tanggal_minta, '98')), $this->height);
        $this->Row_noborder(array("DIKELUARKAN", ":", $this->data->nama_gudang_awal, "UNTUK", ":", $this->data->nama_gudang_tujuan), $this->height);

        $this->Ln(10);
        $this->MultiCell(0 , $this->height-1, 'Dengan ini kami menyatakan bahwa kami telah mengeluarkan sejumlah barang dengan kondisi baik dengan jumlah dan deskripsi sebagai berikut :', 0, 'FJ');

        $this->setFont('arial','B',8);
        $this->SetWidths(array($this->width_p*5/100, $this->width_p*47/100, $this->width_p*10/100, $this->width_p*10/100, $this->width_p*19/100));
        $this->SetAligns(array('C', 'C', 'C', 'C','C'));
        $this->Row(array("NO", "KETERANGAN", "JUMLAH", "SATUAN", "CATATAN"));  

        $this->setFont('Arial','',8);
        $this->SetAligns(array('C', "L", "R", "L", "L"));
        
        $no = 1;
        $arr_non = array('22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33');
        if(count($this->detail) > 0){
            foreach ($this->detail as $k) {
                $ket = '';
                if($k->keterangan != ''){
                    $ket = ' - '.$k->keterangan;
                }
                $nama_barang = barang_byproses($k, 3);
            $this->Row(array($no, $nama_barang->concat_nama.$ket, format_angkav2($k->jumlah), $k->nama_satuan, ''));

            $no++;
            }
        }else{
            $this->Row(array("", "", "", "", "", ''));
        }

        
        $this->Ln(2);
        $y = $this->getY();

        $this->setFont('arial','', 10);
        $this->SetWidths(array($this->width_p*22/100, $this->width_p*22/100, $this->width_p*22/100, $this->width_p*22/100));
        $this->SetAligns(array('C', 'C', 'C', 'C'));
        $this->Row_noborder(array("Penerima :", "Keamanan :", "Mengetahui :", "Pengirim :"));

        $this->Ln(15);
        $this->SetWidths(array($this->width_p*22/100, $this->width_p*22/100, $this->width_p*22/100, $this->width_p*22/100));
        $this->SetAligns(array('C', 'C', 'C', 'C'));
        $this->Row_noborder(array("Nama", "Nama", "Nama", "Nama"));

	}
	
	function Footer()
	{
		$this->Ln();
        $this->SetY(-15);
        $this->SetFont('Arial','',10);
        $this->Cell(0,10, $this->PageNo(),0,0,'C');
	}
	
}
$Pdf = new Pdf();
$Pdf->data=$data['data'];
$Pdf->detail=$data['detail'];
$Pdf->SetAutoPageBreak(true ,15);

$Pdf->SetMargins(10,10,10);
$Pdf->AliasNbPages();
$Pdf->AddPage();
$Pdf->SetFont('Arial','',12);
$Pdf->Content();
$Pdf->SetTitle("Transfer Antar Gudang ".$data['data']->no_faktur.$data['data']->faktur);
$Pdf->Output("Transfer Antar Gudang ".$data['data']->no_faktur.$data['data']->faktur.".pdf", "I");
/*$Pdf->SetTitle("Bon Bahan - ".$data['data']->id_barangkeluar);
$Pdf->Output("Bon Bahan - ".$data['data']->id_barangkeluar.".pdf", "I");*/


?>