-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpenalty.php
executable file
·185 lines (142 loc) · 4.37 KB
/
penalty.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?php
$timezone = "America/Chicago";
if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone);
$checkout = date('m/d/Y', strtotime("+1 day", strtotime($checkin)));
$theDate = date("m/d/y");
?>
<?php
include('config.php');
if(isset($_GET['borrowid'])){
$q=mysql_query("select * from book_loans where loan_id='".$_GET['borrowid']."'");
$name=mysql_fetch_array($q)or die(mysql_error());
}
?>
<form action="" method="post">
<table border="0" style="margin-top:15px; margin-left:20px; ">
<tr><td>
<input type="hidden" name="bid" value="<?php echo $name['borrowid']; ?>">
Borrowers Id:
<input type="hidden" name="accNo" value="<?php echo $name['accNo']; ?>">
</td>
<td>
<input type="text" readonly="readonly" name="borrowersid" style="padding:4px; width:250px;" value="<?php echo $name['studentid']; ?>"><br/>
</td></tr>
<?php
$q=mysql_query("select * from borrower where card_no='".$name['card_no']."'");
$id=mysql_fetch_array($q)or die(mysql_error());
?>
<tr><td>
Borrowers Name:
</td>
<td>
<input type="text" readonly="readonly" style="padding:4px; width:250px;" value="<?php echo $id['fname']." ".$id['lname']; ?>"><br/>
</td></tr>
<tr>
<td colspan="2" height="10"><hr/></td>
</tr>
<tr><td>
Date Due:
</td><td>
<input type="text" readonly="readonly" name="datedue" style="padding:4px; width:250px;" value="<?php echo date_format(date_create($name['duedate']), 'F d Y'); ?>" />
</td></tr>
<?php
include('config.php');
$sql="SELECT * FROM tblpayment";
$rs=mysql_query($sql);
$rowpay=mysql_fetch_array($rs);
$endTimeStamp = strtotime($name['duedate']);
$startTimeStamp = strtotime($theDate);
$timeDiff = abs($endTimeStamp - $startTimeStamp);
$numberDays = $timeDiff/86400; // 86400 seconds in one day
// and you might want to convert to integer
$numberDays = intval($numberDays);
?>
<tr><td>
Date Return:
</td><td>
<input type="text" readonly="readonly" name="datereturn" style="padding:4px; width:250px;" value="<?php echo date_format(date_create($theDate), 'F d, Y'); ?>"/>
</td>
<td>TotalDays</td><td><input name="totaldays" readonly="readonly" type="text" style="padding:4px; width:50px;" value="<?php echo $numberDays; ?>"/></td>
</tr></table>
<fieldset style="margin-top:25px; margin-left:20px; margin-right:20px;">
<table border="0" style="float:left; border:1px inset #333; margin-top:10px; ">
<tr>
<td>Total:</td><td>Php</td><td><input readonly="readonly" type="text" name="total" value="<?php echo number_format($numberDays*$name['amount'],2); ?>"></td>
</tr>
</table>
<fieldset style=" float:right; width:220px; margin-top:10px;">
<table border="0">
<tr><td colspan="2">
Over due book(<small>Base on day return</small>)
</td></tr>
<tr><td>
Php
</td>
<td><input type="text" readonly="readonly" value="<?php echo number_format($numberDays*$rowpay['amount'],2); ?>"></td></tr>
</table>
</fieldset>
<table border="0" style="float:left; margin-top:10px; ">
<tr><td>
<input type="submit" name="resibo" value="Pay" style="padding:8px; width:100px; float:left;">
</td></tr></table>
</fieldset>
</form>
<?php
if(isset($_POST['resibo'])){
/*$borrowersid=$_POST['borrowersid'];
$datedue=$_POST['datedue'];
$datereturn=$_POST['datereturn'];
$totaldays=$_POST['totaldays'];
$total=$_POST['total'];
$sql="insert into tblreciept (borrowersid,datedue,datereturn,totaldays,totalpay) values(
'".$borrowersid."',
'".$datedue."',
'".$datereturn."',
'".$totaldays."',
'".$total."'
)";
$pay=mysql_query($sql) or die (mysql_error());
if($pay){*/
?>
<script>
$(document).ready(function(){
$("#div5").fadeIn(1000);
});
</script>
<?php
// }
?>
<?php
}
if(isset($_GET['print/save'])){?>
<script>
$(document).ready(function(){
$("#div5").fadeIn(1000);
});
</script>
<?php
}
?>
<?php
/*if(isset($_POST['pay'])){
include('config.php');
$borrowersid=$_POST['borrowersid'];
$datedue=$_POST['datedue'];
$datereturn=$_POST['datereturn'];
$totaldays=$_POST['totaldays'];
$total=$_POST['total'];
$borrowid=$_POST['bidl'];
$sql="insert into tblreciept (borrowersid,datedue,datereturn,totaldays,totalpay) values(
'".$borrowersid."',
'".$datedue."',
'".$datereturn."',
'".$totaldays."',
'".$total."'
)";
$pay=mysql_query($sql) or die (mysql_error());
if($pay){
echo "success";
}
}
*/
?>