File size: 3.55Kb
<?php
error_reporting(7);
$p_user=stripslashes(trim($HTTP_POST_VARS['p_user']));
$p_schet=stripslashes(trim($HTTP_POST_VARS['p_schet']));
if ($query3!='') $p_user=$query3;
$p_login=stripslashes(trim($HTTP_POST_VARS['p_login']));
if (($p_user=='')&&($p_schet=='')&&($p_login==''))
{
print '<form action="/?'.$id.'/finance/schet/poisk" method=post>'.
'<b>'.
'KMX/'.
'<input type=text name=p_user size=6 value="">/'.
'<input type=text name=p_schet size=4 value="">'.
'</b>'.
'<input type=submit value="Искать">'.
'</form>'.
'<form action="/?'.$id.'/finance/schet/poisk" method=post>'.
'<b>'.
'Логин:'.
'<input type=text name=p_login size=16 value="">'.
'</b>'.
'<input type=submit value="Искать">'.
'</form>';
exit;
}
if ($p_user!='') $msg='ID='.$p_user;
if (($p_user=='')&&($p_login!='')&&($p_schet==''))
{
# Выбор пользователя
$q_=@mysql(DBName,"SELECT * FROM `users` WHERE `login` = '$p_login' LIMIT 0, 5");
$s=@mysql_num_rows($q_);
if ($s==1)
{
$data_=@mysql_fetch_array($q_);
$p_user=$data_['num'];
}
elseif ($s>1)
{
print '<table border=0 bgcolor=#70E2A0>';
print '<tr bgcolor=#D8998B><th> Пользователь </th><th> ID </th></tr>';
for ($i=0;$i<$s;$i++)
{
$data_=@mysql_fetch_array($q_);
if ($col) {$color='#96BDE0';$col=false;} else {$color='#7AABD8';$col=true;}
print '<tr bgcolor='.$color.'>';
print '<th> <a href="?'.$id.'/finance/schet/poisk/'.$data_['num'].'">'.$data_['login'].'.'.$data_['domain'].'.ru</a> </th>';
print '<th> '.$data_['num'].' </th>';
print '</tr>';
}
print '</table>';
exit;
}
else
{
print '<table border=0 bgcolor=#70E2A0>'.
'<tr bgcolor=#D8998B><th> Пользователь </th><th> ID </th></tr>'.
'<tr bgcolor=#000000><th colspan=2><font color=red><b>Пользователь с логином '.$p_login.' не найден</b></font></th></tr>'.
'</table>';
exit;
}
}
if ($p_user!='') $_query1="`id_user` = '".addslashes($p_user)."'"; else $_query1="1";
if ($p_schet!='') $_query2="`id` = '".addslashes($p_schet)."'"; else $_query2="1";
# Выбор счетов
$q3=@mysql(DBName,"SELECT * FROM `finance_schet` WHERE $_query1 AND $_query2 ORDER BY `createtime` DESC");
$s=@mysql_num_rows($q3);
print '<table border=0 width=100% bgcolor=#70E2A0><tr bgcolor=#D8998B>'.
'<th width=25><b>№№ п/п</b></th>'.
'<th width=120><b>Счет</b></th>'.
'<th><b>Пользователь</b></th>'.
'<th width=75><b>Сумма</b></th>'.
'<th width=100><b>Дата</b></th>'.
'<th><b>Описание</b></th>'.
'<th><b>Комментарий</b></th>'.
'</tr>';
$k=1;
if ($s>0)
{
for ($i=0;$i<$s;$i++)
{
$data3=@mysql_fetch_array($q3);
if ($col) {$color='#96BDE0';$col=false;} else {$color='#7AABD8';$col=true;}
print '<tr bgcolor='.$color.'>';
print '<th>'.($k+$i).'</th>';
print '<th align=left> <a href="?'.$id.'/finance/schet/info/'.$data3['id'].'">KMX/'.$data3['id_user'].'/'.$data3['id'].'</a></th>';
$q__=@mysql(DBName,"SELECT * FROM `users` WHERE `num` = '".$data3['id_user']."' LIMIT 0, 1");
$data__=mysql_fetch_array($q__);
print '<th> <a href="?'.$id.'/finance/users/'.$data3['id_user'].'">'.$data__['login'].'.'.$data__['domain'].'.ru</a> </th>';
print '<th>'.sprintf ("%01.2f",$data3['value']).' у.е.</th>';
print '<th>'.date("j.m H:i ",$data3['createtime']).'</th>';
print '<th>'.$data3['descr'].'</th>';
print '<th>'.$data3['comment'].'</th>';
print '</tr>';
}
}
else print '<tr bgcolor=#96BDE0><th colspan=7>Счетов не найдено</th></tr>';
print '</table>';
exit;
?>