-
Notifications
You must be signed in to change notification settings - Fork 1
/
account_class.php
executable file
·113 lines (110 loc) · 4.15 KB
/
account_class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
include_once("top.php");
?>
<?php
if(($_GET["Submit"])){
if (empty($_GET[classname])){
echo "<script>alert('输入内容不合规!');</script>";
}
else
{
$sql="select * from selfbank_account_class where classname='$_GET[classname]' and ufid='$_SESSION[uid]'";
$query=mysql_query($sql);
$attitle=is_array($row=mysql_fetch_array($query));
if($attitle){
$returnstat="exits";
$status="账务分类名称已存在!";
}else{
$sql="insert into selfbank_account_class (classname, classtype,ufid) values ('$_GET[classname]', '$_GET[classtype]',$_SESSION[uid])";
$query=mysql_query($sql);
if($query){
$returnstat="success";
$status="新添加账务分类成功!";
}else{
$returnstat="failed";
$status="新添加分类失败!";
}
}
}
}
?>
<table align="center" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<form id="form1" name="form1" method="get" action="">
<td bgcolor="#FFFFFF" width="60%" align="center">
<label>账务类型名称:
<input name="classname" type="text" id="classname" />
</label>
</td>
<td width="20%">
<label>
账务分类选择
<select name="classtype" id="classtype">
<option value="1">收入</option>
<option value="2">支出</option>
</select>
</label>
</td>
<br/>
<td>
<label>
<input type="submit" name="Submit" value="新建" />
</label>
</td>
</form>
</tr>
<tr>
<td>
<?php
if($returnstat==="exits")
{ echo "<script>alert('$status');</script>";}
if($returnstat==="failed")
{ echo "<script>alert('$status');</script>";}
if($returnstat==="success")
{ echo "<script>alert('$status');</script>";}
?>
</td>
</tr>
</table>
<table align="center" width="100%" height="15" border="0" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
</table>
<table align="center" width="100%" border="0" cellpadding="5" cellspacing="1" >
<tr>
<th align="center" >账务类型名称</th>
<th align="center" ><font color='blue'>账务分类</font></th>
<th align="center" >操作</th>
</tr>
<?php
$sql="select * from selfbank_account_class where ufid='$_SESSION[uid]' and classtype='1'";
$query=mysql_query($sql);
while($row = mysql_fetch_array($query)){
echo "<tr><td align='center' bgcolor='#FFFFFF'>".$row[classname]."</td>";
if($row[classtype]==1)
echo "<td align='center' bgcolor='#FFFFFF'><font color='#0000FF'>收入</font></td>";
else
echo "<td align='center' bgcolor='#FFFFFF'><font color='#FF0000'>支出</font></td>";
echo "<td align='center' bgcolor='#FFFFFF'> <a href='delete_account_class.php?type=1&classid=".$row[classid]."'>修改</a> <a href='delete_account_class.php?type=3&classid=".$row[classid]."'>删除</a></td>";
}
echo "</tr>";
?>
<td align="center">    </th>
<th align="center" >    </font></th>
<th align="center" >  </th>
</tr>
<?php
$sql="select * from selfbank_account_class where ufid='$_SESSION[uid]' and classtype='2'";
$query=mysql_query($sql);
while($row = mysql_fetch_array($query)){
echo "<tr><td align='center' bgcolor='#FFFFFF'>".$row[classname]."</td>";
if($row[classtype]==1)
echo "<td align='center' bgcolor='#FFFFFF'><font color='#0000FF'>收入</font></td>";
else
echo "<td align='center' bgcolor='#FFFFFF'><font color='#FF0000'>支出</font></td>";
echo "<td align='center' bgcolor='#FFFFFF'><a href='delete_account_class.php?type=1&classid=".$row[classid]."'>修改</a> <a href='delete_account_class.php?type=3&classid=".$row[classid]."'>删除</a></td>";
}
echo "</tr>";
?>
</table>