[ Mini Kiebo ]
Server: Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586
Path:
D:
/
Backup
/
05122024
/
htdocs
/
simpeg
/
administrator
/
[
Home
]
File: libur_e.php
<?php require_once("../lib/konek.php"); require_once("../lib/konfigurasi_semua.php"); require_once("../lib/function_tanggal.php"); //konfigurasi nama file $thisForm = "view.php"; $actionForm = "action.php"; //actionnya if($_POST["libur_id"]) $liburId = $_POST["libur_id"]; if($_POST["mode"]) $mode = $_POST["mode"]; if($_GET["mode"]) { $mode = "edit"; } if($_GET["id"]) { $liburId = $_GET["id"]; $sql = "select * from hrd_hari_libur where libur_id = ".$liburId; $qId = mysql_query($sql); $dataUser = mysql_fetch_array($qId); $_POST["libur_id"] = $dataUser["libur_id"]; $_POST["libur_ket"] = $dataUser["libur_ket"]; $_POST["libur_tgl"] = $dataUser["libur_tgl"]; } if($_POST["btnSimpan"] || $_POST["btnUpdate"] || $_POST["btnApply"] || $_POST["btnApply2"]) { if($_POST["btnSimpan"] || $_POST["btnApply"]) { $sql = "select libur_id from hrd_hari_libur where libur_tgl = '".$_POST["libur_tgl"]."'"; } if($_POST["btnUpdate"] || $_POST["btnApply2"]) { $sql = "select libur_id from hrd_hari_libur where libur_id <> ".$_POST["libur_id"]." and libur_tgl = '".$_POST["libur_tgl"]."'"; } $Qrs_cek = mysql_query($sql); $datacek = mysql_fetch_array($Qrs_cek); if($datacek) $hint[0] = "Kode ".$_POST["libur_ket"]." sudah ada"; if(!$_POST["libur_ket"]) { $stat_err = true; } if(!$datacek && $stat_err!=true) { if($_POST["btnSimpan"] || $_POST["btnApply"]) { $sql = "select max(libur_id) as id from hrd_hari_libur"; $Qrs = mysql_query($sql); $id = mysql_fetch_array($Qrs); $liburId = $id["id"]+1; } if($_POST["btnUpdate"] || $_POST["btnApply2"]) { $liburId = $_POST["libur_id"]; } $nmTable = "hrd_hari_libur"; $tbField[0] = "libur_id"; $tbField[1] = "libur_ket"; $tbField[2] = "libur_tgl"; $tbIsi[0] = $liburId; $tbIsi[1] = "'".$_POST["libur_ket"]."'"; $tbIsi[2] = "'".date_db($_POST["libur_tgl"])."'"; if($_POST["btnSimpan"] || $_POST["btnApply"]) { for($start=0, $jumField=count($tbField); $start<$jumField; $start++) { if($start!=0) { $nmField = $nmField.",".$tbField[$start]; }else{ $nmField = $tbField[$start]; } } for($start=0, $jumIsi=count($tbIsi); $start<$jumIsi; $start++) { if($start!=0) { $isiField = $isiField.",".$tbIsi[$start]; }else{ $isiField = $tbIsi[$start]; } } $sql = "insert ".$nmTable." (".$nmField.") values(".$isiField.")"; } if($_POST["btnUpdate"] || $_POST["btnApply2"]) { for($start=0, $end=count($tbIsi); $start<$end; $start++) { if($start!=0) { $isiField = $isiField.",".$tbField[$start]."=".$tbIsi[$start]; }else{ $isiField = $tbField[$start]."=".$tbIsi[$start]; } } $sql = "update ".$nmTable." set ".$isiField." where ".$tbField[0]." = ".$tbIsi[0]; } $Qrs = mysql_query($sql); //entri ke absen $sql = "select pgw_id, pgw_nama, user_name, user_id from hrd_user_login a left join hrd_pgw b on a.id_pgw = b.pgw_id and a.id_lj <> 5 where pgw_id is not null order by pgw_nama asc"; $rs = mysql_query($sql); while($dataPgw=mysql_fetch_array($rs)) { $sql2 = "select absen_id from hrd_absen where id_user = ".$dataPgw["user_id"]." and absen_tgl = '".date_db($_POST["libur_tgl"])."'"; $Qrs2 = mysql_query($sql2); $cek = mysql_fetch_array($Qrs2); if(!$cek["absen_id"]) { $sql = "select max(absen_id) as id from hrd_absen"; $Qrs = mysql_query($sql); $id = mysql_fetch_array($Qrs); $absenId = $id["id"]+1; $sql = "insert into hrd_absen (absen_id,absen_tgl,id_user,absen_cin,absen_cout,absen_telat,absen_ket) values(".$absenId.",'".date_db($_POST["libur_tgl"])."',".$dataPgw["user_id"].",'00:00:00','00:00:00','n','".$_POST["libur_ket"]."')"; $rs2 = mysql_query($sql); } } //end if($Qrs) { $mode = "edit"; } if($_POST["btnSimpan"] || $_POST["btnUpdate"]) { header("location:libur_v.php"); }else{ $_POST["libur_id"] = $liburId; } } } if($_POST["btnKembali"]) { echo "<script>location.href='libur_v.php';</script>"; } $dir_lib = "../lib"; $dir_img = "../img"; //end ?> <html> <head> <title><?php echo $header;?></title> </head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <!--meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"--> <link rel="stylesheet" type="text/css" href="<?php echo $dir_lib;?>/lib-style.css"> <script language="JavaScript" type="text/javascript" src="<?php echo $dir_lib;?>/ew.js"></script> <script language="JavaScript" type="text/javascript" src="<?php echo $dir_lib;?>/func_curr.js"></script> <script language="JavaScript" type="text/javascript" src="<?php echo $dir_lib;?>/elements.js"></script> <!-- calendar stylesheet --> <link rel="stylesheet" type="text/css" media="all" href="<?php echo $dir_lib;?>/jscalendar/css/calendar-system.css" title="calendar-system" /> <!-- calendar script --> <script type="text/javascript" src="<?php echo $dir_lib;?>/jscalendar/calendar.js"></script> <script type="text/javascript" src="<?php echo $dir_lib;?>/jscalendar/lang/calendar-en.js"></script> <script type="text/javascript" src="<?php echo $dir_lib;?>/jscalendar/calendar-setup.js"></script> <!-- end --> <body> <form name="frmEdit" method="POST" action="libur_e.php"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td colspan="2" align="left" valign="middle" bgcolor="#000000" height="28"> <font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="white"> <?php echo $header;?></font> </td> </tr> <tr> <td colspan="2" align="left" bgcolor="#DEDBE7" height="20"> <?php include("menu_atas.php"); ?> </td> </tr> <tr> <td colspan="2"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr background="<?php echo $dir_img;?>/background.jpg" valign="middle" height="50"> <td height="50" width="10"> </td> <td height="50" width="300"> </td> <td height="50" width="100"> </td> <td> <?php echo $defFont;?> </font> </td> <td height="50" width="5"> </td> <td height="50" width="48" align="center"> <button type="submit" name="btnKembali" value="btnKembali"> <img src="<?php echo $dir_img;?>/cancel_f2.png"> </button> </td> <td height="50" width="5"> </td> <td height="50" width="48" align="center"> <button type="submit" name="<?php if($mode=="edit") { ?>btnApply2<?php }else{ ?>btnApply<?php } ?>" value="<?php if($mode=="edit") { ?>btnApply2<?php }else{ ?>btnApply<?php } ?>"> <img src="<?php echo $dir_img;?>/apply_f2.png"> </button> </td> <td height="50" width="5"> </td> <td height="50" width="50" align="center"> <button type="submit" name="<?php if($mode=="edit") { ?>btnUpdate<?php }else{ ?>btnSimpan<?php } ?>" value="<?php if($mode=="edit") { ?>btnUpdate<?php }else{ ?>btnSimpan<?php } ?>"> <img src="<?php echo $dir_img;?>/save_f2.png"> </button> </td> </tr> <tr bgcolor="#FFF8DC" valign="middle"> <td width="10"> </td> <td width="300"> </td> <td width="100"> </td> <td> </td> <td width="5"> </td> <td width="48" align="center" onmouseover="this.style.backgroundColor='#FF6666'" onmouseout="this.style.backgroundColor='#FFF8DC'"> <?php echo $defFont;?>Batal</font> </td> <td width="5"> </td> <td width="48" align="center" onmouseover="this.style.backgroundColor='#FF6666'" onmouseout="this.style.backgroundColor='#FFF8DC'"> <?php echo $defFont;?>Apply</font> </td> <td width="5"> </td> <td width="50" align="center" onmouseover="this.style.backgroundColor='#FF6666'" onmouseout="this.style.backgroundColor='#FFF8DC'"> <?php echo $defFont;?>Simpan</font> </td> </tr> </table> </td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0" width="100%" align="left"> <tr bgcolor="#FFF8DC"> <td align="right" width="35%"><?php echo $defFont;?>Tanggal <?php echo $tFont;?></td> <td width="65%"> <input onKeyDown="return tabOnEnter_select_with_button(this, event);" type="text" class="textField" name="libur_tgl" id ="libur_tgl" size="10" maxlength="10" value="<?php echo $_POST["libur_tgl"];?>"/> <img src="../img/b_calendar.png" width="16" height="16" align="middle" id="img_libur_tgl" style="cursor: pointer; border: 0px solid white;" title="Date selector" onMouseOver="this.style.background='red';" onMouseOut="this.style.background=''" /> <?php echo $defFont;?>(dd-mm-yy)<?php echo $tFont;?> </td> </tr> <tr bgcolor="#FFF8DC"> <td align="right" width="35%"><?php echo $defFont;?>Keterangan <?php echo $tFont;?></td> <td width="65%"> <input size="35" maxlength="35" type="teks" name="libur_ket" value="<?php echo $_POST["libur_ket"];?>" class="textField" onKeyDown="return tabOnEnter_select(this, event);"> <input type="hidden" name="libur_id" value="<?php echo $_POST["libur_id"];?>"> <input type="hidden" name="mode" value="<?php echo $mode;?>"> </td> </tr> <tr bgcolor="#FFF8DC"> <td align="right"><?php echo $defFont;?> <?php echo $tFont;?></td> <td> </td> </tr> <tr> <td colspan="2"> <font color="yellow"> <?php if($stat_err==true || $hint) echo "Periksa lagi inputan yang bertanda (*)";?><br> <?php if($stat_err==true) echo "<i>Ada field yang belum terisi. Silahkan mengisi terlebih dahulu</i><br>";?> <?php for($start=0, $end=count($hint); $start<$end; $start++) {?> <i><?php echo $defFont;?><?php echo $hint[$start];?> <?php echo $tFont;?></i> <?php } ?> <?php echo $tFont;?> </td> </tr> </table> </form> <script type="text/javascript"> Calendar.setup({ inputField : "libur_tgl", // id of the input field ifFormat : "<?=$formatCal;?>", // format of the input field showsTime : false, // will display a time selector button : "img_libur_tgl", // trigger for the calendar (button ID) singleClick : true, // double-click mode step : 1 // show all years in drop-down boxes (instead of every other year as default) }); </script> </body> </html>