nDh4

cari_material.php

Jun 21st, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.65 KB | None | 0 0
  1. <?php
  2. //Start session
  3. session_start();
  4.  
  5. //Check whether the session variable SESS_MEMBER_ID is present or not
  6. if(!isset($_SESSION["USERNAME"]) || (trim($_SESSION["PASS"]) == '')) {
  7. header("location: access-denied.php");
  8. exit();
  9. }
  10. ?>
  11. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  12. <html xmlns="http://www.w3.org/1999/xhtml">
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  15. <title>Untitled Document</title>
  16. <script src="../tim/datetimepicker_css.js"></script>
  17. <style type="text/css">
  18. <!--
  19. form {
  20. text-align: center;
  21. }
  22. -->
  23. </style>
  24. </head>
  25.  
  26. <body>
  27.  
  28. <p>
  29. <?php
  30. echo "<p>Selamat datang ".$_SESSION['USERNAME']." </p>";
  31. /*
  32. saya akan buang segala yang menurut saya belum perlu
  33. seperti html.. jadi biarlah tampilannya buruk rupa seperti
  34. wajah saya
  35. */
  36.  
  37. if($_POST)
  38. {
  39. $con = mysql_connect("localhost", "root", "root") or
  40. die("Error: " . mysql_error());
  41.  
  42.  
  43. mysql_select_db("pln2", $con);
  44. $date=date('Y-m-d',strtotime($_POST['TGL']) );
  45. //$NM=$_POST['NM'];
  46. $sql="SELECT a.HARI, a.TGL, d.C_TIM, d.NM_APP, a.ID_PEL, b.NM, a.NO_METER, a.DY_BR, a.GARDU, a.TIANG, c.KBL_TC, c.MCB,c.KONEKTOR,c.SI_WEDGE_CLAMP,c.NYM from td_plg a, tm_plg b, t_material c, t_tim d WHERE
  47. a.ID_PEL=b.ID_PEL
  48. and b.KTP=a.KTP
  49. and c.NO_MAT=b.NO_MAT and a.NO_METER=b.NO_METER
  50. AND d.C_TIM = b.C_TIM and b.STATUS_MAT=1
  51. AND d.C_TIM = c.C_TIM
  52. and a.TGL like '$date%'";
  53.  
  54. $result = mysql_query($sql)or die(mysql_error());
  55. /*
  56. pastikan dari point ini.. tampilannya BENAR!!
  57. */
  58. ?>
  59. </p>
  60. <table width="114%" class="display" id="datatables" border="1" >
  61. <thead>
  62. <tr>
  63. <th width="56" rowspan="2">Hari</th>
  64. <th width="82" rowspan="2">Tanggal</th>
  65. <th width="55" rowspan="2">Tim</th>
  66. <th width="92" rowspan="2">Nama APP</th>
  67. <th width="143" rowspan="2">Nama</th>
  68. <th width="121" rowspan="2">Id Pelanggan</th>
  69. <th width="114" rowspan="2">Nomor Meter</th>
  70. <th width="36" rowspan="2">Daya</th>
  71. <th width="49" rowspan="2">Gardu</th>
  72. <th width="44" rowspan="2">Tiang</th>
  73.  
  74. <th colspan="5">Kebutuhan Material Pelanggan</th>
  75. </tr>
  76. <tr>
  77. <th width="71">Kabel TC</th>
  78. <th width="58">MCB</th>
  79. <th width="99">Tap Connector</th>
  80. <th width="119">SI Wedge Clamp</th>
  81. <th width="61">NYM</th>
  82.  
  83. </tr>
  84. </thead>
  85. <tbody>
  86. <?php
  87. while ($row = mysql_fetch_array($result)) {
  88. ?>
  89. <tr>
  90. <td><? echo $row['HARI']; ?></td>
  91. <td><? echo $row['TGL']; ?></td>
  92. <td><? echo $row['C_TIM']; ?></td>
  93. <td><? echo $row['NM_APP']; ?></td>
  94. <td><? echo $row['NM']; ?></td>
  95. <td><? echo $row['ID_PEL']; ?></td>
  96. <td><? echo $row['NO_METER']; ?></td>
  97. <td><? echo $row['DY_BR']; ?></td>
  98. <td><? echo $row['GARDU']; ?></td>
  99. <td><? echo $row['TIANG']; ?></td>
  100.  
  101. <td><? echo $row['KBL_TC']; ?></td>
  102. <td><? echo $row['MCB']; ?></td>
  103. <td><? echo $row['KONEKTOR']; ?></td>
  104. <td><? echo $row['SI_WEDGE_CLAMP']; ?></td>
  105. <td><? echo $row['NYM']; ?></td>
  106. </tr>
  107.  
  108. </tbody>
  109. <?php
  110. }
  111. ?>
  112. <td colspan="15" align="center">
  113. <?php
  114. //jika data tidak ditemukan
  115. if(mysql_num_rows($result)==0){
  116. echo "<font color=red><blink>Tidak ada data yang dicari!</blink></font>";
  117. }
  118. ?>
  119. </td>
  120. </tr>
  121. </table>
  122. <form id="form1" name="form1" action="hsl_cr_mat.php" method="post" target="iframe">
  123. <p>
  124. <input type="hidden" name="HARI" value="<?=$row['HARI'];?>"/>
  125. <input type="hidden" name="TGL" value="<?=$date;?>"/>
  126. <input type="hidden" name="NM" value="<? echo $row['NM'];?>"/>
  127. <input type="hidden" name="ID_PEL" value="<?=$row['ID_PEL'];?>"/>
  128. <input type="hidden" name="NO_METER" value="<?=$row['NO_METER'];?>"/>
  129. <input type="hidden" name="DY_BR" value="<?=$row['DY_BR'];?>"/>
  130. <input type="hidden" name="GARDU" value="<?=$row['GARDU'];?>"/>
  131. <input type="hidden" name="TIANG" value="<?=$row['TIANG'];?>"/>
  132. <input type="hidden" name="ADM" value="<?=$row['ADM'];?>"/>
  133.  
  134. <input type="submit" name="convert" id="convert" value="Submit" />
  135. </p>
  136. </form>
  137.  
  138. <p>&nbsp; </p>
  139. <p>
  140. <?
  141. /*
  142. keluarannya benar.. kalau sudah benar.. ubah script diatas
  143. buat memakai php-excel
  144. caranya ubah2 aja jadi fungsi2 yg keluar di php-excel!!
  145. */
  146. }else{ //if POST?>
  147. </p>
  148.  
  149. <p>&nbsp;</p>
  150. <form action="cari_material.php" method="post" target='iframe'>
  151. <p>Pencarian data material</p>
  152. <p>
  153. <input type="text" name="TGL" id="TGL" maxlength="15" size="15" align="middle" />
  154. <img src="../tim/images2/cal.gif" alt="" height="18" style="cursor:pointer" onclick="javascript:NewCssCal('TGL','yyyyMMdd')"/>
  155. </p>
  156. <p>
  157. <input type="submit" value="Cari" align="middle">
  158. </p>
  159. </form><?
  160. }
  161.  
  162.  
  163. ?>
  164.  
  165. </body>
  166. </html>
Advertisement
Add Comment
Please, Sign In to add comment