<?php
include 'koneksi.php';
$NoSurat=$_POST['NoSurat'];
$TanggalSurat=$_POST['TanggalSurat'];
$Tipe=$_POST['Tipe'];
$NoKTP=$_POST['NoKTP'];
$Nama=$_POST['Nama'];
$Keperluan=$_POST['Keperluan'];
$Keterangan=$_POST['Keterangan'];
mysql_query("INSERT INTO surat (NoSurat,TanggalSurat,Tipe,NoKTP,Nama,Keperluan,Keterangan) VALUES ('$NoSurat', '$TanggalSurat', '$Tipe', '$NoKTP', '$Nama', '$Keperluan', '$Keterangan')")or die(mysql_error());
?>
<div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
           SURAT PENGANTAR UKS
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">
        <!-- TAB INDUK PENDUDUK -->
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title"></h3>
                            <div class="box-tools pull-right">
                                <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                                    
                                <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                            </div>
                    </div><!-- /.box-header -->
                    <div class="box-body" id="Cetak" style="margin-left:60px; margin-right:60px;">
							<?php 
								$idnama = $_POST['idnama'];
								$query2 = mysql_query("SELECT * FROM penduduk where id= '$idnama' ");
								while ($data2 = mysql_fetch_array($query2)) { 
							?>	
							<?php 
							   include 'koneksi.php';
							   $NoSurat = $_POST['NoSurat'];
							   $query1 = mysql_query("SELECT * FROM contact");
							   while ($data1 = mysql_fetch_array($query1)) {
							?>
						<div style="text-transform: uppercase;">
							<img src="images/Kontak/<?php echo $data1['image'];?>" height="120" width="120" style="float:left;">
							<h4 align="center" style="font-family:Arial Black;"><b>PEMERINTAH KOTA <?php echo $data1['Kota']; ?></b></h4>
							<h4 align="center" style="font-family:Arial Black;"><b>KECAMATAN <?php echo $data1['Kecamatan']; ?> </b></h4>
							<h4 align="center" style="font-family:Arial Black;"><b>DESA <?php echo $data1['pemerintah']; ?> </b></h4>
							<small style="font-family:Arial Black; text-align:center;"><p align="center"><?php echo $data1['alamat']; ?> Email:<span><?php echo $data1['email']; ?></span> Telpon: <span><?php echo $data1['TelponDesa']; ?></span>  </p></small>
								
						</div>	
						<hr width="100%" align="center" style="height:15px; border-width: 5px;">
                        <h4 align="center">SURAT PENGANTAR UKS</span></h4> 
						<hr width="40%" align="center" style="border-width: 5px;">
						<h4 align="center">No. <span><?php echo $NoSurat; ?></span></h4>
                        <p style="text-align:Justify;">Desa <span><?php echo $data1['pemerintah']; ?></span> Kecamatan <span><?php echo $data1['Kecamatan']; ?></span> Kabupaten <span><?php echo $data1['Kota']; ?></span> Provinsi <span><?php echo $data1['Provinsi']; ?></span>, dengan ini menerangkan dengan sebenarnya bahwa :</p><br> 	
							<div class="table-responsive" style="margin-left:30px;">
                                <table>
								  <tr>
                              	     <td>NAMA<td>:</td>
                              	     <td><span><?php echo $data2['Nama']; ?></span></td>
                              	  </tr>
								  <tr>
                              	     <td>NO KTP<td>:</td>
                              	     <td><span><?php echo $data2['NoKTP']; ?></span></td>
                              	  </tr>
                              	  <tr>
                              	     <td>JENIS KELAMIN<td>:</td>
                              	     <td><span><?php echo $data2['JenKel']; ?></span></td>
                              	  </tr>
                              	  <tr>
                              	     <td>TEMPAT,TANGGAL LAHIR<td>:</td>
                              	     <td><span><?php echo $data2['TempatLahir']; ?></span>, 
                              	         <span><?php echo date("d F Y", strtotime($data2['TglLahir']));?></span>
                              	     </td>
                              	  </tr>
								  <tr>
                              	     <td>STATUS KAWIN<td>:</td>
                              	     <td><span><?php echo $data2['S_Nikah']; ?></span>
                              	     </td>
                              	  </tr>
								  <tr>
                              	     <td>PEKERJAAN<td>:</td>
                              	     <td><span><?php echo $data2['Pekerjaan']; ?></span>
                              	     </td>
                              	  </tr>
								  <tr>
                              	     <td>ALAMAT<td>:</td>
                              	     <td><span>Kp/Jln.</span> <span><?php echo $data2['Jalan']; ?></span> 
                              	         <span>RT.</span> <span><?php echo $data2['RT']; ?></span>
										 <span>RW.</span> <span><?php echo $data2['RW']; ?></span>
										 </td>
                              	  </tr>
                              	</table>
								</div>
                                <br><br>
                                
                        <p style="text-align:Justify;">
						Orang  tersebut diatas, adalah benar-benar warga kami dan berkelakuan baik di masyarakat hingga sekarang di keluarkan surat kelakuan baik ini. Surat keterangan ini dipergunakan untuk melengkapi persyaratan:<br>
                        <p align="center">---------------------------MEMBUAT SURAT KELAKUAN BAIK---------------------------</p>
						Demikian surat keterangan ini kami buat, untuk dapat dipergunakan sebagaimana mestinya.</p><br>
                        
						
                        
						<div style="float:left; padding-left:80px;" align="center" width="50">
							<span> Yang Bersangkutan </span><br><br><br><br><br>
							<span> <?php echo $data2['Nama'];?> </span>
							
						</div>
						<div style="float:right; padding-right:80px;" align="center" > 
							<span><?php echo $data1['Kota']; ?>, <?php echo date("d F Y", strtotime($TanggalSurat)); ?></span><br>
							<span> Kepala Desa </span><br><br><br><br><br>
							<?php 
							   include 'koneksi.php';
							   $query3 = mysql_query("SELECT * FROM dataaparat where Jabatan = 'Kepala Desa' And Status = 'Aktif'");
							   while ($data3 = mysql_fetch_array($query3)) {
							?>
							<span> <?php echo $data3['Nama'];?> </span>
							   <?php } ?>
						</div>
						
								<?php } } ?>
                    </div><!-- ./box-body -->
                    <div class="box-footer" ><button style="float:right;" class="btn btn-primary" name="Cetak" onclick="printDiv('Cetak')"><i class="fa fa-print"> Cetak</i></button></div>
                </div><!-- /.box -->
            </div><!-- /.col -->
        </div><!-- /.row -->
        <!-- TAB END INDUK PENDUDUK -->    
        </section>
</div>
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<script type="">
function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

     document.body.innerHTML = printContents;

     window.print();

     document.body.innerHTML = originalContents;
}
</script>