-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewpayment.php
106 lines (90 loc) · 3.6 KB
/
viewpayment.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
<?php session_start();
if(!isset($_SESSION['id'])){
echo '<script>windows: location="index.php"</script>';
}
?>
<?php
include 'db.php';
$id =$_REQUEST['id'];
$result = mysql_query("SELECT * FROM bill where id='$id'");
while($row = mysql_fetch_array($result))
{
$prev=$row['prev'];
$owners_id=$row['owners_id'];
$pres=$row['pres'];
$price=$row['price'];
$totalcons=$pres - $prev;
$bill=$totalcons * $price;
$date=$row['date'];
}
?>
<?php
include 'db.php';
$result = mysql_query("SELECT * FROM owners WHERE id = '$owners_id'");
$test = mysql_fetch_array($result);
if (!$result)
{
die("Error: Data not found..");
}
$id=$test['id'] ;
$lname= $test['lname'] ;
$fname=$test['fname'] ;
$mi=$test['mi'] ;
$address=$test['address'] ;
$contact=$test['contact'] ;
?>
<html>
<head><title>Water Billing System</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/dist/css/bootstrap-theme.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/dist/css/bootstrap-theme.min.css" />
<script>
function printDiv(data) {
var printContents = document.getElementById('data').innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
</script>
</head>
<body style=" background-size:cover; font-family:'Courier New', Courier;">
<style type="text/css">
#data { margin: 0 auto; width:700px; padding:20px; border:#066 thin ridge; height:600px; }
</style>
<div id="data">
<center>
<h4><center><b>Water Billing System</b></center></h4>
<p><strong>Bill Invoice</strong></p>
<p>Phone: +2547 (5947) 8072</p>
<i style="text-align:right; margin-left:250px;">Date: <?php echo $date; ?></i>
</center>
<div id="context">
<table class="table table-striped table-bordered">
<tr><td>Last Name:</td><td><b><i><?php echo $lname; ?></i></b></td><td>Client ID</td><td><i>WBS/00<?php echo $id; ?></i></td> </tr>
<tr><td>First Name</td><td><b><i><?php echo $fname; ?></td><td bordercolor="#000000">Meter Number</td><td><?php echo $mi; ?></td></tr>
<tr><td>Address: </td><td><b><i><?php echo $address; ?></td></tr>
<tr><td bordercolor="#000000">Contact: </td><td><b><i><?php echo $contact; ?></td></tr>
<tr><td bordercolor="#000000">Previous Reading :</td><td><b><i> <?php echo $prev;?> </td><td bordercolor="#000000">Present Reading : </td><td><b><i><?php echo $pres; ?> </td></tr>
<tr><td bordercolor="#000000">Consuption: </td><td><b><i><?php echo $totalcons;?> </td><td bordercolor="#000000">Price / unit : </td>
<td><b><i><?php echo $price; ?> Kshs </td>
</tr>
<tr><td colspan="4"><center><h2>Total Invoice:<b><i> <?php echo $bill; ?><b><i> /= Kshs</h2></center></td></tr>
<?php
$session=$_SESSION['id'];
include 'db.php';
$result = mysql_query("SELECT * FROM user where id= '$session'");
while($row = mysql_fetch_array($result))
{
$sessionname=$row['name'];
}
?>
<tr><td>Casher:<?php echo $sessionname;?></td><td>Signature:_____________</td></tr>
</table>
</div>
</div>
<CENTER><button type="button" class="btn btn-default " onclick="printDiv(data)"><span
class=" glyphicon glyphicon-print"></span> Print Bill</button> <a href="bill.php"><button class="btn btn-danger"><span class="glyphicon glyphicon-arrow-left"></span> Go back</button></a></CENTER>
</body>
</html>