 <?php
class Pdf extends PDF_MC_Table{
	//Page header
	//public $kas_masuk,$tgl1,$tgl2;
    public $paper_w = 210, $paper_h = 330;
	function __construct() {
		//set Page 
		parent::__construct('L','mm',array($this->paper_w , $this->paper_h));
    }
	function Header(){
        
		if($this->PageNo() == 1){		
                $this->setFont('Arial','B',14);
                $this->setFillColor(0,0,0);
                $this->setTextColor(255,255,255);
                $this->cell($this->paper_h-20,7,'SURAT PERINTAH KERJA BOOM (SPK)',1,0,'C',1);
                $this->ln();
                $this->setFillColor(255,255,255);
                $this->setTextColor(0,0,0);
                $this->setFont('Arial','',10);
                $this->cell(270,6,'BNG KTG No. : '.$this->data->nama_barang,0,0,'L',1);
                $this->setXY($this->GetX(),$this->GetY());
                $this->cell(60,6,'Tanggal : '.tgl_full($this->data->tanggal,0),0,0,'L',1);
                $this->Ln(7);                                             

            }
				
	}
	
	function Content()
	{   
        $dasar = 0;
        $dasar2 = 0;
        $dasar3 = 0;
        $dasar4 = 0;
        $dasar5 = 0;
        $dasar6 = 0;
        $dasar7 = 0;
        $dasar8 = 0;
        $dasar9 = 0;
        $dasar10 = 0;
        $streep = 0;
        $kombinasi1 = 0;
        $kombinasi2 = 0;
        $kombinasi3 = 0;
        $kluwungan1 = 0;
        $kluwungan2 = 0;
        $kluwungan3 = 0;
        $kluwungan4 = 0;
        $timbulan1 = 0;
        $timbulan2 = 0;
        $timbulan3 = 0;
        $songketan1 = 0;
        $songketan2 = 0;
        $songketan3 = 0;
        $songketan4 = 0;
        $songketan5 = 0;
        $songketan6 = 0;
        $songketan7 = 0;
        $songketan8 = 0;
        $songketan9 = 0;
        $songketan10 = 0;
        $songketan11 = 0;
        $songketan12 = 0;
        $songketan13 = 0;
        $songketan14 = 0;
        $songketan15 = 0;
        $pancingan1 = 0;
        $pancingan2 = 0;
        $gunungan1_atas = 0;
        $gunungan2_atas = 0;
        $gunungan3_atas = 0;
        $gunungan1_bawah = 0;
        $gunungan2_bawah = 0;
        $gunungan3_bawah = 0;
        $garis1 = 0;
        $garis2 = 0;
        foreach($this->detail_barang as $d){
            $dasar += $d->dasar;
            $dasar2 += $d->dasar2;
            $dasar3 += $d->dasar3;
            $dasar4 += $d->dasar4;
            $dasar5 += $d->dasar5;
            $dasar6 += $d->dasar6;
            $dasar7 += $d->dasar7;
            $dasar8 += $d->dasar8;
            $dasar9 += $d->dasar9;
            $dasar10 += $d->dasar10;
            $streep += $d->streep;
            $kombinasi1 += $d->kombinasi1;
            $kombinasi2 += $d->kombinasi2;
            $kombinasi3 += $d->kombinasi3;
            $kluwungan1 += $d->kluwungan1;
            $kluwungan2 += $d->kluwungan2;
            $kluwungan3 += $d->kluwungan3;
            $kluwungan4 += $d->kluwungan4;
            $timbulan1 += $d->timbulan1;
            $timbulan2 += $d->timbulan2;
            $timbulan3 += $d->timbulan3;
            $songketan1 += $d->songketan1;
            $songketan2 += $d->songketan2;
            $songketan3 += $d->songketan3;
            $songketan4 += $d->songketan4;
            $songketan5 += $d->songketan5;
            $songketan6 += $d->songketan6;
            $songketan7 += $d->songketan7;
            $songketan8 += $d->songketan8;
            $songketan9 += $d->songketan9;
            $songketan10 += $d->songketan10;
            $songketan11 += $d->songketan11;
            $songketan12 += $d->songketan12;
            $songketan13 += $d->songketan13;
            $songketan14 += $d->songketan14;
            $songketan15 += $d->songketan15;
            $pancingan1 += $d->pancingan1;
            $pancingan2 += $d->pancingan2;
            $gunungan1_atas += $d->gunungan1_atas;
            $gunungan2_atas += $d->gunungan2_atas;
            $gunungan3_atas += $d->gunungan3_atas;
            $gunungan1_bawah += $d->gunungan1_bawah;
            $gunungan2_bawah += $d->gunungan2_bawah;
            $gunungan3_bawah += $d->gunungan3_bawah;
            $garis1 += $d->garis1;
            $garis2 += $d->garis2;
        }
        $d_dasar = 0;
        $d_dasar2 = 0;
        $d_dasar3 = 0;
        $d_dasar4 = 0;
        $d_dasar5 = 0;
        $d_dasar6 = 0;
        $d_dasar7 = 0;
        $d_dasar8 = 0;
        $d_dasar9 = 0;
        $d_dasar10 = 0;
        $d_streep = 0;
        $d_kombinasi1 = 0;
        $d_kombinasi2 = 0;
        $d_kombinasi3 = 0;
        $d_kluwungan1 = 0;
        $d_kluwungan2 = 0;
        $d_kluwungan3 = 0;
        $d_kluwungan4 = 0;
        $d_timbulan1 = 0;
        $d_timbulan2 = 0;
        $d_timbulan3 = 0;
        $d_songketan1 = 0;
        $d_songketan2 = 0;
        $d_songketan3 = 0;
        $d_songketan4 = 0;
        $d_songketan5 = 0;
        $d_songketan6 = 0;
        $d_songketan7 = 0;
        $d_songketan8 = 0;
        $d_songketan9 = 0;
        $d_songketan10 = 0;
        $d_songketan11 = 0;
        $d_songketan12 = 0;
        $d_songketan13 = 0;
        $d_songketan14 = 0;
        $d_songketan15 = 0;
        $d_pancingan1 = 0;
        $d_pancingan2 = 0;
        $d_gunungan1_atas = 0;
        $d_gunungan2_atas = 0;
        $d_gunungan3_atas = 0;
        $d_gunungan1_bawah = 0;
        $d_gunungan2_bawah = 0;
        $d_gunungan3_bawah = 0;
        $d_garis1 = 0;
        $d_garis2 = 0;
        if($dasar > 0){
            $d_dasar = 1;
        }
        if($dasar2 > 0){
            $d_dasar2 = 1;
        }
        if($dasar3 > 0){
            $d_dasar3 = 1;
        }
        if($dasar4 > 0){
            $d_dasar4 = 1;
        }
        if($dasar5 > 0){
            $d_dasar5 = 1;
        }
        if($dasar6 > 0){
            $d_dasar6 = 1;
        }
        if($dasar7 > 0){
            $d_dasar7 = 1;
        }
        if($dasar8 > 0){
            $d_dasar8 = 1;
        }
        if($dasar9 > 0){
            $d_dasar9 = 1;
        }
        if($dasar10 > 0){
            $d_dasar10 = 1;
        }
        if($streep > 0){
            $d_streep = 1;
        }
        if($kombinasi1 > 0){
            $d_kombinasi1 = 1;
        }
        if($kombinasi2 > 0){
            $d_kombinasi2 = 1;
        }
        if($kombinasi3 > 0){
            $d_kombinasi3 = 1;
        }
        if($kluwungan1 > 0){
            $d_kluwungan1 = 1;
        }
        if($kluwungan2 > 0){
            $d_kluwungan2 = 1;
        }
        if($kluwungan3 > 0){
            $d_kluwungan3 = 1;
        }
        if($kluwungan4 > 0){
            $d_kluwungan4 = 1;
        }
        if($timbulan1 > 0){
            $d_timbulan1 = 1;
        }
        if($timbulan2 > 0){
            $d_timbulan2 = 1;
        }
        if($timbulan3 > 0){
            $d_timbulan3 = 1;
        }
        if($songketan1 > 0){
            $d_songketan1 = 1;
        }
        if($songketan2 > 0){
            $d_songketan2 = 1;
        }
        if($songketan3 > 0){
            $d_songketan3 = 1;
        }
        if($songketan4 > 0){
            $d_songketan4 = 1;
        }
        if($songketan5 > 0){
            $d_songketan5 = 1;
        }
        if($songketan6 > 0){
            $d_songketan6 = 1;
        }
        if($songketan7 > 0){
            $d_songketan7 = 1;
        }
        if($songketan8 > 0){
            $d_songketan8 = 1;
        }
        if($songketan9 > 0){
            $d_songketan9 = 1;
        }
        if($songketan10 > 0){
            $d_songketan10 = 1;
        }
        if($songketan11 > 0){
            $d_songketan11 = 1;
        }
        if($songketan12 > 0){
            $d_songketan12 = 1;
        }
        if($songketan13 > 0){
            $d_songketan13 = 1;
        }
        if($songketan14 > 0){
            $d_songketan14 = 1;
        }
        if($songketan15 > 0){
            $d_songketan15 = 1;
        }
        if($pancingan1 > 0){
            $d_pancingan1 = 1;
        }
        if($pancingan2 > 0){
            $d_pancingan2 = 1;
        }
        if($gunungan1_atas > 0){
            $d_gunungan1_atas = 1;
        }
        if($gunungan2_atas > 0){
            $d_gunungan2_atas = 1;
        }
        if($gunungan3_atas > 0){
            $d_gunungan3_atas = 1;
        }
        if($gunungan1_bawah > 0){
            $d_gunungan1_bawah = 1;
        }
        if($gunungan2_bawah > 0){
            $d_gunungan2_bawah = 1;
        }
        if($gunungan3_bawah > 0){
            $d_gunungan3_bawah = 1;
        }
        if($garis1 > 0){
            $d_garis1 = 1;
        }
        if($garis2 > 0){
            $d_garis2 = 1;
        }

        $row_warna = ($d_dasar+$d_dasar2+$d_dasar3+$d_dasar4+$d_dasar5+$d_dasar6+$d_dasar7+$d_dasar8+$d_dasar9+$d_dasar10)*10;
        $row_streep = $d_streep*10;
        $row_kombinasi = ($d_kombinasi1+$d_kombinasi2+$d_kombinasi3)*10;
        $row_kluwungan = ($d_kluwungan1+$d_kluwungan2+$d_kluwungan3+$d_kluwungan4)*10;
        $row_timbulan = ($d_timbulan1+$d_timbulan2+$d_timbulan3)*10;
        $row_songketan = ($d_songketan1+$d_songketan2+$d_songketan3+$d_songketan4+$d_songketan5+$d_songketan6+$d_songketan7+$d_songketan8+$d_songketan9+$d_songketan10+$d_songketan11+$d_songketan12+$d_songketan13+$d_songketan14+$d_songketan15)*12;
        $row_pancingan = ($d_pancingan1+$d_pancingan2)*10;
        $row_gunungan_atas = ($d_gunungan1_atas+$d_gunungan2_atas+$d_gunungan3_atas)*13;
        $row_gunungan_bawah = ($d_gunungan1_bawah+$d_gunungan2_bawah+$d_gunungan3_bawah)*13;
        $row_garis = ($d_garis1+$d_garis2)*10;
        $row_total = $row_warna+$row_streep+$row_kombinasi+$row_kluwungan+$row_timbulan+$row_songketan+$row_pancingan+$row_gunungan_atas+$row_gunungan_bawah+$row_garis;
        $align_dasar = '';
        $align_dasar2 = '';
        $align_dasar3 = '';
        $align_dasar4 = '';
        $align_dasar5 = '';
        $align_dasar6 = '';
        $align_dasar7 = '';
        $align_dasar8 = '';
        $align_dasar9 = '';
        $align_dasar10 = '';
        $align_streep = '';
        $align_kombinasi1 = '';
        $align_kombinasi2 = '';
        $align_kombinasi3 = '';
        $align_kluwungan1 = '';
        $align_kluwungan2 = '';
        $align_kluwungan3 = '';
        $align_kluwungan4 = '';
        $align_timbulan1 = '';
        $align_timbulan2 = '';
        $align_timbulan3 = '';
        $align_songketan1 = '';
        $align_songketan2 = '';
        $align_songketan3 = '';
        $align_songketan4 = '';
        $align_songketan5 = '';
        $align_songketan6 = '';
        $align_songketan7 = '';
        $align_songketan8 = '';
        $align_songketan9 = '';
        $align_songketan10 = '';
        $align_songketan11 = '';
        $align_songketan12 = '';
        $align_songketan13 = '';
        $align_songketan14 = '';
        $align_songketan15 = '';
        $align_pancingan1 = '';
        $align_pancingan2 = '';
        $align_gunungan1_atas = '';
        $align_gunungan2_atas = '';
        $align_gunungan3_atas = '';
        $align_gunungan1_bawah = '';
        $align_gunungan2_bawah = '';
        $align_gunungan3_bawah = '';
        $align_garis1 = '';
        $align_garis2 = '';
        $r_dasar = '';
        $r_dasar2 = '';
        $r_dasar3 = '';
        $r_dasar4 = '';
        $r_dasar5 = '';
        $r_dasar6 = '';
        $r_dasar7 = '';
        $r_dasar8 = '';
        $r_dasar9 = '';
        $r_dasar10 = '';
        $r_streep = '';
        $r_kombinasi1 = '';
        $r_kombinasi2 = '';
        $r_kombinasi3 = '';
        $r_kluwungan1 = '';
        $r_kluwungan2 = '';
        $r_kluwungan3 = '';
        $r_kluwungan4 = '';
        $r_timbulan1 = '';
        $r_timbulan2 = '';
        $r_timbulan3 = '';
        $r_songketan1 = '';
        $r_songketan2 = '';
        $r_songketan3 = '';
        $r_songketan4 = '';
        $r_songketan5 = '';
        $r_songketan6 = '';
        $r_songketan7 = '';
        $r_songketan8 = '';
        $r_songketan9 = '';
        $r_songketan10 = '';
        $r_songketan11 = '';
        $r_songketan12 = '';
        $r_songketan13 = '';
        $r_songketan14 = '';
        $r_songketan15 = '';
        $r_pancingan1 = '';
        $r_pancingan2 = '';
        $r_gunungan1_atas = '';
        $r_gunungan2_atas = '';
        $r_gunungan3_atas = '';
        $r_gunungan1_bawah = '';
        $r_gunungan2_bawah = '';
        $r_gunungan3_bawah = '';
        $r_garis1 = '';
        $r_garis2 = '';
        $widt_dasar = 0;
        $widt_dasar2 = 0;
        $widt_dasar3 = 0;
        $widt_dasar4 = 0;
        $widt_dasar5 = 0;
        $widt_dasar6 = 0;
        $widt_dasar7 = 0;
        $widt_dasar8 = 0;
        $widt_dasar9 = 0;
        $widt_dasar10 = 0;
        $widt_streep = 0;
        $widt_kombinasi1 = 0;
        $widt_kombinasi2 = 0;
        $widt_kombinasi3 = 0;
        $widt_kluwungan1 = 0;
        $widt_kluwungan2 = 0;
        $widt_kluwungan3 = 0;
        $widt_kluwungan4 = 0;
        $widt_timbulan1 = 0;
        $widt_timbulan2 = 0;
        $widt_timbulan3 = 0;
        $widt_songketan1 = 0;
        $widt_songketan2 = 0;
        $widt_songketan3 = 0;
        $widt_songketan4 = 0;
        $widt_songketan5 = 0;
        $widt_songketan6 = 0;
        $widt_songketan7 = 0;
        $widt_songketan8 = 0;
        $widt_songketan9 = 0;
        $widt_songketan10 = 0;
        $widt_songketan11 = 0;
        $widt_songketan12 = 0;
        $widt_songketan13 = 0;
        $widt_songketan14 = 0;
        $widt_songketan15 = 0;
        $widt_pancingan1 = 0;
        $widt_pancingan2 = 0;
        $widt_gunungan1_atas = 0;
        $widt_gunungan2_atas = 0;
        $widt_gunungan3_atas = 0;
        $widt_gunungan1_bawah = 0;
        $widt_gunungan2_bawah = 0;
        $widt_gunungan3_bawah = 0;
        $widt_garis1 = 0;
        $widt_garis2 = 0;
        $jum_warna = $d_dasar+$d_dasar2+$d_dasar3+$d_dasar4+$d_dasar5+$d_dasar6+$d_dasar7+$d_dasar8+$d_dasar9+$d_dasar10;
        $jum_streep = $d_streep;
        $jum_kombinasi = $d_kombinasi1+$d_kombinasi2+$d_kombinasi3;
        $jum_kluwungan = $d_kluwungan1+$d_kluwungan2+$d_kluwungan3+$d_kluwungan4;
        $jum_timbulan = $d_timbulan1+$d_timbulan2+$d_timbulan3;
        $jum_songketan = $d_songketan1+$d_songketan2+$d_songketan3+$d_songketan4+$d_songketan5+$d_songketan6+$d_songketan7+$d_songketan8+$d_songketan9+$d_songketan10+$d_songketan11+$d_songketan12+$d_songketan13+$d_songketan14+$d_songketan15;
        $jum_pancingan = $d_pancingan1+$d_pancingan2;
        $jum_gunungan_atas = $d_gunungan1_atas+$d_gunungan2_atas+$d_gunungan3_atas;
        $jum_gunungan_bawah = $d_gunungan1_bawah+$d_gunungan2_bawah+$d_gunungan3_bawah;
        $jum_garis = $d_garis1+$d_garis2;
        $jum_total = $jum_warna+$jum_streep+$jum_kombinasi+$jum_kluwungan+$jum_timbulan+$jum_songketan+$jum_pancingan+$jum_gunungan_atas+$jum_gunungan_bawah+$jum_garis;
        $j_warna = 0;
        $j_streep = 0;
        $j_kombinasi = 0;
        $j_kluwungan = 0;
        $j_timbulan = 0;
        $j_songketan = 0;
        $j_pancingan = 0;
        $j_gunungan_atas = 0;
        $j_gunungan_bawah = 0;
        $j_garis = 0;
        if($jum_warna > 0){
            $j_warna = 1;
        }
        if($jum_streep > 0){
            $j_streep = 1;
        }
        if($jum_kombinasi > 0){
            $j_kombinasi = 1;
        }
        if($jum_kluwungan > 0){
            $j_kluwungan = 1;
        }
        if($jum_timbulan > 0){
            $j_timbulan = 1;
        }
        if($jum_songketan > 0){
            $j_songketan = 1;
        }
        if($jum_pancingan > 0){
            $j_pancingan = 1;
        }
        if($jum_gunungan_atas > 0){
            $j_gunungan_atas = 1;
        }
        if($jum_gunungan_bawah > 0){
            $j_gunungan_bawah = 1;
        }
        if($jum_garis > 0){
            $j_garis = 1;
        }
        $j_total = $j_warna+$j_streep+$j_kombinasi+$j_kluwungan+$j_timbulan+$j_songketan+$j_pancingan+$j_gunungan_atas+$j_gunungan_bawah+$j_garis;
        $jml_row = 115+$row_total;
        $sisa = 0;
        $pembagian = 0;
        $pembagian2 = 0;
        $j_margin = 0;
        if($jml_row < 330){
        $sisa = $this->paper_h-(115+$row_total+20);
        $pembagian = round($sisa/$jum_total,1);
        $pembagian2 = round($row_total/$sisa,1);
        $j_margin = round(15/$jum_total,1);
        $margin_warna = round($j_margin*$jum_warna,1);
        $margin_streep = round($j_margin*$jum_streep,1); 
        $margin_kombinasi = round($j_margin*$jum_kombinasi,1);
        $margin_kluwungan = round($j_margin*$jum_kluwungan,1);
        $margin_timbulan = round($j_margin*$jum_timbulan,1);
        $margin_songketan = round($j_margin*$jum_songketan,1);
        $margin_pancingan = round($j_margin*$jum_pancingan,1);
        $margin_gng_atas = round($j_margin*$jum_gunungan_atas,1);
        $margin_gng_bawah = round($j_margin*$jum_gunungan_bawah,1);
        $margin_garis = round($j_margin*$jum_garis,1);
        $total_margin = $margin_warna+$margin_songketan+$margin_gng_atas+$margin_garis;
        }

        $this->setFont('arial','B',10);
        $this->setFillColor(255,255,255);
        $this->setTextColor(0,0,0);
        $this->setlinewidth(0.4);
        $this->cell(10,14,"No.",1,0,"C",1);              
        $this->cell(15,14,"Motif",1,0,"C",1);
        $this->cell(30,14,"No.Order",1,0,"C",1);
        $this->multicell(15,7,"Tgl Celup",1,"C",false);
        $this->setXY($this->GetX()+70,$this->GetY()-14);
        $this->cell(15,14,"HB",1,0,"C",1);
        $this->multicell(15,7,"Jml BOOM",1,"C",false);
        $this->setXY($this->GetX()+100,$this->GetY()-14);
        if($row_warna > 0){
        $this->cell(($row_warna+($pembagian*$jum_warna)-$margin_warna),7,"Warna",1,0,"C",1);
        }
        if($row_streep > 0){
        $this->cell(($row_streep+($pembagian*$jum_streep)-$margin_streep),7,"Streep",1,0,"C",1);
        }
        if($row_kombinasi > 0){
        $this->cell(($row_kombinasi+($pembagian*$jum_kombinasi)-$margin_kombinasi),7,"Kombinasi",1,0,"C",1);
        }
        if($row_kluwungan > 0){
        $this->cell(($row_kluwungan+($pembagian*$jum_kluwungan)-$margin_kluwungan),7,"Kluwungan",1,0,"C",1);
        }
        if($row_timbulan > 0){
        $this->cell(($row_timbulan+($pembagian*$jum_timbulan)-$margin_timbulan),7,"Timbulan",1,0,"C",1);
        }
        if($row_songketan > 0){
        $this->cell(($row_songketan+($pembagian*$jum_songketan)-$margin_songketan),7,"Songketan",1,0,"C",1);
        }
        if($row_pancingan > 0){
        $this->cell(($row_pancingan+($pembagian*$jum_pancingan)-$margin_pancingan),7,"Pancingan",1,0,"C",1);
        }
        if($row_gunungan_atas > 0){
        $this->cell(($row_gunungan_atas+($pembagian*$jum_gunungan_atas)-$margin_gng_atas),7,"Gunungan Atas",1,0,"C",1);
        }
        if($row_gunungan_bawah > 0){
        $this->cell(($row_gunungan_bawah+($pembagian*$jum_gunungan_bawah)-$margin_gng_bawah),7,"Gunungan Bawah",1,0,"C",1);
        }
        if($row_garis > 0){
        $this->cell(($row_garis+($pembagian*$jum_garis)-$margin_garis),7,"Garis",1,0,"C",1);
        }
        $this->cell(30,7,"Tgl Setor",1,0,"C",1);
        $this->Ln();
        $this->setX($this->GetX()+100);
        $this->setFont('arial','B',8);
        if($d_dasar==1){
        $this->Cell(10+$pembagian-$j_margin,7,"DSR 1",1,0,"C",1);
        $widt_dasar = $d_dasar*(10+$pembagian-$j_margin);
        }
        if($d_dasar2==1){
        $this->Cell(10+$pembagian-$j_margin,7,"DSR 2",1,0,"C",1);
        $widt_dasar2 = $d_dasar2*(10+$pembagian-$j_margin);
        }
        if($d_dasar3==1){
        $this->Cell(10+$pembagian/$jum_warna,7,"DSR 3",1,0,"C",1);
        $widt_dasar3 = $d_dasar3*(10+$pembagian-$j_margin);
        }
        if($d_dasar4==1){
        $this->Cell(10+$pembagian-$j_margin,7,"DSR 4",1,0,"C",1);
        $widt_dasar4 = $d_dasar4*(10+$pembagian-$j_margin);
        }
        if($d_dasar5==1){
        $this->Cell(10+$pembagian-$j_margin,7,"DSR 5",1,0,"C",1);
        $widt_dasar5 = $d_dasar5*(10+$pembagian-$j_margin);
        }
        if($d_dasar6==1){
        $this->Cell(10+$pembagian-$j_margin,7,"DSR 6",1,0,"C",1);
        $widt_dasar6 = $d_dasar6*(10+$pembagian-$j_margin);
        }
        if($d_dasar7==1){
        $this->Cell(10+$pembagian-$j_margin,7,"DSR 7",1,0,"C",1);
        $widt_dasar7 = $d_dasar7*(10+$pembagian-$j_margin);
        }
        if($d_dasar8==1){
        $this->Cell(10+$pembagian-$j_margin,7,"DSR 8",1,0,"C",1);
        $widt_dasar8 = $d_dasar8*(10+$pembagian-$j_margin);
        }
        if($d_dasar9==1){
        $this->Cell(10+$pembagian-$j_margin,7,"DSR 9",1,0,"C",1);
        $widt_dasar9 = $d_dasar9*(10+$pembagian-$j_margin);
        }
        if($d_dasar10==1){
        $this->Cell(10+$pembagian-$j_margin,7,"DSR 10",1,0,"C",1);
        $widt_dasar10 = $d_dasar10*(10+$pembagian-$j_margin);
        }
        if($d_streep==1){
        $this->Cell(10+$pembagian-$j_margin,7,"STR",1,0,"C",1);
        $widt_streep = $d_streep*(10+$pembagian-$j_margin);
        }
        if($d_kombinasi1==1){
        $this->Cell(10+$pembagian-$j_margin,7,"WRN 1",1,0,"C",1);
        $widt_kombinasi1 = $d_kombinasi1*(10+$pembagian-$j_margin);
        }
        if($d_kombinasi2==1){
        $this->Cell(10+$pembagian-$j_margin,7,"WRN 2",1,0,"C",1);
        $widt_kombinasi2 = $d_kombinasi2*(10+$pembagian-$j_margin);
        }
        if($d_kombinasi3==1){
        $this->Cell(10+$pembagian-$j_margin,7,"WRN 3",1,0,"C",1);
        $widt_kombinasi3 = $d_kombinasi3*(10+$pembagian-$j_margin);
        }
        if($d_kluwungan1==1){
        $this->Cell(10+$pembagian-$j_margin,7,"KLW 1",1,0,"C",1);
        $widt_kluwungan1 = $d_kluwungan1*(10+$pembagian-$j_margin);
        }
        if($d_kluwungan2==1){
        $this->Cell(10+$pembagian-$j_margin,7,"KLW 2",1,0,"C",1);
        $widt_kluwungan2 = $d_kluwungan2*(10+$pembagian-$j_margin);
        }
        if($d_kluwungan3==1){
        $this->Cell(10+$pembagian-$j_margin,7,"KLW 3",1,0,"C",1);
        $widt_kluwungan3 = $d_kluwungan3*(10+$pembagian-$j_margin);
        }
        if($d_kluwungan4==1){
        $this->Cell(10+$pembagian-$j_margin,7,"KLW 4",1,0,"C",1);
        $widt_kluwungan4 = $d_kluwungan4*(10+$pembagian-$j_margin);
        }
        if($d_timbulan1==1){
        $this->Cell(10+$pembagian-$j_margin,7,"TMB 1",1,0,"C",1);
        $widt_timbulan1 = $d_timbulan1*(10+$pembagian-$j_margin);
        }
        if($d_timbulan2==1){
        $this->Cell(10+$pembagian-$j_margin,7,"TMB 2",1,0,"C",1);
        $widt_timbulan2 = $d_timbulan2*(10+$pembagian-$j_margin);
        }
        if($d_timbulan3==1){
        $this->Cell(10+$pembagian-$j_margin,7,"TMB 3",1,0,"C",1);
        $widt_timbulan3 = $d_timbulan3*(10+$pembagian-$j_margin);
        }
        if($d_songketan1==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 1",1,0,"C",1);
        $widt_songketan1 = $d_songketan1*(12+$pembagian-$j_margin);
        }
        if($d_songketan2==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 2",1,0,"C",1);
        $widt_songketan2 = $d_songketan2*(12+$pembagian-$j_margin);
        }
        if($d_songketan3==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 3",1,0,"C",1);
        $widt_songketan3 = $d_songketan3*(12+$pembagian-$j_margin);
        }
        if($d_songketan4==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 4",1,0,"C",1);
        $widt_songketan4 = $d_songketan4*(12+$pembagian-$j_margin);
        }
        if($d_songketan5==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 5",1,0,"C",1);
        $widt_songketan5 = $d_songketan5*(12+$pembagian-$j_margin);
        }
        if($d_songketan6==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 6",1,0,"C",1);
        $widt_songketan6 = $d_songketan6*(12+$pembagian-$j_margin);
        }
        if($d_songketan7==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 7",1,0,"C",1);
        }
        if($d_songketan8==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 8",1,0,"C",1);
        $widt_songketan8 = $d_songketan8*(12+$pembagian-$j_margin);
        }
        if($d_songketan9==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 9",1,0,"C",1);
        $widt_songketan9 = $d_songketan9*(12+$pembagian-$j_margin);
        }
        if($d_songketan10==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 10",1,0,"C",1);
        $widt_songketan10 = $d_songketan10*(12+$pembagian-$j_margin);
        }
        if($d_songketan11==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 11",1,0,"C",1);
        $widt_songketan11 = $d_songketan11*(12+$pembagian-$j_margin);
        }
        if($d_songketan12==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 12",1,0,"C",1);
        $widt_songketan12 = $d_songketan12*(12+$pembagian-$j_margin);
        }
        if($d_songketan13==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 13",1,0,"C",1);
        $widt_songketan13 = $d_songketan13*(12+$pembagian-$j_margin);
        }
        if($d_songketan14==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 14",1,0,"C",1);
        $widt_songketan14 = $d_songketan14*(12+$pembagian-$j_margin);
        }
        if($d_songketan15==1){
        $this->Cell(12+$pembagian-$j_margin,7,"SNGT 15",1,0,"C",1);
        $widt_songketan15 = $d_songketan15*(12+$pembagian-$j_margin);
        }
        if($d_pancingan1==1){
        $this->Cell(10+$pembagian-$j_margin,7,"PCN 1",1,0,"C",1);
        $widt_pancingan1 = $d_pancingan1*(10+$pembagian-$j_margin);
        }
        if($d_pancingan2==1){
        $this->Cell(10+$pembagian-$j_margin,7,"PCN 2",1,0,"C",1);
        $widt_pancingan2 = $d_pancingan2*(10+$pembagian-$j_margin);
        }
        if($d_gunungan1_atas==1){
        $this->Cell(13+$pembagian-$j_margin,7,"G.ATAS 1",1,0,"C",1);
        $widt_gunungan1_atas = $d_gunungan1_atas*(13+$pembagian-$j_margin);
        }
        if($d_gunungan2_atas==1){
        $this->Cell(13+$pembagian-$j_margin,7,"G.ATAS 2",1,0,"C",1);
        $widt_gunungan2_atas = $d_gunungan2_atas*(13+$pembagian-$j_margin);
        }
        if($d_gunungan3_atas==1){
        $this->Cell(13+$pembagian-$j_margin,7,"G.ATAS 3",1,0,"C",1);
        $widt_gunungan3_atas = $d_gunungan3_atas*(13+$pembagian-$j_margin);
        }
        if($d_gunungan1_bawah==1){
        $this->Cell(13+$pembagian-$j_margin,7,"G.BWH 1",1,0,"C",1);
        $widt_gunungan1_bawah = $d_gunungan1_bawah*(13+$pembagian-$j_margin);
        }
        if($d_gunungan2_bawah==1){
        $this->Cell(13+$pembagian-$j_margin,7,"G.BWH 2",1,0,"C",1);
        $widt_gunungan2_bawah = $d_gunungan2_bawah*(13+$pembagian-$j_margin);
        }
        if($d_gunungan3_bawah==1){
        $this->Cell(13+$pembagian-$j_margin,7,"G.BWH 3",1,0,"C",1);
        $widt_gunungan3_bawah = $d_gunungan3_bawah*(13+$pembagian-$j_margin);
        }
        if($d_garis1==1){
        $this->Cell(10+$pembagian-$j_margin,7,"GRS 1",1,0,"C",1);
        $widt_garis1 = $d_garis1*(10+$pembagian-$j_margin);
        }
        if($d_garis2==1){
        $this->Cell(10+$pembagian-$j_margin,7,"GRS 2",1,0,"C",1);
        $widt_garis2 = $d_garis2*(10+$pembagian-$j_margin);
        }
        $this->Cell(15,7,"BOOM",1,0,"C",1);
        $this->Cell(15,7,"PAKAN",1,1,"C",1);

        $this->setFont('Arial','',10);
       /* $this->SetWidths(array(10, 15, 30, 15, 15, 15,$widt_dasar,$widt_dasar2,$widt_dasar3,$widt_dasar4,$widt_dasar5,$widt_dasar6,$widt_dasar7,$widt_dasar8,$widt_dasar9,$widt_dasar10,$widt_streep,$widt_kombinasi1*10,$widt_kombinasi2*10,$widt_kombinasi3*10,$widt_kluwungan1*10,$widt_kluwungan2*10,$widt_kluwungan3*10,$widt_kluwungan4*10,$widt_timbulan1*10,$widt_timbulan2*10,$widt_timbulan3*10,$widt_songketan1*12,$widt_songketan2*12,$widt_songketan3*12,$widt_songketan4*12,$widt_songketan5*12,$widt_songketan6*12,$widt_songketan7*12,$widt_songketan8*12,$widt_songketan9*12,$widt_songketan10*12,$widt_songketan11*12,$widt_songketan12*12,$widt_songketan13*12,$widt_songketan14*12,$widt_songketan15*12,$widt_pancingan1*10,$widt_pancingan2*10,$widt_gunungan1_atas*13,$widt_gunungan2_atas*13,$widt_gunungan3_atas*13,$widt_gunungan1_bawah*13,$widt_gunungan2_bawah*13,$widt_gunungan3_bawah*13,$widt_garis1*10,$widt_garis2*10,15, 15));*/
         $this->SetWidths(array(10, 15, 30, 15, 15, 15,$widt_dasar,$widt_dasar2,$widt_dasar3,$widt_dasar4,$widt_dasar5,$widt_dasar6,$widt_dasar7,$widt_dasar8,$widt_dasar9,$widt_dasar10,$widt_streep,$widt_kombinasi1,$widt_kombinasi2,$widt_kombinasi3,$widt_kluwungan1,$widt_kluwungan2,$widt_kluwungan3,$widt_kluwungan4,$widt_timbulan1,$widt_timbulan2,$widt_timbulan3,$widt_songketan1,$widt_songketan2,$widt_songketan3,$widt_songketan4,$widt_songketan5,$widt_songketan6,$widt_songketan7,$widt_songketan8,$widt_songketan9,$widt_songketan10,$widt_songketan11,$widt_songketan12,$widt_songketan13,$widt_songketan14,$widt_songketan15,$widt_pancingan1,$widt_pancingan2,$widt_gunungan1_atas,$widt_gunungan2_atas,$widt_gunungan3_atas,$widt_gunungan1_bawah,$widt_gunungan2_bawah,$widt_gunungan3_bawah,$widt_garis1,$widt_garis2,15, 15));
        $this->SetAligns(array("C", "C", "L", "C", "C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","C","L","L"));
        $data_dasar = '';
        $data_dasar2 = '';
        $data_dasar3 = '';
        $data_dasar4 = '';
        $data_dasar5 = '';
        $data_dasar6 = '';
        $data_dasar7 = '';
        $data_dasar8 = '';
        $data_dasar9 = '';
        $data_dasar10 = '';
        $data_streep = '';
        $data_kombinasi1 = '';
        $data_kombinasi2 = '';
        $data_kombinasi3 = '';
        $data_kluwungan1 = '';
        $data_kluwungan2 = '';
        $data_kluwungan3 = '';
        $data_kluwungan4 = '';
        $data_timbulan1 = '';
        $data_timbulan2 = '';
        $data_timbulan3 = '';
        $data_songketan1 = '';
        $data_songketan2 = '';
        $data_songketan3 = '';
        $data_songketan4 = '';
        $data_songketan5 = '';
        $data_songketan6 = '';
        $data_songketan7 = '';
        $data_songketan8 = '';
        $data_songketan9 = '';
        $data_songketan10 = '';
        $data_songketan11 = '';
        $data_songketan12 = '';
        $data_songketan13 = '';
        $data_songketan14 = '';
        $data_songketan15 = '';
        $data_pancingan1 = '';
        $data_pancingan2 = '';
        $data_gunungan1_atas = '';
        $data_gunungan2_atas = '';
        $data_gunungan3_atas = '';
        $data_gunungan1_bawah = '';
        $data_gunungan2_bawah = '';
        $data_gunungan3_bawah = '';
        $data_garis1 = '';
        $data_garis2 = '';
        if($d_dasar==1){
        $data_dasar =   $this->data->dasar_jumlah." ".$this->data->nama_dasar_satuan;
        }
        if($d_dasar2==1){
        $data_dasar2 =  $this->data->dasar2_jumlah." ".$this->data->nama_dasar2_satuan;
        }
        if($d_dasar3==1){
        $data_dasar3 =  $this->data->dasar3_jumlah." ".$this->data->nama_dasar3_satuan;
        }
        if($d_dasar4==1){
        $data_dasar4 =  $this->data->dasar4_jumlah." ".$this->data->nama_dasar4_satuan;
        }
        if($d_dasar5==1){
        $data_dasar5 =  $this->data->dasar5_jumlah." ".$this->data->nama_dasar5_satuan;
        }
        if($d_dasar6==1){
        $data_dasar6 =  $this->data->dasar6_jumlah." ".$this->data->nama_dasar6_satuan;
        }
        if($d_dasar7==1){
        $data_dasar7 =  $this->data->dasar7_jumlah." ".$this->data->nama_dasar7_satuan;
        }
        if($d_dasar8==1){
        $data_dasar8 =  $this->data->dasar8_jumlah." ".$this->data->nama_dasar8_satuan;
        }
        if($d_dasar9==1){
        $data_dasar9 =  $this->data->dasar9_jumlah." ".$this->data->nama_dasar9_satuan;
        }
        if($d_dasar10==1){
        $data_dasar10 = $this->data->dasar10_jumlah." ".$this->data->nama_dasar10_satuan;
        }
        if($d_streep==1){
        $data_streep =  $this->data->streep_jumlah." ".$this->data->nama_streep_satuan;
        }
        if($d_kombinasi1==1){
        $data_kombinasi1 =  $this->data->kombinasi1_jumlah." ".$this->data->nama_kombinasi1_satuan;
        }
        if($d_kombinasi2==1){
        $data_kombinasi2 =  $this->data->kombinasi2_jumlah." ".$this->data->nama_kombinasi2_satuan;
        }
        if($d_kombinasi3==1){
        $data_kombinasi3 =  $this->data->kombinasi3_jumlah." ".$this->data->nama_kombinasi3_satuan;
        }
        if($d_kluwungan1==1){
        $data_kluwungan1 =  $this->data->kluwungan1_jumlah." ".$this->data->nama_kluwungan1_satuan;
        }
        if($d_kluwungan2==1){
        $data_kluwungan2 =  $this->data->kluwungan2_jumlah." ".$this->data->nama_kluwungan2_satuan;
        }
        if($d_kluwungan3==1){
        $data_kluwungan3 =  $this->data->kluwungan3_jumlah." ".$this->data->nama_kluwungan3_satuan;
        }
        if($d_kluwungan4==1){
        $data_kluwungan4 =  $this->data->kluwungan4_jumlah." ".$this->data->nama_kluwungan4_satuan;
        }
        if($d_timbulan1==1){
        $data_timbulan1 =   $this->data->timbulan1_jumlah." ".$this->data->nama_timbulan1_satuan;
        }
        if($d_timbulan2==1){
        $data_timbulan2 =   $this->data->timbulan2_jumlah." ".$this->data->nama_timbulan2_satuan;
        }
        if($d_timbulan3==1){
        $data_timbulan3 =   $this->data->timbulan3_jumlah." ".$this->data->nama_timbulan3_satuan;
        }
        if($d_songketan1==1){
        $data_songketan1 =  $this->data->songketan1_jumlah." ".$this->data->nama_songketan1_satuan;
        }
        if($d_songketan2==1){
        $data_songketan2 =  $this->data->songketan2_jumlah." ".$this->data->nama_songketan2_satuan;
        }
        if($d_songketan3==1){
        $data_songketan3 =  $this->data->songketan3_jumlah." ".$this->data->nama_songketan3_satuan;
        }
        if($d_songketan4==1){
        $data_songketan4 =  $this->data->songketan4_jumlah." ".$this->data->nama_songketan4_satuan;
        }
        if($d_songketan5==1){
        $data_songketan5 =  $this->data->songketan5_jumlah." ".$this->data->nama_songketan5_satuan;
        }
        if($d_songketan6==1){
        $data_songketan6 =  $this->data->songketan6_jumlah." ".$this->data->nama_songketan6_satuan;
        }
        if($d_songketan7==1){
        $data_songketan7 =  $this->data->songketan7_jumlah." ".$this->data->nama_songketan7_satuan;
        }
        if($d_songketan8==1){
        $data_songketan8 =  $this->data->songketan8_jumlah." ".$this->data->nama_songketan8_satuan;
        }
        if($d_songketan9==1){
        $data_songketan9 =  $this->data->songketan9_jumlah." ".$this->data->nama_songketan9_satuan;
        }
        if($d_songketan10==1){
        $data_songketan10 = $this->data->songketan10_jumlah." ".$this->data->nama_songketan10_satuan;
        }
        if($d_songketan11==1){
        $data_songketan11 = $this->data->songketan11_jumlah." ".$this->data->nama_songketan11_satuan;
        }
        if($d_songketan12==1){
        $data_songketan12 = $this->data->songketan12_jumlah." ".$this->data->nama_songketan12_satuan;
        }
        if($d_songketan13==1){
        $data_songketan13 = $this->data->songketan13_jumlah." ".$this->data->nama_songketan13_satuan;
        }
        if($d_songketan14==1){
        $data_songketan14 = $this->data->songketan14_jumlah." ".$this->data->nama_songketan14_satuan;
        }
        if($d_songketan15==1){
        $data_songketan15 = $this->data->songketan15_jumlah." ".$this->data->nama_songketan15_satuan;
        }
        if($d_pancingan1==1){
        $data_pancingan1 =  $this->data->pancingan1_jumlah." ".$this->data->nama_pancingan1_satuan;
        }
        if($d_pancingan2==1){
        $data_pancingan2 =  $this->data->pancingan2_jumlah." ".$this->data->nama_pancingan2_satuan;
        }
        if($d_gunungan1_atas==1){
        $data_gunungan1_atas =  $this->data->gunungan1_atas_jumlah." ".$this->data->nama_gunungan1_atas_satuan;
        }
        if($d_gunungan2_atas==1){
        $data_gunungan2_atas =  $this->data->gunungan2_atas_jumlah." ".$this->data->nama_gunungan2_atas_satuan;
        }
        if($d_gunungan3_atas==1){
        $data_gunungan3_atas =  $this->data->gunungan3_atas_jumlah." ".$this->data->nama_gunungan3_atas_satuan;
        }
        if($d_gunungan1_bawah==1){
        $data_gunungan1_bawah = $this->data->gunungan1_bawah_jumlah." ".$this->data->nama_gunungan1_bawah_satuan;
        }
        if($d_gunungan2_bawah==1){
        $data_gunungan2_bawah = $this->data->gunungan2_bawah_jumlah." ".$this->data->nama_gunungan2_bawah_satuan;
        }
        if($d_gunungan3_bawah==1){
        $data_gunungan3_bawah = $this->data->gunungan3_bawah_jumlah." ".$this->data->nama_gunungan3_bawah_satuan;
        }
        if($d_garis1==1){
        $data_garis1 =  $this->data->garis1_jumlah." ".$this->data->nama_garis1_satuan;
        }
        if($d_garis2==1){
        $data_garis2 =  $this->data->garis2_jumlah." ".$this->data->nama_garis2_satuan;
        }
        $this->Row(array("","","","","","",$data_dasar,$data_dasar2,$data_dasar3,$data_dasar4,$data_dasar5,$data_dasar6,$data_dasar7,$data_dasar8,$data_dasar9,$data_dasar10,$data_streep,$data_kombinasi1,$data_kombinasi2,$data_kombinasi3,$data_kluwungan1,$data_kluwungan2,$data_kluwungan3,$data_kluwungan4,$data_timbulan1,$data_timbulan2,$data_timbulan3,$data_songketan1,$data_songketan2,$data_songketan3,$data_songketan4,$data_songketan5,$data_songketan6,$data_songketan7,$data_songketan8,$data_songketan9,$data_songketan10,$data_songketan11,$data_songketan12,$data_songketan13,$data_songketan14,$data_songketan15,$data_pancingan1,$data_pancingan2,$data_gunungan1_atas,$data_gunungan2_atas,$data_gunungan3_atas,$data_gunungan1_bawah,$data_gunungan2_bawah,$data_gunungan3_bawah,$data_garis1,$data_garis2,"",""));

                $no = 1;
                if(count($this->detail_barang) > 0){
                    foreach ($this->detail_barang as $k) {
                                $detail_dasar = '';
        $detail_dasar2 = '';
        $detail_dasar3 = '';
        $detail_dasar4 = '';
        $detail_dasar5 = '';
        $detail_dasar6 = '';
        $detail_dasar7 = '';
        $detail_dasar8 = '';
        $detail_dasar9 = '';
        $detail_dasar10 = '';
        $detail_streep = '';
        $detail_kombinasi1 = '';
        $detail_kombinasi2 = '';
        $detail_kombinasi3 = '';
        $detail_kluwungan1 = '';
        $detail_kluwungan2 = '';
        $detail_kluwungan3 = '';
        $detail_kluwungan4 = '';
        $detail_timbulan1 = '';
        $detail_timbulan2 = '';
        $detail_timbulan3 = '';
        $detail_songketan1 = '';
        $detail_songketan2 = '';
        $detail_songketan3 = '';
        $detail_songketan4 = '';
        $detail_songketan5 = '';
        $detail_songketan6 = '';
        $detail_songketan7 = '';
        $detail_songketan8 = '';
        $detail_songketan9 = '';
        $detail_songketan10 = '';
        $detail_songketan11 = '';
        $detail_songketan12 = '';
        $detail_songketan13 = '';
        $detail_songketan14 = '';
        $detail_songketan15 = '';
        $detail_pancingan1 = '';
        $detail_pancingan2 = '';
        $detail_gunungan1_atas = '';
        $detail_gunungan2_atas = '';
        $detail_gunungan3_atas = '';
        $detail_gunungan1_bawah = '';
        $detail_gunungan2_bawah = '';
        $detail_gunungan3_bawah = '';
        $detail_garis1 = '';
        $detail_garis2 = '';
        if($d_dasar==1){
        $detail_dasar =   $k->inisial_dasar;
        }
        if($d_dasar2==1){
        $detail_dasar2 =  $k->inisial_dasar2;
        }
        if($d_dasar3==1){
        $detail_dasar3 =  $k->inisial_dasar3;
        }
        if($d_dasar4==1){
        $detail_dasar4 =  $k->inisial_dasar4;
        }
        if($d_dasar5==1){
        $detail_dasar5 =  $k->inisial_dasar5;
        }
        if($d_dasar6==1){
        $detail_dasar6 =  $k->inisial_dasar6;
        }
        if($d_dasar7==1){
        $detail_dasar7 =  $k->inisial_dasar7;
        }
        if($d_dasar8==1){
        $detail_dasar8 =  $k->inisial_dasar8;
        }
        if($d_dasar9==1){
        $detail_dasar9 =  $k->inisial_dasar9;
        }
        if($d_dasar10==1){
        $detail_dasar10 = $k->inisial_dasar10;
        }
        if($d_streep==1){
        $detail_streep =  $k->inisial_streep;
        }
        if($d_kombinasi1==1){
        $detail_kombinasi1 =  $k->inisial_kombinasi1;
        }
        if($d_kombinasi2==1){
        $detail_kombinasi2 =  $k->inisial_kombinasi2;
        }
        if($d_kombinasi3==1){
        $detail_kombinasi3 =  $k->inisial_kombinasi3;
        }
        if($d_kluwungan1==1){
        $detail_kluwungan1 =  $k->inisial_kluwungan1;
        }
        if($d_kluwungan2==1){
        $detail_kluwungan2 =  $k->inisial_kluwungan2;
        }
        if($d_kluwungan3==1){
        $detail_kluwungan3 =  $k->inisial_kluwungan3;
        }
        if($d_kluwungan4==1){
        $detail_kluwungan4 =  $k->inisial_kluwungan4;
        }
        if($d_timbulan1==1){
        $detail_timbulan1 =   $k->inisial_timbulan1;
        }
        if($d_timbulan2==1){
        $detail_timbulan2 =   $k->inisial_timbulan2;
        }
        if($d_timbulan3==1){
        $detail_timbulan3 =   $k->inisial_timbulan3;
        }
        if($d_songketan1==1){
        $detail_songketan1 =  $k->inisial_songketan1;
        }
        if($d_songketan2==1){
        $detail_songketan2 =  $k->inisial_songketan2;
        }
        if($d_songketan3==1){
        $detail_songketan3 =  $k->inisial_songketan3;
        }
        if($d_songketan4==1){
        $detail_songketan4 =  $k->inisial_songketan4;
        }
        if($d_songketan5==1){
        $detail_songketan5 =  $k->inisial_songketan5;
        }
        if($d_songketan6==1){
        $detail_songketan6 =  $k->inisial_songketan6;
        }
        if($d_songketan7==1){
        $detail_songketan7 =  $k->inisial_songketan7;
        }
        if($d_songketan8==1){
        $detail_songketan8 =  $k->inisial_songketan8;
        }
        if($d_songketan9==1){
        $detail_songketan9 =  $k->inisial_songketan9;
        }
        if($d_songketan10==1){
        $detail_songketan10 = $k->inisial_songketan10;
        }
        if($d_songketan11==1){
        $detail_songketan11 = $k->inisial_songketan11;
        }
        if($d_songketan12==1){
        $detail_songketan12 = $k->inisial_songketan12;
        }
        if($d_songketan13==1){
        $detail_songketan13 = $k->inisial_songketan13;
        }
        if($d_songketan14==1){
        $detail_songketan14 = $k->inisial_songketan14;
        }
        if($d_songketan15==1){
        $detail_songketan15 = $k->inisial_songketan15;
        }
        if($d_pancingan1==1){
        $detail_pancingan1 =  $k->inisial_pancingan1;
        }
        if($d_pancingan2==1){
        $detail_pancingan2 =  $k->inisial_pancingan2;
        }
        if($d_gunungan1_atas==1){
        $detail_gunungan1_atas =  $k->inisial_gunungan1_atas;
        }
        if($d_gunungan2_atas==1){
        $detail_gunungan2_atas =  $k->inisial_gunungan2_atas;
        }
        if($d_gunungan3_atas==1){
        $detail_gunungan3_atas =  $k->inisial_gunungan3_atas;
        }
        if($d_gunungan1_bawah==1){
        $detail_gunungan1_bawah = $k->inisial_gunungan1_bawah;
        }
        if($d_gunungan2_bawah==1){
        $detail_gunungan2_bawah = $k->inisial_gunungan2_bawah;
        }
        if($d_gunungan3_bawah==1){
        $detail_gunungan3_bawah = $k->inisial_gunungan3_bawah;
        }
        if($d_garis1==1){
        $detail_garis1 =  $k->inisial_garis1;
        }
        if($d_garis2==1){
        $detail_garis2 =  $k->inisial_garis2;
        }
                        $this->Row(array($no,$k->nama_motif,$k->no_workorder,tgl_full($k->tanggal_celup,98),tgl_full($k->hb,98),$k->jumlah_beem,$detail_dasar,$detail_dasar2,$detail_dasar3,$detail_dasar4,$detail_dasar5,$detail_dasar6,$detail_dasar7,$detail_dasar8,$detail_dasar9,$detail_dasar10,$detail_streep,$detail_kombinasi1,$detail_kombinasi2,$detail_kombinasi3,$detail_kluwungan1,$detail_kluwungan2,$detail_kluwungan3,$detail_kluwungan4,$detail_timbulan1,$detail_timbulan2,$detail_timbulan3,$detail_songketan1,$detail_songketan2,$detail_songketan3,$detail_songketan4,$detail_songketan5,$detail_songketan6,$detail_songketan7,$detail_songketan8,$detail_songketan9,$detail_songketan10,$detail_songketan11,$detail_songketan12,$detail_songketan13,$detail_songketan14,$detail_songketan15,$detail_pancingan1,$detail_pancingan2,$detail_gunungan1_atas,$detail_gunungan2_atas,$detail_gunungan3_atas,$detail_gunungan1_bawah,$detail_gunungan2_bawah,$detail_gunungan3_bawah,$detail_garis1,$detail_garis2,tgl_full($k->beem,98),tgl_full($k->pakan,98)));
                        $no++;
                    }
                }else{
                    $this->Row(array("", "", "", "", "","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""));
                }
                

        $this->Ln(2);
        $this->setX($this->paper_h*3/100);
        $this->cell(50, 5, "KETERANGAN :", 0, 0, "L");
        $this->setFont('Arial','B',15);
        $this->cell(20, 5, "PD",0,0,"C");
        $this->cell(20, 5, "PAK",0,1,"C");
        $this->ln(3);
        $this->setFont('Arial','',15);
        $this->SetWidths(array(50,20,20,20));
        $this->SetAligns(array("L","C","C","C"));
        foreach($this->detail_ket as $k){
        $this->Row_noborder(array($k->nama_keterangan,$k->jumlah_konversi,$k->jumlah,"(".$k->nama_barang.")"));
        }

        $this->ln();
        $this->setFont('Arial','',10);
        $this->setX($this->paper_h*81.5/100);
        $this->cell(51, 5, "Mengetahui", "TLR", 1, "C");

        $this->setX($this->paper_h*81.5/100);
        $this->cell(51, 15, "", "BLR", 1, "C");
	}
	
	function Footer()
	{
        $this->Ln();
        $this->SetY(-15);
        $this->SetFont('Arial','',9);
        $this->Cell(0,10, $this->PageNo(),0,0,'C');
	}

	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->data=$data['data'];
$Pdf->detail_barang=$data['detail_barang'];
$Pdf->detail_ket=$data['detail_ket'];
$Pdf->kertas=$data['kertas'];
$Pdf->SetAutoPageBreak(true ,15);

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


?>