-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfullDues.php
More file actions
165 lines (131 loc) · 3.98 KB
/
fullDues.php
File metadata and controls
165 lines (131 loc) · 3.98 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
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
<?php session_start();
include 'newhead.php';
function fetch_data()
{
include "db.php";
$sql = "SELECT * FROM dues";
$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) > 0) {
//print mysqli_num_rows($result);
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
$cid=$row['compId'];
// print $cid;
$tim=$row['time'];
$roll=$row['rollno'];
$number=$row['number'];
$dID=$row['dID'];
$sql1 = "SELECT * FROM component WHERE compId = '$cid' LIMIT 1";
$result1 = mysqli_query($con, $sql1);
$row1 = mysqli_fetch_assoc($result1);
$name = $row1['name'];
$output .= '
<tr>
<td>'.$roll.'</td>
<td>'.$cid.'</td>
<td>'.$name.'</td>
<td>'.$number.'</td>
<td>'.$tim.'</td>
</tr>
';
}
}
else
$output = "O RESULTS";
return $output;
}
if(isset($_POST["generate_pdf"]))
{
require_once('tcpdf/tcpdf.php');
$obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$obj_pdf->SetCreator(PDF_CREATOR);
$obj_pdf->SetTitle("All dues");
$obj_pdf->SetHeaderData('', '', PDF_HEADER_TITLE, PDF_HEADER_STRING);
$obj_pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(PDF_MARGIN_LEFT, '10', PDF_MARGIN_RIGHT);
$obj_pdf->setPrintHeader(false);
$obj_pdf->setPrintFooter(false);
$obj_pdf->SetAutoPageBreak(TRUE, 10);
$obj_pdf->SetFont('helvetica', '', 11);
$obj_pdf->AddPage();
$content = '';
$content .= '
<table border="1" cellspacing="0" cellpadding="3">
<tr>
<th>Roll Number</th>
<th>Comp ID</th>
<th>Comp Name</th>
<th>Quantity</th>
<th>time</th>
</tr>
';
$content .= fetch_data();
$content .= '</table>';
$obj_pdf->writeHTML($content);
ob_end_clean();
$obj_pdf->Output('file.pdf', 'I');
}
?>
<!DOCTYPE HTML>
<html>
<style type="text/css">
button{
width: 60%%;
background-color: #00C6F0;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover{
background-color: #00bbe6;
}
table {
background-color: #00C6F0;
color: white;
width: 100%;
height: 100%;
}
</style>
<head>
<title>simplest</title>
<meta name="description" content="website description" />
<meta name="keywords" content="website keywords, website keywords" />
<meta http-equiv="content-type" content="text/html; charset=windows-1252" />
<link rel="stylesheet" type="text/css" href="style/style.css" />
</head>
<div id="content">
<div class="table-responsive">
<div class="col-md-12" align="right">
<form method="post">
<input type="submit" name="generate_pdf" class="btn btn-success" value="Generate PDF" />
</form>
</div>
<br/>
<br/>
<table class="table table-bordered">
<tr>
<th>Roll Number</th>
<th>Comp ID</th>
<th>Comp Name</th>
<th>Quantity</th>
<th>time</th>
</tr>
</div>
<?php
echo fetch_data();
//mysqli_close($con);
?>
<script>
function selects()
{
document.getElementById("View Dues").className = "selected";
}
</script>
</body>
</html>