-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewpaymentreport.php
122 lines (117 loc) · 3.84 KB
/
viewpaymentreport.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
<?php
session_start();
include("dbconnection.php");
if(isset($_GET[delid]))
{
$sql ="DELETE FROM billing_records WHERE billingid='$_GET[delid]'";
$qsql=mysqli_query($con,$sql);
if(mysqli_affected_rows($con) == 1)
{
echo "<script>alert('billing record deleted successfully..');</script>";
}
}
?>
<section class="container">
<?php
$sqlbilling_records ="SELECT * FROM billing WHERE appointmentid='$billappointmentid'";
$qsqlbilling_records = mysqli_query($con,$sqlbilling_records);
$rsbilling_records = mysqli_fetch_array($qsqlbilling_records);
?>
<table width="1713" border="3">
<tbody>
<tr>
<th scope="col"><div align="right">Bill number </div></th>
<td><?php echo $rsbilling_records[billingid]; ?></td>
<td>Appointment Number </td>
<td><?php echo $rsbilling_records[appointmentid]; ?></td>
</tr>
<tr>
<th width="442" scope="col"><div align="right">Billing Date </div></th>
<td width="413"><?php echo $rsbilling_records[billingdate]; ?></td>
<td width="413">Billing time </td>
<td width="413"><?php echo $rsbilling_records[billingtime] ; ?></td>
</tr>
<tr>
<th scope="col"><div align="right"></div></th>
<td></td>
<th scope="col"><div align="right">Bill Amount </div></th>
<td><?php
$sql ="SELECT * FROM billing_records where billingid='$rsbilling_records[billingid]'";
$qsql = mysqli_query($con,$sql);
$billamt= 0;
while($rs = mysqli_fetch_array($qsql))
{
$billamt = $billamt + $rs[bill_amount];
}
?>
Rs. <?php echo $billamt; ?></td>
</tr>
<tr>
<th width="442" scope="col"><div align="right"></div></th>
<td width="413"> </td>
<th width="442" scope="col"><div align="right">Tax Amount (5%) </div></th>
<td width="413"> Rs. <?php echo $taxamt = 5 * ($billamt / 100); ?></td>
</tr>
<tr>
<th scope="col"><div align="right">Disount reason</div></th>
<td rowspan="4" valign="top"><?php echo $rsbilling_records[discountreason]; ?></td>
<th scope="col"><div align="right">Discount </div></th>
<td> Rs. <?php echo $rsbilling_records[discount]; ?></td>
</tr>
<tr>
<th rowspan="3" scope="col"> </th>
<th scope="col"><div align="right">Grand Total </div></th>
<td> Rs. <?php echo $grandtotal = ($billamt + $taxamt) - $rsbilling_records[discount] ; ?></td>
</tr>
<tr>
<th scope="col"><div align="right">Paid Amount </div></th>
<td>Rs. <?php
$sqlpayment ="SELECT sum(paidamount) FROM payment where appointmentid='$billappointmentid'";
$qsqlpayment = mysqli_query($con,$sqlpayment);
$rspayment = mysqli_fetch_array($qsqlpayment);
echo $rspayment[0];
?></td>
</tr>
<tr>
<th scope="col"><div align="right">Balance Amount</div></th>
<td>Rs. <?php echo $balanceamt = $grandtotal - $rspayment[0] ; ?></td>
</tr>
</tbody>
</table>
<p><strong>Payment report:</strong></p>
<?php
$sqlpayment = "SELECT * FROM payment where appointmentid='$billappointmentid'";
$qsqlpayment = mysqli_query($con,$sqlpayment);
if(mysqli_num_rows($qsqlpayment) == 0)
{
echo "<strong>No transaction details found..</strong>";
}
else
{
?>
<table width="840" border="3">
<tbody>
<tr>
<th scope="col">Paid Date</th>
<th scope="col">Paid time</th>
<th scope="col">Paid amount</th>
</tr>
<?php
while($rspayment = mysqli_fetch_array($qsqlpayment))
{
?>
<tr>
<td> <?php echo $rspayment[paiddate]; ?></td>
<td> <?php echo $rspayment[paidtime]; ?></td>
<td> Rs. <?php echo $rspayment[paidamount]; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
?>
<p><strong></strong></p>
</section>