<style type="text/css">
#tampil_slip{
	font-size:12px;
	font-weight:bold;
	color:#F00;
}
</style>

<?php
include '../../inc/inc.koneksi.php';
include '../../inc/fungsi_tanggal.php';

$sql2 = mysql_query("SELECT nama1 FROM company");
$r2	  = mysql_fetch_assoc($sql2);
$kop1 = $r2[nama1];	

$bulan= $_GET['bulan'];
$tahun= $_GET['tahun'];
$nik1 = $_GET['nik1'];
$nik2 = $_GET['nik2'];

mysql_query("DELETE FROM slip_gaji");

if(!($nik2==''))
	$sql = "SELECT * FROM gaji WHERE bulan='$bulan' AND tahun='$tahun' AND nik BETWEEN '$nik1' AND '$nik2' ORDER BY kode_gj";
else
	$sql = "SELECT * FROM gaji WHERE bulan='$bulan' AND tahun='$tahun' ORDER BY kode_gj";
$query = mysql_query($sql);

$no=0;
while($r=mysql_fetch_array($query)){
	$no=$no+1;	
	if($bulan==1)
		$cbulan='Januari';
	else if($bulan==2)
		$cbulan='Februari';
	else if($bulan==3)
		$cbulan='Maret';
	else if($bulan==4)
		$cbulan='April';
	else if($bulan==5)
		$cbulan='Mei';
	else if($bulan==6)
		$cbulan='Juni';
	else if($bulan==7)
		$cbulan='Juli';
	else if($bulan==8)
		$cbulan='Agustus';
	else if($bulan==9)
		$cbulan='September';
	else if($bulan==10)
		$cbulan='Oktober';
	else if($bulan==11)
		$cbulan='November';
	else if($bulan==12)
		$cbulan='Desember';
	else $cbulan='THR';
	
	echo "<table width='100%'>
		<tr>
			<td width='31%' style='border-bottom:double 2px'>$kop1</td>
			<td width='2%' style='border-bottom:double 2px'></td>
			<td width='12%' style='border-bottom:double 2px'></td>
			<td width='3.5%'></td>
			<td width='31%' style='border-bottom:double 2px'>$kop1</td>
			<td width='2%' style='border-bottom:double 2px'></td>
			<td width='12%' style='border-bottom:double 2px'></td>
		</tr>
		<tr>
			<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
		</tr>
		<tr>
			<td>TANDA TERIMA GAJI</td>
			<td></td>
			<td></td>
			<td></td>
			<td>TANDA TERIMA GAJI</td>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
		</tr>
		<tr>
			<td>Nama  : $r[nama]</td>
			<td></td>
			<td></td>
			<td></td>
			<td>Nama  : $r[nama]</td>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td width='31%' style='border-bottom:double 2px'>Bulan : $cbulan $tahun</td>
			<td style='border-bottom:double 2px'></td>
			<td width='12%' style='border-bottom:double 2px'></td>
			<td width='3.5%'></td>
			<td width='31%' style='border-bottom:double 2px'>Bulan : $cbulan $tahun</td>
			<td style='border-bottom:double 2px'></td>
			<td width='12%' style='border-bottom:double 2px'></td>
		</tr>
		<tr>
			<td>PENERIMAAN :</td>
			<td></td>
			<td></td>
			<td></td>
			<td>PENERIMAAN :</td>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td width='31%'>1. Gaji Pokok</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[gapok],0)."</td>
			<td width='3.5%'></td>
			<td width='31%'>1. Gaji Pokok</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[gapok],0)."</td>
		</tr>
		<tr>
			<td width='31%'>2. Tunjangan Makan</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[tunj_mak],0)."</td>
			<td width='3.5%'></td>
			<td width='31%'>2. Tunjangan Makan</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[tunj_mak],0)."</td>
		</tr>
		<tr>
			<td width='31%'>3. Tunjangan BPJS</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[tunj_bpjs],0)."</td>
			<td width='3.5%'></td>
			<td width='31%'>3. Tunjangan BPJS</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[tunj_bpjs],0)."</td>
		</tr>
		<tr>
			<td width='31%'>4. Tunjangan Jabatan</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[tunj_jab],0)."</td>
			<td width='3.5%'></td>
			<td width='31%'>4. Tunjangan Jabatan</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[tunj_jab],0)."</td>
		</tr>
		<tr>
			<td width='31%'>5. Tunjangan $r[nama_tl]</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[jumlah_tl],0)."</td>
			<td width='3.5%'></td>
			<td width='31%'>5. Tunjangan $r[nama_tl]</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[jumlah_tl],0)."</td>
		</tr>
		<tr>
			<td width='31%'>   Total Penerimaan</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[tot_gaji],0)."</td>
			<td width='3.5%'></td>
			<td width='31%'>   Total Penerimaan</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[tot_gaji],0)."</td>
		</tr>
		<tr>
			<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
		</tr>
		<tr>
			<td>POTONGAN :</td>
			<td></td>
			<td></td>
			<td></td>
			<td>POTONGAN :</td>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td width='31%'>1. Potongan BPJS</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[pot_bpjs],0)."</td>
			<td width='3.5%'></td>
			<td width='31%'>1. Potongan BPJS</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[pot_bpjs],0)."</td>
		</tr>
		<tr>
			<td width='31%'>2. Uang Muka Gaji</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[um_gaji],0)."</td>
			<td width='3.5%'></td>
			<td width='31%'>2. Uang Muka Gaji</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[um_gaji],0)."</td>
		</tr>
		<tr>
			<td width='31%'>3. Angsuran Pinjaman</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[angsuran],0)."</td>
			<td width='3.5%'></td>
			<td width='31%'>3. Angsuran Pinjaman</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[angsuran],0)."</td>
		</tr>
		<tr>
			<td width='31%'>4. Absen $r[alpa] hari</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[pot_absen],0)."</td>
			<td width='3.5%'></td>
			<td width='31%'>4. Absen $r[alpa] hari</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[pot_absen],0)."</td>
		</tr>
		<tr>
			<td width='31%'>5. PPh Pasal 21</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[pot_pph21],0)."</td>
			<td width='3.5%'></td>
			<td width='31%'>5. PPh Pasal 21</td>
			<td>Rp</td>
			<td width='12%' align='right'>".number_format($r[pot_pph21],0)."</td>
		</tr>
		<tr>
			<td width='31%' style='border-bottom:double 2px'>6. Potongan $r[nama_pl]</td>
			<td style='border-bottom:double 2px'>Rp</td>
			<td width='12%' style='border-bottom:double 2px' align='right'>".number_format($r[jumlah_pl],0)."</td>
			<td width='3.5%'></td>
			<td width='31%' style='border-bottom:double 2px'>6. Potongan $r[nama_pl]</td>
			<td style='border-bottom:double 2px'>Rp</td>
			<td width='12%' style='border-bottom:double 2px' align='right'>".number_format($r[jumlah_pl],0)."</td>
		</tr>
		<tr>
			<td width='31%' style='border-bottom:double 2px'>   Gaji Bersih</td>
			<td style='border-bottom:double 2px'>Rp</td>
			<td width='12%' style='border-bottom:double 2px' align='right'>".number_format($r[gaber],0)."</td>
			<td width='3.5%'></td>
			<td width='31%' style='border-bottom:double 2px'>   Gaji Bersih</td>
			<td style='border-bottom:double 2px'>Rp</td>
			<td width='12%' style='border-bottom:double 2px' align='right'>".number_format($r[gaber],0)."</td>
		</tr>
		<tr>
			<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
		</tr>
		<tr>
			<td></td>
			<td></td>
			<td>Paguyangan, ".jin_date_str($r[tanggal])."</td>
			<td width='3.5%'></td>
			<td></td>
			<td></td>
			<td>Paguyangan, ".jin_date_str($r[tanggal])."</td>
		</tr>
		<br>
		<br>
		<tr>
			<td></td>
			<td></td>
			<td style='border-bottom:double 2px'>$r[nama]</td>
			<td width='3.5%'></td>
			<td></td>
			<td></td>
			<td style='border-bottom:double 2px'>$r[nama]</td>
		</tr>
		<br>
		<br>";
}
echo "</table>";
?>