Tabel Gaji Karyawan (simpan dengan nama gaji_karyawan) |
Gambar 1.0 Ketik Button "Proses" Diclik Maka Tampil Seperti Gambar 2.0 |
Gambar 2.0 Ketika Click "Input Kembali" Maka Tampil Seperti Gambar 1.0 |
NB : Untuk Tabel Liat Gambar "Tabel Gaji Karyawan" & Buat Database Dengan Nama "kampus"
Coding/Listing Gambar 1.0 (Simpan Dengan Nama index.html) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" href="../../Gambar/icon.jpg" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Adam Khamarullah</title>
</head>
<body background="../../Gambar/Background/red_in_abstract-wide.jpg">
<form action="hasil.php" method="post">
<h1 align="center"><font face="Castellar" color="#FFFFFF">Perhitungan Gaji Karyawan "PT. JKL"</font></h1>
<hr width="100%" size="4" color="#FFFFFF" />
<br />
<table width="498" border="1" cellspacing="3" cellpadding="3" align="center">
<tr>
<td colspan="2"><div align="center"><strong><font size="3" face="Times New Roman" color="#FFFFFF">Input Gaji Karyawan</font></strong></div></td>
</tr>
<tr>
<td width="235">Nama Karyawan</td>
<td width="236"> <input type="text" name="nama" size="30" /></td>
</tr>
<tr>
<td>Jabatan</td>
<td> <select name="jab"><option>--Click Here--</option><option value="Direktur">Direktur</option><option value="Manager">Manager</option><option value="Karyawan">Karyawan</option></select></td>
</tr>
<tr>
<td>Status</td>
<td> <input name="status" type="radio" value="Tetap" />Tetap <input type="radio" name="status" value="Honorer" />Honorer</td>
</tr>
<tr>
<td colspan="2"><div align="center"><input type="submit" value="Proses" /><input type="reset" value="Cancel" /></td>
</tr>
</table>
</form>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<hr width="100%" size="4" color="#FFFFFF" />
<h3 align="center"><font face="Castellar" color="#FFFFFF">Back To : <a href="../../index.php">"Website Project"</a> - <a href="../../posting.php">Daftar Posting</a></font></h3>
</body>
</html>
Coding/Listing Gambar 2.0 (Simpan Dengan Nama hasil.php) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" href="../../Gambar/icon.jpg" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Adam Khamarullah</title>
</head>
<body background="../../Gambar/Background/red_in_abstract-wide.jpg">
<h1 align="center"><font face="Castellar" color="#FFFFFF">Perhitungan Gaji Karyawan "PT. JKL"</font></h1>
<hr width="100%" size="4" color="#FFFFFF" />
<br />
<?
$nama=$_POST['nama'];
if($jab=='Direktur')
{
$gaji=6000000;
}
elseif($jab=='Manager')
{
$gaji=3500000;
}
elseif($jab=='Karyawan')
{
$gaji=1500000;
}
else
{
$gaji=0;
}
if($status=='Tetap')
{
$tunj=$gaji*0.3;
}
elseif($status=='Honorer')
{
$tunj=$gaji*0.1;
}
else
{
$tunj=0;
}
$pph=0.1*$gaji;
$gaber=($gaji+$tunj)-$pph;
$koneksi=mysql_connect("localhost","root","password");
if($koneksi){
mysql_select_db("kampus");
echo "<pre>";
echo "<font color='white' face='Times New Romans' size='4'>";
echo " Nama Karyawan : $nama<br>";
echo " Jabatan : $jab<br>";
echo " Gaji Pokok : Rp. $gaji<br>";
echo " Status : $status<br>";
echo " Tunjangan : Rp. $tunj<br>";
echo " PPh 10% : Rp. $pph<br>";
echo " Gaji Bersih : Rp. $gaber<br>";
$sqltr="insert into gaji_karyawan(nakar,jab,gapok,sta,tunj,pph,gaber)values('$nama','$jab','$gaji','$status','$tunj','$pph','$gaber')";
$hasil=mysql_query($sqltr,$koneksi);
echo "<br><br>";
echo "<center><h3>Data Berhasil Disimpan..!!<br></center></h3>";
echo "</font>";
mysql_close($koneksi);
}
else
{
echo "Data Gagal Tersimpan...!!<br>";
}
?>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<h2 align="center"><font face="Castellar" color="#FFFFFF"><a href="index.html">Input Kembali</a></font></h2>
<hr width="100%" size="4" color="#FFFFFF" />
<h3 align="center"><font face="Castellar" color="#FFFFFF">Back To : <a href="../../index.php">"Website Project"</a> - <a href="../../posting.php">Daftar Posting</a></font></h3>
</body>
</html>