-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpayment.php
76 lines (70 loc) · 3.2 KB
/
payment.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
<?php
require("header.php");
?>
<p style="font-size: 24pt; color: blue; "><a href="index.php">報名狀況</a> <a href="payment.php">收支狀況</a> </p>
<form method="post" name="listActivity">
<p style="font-size: 36pt; color: black;">選擇活動:
<select size="1" name="activity" style="font-size: 24pt; width: 300px; height: 50px; align: center;">
<?php
$result = mysql_query("SELECT * from `main` WHERE 1;");
while($row = mysql_fetch_array($result)){
echo '<option value="' . $row['AID'] . '"';
if(isset($_POST['activity'])){
if($_POST['activity'] == $row['AID'])
echo ' selected ';
}
echo '>' . $row['AName'] . '</option>' . "\n";
}
?>
</select>
<input type="submit" value="送出" >
</p>
</form>
<?
if(isset($_POST['activity'])){
$result = mysql_query("SELECT `TName`, `charge`, `chargeMember`, `back`, `backMember` FROM `main` WHERE `AID` = {$_POST['activity']};");
$TName = mysql_fetch_array($result);
LogBook("payment.php", "觀看 {$_POST['activity']} 收支狀況。");
$result = mysql_query("SELECT * FROM `{$TName['TName']}` ORDER BY `stuID`;");
$count = $countPay = $countCheck = $income = $incomeM = $expenditure = $expenditureM = $getM = $get = $payfree = 0;
while($row = mysql_fetch_array($result)){
$info = mysql_query("SELECT `isMember` FROM `stuinfo` WHERE `stuID` = '{$row['stuID']}';");
$isMember = mysql_fetch_array($info);
if($row['charge']==0)
;
else if($isMember['isMember']==1){
$incomeM += $TName['chargeMember'];
$expenditureM += $TName['backMember'];
if($row['money'])
$getM += $TName['chargeMember'];
}
else{
$income += $TName['charge'];
$expenditure += $TName['back'];
if($row['money'])
$get += $TName['charge'];
}
$count ++;
if($row['charge']==0){
mysql_query("UPDATE `{$TName['TName']}` SET `money` = true WHERE `stuID` = {$row['stuID']};");
$row['money'] = true;
$payfree++;
}
else if($row['money'])
$countPay++;
if($row['checkIn'])
$countCheck++;
}
echo "共 {$count} 人報名、{$countPay} 人已繳費、{$payfree} 人免繳費、{$countCheck} 人已報到。<br /><br /><br />\n";
?>
<table align="center" valign="middle" style="font-size: 24pt; ">
<tr><th width="200px"></th><th width="150px">應收</th><th width="150px">實收</th><th width="150px">退費</th><th width="150px">應收小計</th></tr>
<tr align="center"><td>會員</td><td><?php echo $incomeM; ?></td><td><?php echo $getM; ?></td><td><?php echo $expenditureM; ?></td><td><?php echo $incomeM-$expenditureM; ?></td></tr>
<tr align="center"><td>非會員</td><td><?php echo $income; ?></td><td><?php echo $get; ?></td><td><?php echo $expenditure; ?></td><td><?php echo $income-$expenditure; ?></td></tr>
<tr align="center"><td colspan="5">------------------------------------------------------------------------------</td></tr>
<tr align="center"><td>總計</td><td><?php echo $incomeM+$income; ?></td><td><?php echo $get+$getM; ?></td><td><?php echo $expenditureM+$expenditure; ?></td><td><?php echo $incomeM+$income-$expenditureM-$expenditure; ?></td></tr>
</table>
<?php
}
require("footer.php");
?>