<?php

include_once '../session/admin-session.php';
include_once '../classes/class_admin.php';
include_once '../classes/validation.php';
include_once '../classes/common.php';
include_once '../classes/transcriptcal.php';
include_once '../classes/sgpa.php';
include_once 'read-configration.php';

$ObjDB = new class_db();
$objadm = new class_admin();
$val = new validation();

if ($_POST['chrono_transcript_btn']) {
    $issuedate = $_REQUEST["issuedate"];
    $sem_now = $add_period =  $val->ValidateString($_REQUEST['sem_now']);
    $stu_roll = $val->ValidateString($_REQUEST['rollno']);

    $objadm->roll_number = $stu_roll;
    $res_StudentDet = $objadm->GetStudentDetailsbyRollNumber();
    $num = mysqli_num_rows($res_StudentDet);
    if ($num != 1)
        die("Incorrect Roll Number");
    $row = mysqli_fetch_array($res_StudentDet);
    $stu_name = $row["name"];
    $batch = $row["batch"];

    include "sub-list-finder.php";


    $roll_year = substr($stu_roll, 0, 4);
    $batch_no = $roll_year - 2005;
    $exam_year = $roll_year + floor($sem_now / 2);
    $reg_file = "isr_reg_" . $batch."_tbl";

    $base_period = (($roll_year - 2006) * 2);
    $admission_period = $base_period + 1;

// $period = $base_period + $add_period; 

    $period = $add_period;

    $residence_semester = $sem_now - $base_period;
    $curr_file = "isr_curriculam_tbl";

    if (substr($batch, 0, 1) == 'b') {
        if ($batch == 'b13' or $batch == 'b14' or $batch == 'b15' or $batch == 'b16' or $batch == 'b17' or $batch == 'b18' or $batch == 'b19') {
            include ("sem_BSMS_period.php");
        } else {
            die("Chronological transcript is not available for this roll number.");
        }
    } elseif (substr($batch, 0, 1) == 'r') {
        if ($batch == 'r11' or $batch == 'r12') {
            include ("sem_IPHD_period.php");
        } else {
            die("Chronological transcript is not available for this roll number.");
        }
    } elseif (substr($batch, 0, 1) == 'm') {
        if ($batch == 'm1') {
            include ("sem_MSC_period.php");
        } else {
            die("Chronological transcript is not available for this roll number.");
        }
    } else {
        die("Chronological transcript is not available for this roll number.");
//    include ("sem_IPHD.php");
    }
}
?>