-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpaymentdischarge.php
More file actions
103 lines (93 loc) · 3.79 KB
/
paymentdischarge.php
File metadata and controls
103 lines (93 loc) · 3.79 KB
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
<?php
include("adheader.php");
include("dbconnection.php");
if(isset($_POST["submitfullamount"]))
{
$sql ="INSERT INTO payment(patientid,appointmentid,paiddate,paidtime,paidamount,status) values('$_GET[patientid]','$_GET[appointmentid]','$dt','$tim','$_POST[paidamount]','Active')";
if($qsql = mysqli_query($con,$sql))
{
echo "<script>alert('Payment Record Inserted Successfully.');</script>";
}
else
{
echo mysqli_error($con);
}
$sql ="UPDATE billing SET discount=$_POST[discountamount]+ discount, discountreason=CONCAT('$_POST[discountreason] , ', discountreason),discharge_time='$_POST[dischargetime]',discharge_date='$_POST[dischargedate]' WHERE appointmentid='$_GET[appointmentid]'";
$qsql = mysqli_query($con,$sql);
echo mysqli_error($con);
echo "<script>window.location='patientreport.php?patientid=$_GET[patientid]&appointmentid=$_GET[appointmentid]'</script>";
}
if(isset($_SESSION['patientid']))
{
$sql="SELECT * FROM payment WHERE paymentid='$_GET[editid]' ";
$qsql = mysqli_query($con,$sql);
$rsedit = mysqli_fetch_array($qsql);
}
$billappointmentid = $_GET['appointmentid'];
?>
<div class="container-fluid">
<div class="block-header">
<h2>Make Payment</h2>
</div>
<div class="card" style="padding: 10px">
<?php
include("viewpaymentreport.php");
?>
<section class="container">
<form method="post" action="">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th colspan="2" style="text-align:center;">Discharge</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Discharge Date</strong></td>
<td><input class="form-control" name="dischargedate" type="text" id="dischargedate" value="<?php echo date("Y-m-d"); ?>" readonly></td>
</tr>
<tr>
<td><strong>Discharge Time</strong></td>
<td><input class="form-control" name="dischargetime" type="text" id="dischargetime" value="<?php echo date("h:i:s"); ?>" readonly></td>
</tr>
<tr>
<td><strong>Balance Amount</strong></td>
<td><input class="form-control" name="balamt" type="text" id="balamt" value="<?php echo $balanceamt; ?>" readonly onkeyup="calculatepayable()"></td>
</tr>
<tr>
<td><strong>Discount Amount</strong></td>
<td><input class="form-control" name="discountamount" type="text" id="discountamount" value="0" onkeyup="calculatepayable()"></td>
</tr>
<tr>
<td><strong>Payable Amount</strong></td>
<td><input class="form-control" name="paidamount" type="text" id="paidamount" value="<?php echo $balanceamt; ?>" readonly></td>
</tr>
<tr>
<td><strong>Discount Reason</strong></td>
<td><textarea name="discountreason" id="discountreason"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input class="btn btn-raised g-bg-cyan" type="submit" name="submitfullamount" id="submitfullamount" value="Submit" /></td>
</tr>
</tbody>
</table>
<table align="right" width="342">
<thead>
<tr>
<td colspan="2" align="center"><a href='patientreport.php?patientid=<?php echo $_GET['patientid']; ?>&appointmentid=<?php echo $_GET['appointmentid']; ?>'><strong>View Patient Report >></strong></a></td>
</tr>
</thead>
</table>
</form>
</section>
</div>
</div>
<?php
include("adfooter.php");
?>
<script type="application/javascript">
function calculatepayable()
{
document.getElementById("paidamount").value = document.getElementById("balamt").value - document.getElementById("discountamount").value
}
</script>