Advertisement
Guest User

appruv_rev1

a guest
Nov 27th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.67 KB | None | 0 0
  1. <?php
  2. //include('top.php');?>
  3. <?php
  4. require_once('koneksi.php');
  5. ?>
  6. <?php
  7. if(isset($_POST['submit'])):
  8.     //membuat session array dengan variabel - variabel POST
  9.     $_SESSION['pos']=$_POST;
  10. endif;
  11.  
  12. if(isset($_SESSION['pos'])):
  13.     $cari=$_SESSION['pos']['cari'];
  14. else:
  15.     $cari='';
  16. endif;
  17. ?>
  18. <html>
  19. <head>
  20. <title>Untitled Document</title>
  21. <script language="javascript">
  22. function submit_form(){
  23. document.form1.submit();
  24. document.frmactive.submit();
  25. }
  26. </script>
  27. </head>
  28. <script type="text/javascript">
  29. <!--
  30. function un_check(){
  31. for (var i = 0; i < document.frmactive.elements.length; i++) {
  32. var e = document.frmactive.elements[i];
  33. if ((e.name != 'allbox') && (e.type == 'checkbox')) {
  34. e.checked = document.frmactive.allbox.checked;
  35. }}}
  36. //-->
  37. </script>
  38.  
  39. <body>
  40. <table width="955" border="2">
  41.   <tr>
  42.     <td width="750"><center><?php $a = mysql_query("SELECT * FROM data_karyawan where NAMA_LENGKAP LIKE '$username'" );
  43.       $res=mysql_fetch_array($a)?>
  44.     <font face="Comic Sans MS">Pencarian Data Cuti</font>
  45.       <form id="form1" name="form1" method="post" action="">       
  46.         <?php echo "<select name='cari'>";
  47.        
  48.         $tampil=mysql_query("SELECT * FROM struktur where NIK LIKE '%$res[NIK]%'" );
  49.         echo "<option>- Pilih NIK -</option>";
  50.  
  51.         while($w=mysql_fetch_array($tampil))
  52.         {
  53.         echo "<option value=$w[NIK_BAWAHAN]>$w[NIK_BAWAHAN]  </option> ";        
  54.         }
  55.         echo "</select>";
  56.         ?>
  57.         <input type="submit" name="Submit" id="Submit" value="Pencarian" />
  58.       </form>
  59.         <?
  60.       $cari=$_POST['cari'];
  61.       if(!empty($cari)){
  62.       ?>
  63.       <p><font face="Comic Sans MS">Hasil Pencarian Anda:</font></p>
  64.       <?
  65.       $pencarian=mysql_query("SELECT * FROM cuti where NIK LIKE '%$cari%' " );
  66.       $totalcari=mysql_num_rows($pencarian);
  67.       if($totalcari=='0'){
  68.       echo "<center><blink><font size='3'>Mohon maaf NIK  <strong>$cari</strong> tidak ada di dalam database kami";
  69.       }
  70.       else
  71.       {
  72.       echo "Data Cuti dengan NIK <strong>$cari</strong>  yang anda cari adalah: ";
  73.       }
  74.       ?>
  75.       <?php $c = mysql_query("SELECT * FROM data_karyawan where NIK LIKE '$cari'" );
  76.       $sip=mysql_fetch_array($c)?>
  77.      
  78.       <table width="750" border="0">
  79.       <tr>
  80.         <td width="83">NAMA :</td>
  81.         <td width="277"><?=$sip[NAMA_LENGKAP]?></td>
  82.         <td width="180">NIK :</td>
  83.         <td width="180"><?=$sip[NIK]?></td>
  84.       </tr>
  85.       <tr>
  86.         <td>JABATAN :</td>
  87.         <td><?=$sip[POSISI]?></td>
  88.         <td>DEPARTEMEN:</td>
  89.         <td><?=$sip[DEPARTEMEN]?></td>
  90.       </tr>
  91.     </table>
  92.     <form id="frmactive" name="frmactive" method="post" action="">
  93.     <table border="1">
  94.     <tr>
  95.     <td colspan="5"><input name="APPROV" type="submit" id="APPROV" value="APPROV" />
  96.     <input name="NOT_APPROV" type="submit" id="NOT_APPROV" value="NOT_APPROV" /></td>
  97.     </tr>
  98.       <tr align="center" valign="middle">
  99.         <td height="3"><h5>NO</h5></td>
  100.         <td height="3"><h5>JENIS CUTI</h5></td>
  101.         <td height="3"><h5>TANGGAL CUTI</h5></td>
  102.         <td height="3"><h5>TANGGAL PENGAJUAN</h5></td>
  103.         <td height="3"><h5>TANGGAL APPROVAL</h5></td>
  104.         <td height="3"><h5>KEPERLUAN</h5></td>
  105.         <td height="3"><h5>STATUS</h5></td>
  106.         <td height="3"><h5>NIK ATASAN</h5></td>
  107.         <td height="3"><h5>APPROVAL</h5></td>
  108.         </tr>
  109.         <?
  110.         while($pencarian1=mysql_fetch_array($pencarian)){
  111.         ?>
  112.         <tr align="center" valign="middle">
  113.           <td height="2"><h5><?=$pencarian1['NO']; ?></h5></td>
  114.           <td height="2"><h5><?=$pencarian1['JENIS_CUTI']; ?></h5></td>
  115.           <td height="2"><h5><?=$pencarian1['TANGGAL_CUTI']; ?></h5></td>
  116.           <td height="2"><h5><?=$pencarian1['TANGGAL_PENGAJUAN']; ?></h5></td>
  117.           <td height="2"><h5><?=$pencarian1['TANGGAL_APPROVAL']; ?></h5></td>
  118.           <td height="2"><h5><?=$pencarian1['KEPERLUAN']; ?></h5></td>
  119.           <td height="2"><h5><?=$pencarian1['APPROVAL']; ?></td>
  120.           <td height="2"><h5><?=$pencarian1['NIK_ATASAN']; ?></td>
  121.           <td align="center"><?php if ($pencarian1['APPROVAL'] != 'APPROV') { if ($pencarian1['APPROVAL'] != 'NOT_APPROV') {?><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $pencarian1['NO']; ?>"><?php }} ?></td>
  122.           </tr>
  123.         <?
  124.         }
  125.         ?>
  126.     </table>
  127.     <?
  128.       }
  129.       ?></form></center>
  130.       </td>
  131. <td align="center" valign="top"><p>
  132.                 <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="200" height="200">
  133.             <param name="movie" value="images/calendar.swf" />
  134.             <param name="quality" value="high" />
  135.             <param name="wmode" value="opaque" />
  136.             <param name="swfversion" value="8.0.35.0" />
  137.             <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don't want users to see the prompt. -->
  138.             <param name="expressinstall" value="Scripts/expressInstall.swf" />
  139.             <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
  140.             <!--[if !IE]>-->
  141.             <object type="application/x-shockwave-flash" data="images/calendar.swf" width="200" height="200">
  142.               <!--<![endif]-->
  143.               <param name="quality" value="high" />
  144.               <param name="wmode" value="opaque" />
  145.               <param name="swfversion" value="8.0.35.0" />
  146.               <param name="expressinstall" value="Scripts/expressInstall.swf" />
  147.               <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
  148.               <div>
  149.                 <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
  150.                 <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
  151.               </div>
  152.               <!--[if !IE]>-->
  153.               </object>
  154.             <!--<![endif]-->
  155.     </object>
  156.           </p>
  157.          
  158.       <object id="FlashID2" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="200" height="200">
  159.               <param name="movie" value="images/dialclock_LlRmUTNF.swf" />
  160.               <param name="quality" value="high" />
  161.               <param name="wmode" value="opaque" />
  162.               <param name="swfversion" value="6.0.65.0" />
  163.               <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don't want users to see the prompt. -->
  164.               <param name="expressinstall" value="Scripts/expressInstall.swf" />
  165.               <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
  166.               <!--[if !IE]>-->
  167.               <object type="application/x-shockwave-flash" data="images/dialclock_LlRmUTNF.swf" width="190" height="60">
  168.                 <!--<![endif]-->
  169.                 <param name="quality" value="high" />
  170.                 <param name="wmode" value="opaque" />
  171.                 <param name="swfversion" value="6.0.65.0" />
  172.                 <param name="expressinstall" value="Scripts/expressInstall.swf" />
  173.                 <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
  174.                 <div>
  175.                   <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
  176.                   <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
  177.                 </div>
  178.                 <!--[if !IE]>-->
  179.               </object>
  180.               <!--<![endif]-->
  181.       </object>
  182.     <p>&nbsp; </p></td>
  183.   </tr>
  184. </table>
  185. <script type="text/javascript">
  186. swfobject.registerObject("FlashID");
  187. </script>
  188. </body>
  189. </html>
  190.  
  191.  
  192. <?php
  193. $e = mysql_query ("SELECT * FROM cuti where NIK='$cari' ORDER BY SISA_CUTI DESC" );
  194.      $row = mysql_fetch_array($e);
  195.          $z=$row["SISA_CUTI"];
  196.          $y=$z-1;
  197.    
  198. $tuk = mysql_query("SELECT * FROM data_karyawan where NAMA_LENGKAP LIKE '$username'" );
  199.       $req=mysql_fetch_array($tuk);
  200. $g = $req["NIK"];
  201.  
  202. if(isset($_POST['checkbox'])){
  203. $checkbox = $_POST['checkbox'];
  204. if(isset($_POST['APPROV'])) $APPROV=$_POST['APPROV'];
  205. $NO = "('" . implode( "','", $checkbox ) . "');" ;
  206. $NO=1;
  207. $a = date('d/m/Y');
  208.  
  209. $sql="UPDATE cuti SET APPROVAL = '".(isset($APPROV)?'APPROV':'NOT_APPROV')."',
  210.             TANGGAL_APPROVAL = '".(isset($APPROV)?$a:NULL)."',
  211.             SISA_CUTI = '".(isset($APPROV)?$y:$z)."',
  212.             NIK_ATASAN = '".(isset($APPROV)?$g:NULL)."' WHERE NO=$NO" ;
  213.  
  214.             $result = mysql_query($sql) or die(mysql_error());
  215. }
  216. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement