-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshow_pdf.php
47 lines (39 loc) · 1.17 KB
/
show_pdf.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
<?php
include 'lib/student.php';
require('fpdf/fpdf.php');
?>
<?php
$stu = new Student();
$db = new Database();
if(isset($_POST['gen_rep'])){
$courseId=$_POST['courseId'];
$classId=$_POST['classId'];
$getstudent=$db->select("SELECT * FROM tbl_courseallocstu WHERE courseId='$courseId' AND classId='$classId' ORDER BY stu_id ASC");
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Attendance List');
$pdf->Ln();
$pdf->SetFont('Arial','B',14);
$pdf->Cell(40,10,'Course - ID: '.$courseId.' Class: '.$classId);
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('Arial','B',12);
if($getstudent){
$i=1;
while($value = $getstudent->fetch_assoc()){
$getattend = $db->select("SELECT * FROM tbl_attendance WHERE courseId='".$courseId."' AND classId='".$classId."' AND roll=".$value['stu_id']." AND attend='1'");
if($getattend)
$pdf->Cell(40,10,$i.' '.$value['stu_id'].' Attend: '.mysqli_num_rows($getattend));
else
$pdf->Cell(40,10,$i.' '.$value['stu_id'].' Attend: 0');
$pdf->Ln();
$i++;
}
} else{
$pdf->Cell(40,10,'NO STUDENT');
$pdf->Ln();
}
}
$pdf->Output();
?>