Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $tanggal_awal = isset($_GET['tanggal_awal'])?$_GET['tanggal_awal']:date('Y-m-d');
- $tanggal_akhir = isset($_GET['tanggal_akhir'])?$_GET['tanggal_akhir']:date('Y-m-d');
- include 'koneksi.php';
- $sql="SELECT * FROM pemakaian WHERE `tanggal_pemakaian` BETWEEN '{$tanggal_awal}' AND '{$tanggal_akhir}'";
- $data = mysqli_query($link,$sql);
- $row_cnt = mysqli_num_rows($data);
- if($row_cnt==0) die("tidak ada data ditemukan dengan query [{$sql}]");
- require('laporan/fpdf.php');
- $pdf = new FPDF("L","cm","A4");
- $pdf->SetMargins(2,1,1);
- $pdf->AliasNbPages();
- $pdf->AddPage();
- $pdf->SetFont('Times','B',11);
- //$pdf->Image('../logo/tk.png',1,1,2,2);
- $pdf->SetX(4);
- $pdf->MultiCell(19.5,0.5,'TK (TOKO TEUNGKU)',0,'L');
- $pdf->SetX(4);
- $pdf->MultiCell(19.5,0.5,'Telpon : 0812XXXXXXX',0,'L');
- $pdf->SetFont('Arial','B',10);
- $pdf->SetX(4);
- $pdf->MultiCell(19.5,0.5,'JL. Sp.Dodik',0,'L');
- $pdf->SetX(4);
- $pdf->MultiCell(19.5,0.5,'Website : | Email : ',0,'L');
- $pdf->Line(1,3.1,28.5,3.1);
- $pdf->SetLineWidth(0.1);
- $pdf->Line(1,3.2,28.5,3.2);
- $pdf->SetLineWidth(0);
- $pdf->ln(1);
- $pdf->SetFont('Arial','B',14);
- $pdf->Cell(0,0.7,'Laporan Data pemakaian pertanggal',0,0,'C');
- $pdf->ln(1);
- $pdf->SetFont('Arial','B',10);
- $pdf->Cell(5,0.7,"Di cetak pada : ".date("D-d/m/Y"),0,0,'C');
- $pdf->ln(1);
- $pdf->Cell(6,0.7,"tanggal_awal : {$tanggal_awal} tanggal_akhir {$tanggal_akhir}",0,0,'C');
- $pdf->ln(1);
- $pdf->Cell(1, 0.8, 'NO', 1, 0, 'C');
- $pdf->Cell(3, 0.8, 'nik', 1, 0, 'C');
- $pdf->Cell(3, 0.8, 'no_polisi', 1, 0, 'C');
- $pdf->Cell(3, 0.8, 'id_sopir', 1, 0, 'C');
- $pdf->Cell(3, 0.8, 'tanggal_pemakaian', 1, 0, 'C');
- $pdf->Cell(3, 0.8, 'tanggal_pengembalian', 1, 0, 'C');
- $pdf->Cell(3, 0.8, 'tanggal_pemakaian', 1, 0, 'C');
- $pdf->Cell(3, 0.8, 'tujuan', 1, 0, 'C');
- $pdf->Cell(3, 0.8, 'keperluan', 1, 0, 'C');
- $no=1;
- // $pdf->Cell(1, 0.8, date($dari), 1, 0, 'C');
- while ($r = mysqli_fetch_array($data)){
- $pdf->Cell(1, 0.8, $no , 1, 0, 'C');
- $pdf->Cell(3, 0.8, $r['tanggal_pemakaian'],1, 0, 'C');
- $no++;
- }
- $pdf->Output("laporan_pemakaian.pdf","I");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement