예제 #1
0
         $kekurangan_keluar = get_kekurangan($batas_masuk, $batas_keluar, $jam_masuk, $jam_keluar, "keluar");
     } else {
         $kekurangan_keluar = 0;
     }
     $cek_PSW = cek_PSW($batas_masuk, $batas_keluar, $jam_masuk, $jam_keluar);
     if ($kode_alasan == "DL NON SPPD" or $kode_alasan == "DL SPPD" or $kode_alasan == "DL LN" or $kode_alasan == "LA") {
         $cek_PSW[0] = 0;
         $cek_PSW[1] = 0;
         $cek_PSW[2] = 0;
         $cek_PSW[3] = 0;
         $cek_PSW[4] = 0;
     }
     $kode_alasan_keluar = $kode_alasan;
     $keterangan_keluar = $keterangan;
     if ($kode_alasan_masuk == "" or $kode_alasan_masuk == "TK") {
         $kekurangan_masuk = get_kekurangan($batas_masuk, $batas_keluar, $jam_masuk, $jam_keluar, "masuk");
     } else {
         $kekurangan_masuk = 0;
     }
     $cek_TL = cek_TL($kekurangan_masuk);
 } else {
     if ($status == "Tidak Masuk") {
         if ($kode_alasan == "" or $kode_alasan == "TK") {
             $kekurangan_masuk = 450;
         } else {
             $kekurangan_masuk = 0;
         }
         $kode_alasan_masuk = $kode_alasan;
         $keterangan_masuk = $keterangan;
     }
 }
예제 #2
0
파일: siapp.php 프로젝트: abbeet/server39
function isi_absensi($kode_unit)
{
    $hari_ini = date("Y-m-d");
    $kekurangan = 0;
    $oImport = import("`" . $kode_unit . "` = '0'");
    while ($Import = mysql_fetch_array($oImport)) {
        if ($Import['date_from'] < $hari_ini) {
            $src = $Import['id'];
            $date_from = strtotime($Import['date_from']);
            $date_until = strtotime($Import['date_until']);
            for ($date = $date_from; $date <= $date_until; $date += 86400) {
                $tanggal = date("Y-m-d", $date);
                $y = substr($tanggal, 0, 4);
                $m = substr($tanggal, 0, 7);
                $oPegawai = pegawai_list($kode_unit, "", "1", "nip");
                while ($Pegawai = mysql_fetch_array($oPegawai)) {
                    $nip = $Pegawai['nip'];
                    $u = substr($Pegawai['kode_bidang'], 0, 2);
                    cek_rekapitulasi($nip, $m, $u);
                    $kode_jadwal_kerja = $Pegawai['jadwal_kerja'];
                    $oJadwalKerja = jadwal_kerja_id($kode_jadwal_kerja);
                    if (mysql_num_rows($oJadwalKerja) != 0) {
                        $oJadwalKerja2 = jadwal_kerja("date_from <= '" . $tanggal . "' AND date_until >= '" . $tanggal . "'");
                        $nJadwalKerja2 = mysql_num_rows($oJadwalKerja2);
                        if ($nJadwalKerja2 == 0) {
                            $JadwalKerja = mysql_fetch_array($oJadwalKerja);
                        } else {
                            $JadwalKerja = mysql_fetch_array($oJadwalKerja2);
                        }
                        $NamaHari = strtolower(nama_hari($tanggal));
                        $JamKerja = $JadwalKerja[$NamaHari];
                        $oLibur = libur("tanggal = '" . $tanggal . "'");
                        $nLibur = mysql_num_rows($oLibur);
                        $hari = strtolower(nama_hari($tanggal));
                        if ($nLibur == 0 and $hari != "sabtu" and $hari != "minggu") {
                            $oPresensi = presensi($u, "nip = '" . $nip . "' AND tanggal = '" . $tanggal . "'");
                            $num = mysql_num_rows($oPresensi);
                            if ($num == 0) {
                                if ($Pegawai['status'] == '01' or $Pegawai['status'] == '02') {
                                    $jam = "00:00:00";
                                    $status = "";
                                    $kode_alasan = "TK";
                                    $kekurangan = get_kekurangan($nip, $tanggal, $jam, $status, $kode_alasan);
                                    $tidak_hadir = 1;
                                    $tanpa_keterangan = 1;
                                    $TK = 1;
                                    $sql = "\r\n\t\t\t\t\t\t\t\t\t\t\tINSERT INTO presensi_" . $u . " (nip,tanggal,status,kekurangan,tidak_hadir,tanpa_keterangan,TK,\r\n\t\t\t\t\t\t\t\t\t\t\tjam_kerja,src,cek) \r\n\t\t\t\t\t\t\t\t\t\t\tVALUES ('" . $nip . "','" . $tanggal . "','" . $status . "','" . $kekurangan . "','" . $tidak_hadir . "',\r\n\t\t\t\t\t\t\t\t\t\t\t'" . $tanpa_keterangan . "','" . $TK . "','" . $JamKerja . "','" . $src . "','50')\r\n\t\t\t\t\t\t\t\t\t\t";
                                    $query = mysql_query($sql);
                                } else {
                                    if ($Pegawai['status'] == '06' or $Pegawai['status'] == '07') {
                                        $jam = "00:00:00";
                                        $status = "";
                                        $kode_alasan = "DPK/DPB";
                                        $kekurangan = get_kekurangan($nip, $tanggal, $jam, $status, $kode_alasan);
                                        $tidak_hadir = 1;
                                        $dpk_dpb = 1;
                                        $sql = "\r\n\t\t\t\t\t\t\t\t\t\t\tINSERT INTO presensi_" . $u . " (nip,tanggal,status,kekurangan,tidak_hadir,dpk_dpb,jam_kerja,src,cek) \r\n\t\t\t\t\t\t\t\t\t\t\tVALUES ('" . $nip . "','" . $tanggal . "','" . $status . "','" . $kekurangan . "','" . $tidak_hadir . "','" . $dpk_dpb . "',\r\n\t\t\t\t\t\t\t\t\t\t\t'" . $JamKerja . "','" . $src . "','51')\r\n\t\t\t\t\t\t\t\t\t\t";
                                        $query = mysql_query($sql);
                                    } else {
                                        if ($Pegawai['status'] == '16') {
                                            $jam = "00:00:00";
                                            $status = "";
                                            $kode_alasan = "TB";
                                            $kekurangan = get_kekurangan($nip, $tanggal, $jam, $status, $kode_alasan);
                                            $tidak_hadir = 1;
                                            $tugas_belajar = 1;
                                            $TBplus = 1;
                                            $sql = "\r\n\t\t\t\t\t\t\t\t\t\t\tINSERT INTO presensi_" . $u . " (nip,tanggal,status,kekurangan,tidak_hadir,tugas_belajar,TBplus,jam_kerja,src,\r\n\t\t\t\t\t\t\t\t\t\t\tcek) \r\n\t\t\t\t\t\t\t\t\t\t\tVALUES ('" . $nip . "','" . $tanggal . "','" . $status . "','" . $kekurangan . "','" . $tidak_hadir . "',\r\n\t\t\t\t\t\t\t\t\t\t\t'" . $tugas_belajar . "','" . $TBplus . "','" . $JamKerja . "','" . $src . "','52')\r\n\t\t\t\t\t\t\t\t\t\t";
                                            $query = mysql_query($sql);
                                        }
                                    }
                                }
                            } else {
                                if ($num == 1) {
                                    $Presensi = mysql_fetch_array($oPresensi);
                                    if ($Presensi['jam'] != '00:00:00') {
                                        $jam = "00:00:00";
                                        $status = "9";
                                        $kode_alasan = "";
                                        $jam = "00:00:00";
                                        $kekurangan = get_kekurangan($nip, $tanggal, $jam, $status, $kode_alasan);
                                        $PSW[1] = 0;
                                        $PSW[2] = 0;
                                        $PSW[3] = 0;
                                        $PSW[4] = 0;
                                        $PSW = cek_1234($kekurangan);
                                        $sql = "\r\n\t\t\t\t\t\t\t\t\t\t\tINSERT INTO presensi_" . $u . " (nip,tanggal,status,kekurangan,PSW1,PSW2,PSW3,PSW4,jam_kerja,src,cek) \r\n\t\t\t\t\t\t\t\t\t\t\tVALUES ('" . $nip . "','" . $tanggal . "','" . $status . "','" . $kekurangan . "','" . $PSW[1] . "','" . $PSW[2] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t'" . $PSW[3] . "','" . $PSW[4] . "','" . $JamKerja . "','" . $src . "','53')\r\n\t\t\t\t\t\t\t\t\t\t";
                                        $query = mysql_query($sql);
                                    }
                                }
                            }
                        }
                    } else {
                        $oJadwalShift = jadwal_shift("nip = '" . $nip . "' AND tanggal = '" . $tanggal . "' AND jam_kerja != 'L' AND cek = '0'", "jam_masuk");
                        $nJadwalShift = mysql_num_rows($oJadwalShift);
                        if ($nJadwalShift != 0) {
                            while ($JadwalShift = mysql_fetch_array($oJadwalShift)) {
                                if ($JadwalShift['cek_masuk'] == '0') {
                                    $status = "";
                                    $kode_alasan = "TK";
                                    $kekurangan = 450;
                                    $tidak_hadir = 1;
                                    $tanpa_keterangan = 1;
                                    $TK = 1;
                                    $sql = "\r\n\t\t\t\t\t\t\t\t\t\t\tINSERT INTO presensi_" . $u . " (nip,tanggal,status,kekurangan,tidak_hadir,tanpa_keterangan,TK,\r\n\t\t\t\t\t\t\t\t\t\t\tjam_kerja,src,cek) \r\n\t\t\t\t\t\t\t\t\t\t\tVALUES ('" . $nip . "','" . $tanggal . "','" . $status . "','" . $kekurangan . "','" . $tidak_hadir . "',\r\n\t\t\t\t\t\t\t\t\t\t\t'" . $tanpa_keterangan . "','" . $TK . "','" . $JadwalShift['id'] . "','" . $src . "','71')\r\n\t\t\t\t\t\t\t\t\t\t";
                                    $query = mysql_query($sql);
                                    $sql = "UPDATE jadwal_shift SET cek = '1' WHERE id = '" . $JadwalShift['id'] . "'";
                                    $query = mysql_query($sql);
                                } else {
                                    if ($JadwalShift['cek_keluar'] == '0') {
                                        $oPresensi = presensi($u, "nip = '" . $nip . "' AND jam_kerja = '" . $JadwalShift['id'] . "' AND status = '1'");
                                        $Presensi = mysql_fetch_array($oPresensi);
                                        $status = "9";
                                        $kode_alasan = "";
                                        $jam = "00:00:00";
                                        $kekurangan = 450 - $Presensi['kekurangan'];
                                        $PSW[1] = 0;
                                        $PSW[2] = 0;
                                        $PSW[3] = 0;
                                        $PSW[4] = 0;
                                        $PSW = cek_1234($kekurangan);
                                        $sql = "\r\n\t\t\t\t\t\t\t\t\t\t\tINSERT INTO presensi_" . $u . " (nip,tanggal,status,kekurangan,PSW1,PSW2,PSW3,PSW4,jam_kerja,src,cek) \r\n\t\t\t\t\t\t\t\t\t\t\tVALUES ('" . $nip . "','" . $tanggal . "','" . $status . "','" . $kekurangan . "','" . $PSW[1] . "','" . $PSW[2] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t'" . $PSW[3] . "','" . $PSW[4] . "','" . $JadwalShift['id'] . "','" . $src . "','72')\r\n\t\t\t\t\t\t\t\t\t\t";
                                        $query = mysql_query($sql);
                                        $sql = "UPDATE jadwal_shift SET cek = '1' WHERE id = '" . $JadwalShift['id'] . "'";
                                        $query = mysql_query($sql);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            $sql = "UPDATE import SET `" . $kode_unit . "` = '1' WHERE id = '" . $Import['id'] . "'";
            $rs = mysql_query($sql);
        }
    }
}
예제 #3
0
function cek_PSW($batas_masuk, $batas_keluar, $jam_masuk, $jam_keluar)
{
    $PSW = array(0, 0, 0, 0, 0);
    $kekurangan_masuk = get_kekurangan($batas_masuk, $batas_keluar, $jam_masuk, $jam_keluar, "masuk");
    #echo 'd. '.$kekurangan_masuk."<BR>";
    $TL = cek_TL($kekurangan_masuk);
    if ($TL[1] == 1) {
        $kekurangan_keluar = 60 * (substr($jam_keluar, 0, 2) - substr(@$batas_keluar, 0, 2)) + substr($jam_keluar, 3, 2) - substr($batas_keluar, 3, 2);
        #echo 'i. '.$kekurangan_keluar."<BR>";
        $kekurangan_keluar = $kekurangan_masuk - $kekurangan_keluar;
        $kekurangan_keluar = max(0, $kekurangan_keluar);
    } else {
        $kekurangan_keluar = get_kekurangan($batas_masuk, $batas_keluar, $jam_masuk, $jam_keluar, "keluar");
    }
    #echo 'e. '.$kekurangan_keluar."<BR>";
    if ($kekurangan_keluar >= 1 and $kekurangan_keluar <= 30) {
        $PSW[1] = 1;
    } else {
        if ($kekurangan_keluar >= 31 and $kekurangan_keluar <= 60) {
            $PSW[2] = 1;
        } else {
            if ($kekurangan_keluar >= 61 and $kekurangan_keluar <= 90) {
                $PSW[3] = 1;
            } else {
                if ($kekurangan_keluar > 90) {
                    $PSW[4] = 1;
                }
            }
        }
    }
    return $PSW;
}
예제 #4
0
<?php

include "includes.php";
$batas_masuk = "07:30:00";
$batas_keluar = "16:30:00";
$jam_masuk = "11:16:00";
$jam_keluar = "00:00:00";
$kekurangan_masuk = get_kekurangan($batas_masuk, $batas_keluar, $jam_masuk, $jam_keluar, "masuk");
$kekurangan_keluar = get_kekurangan($batas_masuk, $batas_keluar, $jam_masuk, $jam_keluar, "keluar");
echo 'a. ' . $kekurangan_masuk . "<BR>";
echo 'b. ' . $kekurangan_keluar . "<BR>";
$TL = cek_TL($kekurangan_masuk);
echo 'c. ' . $TL[1] . "-" . $TL[2] . "-" . $TL[3] . "<BR>";
$PSW = cek_PSW($batas_masuk, $batas_keluar, $jam_masuk, $jam_keluar);
echo 'd. ' . $PSW[1] . "-" . $PSW[2] . "-" . $PSW[3] . "-" . $PSW[4] . "<BR>";