query("SELECT m.*, s.subject_name, s.code, s.max_marks, s.min_marks, s.is_optional FROM marks_table m LEFT JOIN subjects s ON m.subject_id = s.id WHERE m.result_id = '".$serial_no."' AND (s.is_optional = 0 OR s.is_optional IS NULL) ORDER BY s.subject_name ASC"); $compulsory_marks = []; $total_compulsory_obtain = 0; $total_compulsory_max = 0; if($compulsory_marks_query && $compulsory_marks_query->num_rows > 0) { while($cm = $compulsory_marks_query->fetch_assoc()) { $compulsory_marks[] = $cm; $total_compulsory_obtain += $cm['marks']; $total_compulsory_max += ($cm['max_marks'] ? $cm['max_marks'] : 100); } } // Get optional subjects $optional_marks_query = $con->query("SELECT m.*, s.subject_name, s.code, s.max_marks, s.min_marks, s.is_optional FROM marks_table m LEFT JOIN subjects s ON m.subject_id = s.id WHERE m.result_id = '".$serial_no."' AND s.is_optional = 1 ORDER BY s.subject_name ASC"); $optional_marks = []; if($optional_marks_query && $optional_marks_query->num_rows > 0) { while($om = $optional_marks_query->fetch_assoc()) { $optional_marks[] = $om; } } // Grand total - ONLY COMPULSORY MARKS INCLUDED $grand_total_obtain = $total_compulsory_obtain; $grand_total_max = $total_compulsory_max; $percentage = $grand_total_max > 0 ? round(($grand_total_obtain / $grand_total_max) * 100, 2) : 0; // Function to convert number to words if (!function_exists('numberToWords')) { function numberToWords($num) { $ones = array('', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen'); $tens = array('', '', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety'); if ($num < 20) { return $ones[$num]; } elseif ($num < 100) { return $tens[floor($num/10)] . ' ' . $ones[$num % 10]; } elseif ($num < 1000) { return $ones[floor($num/100)] . ' Hundred ' . numberToWords($num % 100); } return $num; } } // Calculate Age from DOB $dob_date = new DateTime($dob); $today = new DateTime(); $age = $today->diff($dob_date); $age_years = $age->y; $age_months = $age->m; $age_days = $age->d; // Age in words $age_words = numberToWords($age_years) . ' Years'; if($age_months > 0) { $age_words .= ' ' . numberToWords($age_months) . ' Months'; } if($age_days > 0) { $age_words .= ' ' . numberToWords($age_days) . ' Days'; } // DOB formatting - Fixed: DD/MM/YYYY in numbers + (DD Month YYYY in words) $dob_parts = explode('-', $dob); $dob_day = isset($dob_parts[2]) ? (int)$dob_parts[2] : 0; $dob_month = isset($dob_parts[1]) ? (int)$dob_parts[1] : 0; $dob_year = isset($dob_parts[0]) ? (int)$dob_parts[0] : 0; $months = ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; $dob_in_words = numberToWords($dob_day) . ' ' . $months[$dob_month] . ' ' . numberToWords($dob_year); // DOB display format: DD/MM/YYYY (DD Month YYYY) $dob_display = sprintf('%02d/%02d/%04d', $dob_day, $dob_month, $dob_year); // Parse session for exam month/year $session_parts = explode(' ', $session); $exam_month = $session_parts[0] ?? ''; $exam_year = $session_parts[1] ?? date('Y'); $exam_display = $exam_month . ' - ' . $exam_year; // Generate Serial Number $alphabet_index = ($serial_no - 1) % 26; $alpha = chr(65 + $alphabet_index); $num_part = str_pad($serial_no, 6, '572', STR_PAD_LEFT); // Dynamic Seat Number logic $seat_alpha_index = ($serial_no - 1) % 26; $seat_alpha = chr(65 + $seat_alpha_index); $seat_num = str_pad(($serial_no % 100), 2, '0', STR_PAD_LEFT); $seat_no = $seat_alpha . '-' . $seat_num; // Dynamic Centre/Institute Code Resolution $display_centre_code = $center_code ?? $centre_code ?? $centre_no ?? $institute_code ?? $inst_code ?? $school_code ?? $college_code ?? $center_id ?? 'GSOS-AHM-001'; // Dynamic Institute Name Resolution $display_isu = $isu ?? $institute_name ?? $school_name ?? $institute ?? $college_name ?? $inst_name ?? 'WebixSchool'; // Photo path $photo_path = $photo; // QR Code Data $qr_data = "Enrollment No: " . $enroll_no . "\n"; $qr_data .= "Name: " . $name . "\n"; $qr_data .= "Roll No: " . $enroll_no . "\n"; $qr_data .= "Seat No: " . $seat_no . "\n"; $qr_data .= "Serial: " . $alpha . "-" . $num_part . "\n"; $qr_data .= "Course: " . $course_name . "\n"; $qr_data .= "Exam: " . $exam_display . "\n"; $qr_data .= "Result: " . $res . "\n"; $qr_data .= "Grade: " . $grade . "\n"; $qr_data .= "Percentage: " . $percentage . "%"; ob_start(); QRcode::png($qr_data, null, QR_ECLEVEL_L, 10, 1); $image_data = ob_get_contents(); ob_end_clean(); ?> Marksheet | [<?= $enroll_no ?>] | <?= $alpha ?>-<?= $num_part ?> Marksheet Background
-
MONTH & YEAR OF THE EXAM. SEAT No. CENTRE CODE STREAM ROLL NO.
Candidate Name :
Father's Name :
Mother's Name :
Date of Birth : ()
Age : Years Months ()
School/Institute :
Student Photo
= 33 ? 'PASS' : 'FAIL'; $grade_result = my_grade($percentage); ?>
NAME OF THE SUBJECT WITH CODE NO. TOTAL MARKS MARKS OBTAINED +CONDONATION = TOTAL MARKS OBTAINED IN WORDS SUBJECT WISE GRADE
OBTAINED MARKS OUT OF TOTAL MARKS / TOTAL MARKS OBTAINED IN WORDS
'SKILL', 'grade' => 'A'], ]; $max_rows = max(count($optional_marks), count($co_scholastic)); ?>
PERFORMANCE IN THE SUBJECTS OF SCHOOL BASED EXAMINATION
NAME OF THE SUBJECT WITH CODE NO. GRADE CO-SCHOLASTIC EVALUATION GRADE
RESULT GRADE PERCENTILE RANK %
QR Code
મહત્વની સૂચના
આ દસ્તાવેજમાં પ્રદાન કરનાર અધિકારી સિવાય અન્ય કોઈપણ વ્યક્તિ દ્વારા કરવામાં આવેલ કોઈપણ ફેરફાર, આ દસ્તાવેજને રદ કરવામાં પરિણમશે અને તેની સાથે યોગ્ય કાનૂની કાર્યવાહી લાગુ કરવામાં આવશે.
IMPORTANT
Any change in this document except by the issuing authority, will result into cancellation of the statement and shall also invoke imposition of appropriate legal action.