PageRenderTime 93ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/Quản lý website bán quần áo PHP/quanly/cumchucnang/hoadon/quan_ly.php

https://gitlab.com/phamngsinh/baitaplon_sinhvien
PHP | 168 lines | 158 code | 6 blank | 4 comment | 20 complexity | b10ceede57a876065eeb67fd6fa2815c MD5 | raw file
  1. <?php
  2. chong_pha_hoai();
  3. //echo "chao <hr>";
  4. ?>
  5. <?php
  6. //test(defined('__DIR__'));
  7. ?>
  8. <style type="text/css">
  9. a.sua_xoa:link { font-size: 16px; text-decoration: none; color: #FF00FF; font-weight: bold}
  10. a.sua_xoa:visited { font-size: 16px; color: #FF00FF; text-decoration: none; font-weight: bold}
  11. a.sua_xoa:hover { font-size: 16px; text-decoration: underline; color: #FF8C00; font-weight: bold; font-style: normal; }
  12. a.thua__link_1:link { font-size: 16px; text-decoration: none; color: #0b55c4; }
  13. a.thua__link_1:visited { font-size: 16px; color: #0b55c4; text-decoration: none; }
  14. a.thua__link_1:hover { font-size: 16px; text-decoration: none; color: #084095; font-style: normal; }
  15. </style>
  16. <?php
  17. function xuat_link($st)
  18. {
  19. //if($_GET['trang']==""){$_GET['trang']=1;}
  20. ?>
  21. <style>
  22. a.pt3
  23. {
  24. color:black;
  25. text-decoration: none;
  26. font-weight:bold;
  27. }
  28. a.pt3:hover
  29. {
  30. color:red;
  31. text-decoration: none;
  32. font-weight:bold;
  33. }
  34. </style>
  35. <?php
  36. echo "<center>";
  37. if($_GET['trang']!="")
  38. {
  39. if(ereg("&trang=",$_SERVER['REQUEST_URI']))
  40. {
  41. $_SERVER['REQUEST_URI']=str_replace("&trang=","",$_SERVER['REQUEST_URI']);
  42. $_SERVER['REQUEST_URI']=substr($_SERVER['REQUEST_URI'],0,-strlen($_GET['trang']));
  43. $lpt=$_SERVER['REQUEST_URI']."&trang=";
  44. }
  45. else
  46. {
  47. $lpt=$_SERVER['REQUEST_URI']."&trang=";
  48. }
  49. }
  50. else
  51. {
  52. $_SERVER['REQUEST_URI']=str_replace("&trang=","",$_SERVER['REQUEST_URI']);
  53. $lpt=$_SERVER['REQUEST_URI']."&trang=";
  54. }
  55. if($_GET['trang']!="" and $_GET['trang']!="1")
  56. {
  57. if($_GET['trang']=="" or $_GET['trang']==1)
  58. {
  59. $k=1;
  60. }
  61. else
  62. {
  63. $k=$_GET['trang']-1;
  64. }
  65. $link_t=$lpt.$k;
  66. $link_d=$lpt."1";
  67. echo '<a href="'.$link_d.'" style="margin-right:10px" class="pt3">Đầu</a>';
  68. echo '<a href="'.$link_t.'" style="margin-right:10px" class="pt3">Trước</a>';
  69. }
  70. if($_GET['trang']==""){$a=1;}else{$a=$_GET['trang'];}
  71. $b_1=$_GET['trang']-5;$n_1=$b_1;
  72. if($b_1<1){$b_1=1;}
  73. $b_2=$_GET['trang']+5;
  74. if($b_2>=$st){$n_2=$b_2;$b_2=$st;}
  75. //echo $b_1."<hr>";
  76. if($n_1<0){$v=(-1)*$n_1;$b_2=$b_2+$v;}
  77. if($n_2>=$st){$v_2=$n_2-$st;$b_1=$b_1-$v_2;}
  78. if($b_1>1){echo ' ... ';}
  79. for($i=$b_1;$i<=$b_2;$i++)
  80. {
  81. $lpt_1=$lpt.$i;
  82. if($i>0 && $i<=$st)
  83. {
  84. if($i!=$a)
  85. {
  86. ?>
  87. <a href="<?php echo $lpt_1; ?>" class="pt3"><?php echo $i;?> </a>
  88. <?php
  89. }
  90. else
  91. {
  92. echo "<b style=\"color:red\">$i</b>";
  93. }
  94. }
  95. }
  96. if($b_2<$st){echo ' ... ';}
  97. if($_GET['trang']!=$st && $st!=1)
  98. {
  99. if($_GET['trang']==$st)
  100. {
  101. $k=$st;
  102. }
  103. else
  104. {
  105. $k=$_GET['trang']+1;
  106. if($_GET['trang']==""){$k=2;}
  107. }
  108. $link_s=$lpt.$k;
  109. $link_cuoi=$lpt.$st;
  110. echo '<a href="'.$link_s.'" style="margin-left:10px" class="pt3">Sau</a>';
  111. echo '<a href="'.$link_cuoi.'" style="margin-left:10px" class="pt3">Cuối</a>';
  112. }
  113. echo "</center>";
  114. }
  115. ?>
  116. <?php
  117. $sd=20;
  118. $b_tv="select count(*) from hoadon";
  119. $b_tv_1=mysql_query($b_tv);
  120. $b_tv_2=mysql_fetch_row($b_tv_1);
  121. $st=ceil($b_tv_2[0]/$sd);
  122. if($_GET['trang']==""){$vtbd=0;}else{$vtbd=($_GET['trang']-1)*$sd;}
  123. $tv="select * from hoadon order by id desc limit $vtbd,$sd";
  124. $tv_1=mysql_query($tv);
  125. ?>
  126. <table width="913px" id="er" style="text-align:left;margin:6px 0px 6px 0px;font-size:16px;color:#666666">
  127. <tr>
  128. <td width="155px">Người gửi hóa đơn</td>
  129. <!--<td width="155px"> danh</td>-->
  130. <td width="250px">Email</td>
  131. <td width="200px">Điện thoại</td>
  132. <td width="100px" align="center">Xem</td>
  133. <td width="100px" align="center">Xóa</td>
  134. </tr>
  135. <?php
  136. while($tv_2=mysql_fetch_array($tv_1))
  137. {
  138. $link_xem="?thamso=xem_hoa_don&id=$tv_2[id]&trang=$_GET[trang]";
  139. $link_xoa="?thamso=xoa_hoa_don&id=$tv_2[id]&trang=$_GET[trang]";
  140. ?>
  141. <tr>
  142. <td ><a href="<?php echo $link_xem; ?>" class="thua__link_1"><?php echo $tv_2['ho_ten']; ?></a></td>
  143. <!--<td ><a href="#" class="thua__link_1"><?php //echo $tv_2['ky_danh']; ?></a></td>-->
  144. <td ><?php echo $tv_2['email']; ?></td>
  145. <td ><?php echo $tv_2['dien_thoai']; ?></td>
  146. <td width="100px" align="center"><a href="<?php echo $link_xem; ?>" class="sua_xoa">Xem</a></td>
  147. <td width="100px" align="center"><a href="<?php echo $link_xoa; ?>" class="sua_xoa">Xóa</a></td>
  148. </tr>
  149. <?php
  150. }
  151. ?>
  152. <tr>
  153. <td colspan="6">
  154. <?php
  155. xuat_link($st);
  156. ?>
  157. </td>
  158. </tr>
  159. </table>
  160. <script type="text/javascript">
  161. table_css_2("er");
  162. </script>