<html>
<body>
<?php
//koneksi ke database
$host = "localhost";
$user = "root";
$pass = "";
$dbnm = "aris_com";
$conn = mysql_connect($host, $user, $pass);
if ($conn) {
$open = mysql_select_db($dbnm);
}else {
die("Server MySql tidak terhubung karena ".mysql_error());
}
//akhir koneksi
#ambil data di tabel dan masukkan ke array
#ambil data di tabel dan masukkan ke array
$query = "Select id_raker, realisasi, id_bulan, id_tahun from isiraker";
$sql = mysql_query ($query);
$data = array();
while ($row = mysql_fetch_assoc($sql)) {
array_push($data, $row);
}
#setting judul laporan dan header tabel
$judul = "Laporan Data Dokter";
$header = array(
array("label"=>"ID RAKER", "length"=>30, "align"=>"L"),
array("label"=>"REALISASI","length"=>25, "align"=>"L"),
array("label"=>"ID BULAN", "length"=>50, "align"=>"L"),
array("label"=>"ID TAHUN", "length"=>20, "align"=>"L")
);
#sertakan library PDF dan bentuk objek
require_once ("fpdf16/fpdf.php");
$pdf = new FPDF();
$pdf->AddPage();
#tampilkan judul laporan
$pdf->SetFont('Arial','B','16');
$pdf->Cell(0,20, $judul, '0',1, 'C');
#buat header tabel
$pdf->SetFont('Arial','','10');
$pdf->SetFillColor(255,0,0);
$pdf->SetTextColor(255);
$pdf->SetDrawColor(128,0,0);
foreach ($header as $kolom) {
$pdf->Cell($kolom['length'], 5, $kolom['label'], 1, '0',$kolom['align'], true);
}
$pdf->Ln();
#tampilkan data tabelnya
$pdf->SetFillColor(224,235,255);
$pdf->SetTextColor(0);
$pdf->SetFont('');
$fill=false;
foreach ($data as $baris) {
$i=0;
foreach($baris as $cell){
$pdf->Cell($header[$i]['length'], 5, $cell, 1, '0', $kolom['align'], $fill);
$i++;
}
$fill = !$fill;
$pdf->Ln();
#output file PDF
$pdf->output();
}
?>
</body>
</html>
<?php
//koneksi ke database
$host = "localhost";
$user = "root";
$pass = "";
$dbnm = "aris_com";
$conn = mysql_connect($host, $user, $pass);
if ($conn) {
$open = mysql_select_db($dbnm);
}else {
die("Server MySql tidak terhubung karena ".mysql_error());
}
//akhir koneksi
#ambil data di tabel dan masukkan ke array
#ambil data di tabel dan masukkan ke array
$query = "Select id_raker, realisasi, id_bulan, id_tahun from isiraker";
$sql = mysql_query ($query);
$data = array();
while ($row = mysql_fetch_assoc($sql)) {
array_push($data, $row);
}
#setting judul laporan dan header tabel
$judul = "Laporan Data Dokter";
$header = array(
array("label"=>"ID RAKER", "length"=>30, "align"=>"L"),
array("label"=>"REALISASI","length"=>25, "align"=>"L"),
array("label"=>"ID BULAN", "length"=>50, "align"=>"L"),
array("label"=>"ID TAHUN", "length"=>20, "align"=>"L")
);
#sertakan library PDF dan bentuk objek
require_once ("fpdf16/fpdf.php");
$pdf = new FPDF();
$pdf->AddPage();
#tampilkan judul laporan
$pdf->SetFont('Arial','B','16');
$pdf->Cell(0,20, $judul, '0',1, 'C');
#buat header tabel
$pdf->SetFont('Arial','','10');
$pdf->SetFillColor(255,0,0);
$pdf->SetTextColor(255);
$pdf->SetDrawColor(128,0,0);
foreach ($header as $kolom) {
$pdf->Cell($kolom['length'], 5, $kolom['label'], 1, '0',$kolom['align'], true);
}
$pdf->Ln();
#tampilkan data tabelnya
$pdf->SetFillColor(224,235,255);
$pdf->SetTextColor(0);
$pdf->SetFont('');
$fill=false;
foreach ($data as $baris) {
$i=0;
foreach($baris as $cell){
$pdf->Cell($header[$i]['length'], 5, $cell, 1, '0', $kolom['align'], $fill);
$i++;
}
$fill = !$fill;
$pdf->Ln();
}
#output file PDF
$pdf->output();
<?php
include('../config.php');
//mengambil data dari database :
$sql = mysql_query("select * from kriteria");
$data = array();
while($row = mysql_fetch_assoc($sql)){
array_push($data,$row);
}
//pengaturan judul laporan dan header table :
$judul = "..:: LAPORAN DATA KRITERIA ::..";
$header = array(array("label"=>"Nama Kriteria","length"=>30,"align"=>"L"),array("label"=>"Keterangan","length"=>30,"align"=>"L"));
//mengambil library fpdf :
require_once("fpdf/fpdf.php");
$pdf = new FPDF();
$pdf->AddPage();
//menampilkan judul laporan :
$pdf->SetFont('Arial','B','14');
$pdf->Cell(0,20,$judul,'0',1,'C');
//header table :
$pdf->SetFont('Arial','','14');
$pdf->SetFillColor(255,0,0);
$pdf->SetTextColor(255);
$pdf->SetDrawColor(128,0,0);
foreach($header as $kolom){
$pdf->Cell($kolom['length'], 5 ,$kolom['label'], 1, '0', $kolom['align'],true);
}
$pdf->Ln();
//menampilkan data table :
$pdf->SetFillColor(224,235,255);
$pdf->SetTextColor(0);
$pdf->SetFont('');
$fill = false;
foreach($data as $baris){
$i = 0;
foreach($baris as $cell){
$pdf->Cell($header[$i]['length'], 5,$cell, 1, '0', $kolom['align'],$fill);
$i++;
}
$fill = !$fill;
$pdf->Ln();
}
//keluaran file pdf :
$pdf->Output();
?>
<?php
$host = "localhost";
$user = "root";
$pass = " ";
$dbnm = "absensi";
$conn = mysql_connect('$host, $user');
if ($conn) {
$open = mysql_select_db($dbnm);
if (!$open) {
die ("Database tidak dapat dibuka karena ".mysql_error());
}
} else {
die ("Server MySQL tidak terhubung karena ".mysql_error());
}
#ambil data di tabel dan masukkan ke array
$id = $_GET["id"];
$nama_bulan = 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");
$bulan = substr($id,5,2);
$tahun = substr($id,0,4);
$tgl = $tahun."-".$bulan;
$query = "SELECT * FROM absensi,pegawai WHERE absensi.nip=pegawai.nip and tanggal like '%$id-%'
GROUP BY absensi.nip,date_format(tanggal,'%Y-%m')";
$sql = mysql_query($query) or die("Query Gagal");
require('../fpdf16/fpdfabsensibulan.php');
class PDF extends FPDF
{
//Fungsi Untuk Membuat Header
function Header()
{
//Pilih font Arial bold 15
$this->SetFont('Arial','B',12);
//Geser ke kanan
$this->Cell(80);
//Judul dalam bingkai
$this->Cell(0,0,'Title',0,0,'L');
//Ganti baris
$this->Ln(1);
}
//Fungsi Untuk Membuat Footer
function Footer()
{
//Position at 1.5 cm from bottom
$this->SetY(-5);
//Arial italic 8
$this->SetFont('Arial','',8);
//Page number
$this->Cell(10,7,'Head office : UPTD Perpustakaan Daerah Purwakarta',10,10,'L');
}
}
$pdf = new PDF('P','cm','A4');
$pdf->Open();
$pdf->AddPage();
$pdf->image("../images/Logo Kab.jpg",1,1,2,2.5);
$pdf->SetFont("Arial","B",12);
$pdf->Cell(19,0,' UPTD Perpustakaan Daerah Purwakarta','',1,'L');
$pdf->SetFont("Arial","",10);
$pdf->Cell(19,1,' Jl. K.K Singawinata No.10','',1,'L');
$pdf->SetFont("Arial","B",12);
$pdf->Cell(19,1,'REKAP ABSENSI PEGAWAI','',10,'C');
$pdf->SetFont("Times","",9);
$pdf->Cell(19,0,"BULAN ".$nama_bulan[$bulan].' '.$tahun,'',10,'C');
$pdf->SetFont('Times','',10);
$pdf->Cell(1,1,'','',0,'C');
$pdf->Cell(3,1,'','',0,'L');
$pdf->Cell(15,1,'','',0,'L');
$pdf->Ln();
$pdf->SetFont('Times','B',10);
$pdf->Cell(1,1,"No.",'LBTR',0,'C');
$pdf->Cell(4,1,"NIP",'LBTR',0,'C');
$pdf->Cell(8,1,"Nama Pegawai",'LBTR',0,'C');
$pdf->Cell(1,1,"H",'LBTR',0,'C');
$pdf->Cell(1,1,"S",'LBTR',0,'C');
$pdf->Cell(1,1,"I",'LBTR',0,'C');
$pdf->Cell(1,1,"C",'LBTR',0,'C');
$pdf->Cell(1,1,"DL",'LBTR',0,'C');
$pdf->Cell(1,1,"TK",'LBTR',0,'C');
$pdf->Ln();
$pdf->SetFont('Times','',10);
$no=1;
while($row = mysql_fetch_array($sql))
{
$nip = $row["nip"];
$nama_pegawai = $row["nama"];
$h = mysql_query("select COUNT(*) as h FROM absensi where kehadiran='H' and nip='$nip' and tanggal
like '%$id%'");
$hadir = mysql_fetch_array($h);
$totalhadir = $hadir["h"];
$s = mysql_query("select COUNT(*) as s FROM absensi where kehadiran='S' and nip='$nip' and tanggal
like '%$id%'");
$sakit = mysql_fetch_array($s);
$totalsakit = $sakit["s"];
$i = mysql_query("select COUNT(*) as i FROM absensi where kehadiran='I' and nip='$nip' and tanggal
like '%$id%'");
$izin = mysql_fetch_array($i);
$totalizin = $izin["i"];
$c = mysql_query("select COUNT(*) as c FROM absensi where kehadiran='C' and nip='$nip' and tanggal
like '%$id%'");
$cuti = mysql_fetch_array($c);
$totalcuti = $cuti["c"];
$dl = mysql_query("select COUNT(*) as dl FROM absensi where kehadiran='DL' and nip='$nip' and tanggal
like '%$id%'");
$dinasluar = mysql_fetch_array($dl);
$totaldinasluar = $dinasluar["dl"];
$tk = mysql_query("select COUNT(*) as tk FROM absensi where kehadiran='TK' and nip='$nip' and tanggal
like '%$id%'");
$tanpaketerangan = mysql_fetch_array($tk);
$totaltanpaketerangan = $tanpaketerangan["tk"];
//menampilkan data dari hasil query database
$pdf->Cell(1,1,$no.'.','LBTR',0,'C');
$pdf->Cell(4,1,$nip,'LBTR',0,'C');
$pdf->Cell(8,1,$nama_pegawai,'LBTR',0,'L');
$pdf->Cell(1,1,$totalhadir,'LBTR',0,'C');
$pdf->Cell(1,1,$totalsakit,'LBTR',0,'C');
$pdf->Cell(1,1,$totalizin,'LBTR',0,'C');
$pdf->Cell(1,1,$totalcuti,'LBTR',0,'C');
$pdf->Cell(1,1,$totaldinasluar,'LBTR',0,'C');
$pdf->Cell(1,1,$totaltanpaketerangan,'LBTR',0,'C');
$pdf->Ln();
$no++;
}
$pdf->SetFont("Times","",10);
$pdf->Cell(19,1,'Keterangan :','',0,'L');
$pdf->Ln();
$pdf->SetFont("Times","",10);
$pdf->Cell(19,0,'H = Hadir, S = Sakit, I = Izin, C = Cuti, DL = Dinas Luar, TK = Tanpa Keterangan','',0,'L');
$pdf->Ln();
$pdf->SetFont("Times","",10);
$pdf->Cell(8,1,'','',0,'C');
$pdf->Cell(4,1,'','',0,'C');
$pdf->Cell(7,1,'','',0,'C');
$pdf->Ln();
$pdf->SetFont("Times","",10);
$pdf->Cell(8,1,'','',0,'C');
$pdf->Cell(4,1,'','',0,'C');
$pdf->Cell(7,1,'Mengetahui,','',0,'C');
$pdf->Ln();
$pdf->SetFont("Times","",10);
$pdf->Cell(8,0,'','',0,'C');
$pdf->Cell(4,0,'','',0,'C');
$pdf->Cell(7,0,'Kepala Perpustakaan','',0,'C');
$pdf->Ln();
$pdf->SetFont("Times","B",9);
$pdf->Cell(8,1,'','',0,'C');
$pdf->Cell(4,1,'','',0,'C');
$pdf->Cell(7,1,'','',0,'C');
$pdf->SetFont("Times","B",9);
$pdf->Cell(8,1,'','',0,'C');
$pdf->Cell(4,1,'','',0,'C');
$pdf->Cell(7,1,'','',0,'C');
$pdf->Ln();
$pdf->SetFont("Times","U",10);
$pdf->Cell(8,1,'','',0,'C');
$pdf->Cell(4,1,'','',0,'C');
$pdf->Cell(7,1,"( Nina Aminah Bajri, SH )",'',0,'C');
$pdf->Ln();
$pdf->SetFont("Times","",10);
$pdf->Cell(8,0,"",'',0,'C');
$pdf->Cell(4,0,"",'',0,'C');
$pdf->Cell(7,0,"NIP : 196203161997032001",'',0,'C');
$pdf->Ln();
$pdf->SetFont("Times","U",10);
$pdf->Cell(8,1,'','',0,'C');
$pdf->Cell(4,1,'','',0,'C');
$pdf->Cell(7,1,"",'',0,'C');
$pdf->Ln();
$pdf->SetFont("Times","U",10);
$pdf->Cell(8,1,'','',0,'C');
$pdf->Cell(4,1,'','',0,'C');
$pdf->Cell(7,1,"",'',0,'C');
$pdf->Ln();
//menampilkan output berupa halaman PDF
$pdf->Output();
?>