<?php
include "function_fpdf.php";
$no=$_GET['no'];
//include "random.php";
include "../koneksi.php";
include "../terbilang.php";
	$cari="SELECT * FROM daf_0 WHERE no='$no'";
	$hasil=mysql_query($cari,$konek);
	$data=mysql_fetch_array($hasil);
	//panggil database ke form
	$idsekolah=md5($data['sekolah']);
	$idjenjang=md5($data['jenjang']);
	$idversi=md5($data['versi']);
	$jenjang=$data['jenjang'];
	$versi=$data['versi'];
	$sekolah=$data['sekolah'];
	$email=$data['email'];
	$hp=$data['hp'];
	$harga=$data['harga'];
	$aplikasi=$data['aplikasi'];
	$token=$data['token'];
	$id_link=$data['id_link'];
	$daf1=$data['daf1'];
	$daf2=$data['daf2'];
	$daf3=$data['daf3'];
	$daf4=$data['daf4'];
	$daf5=$data['daf5'];
	$akt=$data['akt'];
if($jenjang=="PAUD"){$kd_jen=1;}
	elseif($jenjang=="SD"){$kd_jen=2;}
	elseif($jenjang=="SMP"){$kd_jen=3;}
	elseif($jenjang=="SMA"){$kd_jen=4;};
	
	if($versi=="AKS1"){$kd_ver="X";}
	elseif($versi=="AKS2"){$kd_ver="Y";}
	elseif($versi=="AKS3"){$kd_ver="Z";};
	
	if($versi=="AKS1"){$apl_ver="k1-";}
	elseif($versi=="AKS2"){$apl_ver="k2-";}
	elseif($versi=="AKS3"){$apl_ver="k3-";};
	
	$aplikasi="aks-".$apl_ver.strtolower($jenjang);
	$terb=ucwords(terbilang($harga))." Rupiah";
	//BUAT Serial
$serial1=substr($idsekolah,4,2).substr($idjenjang,8,2).substr($idversi,6,1);
$serial2=substr($idjenjang,19,2).substr($idsekolah,1,2).substr($idversi,18,1);
$serial3=substr($idversi,0,2).substr($idsekolah,23,2).substr($idjenjang,24,1);
$serial4=substr($idsekolah,14,2).substr($idjenjang,6,2).substr($idversi,14,1);
$serial5=substr($idsekolah,22,2).substr($idjenjang,0,2).substr($idjenjang,11,1);
$random1=substr($idsekolah,6,1);
$random2=substr($idsekolah,4,3);
$akt2=substr($idsekolah,9,2).$kd_ver.$random1.substr($idjenjang,0,2).substr($idversi,3,5).$kd_jen.$random2.substr($idversi,8,3).substr($idsekolah,18,1).substr($idsekolah,1,1);
$akt3=strtoupper($akt2);
	$sn=strtoupper($serial1)."-".strtoupper($serial2)."-".strtoupper($serial3)."-".strtoupper($serial4)."-".strtoupper($serial5);
	
 # untuk menuliskan nama bulan dengan format Indonesia
        $bln = array(
          '01' => 'Januari',
          '02' => 'Februari',
          '03' => 'Maret',
          '04' => 'April',
          '05' => 'Mei',
          '06' => 'Juni',
          '07' => 'Juli',
          '08' => 'Agustus',
          '09' => 'September',
          '10' => 'Oktober',
          '11' => 'November',
          '12' => 'Desember'
        );
		
//Memanggil file FPDF dari file yang anda download tadi
require('fpdf.php');

$pdf = new FPDF("P","cm","A4");

$pdf->SetMargins(2,1,1);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','B',11);
$pdf->ln(1);


$pdf = new FPDF("P","cm","A4");

$pdf->SetMargins(2,1,1);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','B',11);
$pdf->Image('header.png',1,1,19,2.2);
$pdf->ln(4);
$pdf->SetFont('Courier','B',14);
$pdf->Cell(25.5,0.7,"KUITANSI PEMBAYARAN",0,10,'L');

$pdf->SetFont('Courier','BI',6);
$pdf->Cell(25.5,0.3,"Kebumen, ".date('d').' '.$bln[date('m')].' '.date('Y'),0,0,'L');


//Data Registrasi
//$pdf->Cell(15,0.7,0,1,'L');

$pdf->SetFont('Courier','',9);
$pdf->ln(2);
$pdf->Cell(4,0.5,'Telah terima dari',0,0,'L');
$pdf->Cell(1,0.5,':',0,0,'C');
$pdf->Cell(15,0.5,' '.$sekolah,0,1,'L');

$pdf->Cell(4,0.5,'Uang Sebesar',0,0,'L');
$pdf->Cell(1,0.5,':',0,0,'C');
$pdf->Cell(15,0.5,$terb,0,1,'L');

$pdf->Cell(4,0.5,'Guna Membayar',0,0,'L');
$pdf->Cell(1,0.5,':',0,0,'C');
$pdf->Cell(15,0.5,' Pembelian & Aktivasi Aplikasi Keuangan Sekolah (AKS) ',0,1,'L');

$pdf->Cell(4,0.5,'',0,0,'L');
$pdf->Cell(1,0.5,'',0,0,'C');
$pdf->Cell(15,0.5,' berbasis web, http://aplikasiaks.com',0,0,'L');
$pdf->ln(1);

//Data Serial NUmber
$pdf->Cell(4,0.5,'',0,0,'L');
$pdf->Cell(1,0.5,'',0,0,'C');
$pdf->SetFont('Courier','B',9);
$pdf->Cell(2.4,0.5,' Aktivasi Aplikasi AKS ',0,1,'L');

$pdf->SetFont('Courier','',9);
$pdf->Cell(4,0.5,'',0,0,'L');
$pdf->Cell(1,0.5,'',0,0,'C');
$pdf->Cell(2.4,0.5,' Nama Lembaga',0,0,'L');
$pdf->Cell(1,0.5,':',0,0,'R');
$pdf->Cell(15,0.5, $sekolah, 0, 1,'L');

$pdf->SetFont('Courier','',9);
$pdf->Cell(4,0.5,'',0,0,'L');
$pdf->Cell(1,0.5,'',0,0,'C');
$pdf->Cell(2.4,0.5,' Serial Number',0,0,'L');
$pdf->Cell(1,0.5,':',0,0,'R');
$pdf->Cell(15,0.5, $sn, 0, 1,'L');

$pdf->SetFont('Courier','',9);
$pdf->Cell(4,0.5,'',0,0,'L');
$pdf->Cell(1,0.5,'',0,0,'C');
$pdf->Cell(2.4,0.5,' Kode Aktivasi',0,0,'L');
$pdf->Cell(1,0.5,':',0,0,'R');
$pdf->Cell(15,0.5, $akt2, 0, 1,'L');

$pdf->SetFont('Courier','',9);
$pdf->Cell(4,0.5,'',0,0,'L');
$pdf->Cell(1,0.5,'',0,0,'C');
$pdf->Cell(2.4,0.5,' Jenjang',0,0,'L');
$pdf->Cell(1,0.5,':',0,0,'R');
$pdf->Cell(15,0.5, $jenjang, 0, 1,'L');

$pdf->SetFont('Courier','',9);
$pdf->Cell(4,0.5,'',0,0,'L');
$pdf->Cell(1,0.5,'',0,0,'C');
$pdf->Cell(2.4,0.5,' Versi AKS',0,0,'L');
$pdf->Cell(1,0.5,':',0,0,'R');
$pdf->Cell(15,0.5, $versi, 0, 1,'L');

$pdf->SetFont('Courier','',9);
$pdf->Cell(4,0.5,'',0,0,'L');
$pdf->Cell(1,0.5,'',0,0,'C');
$pdf->Cell(2.4,0.5,' Harga ',0,0,'L');
$pdf->Cell(1,0.5,':',0,0,'R');
$pdf->Cell(15,0.5, number_format($harga,0,",","."), 0, 1,'L');
 


$pdf->ln(1);
$pdf->SetFont('Courier','B',9); 
$pdf->Cell(4,0.5,'Jumlah',0,0,'L');
$pdf->Cell(1,0.5,':',0,0,'C');
$pdf->Cell(15,0.5,' Rp. '.number_format($harga,0,",","."),0,1,'L');

$pdf->Image('Lunas2.png',3,16.5,3,1.2);
$pdf->SetFont('Arial','B',10);
$pdf->ln(1);
$pdf->SetFont('Courier','',9);
$pdf->Cell(10.5,0.7,"",0,0,'L');
$pdf->Cell(11.5,0.7,"Penerima",0,1,'L');
$pdf->ln(1);
$pdf->SetFont('Courier','',9);
$pdf->Cell(10.5,0.7,"",0,0,'L');

$pdf->Cell(11.5,0.7,"TTD",0,1,'L');
//$pdf->ln(1);
$pdf->SetFont('Courier','',9);
$pdf->Cell(10.5,0.7,"",0,0,'L');
$pdf->Cell(11.5,0.7,"Hasna Alifatuzahro",0,1,'L');
$pdf->ln(2);
$pdf->SetFont('Courier','',7);
$pdf->Cell(25,0.7,"_____________________________________________________________________________________________________________________",0,1,'L');
$pdf->Cell(25,0.3,"Terima Kasih atas kepercayaannya menggunakan Aplikasi AKS. Semoga mendapatkan keberkahan, memudahkan dan meningkatkan ",0,1,'L');
$pdf->Cell(25,0.3,"akuntabilitas laporan keuangan sekolah/madrasah serta semakin meningkatkan kepercayaan masyarakat  terhadap ",0,1,'L');
$pdf->Cell(25,0.3,"sekolah/madrasah yang dikelola.",0,1,'L');
$pdf->Cell(25,0.3,"",0,1,'L');
$pdf->Cell(25,0.3,"Apabila menemui kendala terkait pengoperasian aplikasi silahkan menghubungi kami untuk mendapatkan layanan bantuan.",0,1,'L');
$pdf->Cell(25,0.3,"",0,1,'L');
$pdf->Cell(25,0.3,"",0,1,'L');


//Nama file ketika di print
$nama="Kuitansi-".$akt3.".pdf";
$pdf->Output($nama,"F");
?>
