Просмотр файла includes/adm/finance/schet_poisk.php

Размер файла: 3.55Kb
  1. <?php
  2. error_reporting(7);
  3. $p_user=stripslashes(trim($HTTP_POST_VARS['p_user']));
  4. $p_schet=stripslashes(trim($HTTP_POST_VARS['p_schet']));
  5. if ($query3!='') $p_user=$query3;
  6. $p_login=stripslashes(trim($HTTP_POST_VARS['p_login']));
  7.  
  8. if (($p_user=='')&&($p_schet=='')&&($p_login==''))
  9. {
  10. print '<form action="/?'.$id.'/finance/schet/poisk" method=post>'.
  11. '<b>'.
  12. 'KMX/'.
  13. '<input type=text name=p_user size=6 value="">/'.
  14. '<input type=text name=p_schet size=4 value="">'.
  15. '</b>'.
  16. '<input type=submit value="Искать">'.
  17. '</form>'.
  18. '<form action="/?'.$id.'/finance/schet/poisk" method=post>'.
  19. '<b>'.
  20. 'Логин:'.
  21. '<input type=text name=p_login size=16 value="">'.
  22. '</b>'.
  23. '<input type=submit value="Искать">'.
  24. '</form>';
  25. exit;
  26. }
  27.  
  28. if ($p_user!='') $msg='ID='.$p_user;
  29.  
  30. if (($p_user=='')&&($p_login!='')&&($p_schet==''))
  31. {
  32. # Выбор пользователя
  33. $q_=@mysql(DBName,"SELECT * FROM `users` WHERE `login` = '$p_login' LIMIT 0, 5");
  34. $s=@mysql_num_rows($q_);
  35.  
  36. if ($s==1)
  37. {
  38. $data_=@mysql_fetch_array($q_);
  39. $p_user=$data_['num'];
  40. }
  41. elseif ($s>1)
  42. {
  43. print '<table border=0 bgcolor=#70E2A0>';
  44. print '<tr bgcolor=#D8998B><th>&nbsp;Пользователь&nbsp;</th><th>&nbsp;ID&nbsp;</th></tr>';
  45. for ($i=0;$i<$s;$i++)
  46. {
  47. $data_=@mysql_fetch_array($q_);
  48. if ($col) {$color='#96BDE0';$col=false;} else {$color='#7AABD8';$col=true;}
  49. print '<tr bgcolor='.$color.'>';
  50. print '<th>&nbsp;<a href="?'.$id.'/finance/schet/poisk/'.$data_['num'].'">'.$data_['login'].'.'.$data_['domain'].'.ru</a>&nbsp;</th>';
  51. print '<th>&nbsp;'.$data_['num'].'&nbsp;</th>';
  52. print '</tr>';
  53. }
  54. print '</table>';
  55. exit;
  56. }
  57. else
  58. {
  59. print '<table border=0 bgcolor=#70E2A0>'.
  60. '<tr bgcolor=#D8998B><th>&nbsp;Пользователь&nbsp;</th><th>&nbsp;ID&nbsp;</th></tr>'.
  61. '<tr bgcolor=#000000><th colspan=2><font color=red><b>Пользователь с логином '.$p_login.' не найден</b></font></th></tr>'.
  62. '</table>';
  63. exit;
  64. }
  65. }
  66.  
  67. if ($p_user!='') $_query1="`id_user` = '".addslashes($p_user)."'"; else $_query1="1";
  68. if ($p_schet!='') $_query2="`id` = '".addslashes($p_schet)."'"; else $_query2="1";
  69.  
  70. # Выбор счетов
  71. $q3=@mysql(DBName,"SELECT * FROM `finance_schet` WHERE $_query1 AND $_query2 ORDER BY `createtime` DESC");
  72. $s=@mysql_num_rows($q3);
  73.  
  74. print '<table border=0 width=100% bgcolor=#70E2A0><tr bgcolor=#D8998B>'.
  75. '<th width=25><b>№№ п/п</b></th>'.
  76. '<th width=120><b>Счет</b></th>'.
  77. '<th><b>Пользователь</b></th>'.
  78. '<th width=75><b>Сумма</b></th>'.
  79. '<th width=100><b>Дата</b></th>'.
  80. '<th><b>Описание</b></th>'.
  81. '<th><b>Комментарий</b></th>'.
  82. '</tr>';
  83.  
  84. $k=1;
  85. if ($s>0)
  86. {
  87. for ($i=0;$i<$s;$i++)
  88. {
  89. $data3=@mysql_fetch_array($q3);
  90.  
  91. if ($col) {$color='#96BDE0';$col=false;} else {$color='#7AABD8';$col=true;}
  92.  
  93. print '<tr bgcolor='.$color.'>';
  94. print '<th>'.($k+$i).'</th>';
  95. print '<th align=left>&nbsp;<a href="?'.$id.'/finance/schet/info/'.$data3['id'].'">KMX/'.$data3['id_user'].'/'.$data3['id'].'</a></th>';
  96. $q__=@mysql(DBName,"SELECT * FROM `users` WHERE `num` = '".$data3['id_user']."' LIMIT 0, 1");
  97. $data__=mysql_fetch_array($q__);
  98. print '<th>&nbsp;<a href="?'.$id.'/finance/users/'.$data3['id_user'].'">'.$data__['login'].'.'.$data__['domain'].'.ru</a>&nbsp;</th>';
  99. print '<th>'.sprintf ("%01.2f",$data3['value']).' у.е.</th>';
  100. print '<th>'.date("j.m H:i ",$data3['createtime']).'</th>';
  101. print '<th>'.$data3['descr'].'</th>';
  102. print '<th>'.$data3['comment'].'</th>';
  103. print '</tr>';
  104. }
  105. }
  106. else print '<tr bgcolor=#96BDE0><th colspan=7>Счетов не найдено</th></tr>';
  107.  
  108. print '</table>';
  109.  
  110. exit;
  111. ?>