Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $jumlah=isset($_GET['banyaknya'])?$_GET['banyaknya']:10;
- $nik=isset($_POST['NIK'])?_POST['NIK'):'';
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- #kotak_utama{
- margin:0;
- width:21 cm;
- height:30 cm;
- font-size:6pt;
- padding-top:1pt;
- background-color:#FFF;
- }
- .kotak{
- margin:0 auto;
- margin-left:6pt;
- border:thin solid #000;
- width:240pt;
- height:160pt;
- font-size:5pt;
- background-color:#FFF;
- }
- .jarak_table{
- margin-top:6pt;
- }
- .tr{
- background-color:#FFF;
- }
- .tr:hover{
- background-color:#9FF;
- }
- </style>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Kartu Sehat</title>
- </head>
- <body>
- <div id="kotak_utama">
- <form method="post">
- NIK : <input type='text' name='NIK' />
- <input type="submit" name="kirim" value="Cari" />
- </form>
- <br/>
- <table>
- <tr>
- <?php
- if(!empty($jumlah))
- {
- //-- database configuration
- $dbhost='localhost';
- $dbuser='root';
- $dbpass='';
- $dbname='test';
- //-- database connection
- $db=new mysqli($dbhost,$dbuser,$dbpass,$dbname);
- //-- query data
- $sql="SELECT
- a.no_absen,a.NIK,a.nama,a.jabatan,a.departemen,a.alamat,a.kelurahan,a.kecamatan,a.kabupaten,
- IF(b.nama_istri IS NULL,'-',b.nama_istri) AS nama_istri,
- IF(b.tgl_lahir_istri IS NULL,'-',b.tgl_lahir_istri) AS tgl_lahir_istri,
- IF(c.no_anak='1',c.nama_anak,'-') AS anak1,
- IF(c.no_anak='1',c.tgl_lahir,'-') AS tgl_lahir_anak1,
- IF(c.no_anak='2',c.nama_anak,'-') AS anak2,
- IF(c.no_anak='2',c.tgl_lahir,'-') AS tgl_lahir_anak2,
- IF(c.no_anak='3',c.nama_anak,'-') AS anak3,
- IF(c.no_anak='3',c.tgl_lahir,'-') AS tgl_lahir_anak3
- FROM qw_karyawan_baru a
- LEFT JOIN qw_istri b USING(NIK)
- LEFT JOIN qw_anak_jamsostek c USING(NIK) "
- .($empty($nik)?"WHERE a.NIK='$nik' ":"")
- ."GROUP BY a.NIK
- LIMIT $jumlah";
- //-- execute query
- $result=$db->query($sql);
- if($jml=$result->num_rows)
- {
- $i=0;
- while($records=$result->fetch_object())
- {
- echo (++$i%2!=0?'</tr></tr>':'';
- ?>
- <td>
- <div class="kotak">
- <img src="img/headbnr.jpg" width="304" height="41" />
- <center>
- <b>KARTU SEHAT</b>
- <br />
- <b>KARYAWAN PT. RESTU AGUNG NAROGONG</b>
- </center>
- <table width="308" border="1" style="border-collapse:collapse;margin-top:3pt; margin-left:2pt">
- <tr>
- <th colspan="2"><b>IDENTITAS KARYAWAN</b></th>
- <th colspan="3"><b>TANGGUNGAN</b></th>
- </tr>
- <tr>
- <td width="59">No Absen</td>
- <td width="84"><?php echo $records->no_absen;?></td>
- <td width="24">Status</td>
- <td width="68">Nama</td>
- <td width="39">Tgl Lahir</td>
- </tr>
- <tr>
- <td>NIK</td>
- <td><?php echo $records->NIK;?></td>
- <td>Istri</td>
- <td><?php echo $records->nama_istri;?></td>
- <td><?php echo $records->tgl_lahir_istri;?></td>
- </tr>
- <tr>
- <td>Nama</td>
- <td><?php echo $records->nama;?></td>
- <td>Anak</td>
- <td><?php echo $records->anak1;?></td>
- <td><?php echo $records->tgl_lahir_anak1;?></td>
- </tr>
- <tr>
- <td>Jabatan</td>
- <td><?php echo $records->jabatan;?></td>
- <td>Anak</td>
- <td><?php echo $records->anak2;?></td>
- <td><?php echo $records->tgl_lahir_anak2;?></td>
- </tr>
- <tr>
- <td>Bagian</td>
- <td><?php echo $records->departemen;?></td>
- <td>Anak</td>
- <td><?php echo $records->anak3;?></td>
- <td><?php echo $records->tgl_lahir_anak3;?></td>
- </tr>
- <tr>
- <td colspan="2" align="center">Alamat</td>
- <td colspan="3" rowspan="6" align="center">
- Narogong, <?php echo date('d-m-Y'); ?><br />
- PT. RESTU AGUNG NAROGONG<br />
- TTD<br />
- <br />
- <br />
- <br />
- <br />
- <i>Direktur Utama</i>
- </td>
- </tr>
- <tr>
- <td colspan="2">Kp/RT/RW</td>
- <td colspan="3"><?php echo $records->alamat;?></td>
- </tr>
- <tr>
- <td colspan="2">Desa</td>
- <td colspan="3"><?php echo $records->kelurahan;?></td>
- </tr>
- <tr>
- <td colspan="2">Kec</td>
- <td colspan="3"><?php echo $records->kecamatan;?></td>
- </tr>
- <tr>
- <td colspan="2">Kab/Kota</td>
- <td colspan="3"><?php echo $records->kabupaten;?></td>
- </tr>
- <tr>
- <td colspan="2" align="center"><i>Kartu harap di bawa <br />kunjungan pemeriksaan</i></td>
- <td colspan="3"> </td>
- </tr>
- </table>
- <div align="right">
- <b>KTS-03/010613</b>
- </div>
- </div>
- </td>
- <?php
- }
- if($jml%2!=0)
- {
- echo "<td> </td>";
- }
- }
- else
- {
- echo "<td>Tidak ada data</td>\n";
- }
- }
- else
- {
- echo "<td>Tidak ada data</td>\n";
- }
- ?>
- </tr>
- </table>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement