-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathviewbilling.php
146 lines (129 loc) · 4.69 KB
/
viewbilling.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
<?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 class="table table-bordered table-striped">
<tbody>
<tr>
<th scope="col"><div align="right">Bill number </div></th>
<td> <?php echo '#HMS_'.$rsbilling_records[billingid]; ?></td>
</tr>
<tr>
<th width="124" scope="col"><div align="right">Appointment Number </div></th>
<td width="413"> <?php echo $rsbilling_records[appointmentid]; ?>
</td>
</tr>
<tr>
<th scope="col"><div align="right">Billing Date </div></th>
<td> <?php echo $rsbilling_records[billingdate]; ?></td>
</tr>
<tr>
<th scope="col"><div align="right">Billing time </div></th>
<td> <?php echo $rsbilling_records[billingtime] ; ?></td>
</tr>
</tbody>
</table>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th width="97" scope="col">Date</th>
<th width="245" scope="col">Decription</th>
<th width="86" scope="col">Bill Amount</th>
</tr>
</thead>
<tbody>
<?php
$sql ="SELECT * FROM billing_records where billingid='$rsbilling_records[billingid]'";
$qsql = mysqli_query($con,$sql);
$billamt= 0;
while($rs = mysqli_fetch_array($qsql))
{
echo "<tr>
<td> $rs[bill_date]</td>
<td> $rs[bill_type]";
if($rs[bill_type] == "Service Charge")
{
$sqlservice_type1 = "SELECT * FROM service_type WHERE service_type_id='$rs[bill_type_id]'";
$qsqlservice_type1 = mysqli_query($con,$sqlservice_type1);
$rsservice_type1 = mysqli_fetch_array($qsqlservice_type1);
echo " - " . $rsservice_type1[service_type];
}
if($rs[bill_type]== "Room Rent")
{
$sqlroomtariff = "SELECT * FROM room WHERE roomid='$rs[bill_type_id]'";
$qsqlroomtariff = mysqli_query($con,$sqlroomtariff);
$rsroomtariff = mysqli_fetch_array($qsqlroomtariff);
echo " : ". $rsroomtariff[roomtype] . "- Room No." . $rsroomtariff[roomno];
}
if($rs[bill_type] == "Consultancy Charge")
{
//Consultancy Charge
$sqldoctor = "SELECT * FROM doctor WHERE doctorid='$rs[bill_type_id]'";
$qsqldoctor = mysqli_query($con,$sqldoctor);
$rsdoctor = mysqli_fetch_array($qsqldoctor);
echo " - Mr.".$rsdoctor[doctorname];
}
if($rs[bill_type] =="Treatment Cost")
{
//Treatment Cost
$sqltreatment = "SELECT * FROM treatment WHERE treatmentid='$rs[bill_type_id]'";
$qsqltreatment = mysqli_query($con,$sqltreatment);
$rstreatment = mysqli_fetch_array($qsqltreatment);
echo " - ".$rstreatment[treatmenttype];
}
if($rs[bill_type] == "Prescription charge")
{
$sqltreatment = "SELECT * FROM prescription WHERE treatmentid='$rs[bill_type_id]'";
$qsqltreatment = mysqli_query($con,$sqltreatment);
$rstreatment = mysqli_fetch_array($qsqltreatment);
$sqltreatment1 = "SELECT * FROM treatment_records WHERE treatmentid='$rstreatment[treatment_records_id]'";
$qsqltreatment1 = mysqli_query($con,$sqltreatment1);
$rstreatment1 = mysqli_fetch_array($qsqltreatment1);
$sqltreatment2 = "SELECT * FROM treatment WHERE treatmentid='$rstreatment1[treatmentid]'";
$qsqltreatment2 = mysqli_query($con,$sqltreatment2);
$rstreatment2 = mysqli_fetch_array($qsqltreatment2);
echo " - " . $rstreatment2[treatmenttype];
}
echo " </td><td> ₹ $rs[bill_amount]</td></tr>";
$billamt = $billamt + $rs[bill_amount];
}
?>
</tbody>
</table>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<th scope="col"><div align="right">Bill Amount </div></th>
<td> ₹ <?php echo $billamt; ?></td>
</tr>
<tr>
<th width="442" scope="col"><div align="right">Tax Amount (5%) </div></th>
<td width="95"> ₹ <?php echo $taxamt = 5 * ($billamt / 100); ?>
</td>
</tr>
<tr>
<th scope="col"><div align="right">Discount </div></th>
<td> ₹ <?php echo $rsbilling_records[discount]; ?></td>
</tr>
<tr>
<th scope="col"><div align="right">Grand Total </div></th>
<td> ₹ <?php echo ($billamt + $taxamt) - $rsbilling_records[discount] ; ?></td>
</tr>
</tbody>
</table>
</section>