Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /***********************/
- //FILE : simpan_absen.php
- /***********************/
- session_start();
- include "conn.php";
- if(isset($_POST['ok1']))
- {
- $jam_masuk = $_POST['jam1'];
- $menit_masuk = $_POST['menit1'];
- $jam_keluar = $_POST['jam2'];
- $menit_keluar= $_POST['menit2'];
- $tanggal = $_POST['tanggal'];
- $nama = $_POST['nama'];
- $jabatan = $_POST['jabatan'];
- $jam_masuk = $_POST['jam_masuk'];
- $jam_keluar = $_POST['jam_keluar'];
- $keterangan = $_POST['keterangan'];
- $num = count($nama);
- $sql = "INSERT INTO seamolec.staff
- (tanggal,nama,jabatan,jam_masuk,jam_keluar,total_jam,
- hadir,izin,sakit,cuti,tugasluar,tanpaketerangan,status)
- VALUES ";
- $jam_in=array();
- $jam_out=array();
- $total_jam=array();
- $values=array();
- for($i=0;$i<$num;$i++){
- if($menit_keluar[$i] < $menit_masuk[$i])
- {
- $jam_keluar[$i] -= 1;
- $menit_keluar[$i] += 60;
- }
- $jam_in[$i] = "{$jam_masuk[$i]}{$menit_masuk[$i]}";
- $jam_out[$i] = "{$jam_keluar[$i]}{$menit_keluar[$i]}";
- $total_jam[$i] = ($jam_keluar[$i] - $jam_masuk[$i] - 1).($menit_keluar[$i] - $menit_masuk[$i]);
- $values[]="(
- '{$tanggal[$i]}',
- '{$nama[$i]}',
- '{$jabatan[$i]}',
- '{$jam_in[$i]}',
- '{$jam_out[$i]}',
- '{$total_jam[$i]}',
- ".($keterangan[$i]=="1"?"'1'":"NULL").",
- ".($keterangan[$i]=="2"?"'1'":"NULL").",
- ".($keterangan[$i]=="3"?"'1'":"NULL").",
- ".($keterangan[$i]=="4"?"'1'":"NULL").",
- ".($keterangan[$i]=="5"?"'1'":"NULL").",
- ".($keterangan[$i]=="6"?"'1'":"NULL").",
- 'OK')";
- }
- $sql.=implode(",",$values);
- $result=mysql_query($sql);
- require "rekap_baru.php";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement