function get_jumlah_hari_kerja($m, $y) { $bulan = $y . "-" . $m; $jumlah_hari = jumlah_hari($m, $y); $tgl = $bulan . "-" . $jumlah_hari; $hari_kerja = 0; #$date_until = last_import($u); #if ($tgl >= date("Y-m-d") or $tgl >= $date_until) $jumlah_hari = substr($date_until,8,2) + 0; for ($x = 1; $x <= $jumlah_hari; $x++) { if ($x < 10) { $x = "0" . $x; } $tgl = $bulan . "-" . $x; #$oLibur = libur("tanggal = '".$tgl."'"); #$nLibur = mysql_num_rows($oLibur); $s_libur = "SELECT * FROM libur WHERE tanggal = '" . $tgl . "'"; $q_libur = mysql_query($s_libur); $n_libur = mysql_fetch_array($q_libur); $hari = strtolower(nama_hari($tgl)); if ($hari != "sabtu" and $hari != "minggu" and $nLibur == 0) { $hari_kerja++; } } return $hari_kerja; }
$s_pegawai = "SELECT * FROM m_idpegawai WHERE nip = '" . $q . "' AND (kdunitkerja LIKE '" . $bidang . "%' OR kdunitkerja = '2320000')"; } else { $s_pegawai = "SELECT * FROM m_idpegawai WHERE nip = '" . $q . "' AND kdunitkerja LIKE '" . $bidang . "%'"; } #echo $s_pegawai."<BR>"; $q_pegawai = mysql_query($s_pegawai); $n_pegawai = mysql_num_rows($q_pegawai); if ($n_pegawai == 0) { $nip = ""; } else { $pegawai = mysql_fetch_array($q_pegawai); $nip = $pegawai['nip']; } $url = "m=" . $m . "&y=" . $y . "&u=" . $u . "&b=" . $b . "&s=" . $s . "&r=" . $r; $ed_link = "index.php?p=470&u=" . $u; $jumlah_hari = jumlah_hari($m, $y); $s_presensi = "SELECT * FROM presensi WHERE nip = '" . $nip . "' AND tanggal LIKE '" . $bulan . "%' ORDER BY tanggal"; #echo $s_presensi."<BR>"; $q_presensi = mysql_query($s_presensi); $n_presensi = mysql_num_rows($q_presensi); if ($n_presensi != 0) { $l = 0; while ($presensi = mysql_fetch_array($q_presensi)) { foreach ($field as $k => $val) { $col[$val][] = $presensi[$val]; } $ed[] = $ed_link . "&q=" . $presensi['id']; #$rowspan[] = $counta; #$d = substr($presensi['tanggal'],8,2) + 0; #if ($d % 2 == 1) $class[] = "row1"; #else $class[] = "row0";
$ndata = $n_data; } if (empty($n_data)) { $s_pegawai = "SELECT * FROM m_idpegawai WHERE nip = '" . $q . "'"; $q_pegawai = mysql_query($s_pegawai); $Pegawai = mysql_fetch_array($q_pegawai); $kode_unit = substr($Pegawai['kdunitkerja'], 0, 5); } else { $kode_unit = substr($_POST['kode_unit'], 0, 5); } $s_unit = "SELECT * FROM kd_unitkerja WHERE kdunit = '" . $kode_unit . "00'"; $q_unit = mysql_query($s_unit); $unit = mysql_fetch_array($q_unit); $nama_unit = $unit->nmunit; $a_tgl = $y . "-" . $m . "-01"; $b_tgl = $y . "-" . $m . "-" . jumlah_hari($m + 0, $y); if (@$_POST["excel"] or @$_POST["calc"] or $t == "excel" or $t == "calc") { if (@$_POST["excel"] or $t == "excel") { $ext = ".xls"; } else { if (@$_POST["calc"] or $t == "calc") { $ext = ".ods"; } } header("Content-type: application/octet-stream"); # replace excelfile.xls with whatever you want the filename <strong class="highlight">to</strong> default <strong class="highlight">to</strong> $filename = "presensi_" . $y . $m . $ext; header("Content-Disposition: attachment; filename=\"{$filename}\""); header("Pragma: no-cache"); header("Expires: 0"); for ($n = 1; $n <= $ndata; $n++) {
function get_jumlah_hari_kerja($u, $m, $y) { $bulan = $y . "-" . $m; $jumlah_hari = jumlah_hari($m, $y); $tgl = $bulan . "-" . $jumlah_hari; $hari_kerja = 0; $date_until = last_import($u); if ($tgl >= date("Y-m-d") or $tgl >= $date_until) { $jumlah_hari = substr($date_until, 8, 2) + 0; } for ($x = 1; $x <= $jumlah_hari; $x++) { if ($x < 10) { $x = "0" . $x; } $tgl = $bulan . "-" . $x; $oLibur = libur("tanggal = '" . $tgl . "'"); $nLibur = mysql_num_rows($oLibur); $hari = strtolower(nama_hari($tgl)); if ($hari != "sabtu" and $hari != "minggu" and $nLibur == 0) { $hari_kerja++; } } return $hari_kerja; }