<?php
include("../../index.globalconfig.php");
//class ezpdf yg di panggil
include "pdf/class.ezpdf.php"; 
$pdf = new Cezpdf('F4','landscape');
$pdf->ezSetCmMargins(3, 3, 3, 3);
$pdf->selectFont('pdf/fonts/Helvetica.afm');
$pdf->addJpegFromFile('../images/logo.jpg',30,778,60);
$pdf->addText(230, 815, 14,'<b>Rekap Persuratan</b>');
$pdf->addText(160, 800, 12,'<b>'.$satker.'</b>');
$pdf->addText(210, 785, 10,'<b>'.$alamat.'</b>');
$pdf->line(2, 770, 590, 770);
$pdf->line(2, 50, 590, 50);
date_default_timezone_set("Asia/Jakarta");
$pdf->addText(410,34,8,'Dicetak tgl:' . date( 'd-m-Y, H:i:s'));
mysql_connect("localhost", "root", "benk");
mysql_select_db("cma");
$Dari=$_POST['Dari'];
$Sampai=$_POST['Sampai'];
$tampil = "SELECT * FROM tab_surat20193 WHERE (tu_tglterima BETWEEN '$Dari' AND '$Sampai');";
$sql = mysql_query($tampil);  
$jml = mysql_num_rows($sql);
if ($jml > 0){
$i = 1;
while($r = mysql_fetch_array($sql)) {
 $data[$i]=array('No'=>$i,
          'ASAL SURAT'=>"$r[tu_asalsrt]",
       'Perihal'=>"$r[tu_perihal]",
       'No Agenda'=>"$r[tu_noagenda]"
       );
 $i++;
}
$pdf->ezTable($data);
$pdf->ezText("\nPeriode: $Dari s/d $Sampai");
$pdf->ezStartPageNumbers(700, 20, 8);
$pdf->ezStream();
}
else{
 echo "
 <script>
 alert('Tidak Di Temukan Data Surat');
 </script>
 ";
}
?>
