<?php
namespace App\Controllers;
SESSION_START();
use \Core\View;
use \Core\Inputs;
use \Core\Userlog;
use \Core\Menu;
use \Core\Form;
use App\Models\Homem;
use App\Email\Emails;
class Certificates extends \Core\Controller
{
    public static function certificatefoldersearch()
    {
        $table = "";
        if($_SESSION['user_role'] == 5 || $_SESSION['user_role'] == 6 || $_SESSION['user_role'] == 4 || $_SESSION['user_role'] == 8)
        {
            if(isset($_POST["no"]))
            {
                $data = Homem::getdata("SELECT * FROM `certificate_folders` WHERE `no`='$_POST[no]'");
                if(sizeof($data) == 1)
                {
                    $head = '<thead>
                                <tr>
                                    <th>Description</th>
                                    <th>Details</th>
                                </tr>
                            </thead>';
                    $body = '<tbody>'; 
                    $body .= '<tr><td>HallTicket / Pin Number</td><td>'.$data[0]["no"].'</td></tr>
                            <tr><td>Name</td><td>'.$data[0]["name"].'</td></tr>
                            <tr><td>Course</td><td>'.$data[0]["course"].'</td></tr>
                            <tr><td>Branch</td><td>'.$data[0]["branch"].'</td></tr>
                            <tr><td>File No</td><td>'.$data[0]["fileno"].'</td></tr>
                            <tr><td>Folder No</td><td>'.$data[0]["folderno"].'</td></tr>
                            <tr><td>Admission Year</td><td>'.$data[0]["fromyear"].'</td></tr>
                            
                                ';
                    $body .= '</tbody>';
                    $table = '
                        <div class="table-responsive" id="exporttable">
                            <table class="table table-responsive-sm" border="1px">'.$head.'
                            '.$body.'
                            </table>
                        </div>
                    ';
                }
            }
            
            echo static::css();
            echo '<body>';
            echo $_SESSION['menu'];
            echo '
                <div class="clearfix"></div>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-lg-4"> 
                            </div>
                            <div class="col-lg-4">
                                <form action="" method="POST" enctype="multipart/form-data">
                                    <section class="box" style="margin-top: 30px;">
                                        <header class="panel_header">
                                            <h5 class="title pull-left">Certificate Folder Search</h5>
                                        </header>
                                        <div class="content-body"> 
                                            <div class="row">
                                                <div class="col-lg-12">
                                                    <div class="form-group">   
                                                        <input type="text" name="no" id="no" class="form-control" placeholder="Hallticket Number" onchange="getusername()" required>                                         
                                                    </div>
                                                </div>                              
                                            </div>   
                                            
                                            <div class="row">
                                                <div class="col-md-12">  
                                                    <div class="form-group">
                                                        <button id="btn_reg" class="btn btn-primary pull-right" type="submit" style="background-color: #002366 !important;">Submit</button>
                                                    </div>
                                                </div>
                                            </div>  
                                        </div>
                                    </selection>
                                </form>
                            </div>
                            <div class="col-lg-4">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2"></div>
                            <div class="col-lg-8">
                            '.$table.'
                            </div>
                            <div class="col-lg-2"></div>
                        </div>
                    </div>
                
                ';
            echo '</body>';
            echo static::script();
            echo '
            <script>

            </script>';
            if(isset($_GET['status']))
            {
                if($_GET['status'] == 1)
                {
                    echo '<script>swal("", "Inserted Successfully", "success");</script>';
                }
                else if($_GET['status'] == 2)
                {
                    echo '<script>swal("", "Updated Successfully", "success");</script>';
                }
                else
                {
                    echo '<script>swal("", "Something went Wrong.. Please try again later..", "error");</script>';
                }
            }
            if(isset($_POST['no']))
            {
                echo '
                    <script>
                        $("#no").val("'.$_POST['no'].'");
                    </script>';
            }
        }
    }
    // methods called through script started
    public static function getusernamemobileemail()
    {
        if($_SESSION['user_role'] == 4 || $_SESSION['user_role'] == 6 || $_SESSION['user_role'] == 5)
        {
            $data[0]['name']= '';
            $data = Homem::getdata("SELECT * FROM `user_master` WHERE `no`='$_POST[no]'");
            echo json_encode($data);
        }
    }
    // methods called through script ending
    
    // Supporting Methods Started
    private static function course($id)
    {
        if($id != '')
        {
            if($_SESSION['org_id'] == 1)
            {
                if($id == 1)
                {
                    return 'B.Sc.';
                }
                if($id == 2)
                {
                    return 'B.Com.';
                }
                if($id == 3)
                {
                    return 'B.A.';
                }
                if($id == 4)
                {
                    return 'Inter';
                }
                if($id == 5)
                {
                    return 'M.Sc.';
                }
                if($id == 6)
                {
                    return 'BBA';
                }
                if($id == 7)
                {
                    return 'BCA';
                }
            }
            if($_SESSION['org_id'] == 2)
            {
                if($id == 1)
                {
                    return 'B.Sc.';
                }
                if($id == 2)
                {
                    return 'M.Sc.';
                }
                if($id == 3)
                {
                    return 'M.Sc. (Vocational)';
                }
            }
            if($_SESSION['org_id'] == 3)
            {
                if($id == 1)
                {
                    return 'Diploma';
                }
                if($id == 2)
                {
                    return 'B.Tech.';
                }
            }
            if($_SESSION['org_id'] == 4)
            {
                if($id == 1)
                {
                    return 'MCA';
                }
                if($id == 2)
                {
                    return 'M.Com';
                }
            }
            if($_SESSION['org_id'] == 5)
            {
                if($id == 1)
                {
                    return 'MBA';
                }
            }
            if($_SESSION['org_id'] == 6)
            {
                if($id == 1)
                {
                    return 'M.Com';
                }
            }
        }
    }
    private static function dept($id)
    {
        if($id != '')
        {
            if($_SESSION['org_id'] == 1)
            {
                if($id == 1)
                {
                    return 'MPCS';
                }
                if($id == 2)
                {
                    return 'MSCS';
                }
                if($id == 3)
                {
                    return 'MECS';
                }
                if($id == 4)
                {
                    return 'General';
                }
                if($id == 5)
                {
                    return 'Computers';
                }
                if($id == 6)
                {
                    return 'MPC';
                }
                if($id == 7)
                {
                    return 'BZC';
                }
                if($id == 8)
                {
                    return 'GPC';
                }
                if($id == 9)
                {
                    return 'MiBC';
                }
                if($id == 10)
                {
                    return 'BiMC';
                }
                if($id == 11)
                {
                    return 'HS';
                }
                if($id == 12)
                {
                    return 'BS';
                }
                if($id == 13)
                {
                    return 'HEP';
                }
                if($id == 14)
                {
                    return 'EHP';
                }
                if($id == 15)
                {
                    return 'MES';
                }
                if($id == 16)
                {
                    return 'EPC';
                }
                if($id == 17)
                {
                    return 'MPC';
                }
                if($id == 18)
                {
                    return 'BiPC';
                }
                if($id == 19)
                {
                    return 'MEC';
                }
                if($id == 20)
                {
                    return 'CEC';
                }
                if($id == 21)
                {
                    return 'ABC';
                }
                if($id == 22)
                {
                    return 'HBZ';
                }
                if($id == 23)
                {
                    return 'FTM';
                }
                if($id == 24)
                {
                    return 'PHYSICS';
                }if($id == 25)
                {
                    return 'CHEMISTRY';
                }
                if($id == 26)
                {
                    return 'BOTANY';
                }
                if($id == 27)
                {
                    return 'FOOD PROCESSING';
                }
                if($id == 28)
                {
                    return 'HORTICULTURAL LANDSCAPING';
                }
                if($id == 29)
                {
                    return 'General';
                }
            }
            if($_SESSION['org_id'] == 2)
            {
                if($id == 1)
                {
                    return 'Agriculture';
                }
                if($id == 2)
                {
                    return 'Horticulture';
                }
                if($id == 3)
                {
                    return 'Food Technology';
                }
                if($id == 4)
                {
                    return 'Physics';
                }
                if($id == 5)
                {
                    return 'Chemistry';
                }
                if($id == 6)
                {
                    return 'Botany';
                }
                if($id == 7)
                {
                    return 'Food Processing (Vocational)';
                }
                if($id == 8)
                {
                    return 'Horticultural Landscaping (Vocational)';
                }
            }
            if($_SESSION['org_id'] == 3)
            {
                if($id == 1)
                {
                    return 'Civil Engineering';
                }
                else if($id == 2)
                {
                    return 'Electrical & Electronics Engineering';
                }
                else if($id == 3)
                {
                    return 'Mechanical Engineering';
                }
                else if($id == 4)
                {
                    return 'Electronics & Communication Engineering';
                }
                else if($id == 5)
                {
                    return 'Computer Science Engineering';
                }
                else if($id == 6)
                {
                    return 'Wed Design';
                }
                else
                {
                    return '';
                }
            }
            if($_SESSION['org_id'] == 4)
            {
                if($id == 1)
                {
                    return 'Computers';
                }
                if($id == 2)
                {
                    return 'Commerce';
                }
            }
            if($_SESSION['org_id'] == 5)
            {
                if($id == 1)
                {
                    return 'MBA';
                }
            }
            if($_SESSION['org_id'] == 6)
            {
                if($id == 1)
                {
                    return 'M.Com';
                }
            }
        }
    }
    private static function hisorher($id)
    {
        if($id=="M")
        {
            return 'his';
        }
        if($id=="F")
        {
            return 'her';
        }
    }
    private static function medieum($id)
    {
        if($id=="1")
        {
            return 'Telugu';
        }
        if($id=="2")
        {
            return 'English';
        }
    }
    private static function syear($id)
    {
        if($id=="1")
        {
            return 'I';
        }
        if($id=="2")
        {
            return 'II';
        }
        if($id=="3")
        {
            return 'III';
        }
        if($id=="4")
        {
            return 'IV';
        }
    }
    private static function presentacademicyear($fromyear, $toyear, $syear)
    {
        $years = (int) $toyear-(int) $fromyear;
        if($syear == 1)
        {
            $fromyear = $fromyear + 0;
            $toyear = $toyear - $years +1;
            $txt = $fromyear.' - '.$toyear;
            return $txt;
        }
        if($syear == 2)
        {
            $fromyear = $fromyear + 1;
            $toyear = $toyear - $years +2;
            $txt = $fromyear.' - '.$toyear;
            return $txt;
        }
        if($syear == 3)
        {
            $fromyear = $fromyear + 2;
            $toyear = $toyear - $years +3;
            $txt = $fromyear.' - '.$toyear;
            return $txt;
        }
        if($syear == 4)
        {
            $fromyear = $fromyear + 3;
            $toyear = $toyear - $years +4;
            $txt = $fromyear.' - '.$toyear;
            return $txt;
        }
    }
    // Supproting Methods Ended
    
    /** Browser Checking code started */
    private static function checkbrower()
    {
        $mystring = $_SERVER['HTTP_USER_AGENT'];
        $word = 'Chrome';
        if(strpos($mystring, $word) !== false)
        {
            if(strpos($mystring, 'Mozilla') !== false)
            {
                return "1";
            } 
        }
        else if(strpos($mystring, 'Mozilla') !== false)
        {
            return "1";
        } 
        else
        {
            return "0";
        }
    }
    private static function checkiphone()
    {
        $iPod    = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
        $iPhone  = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
        $iPad    = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
        $Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");
        $webOS   = stripos($_SERVER['HTTP_USER_AGENT'],"webOS");
        if($iPod || $iPhone || $iPad || $Android || $webOS)
        {
            echo 1;
        }
        else
        {
            echo 0;
        }
    }
    /** Browser Checking code Ended */

    /** CSS, Script started */
    private static function css()
    {
        $css = 
        '<!DOCTYPE html>
        <html lang="en">
        <head>
            <meta name="viewport" content="width=device-width, initial-scale=1">
            <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
            <title>Hindu College of Engineering & Technology || Guntur</title>
            <meta name="viewport" content="width=device-width, initial-scale=1">
            <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
            <title>Hindu College of Engineering & Technology || Guntur</title>
            <link rel="stylesheet" href="https://assets.hinduengg.com/hindu/assets/css/bootstrap.min.css">
            <link rel="stylesheet" href="https://assets.hinduengg.com/hindu/assets/css/style.css">
            <link rel="stylesheet" href="https://assets.hinduengg.com/hindu/assets/sweetalert2/dist/sweetalert2.min.css" >
            <style>
                @media print
                {
                    body * {
                        visibility: hidden;
                    }
                    .print-this, .print-this * {
                        visibility: visible;
                    }
                }
            </style>
            <script>
                function exportTableToExcel(tableID, filename = "")
                {
                    var downloadLink;
                    var dataType = "application/vnd.ms-excel";
                    var tableSelect = document.getElementById(tableID);
                    var tableHTML = tableSelect.outerHTML.replace(/ /g, "%20");
                    
                    // Specify file name
                    filename = filename?filename+".xls":"excel_data.xls";
                    
                    // Create download link element
                    downloadLink = document.createElement("a");
                    
                    document.body.appendChild(downloadLink);
                    
                    if(navigator.msSaveOrOpenBlob){
                        var blob = new Blob(["\ufeff", tableHTML], {
                            type: dataType
                        });
                        navigator.msSaveOrOpenBlob( blob, filename);
                    }else{
                        // Create a link to the file
                        downloadLink.href = "data:" + dataType + ", " + tableHTML;
                    
                        // Setting the file name
                        downloadLink.download = filename;
                        
                        //triggering the function
                        downloadLink.click();
                    }
                }
            </script>
        </head>';
        return $css;  
    }
    private static function script()
    {
        $script =
                '
                <div class="footer navbar-fixed-bottom text-center">        
                    <span class="text-muted text-center">Copyright &#169 2020. Hindu College of Engineering & Technology, Guntur</span>
                </div>
                <script src="https://assets.hinduengg.com/hindu/assets/word/jquery.min.js" ></script>
                <script src="https://assets.hinduengg.com/hindu/assets/js/bootstrap.min.js" ></script>
                <script src="https://assets.hinduengg.com/hindu/assets/vendor/sweetalert2/dist/sweetalert2.min.js" ></script>';
        return $script;  
    }
    private static function blockscript()
    {
        $script =
                '
                <div class="footer navbar-fixed-bottom text-center">        
                    <span class="text-muted text-center">Copyright &#169 2020. Hindu College of Engineering & Technology, Guntur</span>
                </div>
                <script src="https://assets.hinduengg.com/hindu/assets/word/jquery.min.js" ></script>
                <script src="https://assets.hinduengg.com/hindu/assets/js/bootstrap.min.js" ></script>
                <script src="https://assets.hinduengg.com/hindu/assets/sweetalert2/dist/sweetalert2.min.js" ></script>
                <!-- Script to stop mouse right click start-->
            <script>
                //Disable right click script
                var message = "";
                ///////////////////////////////////
                function clickIE() {
                    if (document.all) {
                        (message);
                        return false;
                    }
                }

                function clickNS(e) {
                    if (document.layers || (document.getElementById && !document.all)) {
                        if (e.which == 2 || e.which == 3) {
                            (message);
                            return false;
                        }
                    }
                }
                if (document.layers) {
                    document.captureEvents(Event.MOUSEDOWN);
                    document.onmousedown = clickNS;
                } else {
                    document.onmouseup = clickNS;
                    document.oncontextmenu = clickIE;
                }

                document.oncontextmenu = new Function("return false")
            </script>
            <!-- Script to stop mouse right click end-->

            <!-- Script to prevent selection start-->
            <script>
                $(document).ready(function () {
                    $("body").bind("cut copy", function (e) {
                        e.preventDefault();
                    });
                });
            </script>
            <!-- Script to prevent selection end-->
                ';
        return $script;  
    }
    private static function datem($id)
    {
        $data = explode('-', $id);
        $final = $data[2].'-'.$data[1].'-'.$data[0];
        return $final;
    }
    public static function datemnew()
    {
        $id=$_POST["date"];
        $data = explode('-', $id);
        $final = $data[2].'-'.$data[1].'-'.$data[0];
        echo $final;

    }
    /** CSS, Script Ended */
    
    /** Supporting Functions Started */
    private static function singlenumbertotext($a)
    {
        if($a == '0')
        {
            return 'Zero ';
        }
        if($a == '1')
        {
            return 'One ';
        }
        if($a == '2')
        {
            return 'Two ';
        }
        if($a == '3')
        {
            return 'Three ';
        }
        if($a == '4')
        {
            return 'Four ';
        }
        if($a == '5')
        {
            return 'Five ';
        }
        if($a == '6')
        {
            return 'Six ';
        }
        if($a == '7')
        {
            return 'Seven ';
        }
        if($a == '8')
        {
            return 'Eight ';
        }
        if($a == '9')
        {
            return 'Nine ';
        }
        if($a == '-')
        {
            return '- ';
        }
    }
    /** Supporting Functions Ended */
    
    
    // Study certificate code starting
    private static function studycertificateheader()
    {
        if($_SESSION['org_id'] == '1')
        {
            return '
                <tr style="text-align: center;">
                    <td>
                        <h1 style="font-family: Algerian; font-size:50px;">HINDU COLLEGE, GUNTUR</h1>
                        <h5 style="font-family: Arial Black;">(Re-accredited by NAAC as Grade ‘A’ College)</h5>
                    </td>
                </tr>
                <tr style="text-align: center;">
                    <td>
                        <img src="https://assets.hinduengg.com/hindu/assets/img/logo-1.png" width="100px" height="100px">
                    </td>
                </tr>

                <tr style="text-align: center;">
                    <td>
                        <br/>
                                        <a style="border-style: double;  font-family: Bodoni MT Black; font-size: 31px;">STUDY & CONDUCT CERTIFICATE</a>
                                        <!--<a style="font-family: Bodoni MT Black; margin-top: 10px; border: solid 1px black; border-radius: 1px; padding: 2px; box-shadow: 5px 5px; font-size: 31px;">STUDY & CONDUCT CERTIFICATE</a>-->
                    </td>
                </tr>
            ';
        }
    }
    public static function studycertificateentry()
    {
        if($_SESSION['user_role'] == 5 || $_SESSION['user_role'] == 6 || $_SESSION['user_role'] == 4 || $_SESSION['user_role'] == 8)
        {
            $course = Inputs::optionsdb(Homem::getdata("SELECT * FROM `degree_name_master`"), 'id', 'code');
            $dept = Inputs::optionsdb(Homem::getdata("SELECT * FROM `degree_dept_master`"), 'id', 'name');
            $medieum = Inputs::optionsdb(Homem::getdata("SELECT * FROM `medium`"), 'id', 'name');
            $table = '';
            {
                $date = date('Y-m-d');
                // $blood = Homem::getdata("SELECT * FROM `stdnt_normalfee` WHERE (`entry_date`='$date' OR `edit_date`='$date') AND (`entry_id`='$_SESSION[user_id]' OR `edit_id`='$_SESSION[user_id]') AND `fk_org_id`='$_SESSION[org_id]'");
                $blood = Homem::getdata("SELECT * FROM stdnt_normalfee sn JOIN user_master um ON um.id=sn.no WHERE (sn.entry_date='$date' OR sn.edit_date='$date') AND (sn.entry_id='$_SESSION[user_id]' OR sn.edit_id='$_SESSION[user_id]') AND sn.fk_org_id='$_SESSION[org_id]'");
                $table = '';
            }
            echo static::css();
            echo '<body>';
            echo $_SESSION['menu'];
            echo '
                <div class="clearfix"></div>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-lg-4"> 
                            </div>
                            <div class="col-lg-4">
                                <form action="/Certificates/studycertificate" method="POST" enctype="multipart/form-data">
                                    <section class="box" style="margin-top: 30px;">
                                        <header class="panel_header">
                                            <h5 class="title pull-left">Application for Study Certificate</h5>
                                        </header>
                                        <div class="content-body"> 
                                            <div class="row">
                                                <div class="col-lg-12">
                                                    <div class="form-group">   
                                                        <input type="text" name="no" id="no" class="form-control" placeholder="Hallticket Number" onchange="getusername()" required>                                         
                                                    </div>
                                                </div>                              
                                            </div>   
                                            <div class="row">
                                                <div class="col-lg-6">
                                                    <div class="form-group">   
                                                        <input type="text" name="name" id="name" class="form-control" placeholder="Student Name"  required>                                         
                                                    </div>
                                                </div>
                                                
                                                <div class="col-lg-6">
                                                    <div class="form-group">   
                                                        <input type="text" name="pname" id="pname" class="form-control" placeholder="Parent Name" required>                                         
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                
                                                <div class="col-lg-6">
                                                    <div class="form-group">    
                                                        <input type="text" name="mobile" id="mobile" class="form-control" placeholder="Student Mobile Number" required>                                         
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">   
                                                        <input type="text" name="pmobile" id="pmobile" class="form-control" placeholder="Parent Mobile Number" required>   
                                                        
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-lg-6">
                                                    <div class="form-group">   
                                                        <input type="text" name="email" id="email" class="form-control" placeholder="Student Email" required>                                         
                                                    </div>
                                                </div> 
                                                <div class="col-lg-6">
                                                    <div class="form-group">   
                                                        <input type="text" name="dob" id="dob" class="form-control" placeholder="Date of Birth" onfocus="this.type=`date`" onblur="this.type=`text`" required>                                         
                                                    </div>
                                                </div> 
                                            </div>   
                                            <div class="row">
                                                <div class="col-lg-6">
                                                    <div class="form-group">  
                                                        <select id="gender" name="gender" class="form-control" required>
                                                            <option value="">Select Gender</option>
                                                            <option value="M">Male</option>
                                                            <option value="F">Female</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">  
                                                        <select id="medieum" name="medieum" class="form-control" required>
                                                            <option value="">Select Medieum</option>
                                                            '.$medieum.'
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-lg-6">
                                                    <div class="form-group">  
                                                        <select id="course" name="course" class="form-control" required>
                                                            <option value="">Select Course</option>
                                                            '.$course.'
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">  
                                                        <select id="dept" name="dept" class="form-control" required>
                                                            <option value="">Select Department</option>
                                                            '.$dept.'
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-lg-6">
                                                    <div class="form-group">   
                                                        <input type="text" name="fromyear" id="fromyear" class="form-control" placeholder="From year" required>                                         
                                                    </div>
                                                </div> 
                                                <div class="col-lg-6">
                                                    <div class="form-group">   
                                                        <input type="text" name="toyear" id="toyear" class="form-control" placeholder="To year" required>                                         
                                                    </div>
                                                </div> 
                                            </div> 
                                            <div class="row">
                                                <div class="col-lg-6">
                                                    <div class="form-group">  
                                                        <select id="syear" name="syear" class="form-control" required>
                                                            <option value="">Select Year of study</option>
                                                            <option value="1">First Year</option>
                                                            <option value="2">Second Year</option>
                                                            <option value="3">Third Year</option>
                                                            <option value="4">Fourth Year</option>
                                                            <option value="5">Completed</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">   
                                                    <input type="hidden" name="paydate" id="paydate" class="form-control" onfocus="(this.type=`date`)" onblur="(this.type=`text`)" placeholder="Fee Paid Date"> 
                                                    <input type="text" name="remarks" id="remarks" class="form-control" placeholder="Remarks" required>                                   
                                                    </div>
                                                </div>                              
                                            </div> 
                                            <!--
                                            <div class="row" id="modifylink" style="display:none;">
                                                    <div class="col-lg-12">
                                                        <div class="float-lg-right"><a href="javascript:void(0);" onclick="updatecontactdetails()">Change Contact Information</a></div> 
                                                    </div>
                                            </div>-->
                                            <div class="row"> 
                                                <div class="col-lg-12">
                                                    <div class="form-group"> 
                                                        <input type="hidden" name="sid" id="sid" class="form-control" placeholder="user id" required>
                                                        <input type="hidden" name="edit_id" id="edit_id" class="form-control" placeholder="edit id">                                         
                                                    </div>
                                                </div>                            
                                            </div> 
                                            <div class="row">
                                                <div class="col-md-12">  
                                                    <div class="form-group">
                                                        <button id="btn_reg" class="btn btn-primary pull-right" type="submit" style="background-color: #002366 !important;">Submit</button>
                                                    </div>
                                                </div>
                                            </div>  
                                        </div>
                                    </selection>
                                </form>
                            </div>
                            <div class="col-lg-4">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2"></div>
                            <div class="col-lg-8">
                            '.$table.'
                            </div>
                            <div class="col-lg-2"></div>
                        </div>
                    </div>
                
                ';
            echo '</body>';
            echo static::script();
            echo '
            <script>
                $(document).ready(function(){
                    var div = document.createElement("div");
                    div.id = "addcoplayerinner1";
                    document.getElementsByTagName("body")[0].appendChild(div);
                    $("#addcoplayerinner1").load("/Accounts/addcoplayerinner");
                });
                function updatecontactdetails()
                {
                    $("#addcoplayerinner").modal("show");
                }
                function getusername()
                {
                    var no = $("#no").val();
                    $.ajax({
                        url: "/Accounts/getusernamemobileemail",
                        type: "post",
                        data: {no: no},
                        success: function(d) {
                            const a = JSON.parse(d);
                            document.getElementById("name").value = a[0]["name"];
                            document.getElementById("mobile").value = a[0]["mobile"];
                            document.getElementById("email").value = a[0]["email"];
                            document.getElementById("pname").value = a[0]["fname"];
                            document.getElementById("pmobile").value = a[0]["fmobile"];
                            document.getElementById("course").value = a[0]["fk_course_id"];
                            document.getElementById("dept").value = a[0]["fk_dept_id"];
                            document.getElementById("fromyear").value = a[0]["fromyear"];
                            document.getElementById("toyear").value = a[0]["toyear"];
                            document.getElementById("gender").value = a[0]["gender"];
                            document.getElementById("medieum").value = a[0]["medieum"];
                            if(a[0]["id"] != "")
                            {
                                $("#modifylink").show();
                            }
                            getuserid();
                            setTimeout(function(){ $("#id").val(a[0]["id"]); }, 500);
                            $("#id").val(a[0]["id"]);
                            $("#sno").val(a[0]["no"]);
                            $("#sname").val(a[0]["name"]);
                            $("#gender").val(a[0]["gender"]);
                            $("#dob").val(a[0]["dob"]);
                            $("#smobile").val(a[0]["mobile"]);
                            $("#semail").val(a[0]["email"]);
                            $("#fname").val(a[0]["fname"]);
                            $("#fmobile").val(a[0]["fmobile"]);
                        }
                    });
                }
                function getdueamount()
                {
                    var no = $("#no").val();
                    var year = $("#year").val();
                    var feetype = $("#feetype").val();
                    $.ajax({
                        url: "/Accounts/getdueamount",
                        type: "post",
                        data: {no: no, year: year, feetype: feetype},
                        success: function(d) {
                            if(d != "fail")
                            {
                                document.getElementById("dueamount").value = d;
                                $("#btn_reg").show();
                            }
                            else
                            {
                                $("#btn_reg").hide();
                            }
                        }
                    });
                }
                function getuserid()
                {
                    var no = $("#no").val();
                    $.ajax({
                        url: "/Accounts/getuserid",
                        type: "post",
                        data: {no: no},
                        success: function(d) {
                            if(d != "fail")
                            {
                                document.getElementById("sid").value = d;
                                $("#btn_reg").show();
                            }
                            else
                            {
                                $("#btn_reg").hide();
                            }
                        }
                    });
                }
            </script>';
            if(isset($_GET['status']))
            {
                if($_GET['status'] == 1)
                {
                    echo '<script>swal("", "Inserted Successfully", "success");</script>';
                }
                else if($_GET['status'] == 2)
                {
                    echo '<script>swal("", "Updated Successfully", "success");</script>';
                }
                else
                {
                    echo '<script>swal("", "Something went Wrong.. Please try again later..", "error");</script>';
                }
            }
            if(isset($_GET['no']))
            {
                echo '
                    <script>
                        $("#no").val("'.$_GET['no'].'");
                        getusername();
                    </script>';
            }
        }
    }
    public static function studycertificate()
    {
        if($_SESSION['user_role'] != '' && ($_SESSION['user_role'] == 6 || $_SESSION['user_role'] == 4 || $_SESSION['user_role'] == 5))
        {
            $a = '';
            // echo $_POST["sid"];
            $name = $_POST['name'];
            $duration = $_POST['fromyear'].' - '.$_POST['toyear'];
            $course = static::course($_POST['course']);
            $dept = static::dept($_POST['dept']);
            $medieum = static::medieum($_POST['medieum']);
            $hisorher = static::hisorher($_POST['gender']);
            $date = date('Y-m-d');
            $odata = Homem::getdata("SELECT * FROM `user_master` WHERE `id`='$_POST[sid]'");
            $edit = 0;
            
            $data['name']['old']= $odata[0]['name'];
            $data['name']['new']= $_POST['name'];
            $data['name']['status']= 0;
            if($odata[0]['name'] != $_POST['name'])
            {
                Homem::update("UPDATE `user_master` SET `name`='$_POST[name]' WHERE `id`='$_POST[sid]'");
                $data['name']['status']= 1;
                $edit++;
            }
            $data['pname']['old']= $odata[0]['fname'];
            $data['pname']['new']= $_POST['pname'];
            $data['pname']['status']= 0;
            if($odata[0]['fname'] != $_POST['pname'])
            {
                Homem::update("UPDATE `user_master` SET `fname`='$_POST[pname]' WHERE `id`='$_POST[sid]'");
                $data['pname']['status']= 1;
                $edit++;
            }
            $data['mobile']['old']= $odata[0]['mobile'];
            $data['mobile']['new']= $_POST['mobile'];
            $data['mobile']['status']= 0;
            if($odata[0]['mobile'] != $_POST['mobile'])
            {
                Homem::update("UPDATE `user_master` SET `mobile`='$_POST[mobile]' WHERE `id`='$_POST[sid]'");
                $data['mobile']['status']= 1;
                $edit++;
            }
            $data['pmobile']['old']= $odata[0]['fmobile'];
            $data['pmobile']['new']= $_POST['pmobile'];
            $data['pmobile']['status']= 0;
            if($odata[0]['fmobile'] != $_POST['pmobile'])
            {
                Homem::update("UPDATE `user_master` SET `fmobile`='$_POST[pmobile]' WHERE `id`='$_POST[sid]'");
                $data['pmobile']['status']= 1;
                $edit++;
            }
            $data['email']['old']= $odata[0]['email'];
            $data['email']['new']= $_POST['email'];
            $data['email']['status']= 0;
            if($odata[0]['email'] != $_POST['email'])
            {
                Homem::update("UPDATE `user_master` SET `email`='$_POST[email]' WHERE `id`='$_POST[sid]'");
                $data['email']['status']= 1;
                $edit++;
            }
            $data['dob']['old']= $odata[0]['dob'];
            $data['dob']['new']= $_POST['dob'];
            $data['dob']['status']= 0;
            if($odata[0]['dob'] != $_POST['dob'])
            {
                Homem::update("UPDATE `user_master` SET `dob`='$_POST[dob]' WHERE `id`='$_POST[sid]'");
                $data['dob']['status']= 1;
                $edit++;
            }
            $data['gender']['old']= $odata[0]['gender'];
            $data['gender']['new']= $_POST['gender'];
            $data['gender']['status']= 0;
            if($odata[0]['gender'] != $_POST['gender'])
            {
                Homem::update("UPDATE `user_master` SET `gender`='$_POST[gender]' WHERE `id`='$_POST[sid]'");
                $data['gender']['status']= 1;
                $edit++;
            }
            $data['medieum']['old']= $odata[0]['medieum'];
            $data['medieum']['new']= $_POST['medieum'];
            $data['medieum']['status']= 0;
            if($odata[0]['medieum'] != $_POST['medieum'])
            {
                Homem::update("UPDATE `user_master` SET `medieum`='$_POST[medieum]' WHERE `id`='$_POST[sid]'");
                $data['medieum']['status']= 1;
                $edit++;
            }
            $data['course']['old']= $odata[0]['fk_course_id'];
            $data['course']['new']= $_POST['course'];
            $data['course']['status']= 0;
            if($odata[0]['fk_course_id'] != $_POST['course'])
            {
                Homem::update("UPDATE `user_master` SET `fk_course_id`='$_POST[course]' WHERE `id`='$_POST[sid]'");
                $data['course']['status']= 1;
                $edit++;
            }
            $data['dept']['old']= $odata[0]['fk_dept_id'];
            $data['dept']['new']= $_POST['dept'];
            $data['dept']['status']= 0;
            if($odata[0]['fk_dept_id'] != $_POST['dept'])
            {
                Homem::update("UPDATE `user_master` SET `fk_dept_id`='$_POST[dept]' WHERE `id`='$_POST[sid]'");
                $data['dept']['status']= 1;
                $edit++;
            }
            $data['fromyear']['old']= $odata[0]['fromyear'];
            $data['fromyear']['new']= $_POST['fromyear'];
            $data['fromyear']['status']= 0;
            if($odata[0]['fromyear'] != $_POST['fromyear'])
            {
                Homem::update("UPDATE `user_master` SET `fromyear`='$_POST[fromyear]' WHERE `id`='$_POST[sid]'");
                $data['fromyear']['status']= 1;
                $edit++;
            }
            $data['toyear']['old']= $odata[0]['toyear'];
            $data['toyear']['new']= $_POST['toyear'];
            $data['toyear']['status']= 0;
            if($odata[0]['toyear'] != $_POST['toyear'])
            {
                Homem::update("UPDATE `user_master` SET `toyear`='$_POST[toyear]' WHERE `id`='$_POST[sid]'");
                $data['toyear']['status']= 1;
                $edit++;
            }
            $data['addby']['old']= $odata[0]['add_by'];
            $data['addby']['new']= $_SESSION['user_id'];
            $data['addby']['status']= 0;
            if($data['addby']['old'] != $data['addby']['new'])
            {
                $data['addby']['status']= 1;
            }
            $data['adddate']['old']= $odata[0]['add_date'];
            $data['adddate']['new']= date('Y-m-d');
            $data['adddate']['status']= 0;
            if($data['adddate']['old'] != $data['adddate']['new'])
            {
                $data['adddate']['status']= 1;
            }
            date_default_timezone_set('Asia/Kolkata'); 
            $time = date('Y-m-d H:i:s A');
            $fdata = json_encode($data);
            $count = Homem::getdata("SELECT * FROM `study_certificates` WHERE `sid`='$_POST[sid]' AND `date`='$date' AND `user_id`='$_SESSION[user_id]' AND `status`='1' AND `presentsyear`='$_POST[syear]'");
            if(sizeof($count) == 0)
            {
                Homem::insert("INSERT INTO `study_certificates` (`id`, `sid`, `data`, `presentsyear`, `remarks`, `noofedits`, `date`, `user_id`, `entry_time`, `status`) VALUES (NULL, '$_POST[sid]', '$fdata', '$_POST[syear]', '$_POST[remarks]', '$edit', '$date', '$_SESSION[user_id]', '$time', '1')");
            }
            if($_SESSION['org_id'] == '1')
            {
                if($_POST['syear'] != 5)
                {
                    $duration = static::presentacademicyear($_POST['fromyear'], $_POST['toyear'], $_POST['syear']);
                    $course = static::syear($_POST['syear']) .'-'. $course;
                    $a = '<tr><td><p style="line-height: 1.6; font-family: Californian FB; text-align:justify; margin-top: 15px; font-size: 35px; margin-left: 20px; margin-right: 20px;">This is to certify that<b> '. $name . ' </b>was  / is a student of this college during <b>'.$duration.'</b> in <b>'.$course.'</b> class in <b>'.$medieum.'</b> medium with
                    Group  subjects <b>'.$dept.'</b> and '.$hisorher.' character and conduct was / is found satisfactory.</p></td></tr>';
                                }
                                if($_POST['syear'] == 5)
                                {
                                    $a = '<tr><td><p style="line-height: 1.6; font-family: Californian FB; text-align:justify; margin-top: 15px; font-size: 35px; margin-left: 20px; margin-right: 20px;">This is to certify that<b> '. $name . ' </b>was  / is a student of this college during <b>'.$duration.'</b> in <b>'.$course.'</b> class in <b>'.$medieum.'</b> medium with
                    Group  subjects <b>'.$dept.'</b> and <b>'.$hisorher.'</b> character and conduct was / is found satisfactory.</p></td></tr>';
                }
                $a .= '<tr><td><br /><p style=" text-align:right; margin-right: 20px; font-family: Cambria; font-size: 35px;"><b>PRINCIPAL</b></p></td></tr>';
            }
            if($_SESSION['org_id'] == '3')
            {
                if($_POST['syear'] != 4)
                {
                    $duration = static::presentacademicyear($_POST['fromyear'], $_POST['toyear'], $_POST['syear']);
                    $course = static::syear($_POST['syear']) .'-'. $course;
                    $a = '<tr><td><p style="line-height: 1.6; font-family: Californian FB; text-align:justify; margin-top: 15px; font-size: 35px; margin-left: 20px; margin-right: 20px;">This is to certify that<b> '. $name . ' </b>was  / is a student of this college during <b>'.$duration.'</b> in <b>'.$course.'</b> class in <b>'.$medieum.'</b> medium with
                    Group  subjects <b>'.$dept.'</b> and '.$hisorher.' character and conduct was / is found satisfactory.</p></td></tr>';
                }
                if($_POST['syear'] == 5)
                {
                    $a = '<tr><td><p style="line-height: 1.6; font-family: Californian FB; text-align:justify; margin-top: 15px; font-size: 35px; margin-left: 20px; margin-right: 20px;">This is to certify that<b> '. $name . ' </b>was  / is a student of this college during <b>'.$duration.'</b> in <b>'.$course.'</b> class in <b>'.$medieum.'</b> medium with
                    Group  subjects <b>'.$dept.'</b> and <b>'.$hisorher.'</b> character and conduct was / is found satisfactory.</p></td></tr>';
                }
            }
            echo static::css();
            echo '<body>';
            echo $_SESSION['menu'];
            echo '
                <div class="clearfix"></div>
                <form action="#" method="POST">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-lg-2"></div>
                            <div class="col-lg-8">                                       
                                <div class="row print-this">
                                    <div class="col-lg-12">
                                        <div style="border-style: solid; border-width: thick; padding: 2px;">
                                        <div style="border-style: solid; border-width: thin;">
                                        <section class="box" style="margin-top: 5px;">
                                            <header class="panel_header">
                                                <h5 class="title pull-left"></h5>
                                                <div class="actions panel_actions pull-right">
                                                    <a class="fa fa-refresh" onclick="refreshClick()"></a>
                                                    <a class="box_toggle fa fa-chevron-down"></a>
                                                </div>
                                            </header>
                                            <div class="content-body">  
                                                <div class="row">
                                                    <div class="col-lg-12">
                                                        <table width="100%">
                                                            <tbody>
                                                                '.static::studycertificateheader().'
                                                                    <tr style="text-align: right;">
                                                                        <td>
                                                                            <h5 style="margin-right: 20px; font-family: Cambria; font-size: 35px;">Date: '.static::datem($date).'</h5>
                                                                        </td>
                                                                    </tr>
                                                                '.$a.'
                                                                
                                                                
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                                <!--
                                                <div class="row">
                                                    <div class="col-lg-6">
                                                        <div class="form-group">                                            
                                                            <input placeholder="From Date" class="form-control" name="fromdate" id="fromdate" onfocus="(this.type=`date`)" onblur="(this.type=`text`)">
                                                        </div>
                                                    </div>    
                                                    <div class="col-lg-6">
                                                        <div class="form-group">             
                                                        <input placeholder="To Date" class="form-control" name="todate" id="todate" onfocus="(this.type=`date`)" onblur="(this.type=`text`)">                               
                                                        </div>
                                                    </div>                            
                                                </div>
                                                <div class="row">
                                                    <div class="col-md-12">  
                                                        <div class="form-group">
                                                            <button id="btn_reg" class="btn btn-primary pull-right" type="submit" style="background-color: #002366 !important;">Submit</button>
                                                        </div>
                                                    </div>
                                                </div>
                                                -->
                                            </div>                        
                                        </section>
                                        </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-2"></div>
                        </div>
                        <div class="row">
                            <div class="col-lg-1"></div>
                            <div class="col-lg-10">
                                <a onclick="window.print()">Print this page</a>
                            </div>
                            <div class="col-lg-1"></div>
                        </div>
                    </div>
                </form>
                ';
            echo '</body>';
            echo static::script();
        }
    }
    private static function transfercertificateheader()
    {
        if($_SESSION['org_id'] == '1')
        {
            return '
            <tr style="text-align: center;">
                <td>
                    <img src="https://assets.hinduengg.com/hindu/assets/img/logo-1.png" width="110px" height="110px">
                </td>
                <td>
                    <h1 style="font-family: Algerian; font-size:50px;">HINDU COLLEGE, GUNTUR</h1>
                    <h5 style="font-family: Arial Black;">(Re-accredited by NAAC as Grade ‘A’ College)</h5>
                    
                </td>
            </tr>
            ';
        }
        if($_SESSION['org_id'] == '3')
        {
            return '
            <tr style="text-align: center;">
                <td>
                    <img src="https://assets.hinduengg.com/hindu/assets/img/logo-1.png" width="110px" height="110px">
                </td>
                <td>
                    <h1 style="font-family: Algerian; font-size:25px;">HINDU COLLEGE OF ENGINEERING AND TECHNOLOGY</h1>
                    <h5 style="font-family: Arial Black;">(Approved by AICTE, New Delhi, Affiliated to APSBTET, Mangalagiri)</h5>
                    
                </td>
            </tr>
            ';
        }
    }
    private static function transfercertificateheaderwithcourse()
    {
        if($_SESSION['org_id'] == '3')
        {
            return '
            <tr style="text-align: center;">
                <td>
                    <img src="https://assets.hinduengg.com/hindu/assets/img/logo-1.png" width="110px" height="110px">
                </td>
                <td>
                    <h1 style="font-family: Algerian; font-size:50px;">HINDU COLLEGE OF ENGINEERING AND TECHNOLOGY</h1>
                    <h5 style="font-family: Arial Black;">(Re-accredited by NAAC as Grade ‘A’ College)</h5>
                    
                </td>
            </tr>
            ';
        }
    }
    public static function transfercertificateheading($course)
    {
        if($_SESSION['org_id'] == '1')
        {
            if($course < 4)
            {
                $a = '
                <tr style="text-align: center;">
                        <td></td>
                        <td>
                        <h5 style="font-family: Times New Roman;">(Affiliated to Acharya Nagarjuna University, Nagarjuna Nagar)</h5>
                            <a style="border: solid 1px black; border-radius: 1px; padding: 5px; box-shadow: 5px 5px; font-size: 20px;">TRANSFER CERTIFICATE DEGREE COURSE</a>
                        </td>
                    </tr>';
            }
            if($course == 4)
            {
                $a = '<tr style="text-align: center;">
                        <td></td>
                        <td>
                            <a style="border: solid 1px black; border-radius: 1px; padding: 5px; box-shadow: 5px 5px; font-size: 20px;">TRANSFER CERTIFICATE FOR INTERMEDIATE COURSE</a>
                        </td>
                    </tr>';
            }
            if($course == 5)
            {
                $a = '<tr style="text-align: center;">
                        <td></td>
                        <td>
                        <h5 style="font-family: Times New Roman;">(Affiliated to Acharya Nagarjuna University, Nagarjuna Nagar)</h5>
                            <a style="border: solid 1px black; border-radius: 1px; padding: 5px; box-shadow: 5px 5px; font-size: 20px;">TRANSFER CERTIFICATE FOR POST GRADUATE COURSES</a>
                        </td>
                    </tr>';
            }
            if($course > 5)
            {
                $a = '
                <tr style="text-align: center;">
                        <td></td>
                        <td>
                        <h5 style="font-family: Times New Roman;">(Affiliated to Acharya Nagarjuna University, Nagarjuna Nagar)</h5>
                            <a style="border: solid 1px black; border-radius: 1px; padding: 5px; box-shadow: 5px 5px; font-size: 20px;">TRANSFER CERTIFICATE DEGREE COURSE</a>
                        </td>
                    </tr>';
            }
        }
        if($_SESSION['org_id'] == '3')
        {
            if($course == 1)
            {
                $a = '<tr style="text-align: center;">
                        <td></td>
                        <td>
                            <a style="border: solid 1px black; border-radius: 1px; padding: 5px; box-shadow: 5px 5px; font-size: 20px;">TRANSFER CERTIFICATE FOR DIPLOMA COURSE</a>
                        </td>
                    </tr>';
            }
            if($course == 2)
            {
                $a = '<tr style="text-align: center;">
                        <td></td>
                        <td>
                            <a style="border: solid 1px black; border-radius: 1px; padding: 5px; box-shadow: 5px 5px; font-size: 20px;">TRANSFER CERTIFICATE FOR ENGINEERING COURSE</a>
                        </td>
                    </tr>';
            }
        }
        return $a;
    }
    public static function transfercertificatebody($id, $course)
    {
        if($_SESSION['org_id'] == '1')
        {
            $acourse=$course;
            
            $cast = 'SC';
            if($acourse < 4)
            {
                $a = '
                    <tr>
                        <td width="2%">a)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Name of the Student in full</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[2]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Name of the Parent</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[3]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">iii)</td>
                        <td width="46%">Nationality & Religion</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[4]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">b)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Date of Birth as entered in the Admission Register</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[5]" name="dob"></div><div id="dobtext" name="dobtext"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Caste : BC/SC/ST/Other</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[6]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">c)</td>
                        <td width="2%"></td>
                        <td width="46%">Date  on which he/she was admitted to the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[7]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">d)</td>
                        <td width="2%"></td>
                        <td width="46%">Date on which he/she leaves or has left the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[8]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">e)</td>
                        <td width="2%"></td>
                        <td width="46%">Class studying / studied at the leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[9]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">f)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Subject studied by him/her at the time of leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[10]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Medium which he/she studies and second language</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[11]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">g)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether he/she is qualified for promotion to the higher class</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[12]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">h)</td>
                        <td width="2%"></td>
                        <td width="46%">The number of days the student has attended the college as against the number of working days prescribed by the college to the date of issue of the transfer certificate</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[13]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">i)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether  he/she has paid all fees and other money due to the institution</td>
                        <td>:</td>
                        <td><div id="data[14]"></div></td>
                    </tr>
                    <tr>
                        <td>j)</td>
                        <td></td>
                        <td>General progress and conduct of the student</td>
                        <td>:</td>
                        <td><div id="data[15]"></div></td>
                    </tr>
                    <tr>
                        <td>k)</td>
                        <td></td>
                        <td>Whether the student has applied for the certificate Or whether the college has given it Suemoto</td>
                        <td>:</td>
                        <td><div id="data[16]"></div></td>
                    </tr>
                    <tr>
                        <td>l)</td>
                        <td></td>
                        <td>Reasons for Applying/giving for the certificate</td>
                        <td>:</td>
                        <td><div id="data[17]"></div></td>
                    </tr>
                    ';
                
            }
            if($acourse == 4)
            {
                $a = '
                    <tr>
                        <td width="2%">1.</td>
                        <td width="2%"></td>
                        <td width="46%">Name of the Pupil</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[2]" id="data[2]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">2.</td>
                        <td width="2%"></td>
                        <td width="46%">Name of the Parent or Guardian</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[3]" id="data[3]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">3.</td>
                        <td width="2%"></td>
                        <td width="46%">Nationality & Religion</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[4]" id="data[4]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">4.</td>
                        <td width="2%"></td>
                        <td width="46%">Whether the candidate belongs to S.C.`s to S.T.`s or Vimuktha Jathis or other socially and education-ally back-ward classes specified in APE rules or is he a convert from the SC`s or ST`s if so, the particulars there of.
                        </td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[5]" id="data[5]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">5.</td>
                        <td width="2%"></td>
                        <td width="46%">Date of Birth (in words)  as entered in the Admission Register
                        </td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="dob" id="data[6]"></div><div id="dobtext" name="dobtext"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">6.</td>
                        <td width="2%">a)</td>
                        <td width="46%">Class in which the pupil was reading at the time of leaving (in words)</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[7]" id="data[7]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">b)</td>
                        <td width="46%">First Language under part – I</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[8]" id="data[8]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">c)</td>
                        <td width="46%">Second Language under part –II</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[9]" id="data[9]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">d)</td>
                        <td width="46%">Optional under part-III</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[10]" id="data[10]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">7.</td>
                        <td width="2%"></td>
                        <td width="46%">Mother Tongue and Medium of Instruction</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[11]" id="data[11]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">8.</td>
                        <td width="2%"></td>
                        <td width="46%">Date of admission to 1st year Intermediate course (the year to be entered in words)
                        </td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[12]" id="data[12]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">9.</td>
                        <td width="2%"></td>
                        <td width="46%">Class and year in which the pupil was first admitted into the Intermediate course (1st year or 2nd year)
                        </td>
                        <td>:</td>
                        <td><div name="data[13]" id="data[13]"></div></td>
                    </tr>
                    <tr>
                        <td>10.</td>
                        <td></td>
                        <td>Whether the pupil has been declared eligible by the Board of intermediate Education for University course of Study
                        </td>
                        <td>:</td>
                        <td><div name="data[14]" id="data[14]"></div></td>
                    </tr>
                    <tr>
                        <td>11.</td>
                        <td></td>
                        <td>Whether qualified to Study II year class of Inter mediate course (In case of students leaving after completing 1St year class)
                        </td>
                        <td>:</td>
                        <td><div name="data[15]" id="data[15]"></div></td>
                    </tr>
                    <tr>
                        <td>12.</td>
                        <td>a)</td>
                        <td>Whether the pupil was in receipt of any scholarship (Nature to be specified)
                        </td>
                        <td>:</td>
                        <td><div name="data[16]" id="data[16]"></div></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>b)</td>
                        <td>
                        Whether the pupil was in receipt of any concession (Nature of concession to be specified)
                        </td>
                        <td>:</td>
                        <td><div name="data[17]" id="data[17]"></div></td>
                    </tr>
                    <tr>
                        <td>13.</td>
                        <td></td>
                        <td>
                        Personal marks of identification 
                        </td>
                        <td>:</td>
                        <td></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td></td>
                        <td style="text-align: right;">
                        i)
                        </td>
                        <td></td>
                        <td><div name="data[18]" id="data[18]"></div></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td></td>
                        <td style="text-align: right;">
                        ii)
                        </td>
                        <td></td>
                        <td><div name="data[19]" id="data[19]"></div></td>
                    </tr>
                    <tr>
                        <td>14.</td>
                        <td></td>
                        <td>
                        Date on which the pupil has actually left the College
                        </td>
                        <td>:</td>
                        <td><div name="data[20]" id="data[20]"></div></td>
                    </tr>
                    <tr>
                        <td>15.</td>
                        <td></td>
                        <td>
                        Conduct
                        </td>
                        <td>:</td>
                        <td><div name="data[21]" id="data[21]"></div></td>
                    </tr>
                    ';
            }
            if($acourse == 5)
            {
                $a = '
                    <tr>
                        <td width="2%">a)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Name of the Student in full</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[2]" id="data[2]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Name of the Parent</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[3]" id="data[3]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">iii)</td>
                        <td width="46%">Nationality & Religion</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[4]" id="data[4]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">b)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Date of Birth as entered in the Admission Register</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="dob" id="data[5]"></div><div id="dobtext" name="dobtext"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Caste : BC/SC/ST/Other</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[6]" id="data[6]"></td>
                    </tr>
                    <tr>
                        <td width="2%">c)</td>
                        <td width="2%"></td>
                        <td width="46%">Date  on which he/she was admitted to the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[7]" id="data[7]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">d)</td>
                        <td width="2%"></td>
                        <td width="46%">Date on which he/she leaves or has left the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[8]" id="data[8]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">e)</td>
                        <td width="2%"></td>
                        <td width="46%">Class studying / studied at the leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[9]" id="data[9]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">f)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Course studied by the student at the time of leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[10]" id="data[10]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Medium in which the student studied and second  language</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[11]" id="data[11]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">g)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether the student is qualified for promotion to the higher class</td>
                        <td width="2%">:</td>
                        <td width="48%"><div name="data[12]" id="data[12]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">h)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether  he/she has paid all fees and other money due to the institution</td>
                        <td>:</td>
                        <td><div name="data[13]" id="data[13]"></div></td>
                    </tr>
                    <tr>
                        <td>i)</td>
                        <td></td>
                        <td>General progress and conduct of the student</td>
                        <td>:</td>
                        <td><div name="data[15]" id="data[15]"></div></td>
                    </tr>
                    <tr>
                        <td>j)</td>
                        <td></td>
                        <td>Whether the student has applied of the certificate Or whether the college has given it Suemoto</td>
                        <td>:</td>
                        <td><div name="data[16]" id="data[16]"></div></td>
                    </tr>
                    <tr>
                        <td>k)</td>
                        <td></td>
                        <td>Reasons for Applying/giving for the certificate</td>
                        <td>:</td>
                        <td><div name="data[17]" id="data[17]"></div></td>
                    </tr>
                    ';
            }
            if($acourse > 5)
            {
                $a = '
                    <tr>
                        <td width="2%">a)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Name of the Student in full</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[2]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Name of the Parent</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[3]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">iii)</td>
                        <td width="46%">Nationality & Religion</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[4]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">b)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Date of Birth as entered in the Admission Register</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[5]" name="dob"></div><div id="dobtext" name="dobtext"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Caste : BC/SC/ST/Other</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[6]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">c)</td>
                        <td width="2%"></td>
                        <td width="46%">Date  on which he/she was admitted to the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[7]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">d)</td>
                        <td width="2%"></td>
                        <td width="46%">Date on which he/she leaves or has left the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[8]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">e)</td>
                        <td width="2%"></td>
                        <td width="46%">Class studying / studied at the leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[9]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">f)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Subject studied by him/her at the time of leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[10]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Medium which he/she studies and second language</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[11]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">g)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether he/she is qualified for promotion to the higher class</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[12]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">h)</td>
                        <td width="2%"></td>
                        <td width="46%">The number of days the student has attended the college as against the number of working days prescribed by the college to the date of issue of the transfer certificate</td>
                        <td width="2%">:</td>
                        <td width="48%"><div id="data[13]"></div></td>
                    </tr>
                    <tr>
                        <td width="2%">i)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether  he/she has paid all fees and other money due to the institution</td>
                        <td>:</td>
                        <td><div id="data[14]"></div></td>
                    </tr>
                    <tr>
                        <td>j)</td>
                        <td></td>
                        <td>General progress and conduct of the student</td>
                        <td>:</td>
                        <td><div id="data[15]"></div></td>
                    </tr>
                    <tr>
                        <td>k)</td>
                        <td></td>
                        <td>Whether the student has applied for the certificate Or whether the college has given it Suemoto</td>
                        <td>:</td>
                        <td><div id="data[16]"></div></td>
                    </tr>
                    <tr>
                        <td>l)</td>
                        <td></td>
                        <td>Reasons for Applying/giving for the certificate</td>
                        <td>:</td>
                        <td><div id="data[17]"></div></td>
                    </tr>
                    ';
                
            }
            return $a;
        }
    }
    public static function transfercertificatenumberentry($course)
    {
        if($_SESSION['org_id'] == '1')
        {
            if($course <= 4 || $course > 5)
            {
                return '
                <p style="align:right;"></p>
                <table width="100%">
                    <tbody>
                        <tr><td>Admission No.</td><td><input type="text" name="data[0]" id="data[0]" placeholder="Admission No." class="form-control" required></td></tr>
                        <tr><td>Class No.</td><td><input type="text" name="data[1]" id="data[1]" placeholder="Class No." class="form-control" required></td></tr>
                    </tbody>
                </table>';
            }
            if($course == 5)
            {
                return '
                <p style="align:right;"></p>
                <table width="100%">
                    <tbody>
                        <tr><td>Admission No.</td><td><input type="text" name="data[0]" id="data[0]" placeholder="Admission No." class="form-control" required></td></tr>
                        <tr><td>Class No.</td><td><input type="text" name="data[1]" id="data[1]" placeholder="Class No." class="form-control" required></td></tr>
                        <tr><td>Year</td><td><input type="text" name="data[18]" id="data[18]" placeholder="Year" class="form-control" required></td></tr>
                    </tbody>
                </table>';
            }
        }
        if($_SESSION['org_id'] == '3')
        {
            if($course == 1 || $course == 2)
            {
                return '
                <p style="align:right;"></p>
                <table width="100%">
                    <tbody>
                    <tr><td>Hall Ticket No.</td><td><input type="text" name="data[1]" id="data[1]" placeholder="Hall Ticket No." class="form-control" required></td></tr>
                    </tbody>
                </table>';
            }
        }
    }
    public static function transfercertificatenumber($course)
    {
        if($_SESSION['org_id'] == '1')
        {
            if($course <= 4 || $course > 5)
            {
                return '
                    <p style="align:right;"></p>
                    <table width="100%">
                        <tbody>
                            <tr style="text-align:right;"><td>Date: <span id="issuedate"></span></td></tr>
                        </tbody>
                    </table>
                    <table>
                        <tbody>
                            <tr><td>S. No.</td><td><div id="sno"></div></td></tr>
                            <tr><td>T.C. No.</td><td><div id="tcno"></div></td></tr>
                            <tr><td>Admission No.</td><td><div id="data[0]"></div></td></tr>
                            <tr><td>Roll No.</td><td><div id="data[1]"></div></td></tr>
                        </tbody>
                    </table>';
            }
            if($course == 5)
            {
                return '
                    <p style="align:right;"></p>
                    <table width="100%">
                        <tbody>
                            <tr style="text-align:right;"><td>Date: <span id="issuedate"></span></td></tr>
                            </tbody>
                    </table>
                    <table>
                        <tbody>
                            <tr><td>S. No.</td><td><div id="sno"></div></td></tr>
                            <tr><td>T.C. No.</td><td><div id="tcno"></div></td></tr>
                            <tr><td>Admission No.</td><td><div id="data[0]"></div></td></tr>
                            <tr><td>Roll No.</td><td><div id="data[1]"></div></td></tr>
                            <tr><td>Year</td><td><div id="data[18]"></div></td></tr>
                        </tbody>
                    </table>';
            }
        }
    }
    public static function transfercertificatedataentry($course)
    {
        if($_SESSION['org_id'] == '1')
        {
            $acourse=$course;
            if($acourse < 4 || $acourse > 5)
            {
                $a = '
                    <tr>
                        <td width="2%">a)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Name of the student in full</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[2]" id="data[2]" placeholder="Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Name of the parent</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[3]" id="data[3]" placeholder="Parent Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">iii)</td>
                        <td width="46%">Nationality & Religion</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[4]" id="data[4]" placeholder="Nationality & Religion" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">b)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Date of birth as entered in the admission registered</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[5]" id="data[5]" placeholder="Date of Birth" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Caste : BC/SC/ST/Other</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[6]" id="data[6]" placeholder="Cast" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">c)</td>
                        <td width="2%"></td>
                        <td width="46%">Date  on which he was admitted to the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[7]" id="data[7]" placeholder="Date of Admission" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">d)</td>
                        <td width="2%"></td>
                        <td width="46%">Date on which he leaves or has left the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[8]" id="data[8]" placeholder="Date of Leaving the college" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">e)</td>
                        <td width="2%"></td>
                        <td width="46%">Class studying / studies at the leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[9]" id="data[9]" placeholder="Class studying" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">f)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Subject studied by him at the time of leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[10]" id="data[10]" placeholder="Subjects Studied" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Medium which he studies and second language</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[11]" id="data[11]" placeholder="Medieum & Second Language" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">g)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether he is qualified for promotion to the higher class</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[12]" id="data[12]" placeholder="Whether Qualified" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">h)</td>
                        <td width="2%"></td>
                        <td width="46%">The number of days the student has attended The college as against the number of working Days prescribed by the college to the date of Issue of the transfer certificate</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[13]" id="data[13]" placeholder="Number of Days Attended" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">i)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether  he has paid all fees and other money Due to the institution</td>
                        <td>:</td>
                        <td><input type="text" name="data[14]" id="data[14]" placeholder="Whether  he has paid all fees" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>j)</td>
                        <td></td>
                        <td>General progress and conduct of the student</td>
                        <td>:</td>
                        <td><input type="text" name="data[15]" id="data[15]" placeholder="Progress and conduct of the student" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>k)</td>
                        <td></td>
                        <td>Whether the student has applied of the certificate Or whether the college has given it Suemoto</td>
                        <td>:</td>
                        <td><input type="text" name="data[16]" id="data[16]" placeholder="Applied / Suemoto" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>l)</td>
                        <td></td>
                        <td>Reasons for Applying/giving the certificate</td>
                        <td>:</td>
                        <td><input type="text" name="data[17]" id="data[17]" placeholder="Reason" class="form-control" required></td>
                    </tr>
                    ';
                
            }
            if($acourse == 4)
            {
                $a = '
                    <tr>
                        <td width="2%">1.</td>
                        <td width="2%"></td>
                        <td width="46%">Name of the Pupil</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[2]" id="data[2]" placeholder="Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">2.</td>
                        <td width="2%"></td>
                        <td width="46%">Name of the parent or Guardian</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[3]" id="data[3]" placeholder="Parent Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">3.</td>
                        <td width="2%"></td>
                        <td width="46%">Nationality & Religion</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[4]" id="data[4]" placeholder="Nationality & Religion" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">4.</td>
                        <td width="2%"></td>
                        <td width="46%">Whether the candidate belongs to S.C.`s to S.T.`s or Vimuktha Jathis or other socially and education-ally back-ward classes specified in APE rules or is he a convert from the SC`s or ST`s if so, the particulars there of.
                        </td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[5]" id="data[5]" placeholder="Details" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">5.</td>
                        <td width="2%"></td>
                        <td width="46%">Date of birth (in words)  as entered in the admission register
                        </td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[6]" id="data[6]" placeholder="Date of Birth" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">6.</td>
                        <td width="2%">a)</td>
                        <td width="46%">Class in which the pupil was reading at the time of leaving (in words)</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[7]" id="data[7]" placeholder="Class at time of leaving" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">b)</td>
                        <td width="46%">First language under part – I</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[8]" id="data[8]" placeholder="First Language" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">c)</td>
                        <td width="46%">Second language under part –II</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[9]" id="data[9]" placeholder="Second Language" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">d)</td>
                        <td width="46%">Optional under part-III</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[10]" id="data[10]" placeholder="Optional" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">7.</td>
                        <td width="2%"></td>
                        <td width="46%">Mother tongue and medium of Instruction</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[11]" id="data[11]" placeholder="Class at time of leaving" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">8.</td>
                        <td width="2%"></td>
                        <td width="46%">Date of admission to 1st year Intermediate course (the year to be entered in words)
                        </td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[12]" id="data[12]" placeholder="Date of Admission" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">9.</td>
                        <td width="2%"></td>
                        <td width="46%">Class and year in which the pupil was first admitted into the Intermediate course (1st year or 2nd year)
                        </td>
                        <td>:</td>
                        <td><input type="text" name="data[13]" id="data[13]" placeholder="Class & Year" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>10.</td>
                        <td></td>
                        <td>Whether the pupil has been declared eligible by the Board of intermediate Education for University course of Study
                        </td>
                        <td>:</td>
                        <td><input type="text" name="data[14]" id="data[14]" placeholder="Declared by Board" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>11.</td>
                        <td></td>
                        <td>Whether qualified to Study II year class of Inter mediate course (In case of students leaving after completing 1St year class)
                        </td>
                        <td>:</td>
                        <td><input type="text" name="data[15]" id="data[15]" placeholder="Wheather Qualified" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>12.</td>
                        <td>a)</td>
                        <td>Whether the pupil was in receipt of any scholarship (Nature to be specified)
                        </td>
                        <td>:</td>
                        <td><input type="text" name="data[16]" id="data[16]" placeholder="Scholarship" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>b)</td>
                        <td>
                        Whether the pupil was in receipt of any concession (Nature of concession to be specified)
                        </td>
                        <td>:</td>
                        <td><input type="text" name="data[17]" id="data[17]" placeholder="Concession" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>13.</td>
                        <td></td>
                        <td>
                        Personal marks of identification 
                        </td>
                        <td>:</td>
                        <td></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td></td>
                        <td style="text-align: right;">
                        i)
                        </td>
                        <td></td>
                        <td><input type="text" name="data[18]" id="data[18]" placeholder="Identifiation Mark - I" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td></td>
                        <td style="text-align: right;">
                        ii)
                        </td>
                        <td></td>
                        <td><input type="text" name="data[19]" id="data[19]" placeholder="Identifiation Mark - II" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>14.</td>
                        <td></td>
                        <td>
                        Date on which the pupil has actually left the College
                        </td>
                        <td>:</td>
                        <td><input type="text" name="data[20]" id="data[20]" placeholder="Date of Leaving the college" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>15.</td>
                        <td></td>
                        <td>
                        Conduct
                        </td>
                        <td>:</td>
                        <td><input type="text" name="data[21]" id="data[21]" placeholder="Conduct" class="form-control" required></td>
                    </tr>
                    ';
            }
            if($acourse == 5)
            {
                $a = '
                    <tr>
                        <td width="2%">a)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Name of the student in full</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[2]" id="data[2]" placeholder="Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Name of the parent</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[3]" id="data[3]" placeholder="Parent Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">iii)</td>
                        <td width="46%">Nationality & Religion</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[4]" id="data[4]" placeholder="Nationality & Religion" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">b)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Date of birth as entered in the admission registered</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[5]" id="data[5]" placeholder="Date of Birth" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Caste : BC/SC/ST/Other</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[6]" id="data[6]" placeholder="Cast" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">c)</td>
                        <td width="2%"></td>
                        <td width="46%">Date  on which he was admitted to the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[7]" id="data[7]" placeholder="Date of Admission" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">d)</td>
                        <td width="2%"></td>
                        <td width="46%">Date on which he leaves or has left the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[8]" id="data[8]" placeholder="Date of Leaving the college" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">e)</td>
                        <td width="2%"></td>
                        <td width="46%">Class studying / studies at the leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[9]" id="data[9]" placeholder="Class studying" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">f)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Course studied by the student at the time of leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[10]" id="data[10]" placeholder="Subjects Studied" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Medium in which the student studied and second  language</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[11]" id="data[11]" placeholder="Medieum & Second Language" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">g)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether the student is qualified for promotion to the higher class</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[12]" id="data[12]" placeholder="Whether Qualified" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">h)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether  he has paid all fees and other money Due to the institution</td>
                        <td>:</td>
                        <td><input type="text" name="data[13]" id="data[13]" placeholder="Whether  he has paid all fees" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>i)</td>
                        <td></td>
                        <td>General progress and conduct of the student</td>
                        <td>:</td>
                        <td><input type="text" name="data[15]" id="data[15]" placeholder="Progress and conduct of the student" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>j)</td>
                        <td></td>
                        <td>Whether the student has applied of the certificate Or whether the college has given it Suemoto</td>
                        <td>:</td>
                        <td><input type="text" name="data[16]" id="data[16]" placeholder="Applied / Suemoto" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>k)</td>
                        <td></td>
                        <td>Reasons for Applying/giving the certificate</td>
                        <td>:</td>
                        <td><input type="text" name="data[17]" id="data[17]" placeholder="Reason" class="form-control" required></td>
                    </tr>
                    ';
            }
            return $a;
        }
        if($_SESSION['org_id'] == '3')
        {
            $acourse=$course;
            if($acourse == 1)
            {
                $a = '
                    <tr>
                        <td width="2%">1.</td>
                        <td width="48%">Name of the Student in Full (As per SSC)</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[2]" id="data[2]" placeholder="Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">2.</td>
                        <td width="48%">Name of the Parent / Guardian</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[3]" id="data[3]" placeholder="Parent Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">3.</td>
                        <td width="48%">Nationality & Religion</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[4]" id="data[4]" placeholder="Nationality & Religion" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">4.</td>
                        <td width="48%">Whether the candidate belongs to Scheduled Caste or Scheduled Tribe or Backward Class</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[5]" id="data[5]" placeholder="SC/ST"  class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">5.</td>
                        <td width="48%">Date of Birth as Entered in the admission register (in figures & words)</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[6]" id="data[6]" placeholder="Date of Birth" class="form-control" required onfocus="this.type=`date`" onblur="this.type=`text`" ></td>
                    </tr>
                    <tr>
                        <td width="2%">6.</td>
                        <td width="48%">Admission Number and Date</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[7]" id="data[7]" placeholder="Admission Date" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">7.</td>
                        <td width="48%">Class in which the student was first admitted</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[8]" id="data[8]" placeholder="First Admitted Class" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">8.</td>
                        <td width="48%">Period of Stay in Academic Year`s from</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[9]" id="data[9]" placeholder="Period of Stay" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">9.</td>
                        <td width="48%">Whether Qualified for Promotion or not</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[10]" id="data[10]" placeholder="Promotion" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">10.</td>
                        <td width="48%">Whether the Student has Paid all the Fee due to the College</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[11]" id="data[11]" placeholder="Fee Due" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">11.</td>
                        <td width="48%">Whether Student was in receipt of any Scholarship Nature of Scholarship to be Specified</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[12]" id="data[12]" placeholder="Scholarship" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">12.</td>
                        <td width="48%">Conduct and Character</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[13]" id="data[13]" placeholder="Conduct & Character" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">13.</td>
                        <td width="48%">Date of Leaving the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[14]" id="data[14]" placeholder="Date of Leaving College" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">14.</td>
                        <td width="48%">Personal Marks of Identification</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[15]" id="data[15]" placeholder="Personal Marks of Identification" class="form-control" required></td>
                    </tr>
                    ';
                
            }
            if($acourse == 2)
            {
                $a = '
                    <tr>
                        <td width="2%">1.</td>
                        <td width="48%">Name of the Student in Full (As per SSC)</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[2]" id="data[2]" placeholder="Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">2.</td>
                        <td width="48%">Name of the Parent / Guardian</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[3]" id="data[3]" placeholder="Parent Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">3.</td>
                        <td width="48%">Nationality & Religion</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[4]" id="data[4]" placeholder="Nationality & Religion" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">4.</td>
                        <td width="48%">Whether the candidate belongs to Scheduled Caste or Scheduled Tribe or Backward Class</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[5]" id="data[5]" placeholder="SC/ST"  class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">5.</td>
                        <td width="48%">Date of Birth as Entered in the admission register (in figures & words)</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[6]" id="data[6]" placeholder="Date of Birth" class="form-control" required onfocus="this.type=`date`" onblur="this.type=`text`" ></td>
                    </tr>
                    <tr>
                        <td width="2%">6.</td>
                        <td width="48%">Admission Number and Date</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[7]" id="data[7]" placeholder="Admission Date" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">7.</td>
                        <td width="48%">Class in which the student was first admitted</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[8]" id="data[8]" placeholder="First Admitted Class" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">8.</td>
                        <td width="48%">Period of Stay in Academic Year`s from</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[9]" id="data[9]" placeholder="Period of Stay" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">9.</td>
                        <td width="48%">Whether Qualified for Promotion or not</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[10]" id="data[10]" placeholder="Promotion" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">10.</td>
                        <td width="48%">Whether the Student has Paid all the Fee due to the College</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[11]" id="data[11]" placeholder="Fee Due" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">11.</td>
                        <td width="48%">Whether Student was in receipt of any Scholarship Nature of Scholarship to be Specified</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[12]" id="data[12]" placeholder="Scholarship" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">12.</td>
                        <td width="48%">Conduct and Character</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[13]" id="data[13]" placeholder="Conduct & Character" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">13.</td>
                        <td width="48%">Date of Leaving the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[14]" id="data[14]" placeholder="Date of Leaving College" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">14.</td>
                        <td width="48%">Personal Marks of Identification</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[15]" id="data[15]" placeholder="Personal Marks of Identification" class="form-control" required></td>
                    </tr>
                    ';
                
            }
            return $a;
        }
        if($_SESSION['org_id'] == '4')
        {
            $acourse=$course;
            if($acourse == 1)
            {
                $a = '
                    <tr>
                        <td width="2%">a)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Name of the student in full</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[2]" id="data[2]" placeholder="Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Name of the parent</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[3]" id="data[3]" placeholder="Parent Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">iii)</td>
                        <td width="46%">Nationality & Religion</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[4]" id="data[4]" placeholder="Nationality & Religion" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">b)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Date of birth as entered in the admission registered</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[5]" id="data[5]" placeholder="Date of Birth" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Caste : BC/SC/ST/Other</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[6]" id="data[6]" placeholder="Cast" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">c)</td>
                        <td width="2%"></td>
                        <td width="46%">Date  on which he was admitted to the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[7]" id="data[7]" placeholder="Date of Admission" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">d)</td>
                        <td width="2%"></td>
                        <td width="46%">Date on which he leaves or has left the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[8]" id="data[8]" placeholder="Date of Leaving the college" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">e)</td>
                        <td width="2%"></td>
                        <td width="46%">Class studying / studies at the leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[9]" id="data[9]" placeholder="Class studying" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">f)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Course studied by the student at the time of leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[10]" id="data[10]" placeholder="Subjects Studied" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Medium in which the student studied and second  language</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[11]" id="data[11]" placeholder="Medieum & Second Language" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">g)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether the student is qualified for promotion to the higher class</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[12]" id="data[12]" placeholder="Whether Qualified" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">h)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether  he has paid all fees and other money Due to the institution</td>
                        <td>:</td>
                        <td><input type="text" name="data[13]" id="data[13]" placeholder="Whether  he has paid all fees" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>i)</td>
                        <td></td>
                        <td>General progress and conduct of the student</td>
                        <td>:</td>
                        <td><input type="text" name="data[15]" id="data[15]" placeholder="Progress and conduct of the student" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>j)</td>
                        <td></td>
                        <td>Whether the student has applied of the certificate Or whether the college has given it Suemoto</td>
                        <td>:</td>
                        <td><input type="text" name="data[16]" id="data[16]" placeholder="Applied / Suemoto" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>k)</td>
                        <td></td>
                        <td>Reasons for Applying/giving the certificate</td>
                        <td>:</td>
                        <td><input type="text" name="data[17]" id="data[17]" placeholder="Reason" class="form-control" required></td>
                    </tr>
                    ';
            }
            if($acourse == 2)
            {
                $a = '
                    <tr>
                        <td width="2%">a)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Name of the student in full</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[2]" id="data[2]" placeholder="Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Name of the parent</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[3]" id="data[3]" placeholder="Parent Name" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">iii)</td>
                        <td width="46%">Nationality & Religion</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[4]" id="data[4]" placeholder="Nationality & Religion" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">b)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Date of birth as entered in the admission registered</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[5]" id="data[5]" placeholder="Date of Birth" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Caste : BC/SC/ST/Other</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[6]" id="data[6]" placeholder="Cast" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">c)</td>
                        <td width="2%"></td>
                        <td width="46%">Date  on which he was admitted to the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[7]" id="data[7]" placeholder="Date of Admission" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">d)</td>
                        <td width="2%"></td>
                        <td width="46%">Date on which he leaves or has left the college</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[8]" id="data[8]" placeholder="Date of Leaving the college" onfocus="this.type=`date`" onblur="this.type=`text`" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">e)</td>
                        <td width="2%"></td>
                        <td width="46%">Class studying / studies at the leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[9]" id="data[9]" placeholder="Class studying" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">f)</td>
                        <td width="2%">i)</td>
                        <td width="46%">Course studied by the student at the time of leaving</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[10]" id="data[10]" placeholder="Subjects Studied" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%"></td>
                        <td width="2%">ii)</td>
                        <td width="46%">Medium in which the student studied and second  language</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[11]" id="data[11]" placeholder="Medieum & Second Language" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">g)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether the student is qualified for promotion to the higher class</td>
                        <td width="2%">:</td>
                        <td width="48%"><input type="text" name="data[12]" id="data[12]" placeholder="Whether Qualified" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td width="2%">h)</td>
                        <td width="2%"></td>
                        <td width="46%">Whether  he has paid all fees and other money Due to the institution</td>
                        <td>:</td>
                        <td><input type="text" name="data[13]" id="data[13]" placeholder="Whether  he has paid all fees" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>i)</td>
                        <td></td>
                        <td>General progress and conduct of the student</td>
                        <td>:</td>
                        <td><input type="text" name="data[15]" id="data[15]" placeholder="Progress and conduct of the student" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>j)</td>
                        <td></td>
                        <td>Whether the student has applied of the certificate Or whether the college has given it Suemoto</td>
                        <td>:</td>
                        <td><input type="text" name="data[16]" id="data[16]" placeholder="Applied / Suemoto" class="form-control" required></td>
                    </tr>
                    <tr>
                        <td>k)</td>
                        <td></td>
                        <td>Reasons for Applying/giving the certificate</td>
                        <td>:</td>
                        <td><input type="text" name="data[17]" id="data[17]" placeholder="Reason" class="form-control" required></td>
                    </tr>
                    ';
            }
            return $a;
        }
    }
    public static function test()
    {
        $_SESSION['org_id'] = '3';
        $course = 1;
        echo static::transfercertificatedataentry($course);
    }
    public static function transfercertificatedataentryautofillscript()
    {
        $sid = $_POST["id"];
        $data = Homem::getdata("SELECT * FROM `stdnt_tcinfo` WHERE `sid`='$sid'");
        echo $data[0]["data"];
    }
    public static function transfercertificatedataentryoperatorid()
    {
        $sid = $_POST["id"];
        $data = Homem::getdata("SELECT * FROM `stdnt_tcinfo` WHERE `sid`='$sid'");
        echo $data[0]["fk_user_id"];
    }
    public static function transfercertificateentrypagemain()
    {
        $b = static::transfercertificateheading($_POST["course"]);
        $a = '
        <div style="border-style: solid; border-width: thick; padding: 2px;">
        <div style="border-style: solid; border-width: thin;">
        <div style="padding: 10px;">
        <font face="Times New Roman" size="4.9">
        <table width="100%">
            <tbody>
                '.static::transfercertificateheader().'
                '.$b.'
                '.static::transfercertificatenumberentry($_POST["course"]).'
            </tbody>
        </table>
        </font>
        <font face="Times New Roman" size="4.7">
        <table width="100%" >
            '.static::transfercertificatedataentry($_POST["course"]).'
        </table>
        </font>
        </div>
        </div>
        </div>';
        echo $a;
    }
    public static function transfercertificateissueingpagemain()
    {
        $b = static::transfercertificateheading($_POST["course"]);
        $a = '
        <div style="border-style: solid; border-width: thick; padding: 2px;">
        <div style="border-style: solid; border-width: thin;">
        <div style="padding: 10px;">
        <font face="Times New Roman" size="4.9">
        <table width="100%">
            <tbody>
                '.static::transfercertificateheader().'
                '.$b.'
                '.static::transfercertificatenumber($_POST["course"]).'
            </tbody>
        </table>
        </font>
        <font face="Times New Roman" size="4.7">
        <table width="100%" >
            '.static::transfercertificatebody($_POST["id"], $_POST["course"]).'
        </table>
        </font></div></div></div>';
        echo $a;
    }
    public static function dobtotext()
    {
        $dob = $_POST["date"];
        $dobarray = str_split($dob);
        $dobtext = '';
        for($i=0; $i<sizeof($dobarray); $i++)
        {
            $dobtext .= static::singlenumbertotext($dobarray[$i]);
        }
        echo $dobtext;
    }
    public static function transfercertificateissuingpage()
    {
        if($_SESSION['user_role'] == 5 || $_SESSION['user_role'] == 6 || $_SESSION['user_role'] == 4 || $_SESSION['user_role'] == 8)
        {
            $course = Inputs::optionsdb(Homem::getdata("SELECT * FROM `degree_name_master`"), 'id', 'code');
            $dept = Inputs::optionsdb(Homem::getdata("SELECT * FROM `degree_dept_master`"), 'id', 'name');
            $medieum = Inputs::optionsdb(Homem::getdata("SELECT * FROM `medium`"), 'id', 'name');
            $table = '';
            {
                $date = date('Y-m-d');
                $blood = Homem::getdata("SELECT * FROM stdnt_tcdetails_issued sti JOIN user_master um ON um.id=sti.sid WHERE sti.edate='$date'");
                $table = Form::dbtableprint($blood, ['Admission Number', 'Hallticket Number',], ['sid', 'name'], '/Certificates/tccertificateprint', 'sid', '');
            }
            echo static::css();
            echo '<body>';
            echo $_SESSION['menu'];
            echo '
                <div class="clearfix"></div>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-lg-2"> 
                            </div>
                            <div class="col-lg-8">
                                <form action="/Certificates/savetransfercertificateissuingpage" method="POST" enctype="multipart/form-data">
                                    <section class="box" style="margin-top: 30px;">
                                        <header class="panel_header">
                                            <h5 class="title pull-left">Transfer Certificate Issueing</h5>
                                        </header>
                                        <div class="content-body"> 
                                            <div class="row">
                                                <div class="col-lg-6">
                                                    <div class="form-group">   
                                                        <input type="text" name="no" id="no" class="form-control" placeholder="Hallticket Number" onchange="getusername()" required>                                         
                                                    </div>
                                                </div>  
                                                <div class="col-lg-6">
                                                    <div class="form-group">   
                                                        <input type="text" name="name" id="name" class="form-control" placeholder="Student Name"  required readonly>                                         
                                                    </div>
                                                </div>                            
                                            </div>   
                                            <div class="row">
                                                <div class="col-lg-12">
                                                    <div id="feestatus"></div>
                                                    <div id="tcstatus"></div>
                                                    <div id="tcinfo" class="print-this"></div>
                                                    <div id="tcinfoscript"></div>
                                                </div>
                                            </div>
                                            <!--
                                            <div class="row" id="modifylink" style="display:none;">
                                                    <div class="col-lg-12">
                                                        <div class="float-lg-right"><a href="javascript:void(0);" onclick="updatecontactdetails()">Change Contact Information</a></div> 
                                                    </div>
                                            </div>-->
                                            <div class="row"> 
                                                <div class="col-lg-12">
                                                    <div class="form-group"> 
                                                        <input type="hidden" id="gender" name="gender" class="form-control" required>
                                                        <input type="hidden" id="course" name="course" class="form-control" required>
                                                        <input type="hidden" id="dept" name="dept" class="form-control" required>
                                                        <input type="hidden" name="sid" id="sid" class="form-control" placeholder="user id" required>
                                                        <input type="hidden" name="edit_id" id="edit_id" class="form-control" placeholder="edit id">                                         
                                                    </div>
                                                </div>                            
                                            </div> 
                                            <div class="row">
                                                <div class="col-md-12">  
                                                    <div class="form-group" style="display:none;" id="button">
                                                        <button id="btn_reg" class="btn btn-primary pull-right" type="submit" style="background-color: #002366 !important;">Submit</button>
                                                    </div>
                                                </div>
                                            </div>  
                                        </div>
                                    </selection>
                                </form>
                            </div>
                            <div class="col-lg-2">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2"></div>
                            <div class="col-lg-8">
                            '.$table.'
                            </div>
                            <div class="col-lg-2"></div>
                        </div>
                    </div>
                
                ';
            echo '</body>';
            echo static::script();
            echo '
            <script>
                $(document).ready(function(){
                    var div = document.createElement("div");
                    div.id = "addcoplayerinner1";
                    document.getElementsByTagName("body")[0].appendChild(div);
                    $("#addcoplayerinner1").load("/Accounts/addcoplayerinner");
                });
                function updatecontactdetails()
                {
                    $("#addcoplayerinner").modal("show");
                }
                function getusername()
                {
                    var no = $("#no").val();
                    $.ajax({
                        url: "/Accounts/getusernamemobileemail",
                        type: "post",
                        data: {no: no},
                        success: function(d) {
                            const a = JSON.parse(d);
                            document.getElementById("name").value = a[0]["name"];
                            document.getElementById("course").value = a[0]["fk_course_id"];
                            document.getElementById("dept").value = a[0]["fk_dept_id"];
                            document.getElementById("gender").value = a[0]["gender"];
                            if(a[0]["id"] != "")
                            {
                                $("#modifylink").show();
                            }
                            getuserid();
                            <!--setTimeout(function(){ $("#id").val(a[0]["id"]); }, 500);-->
                            setTimeout(function(){
                                var id = $("#sid").val();
                                var course = $("#course").val();
                                $.ajax({
                                    url: "/Certificates/transfercertificateissueingpagemain",
                                    type: "post",
                                    data: {no: no, id: id, course: course},
                                    success: function(d) {
                                        // console.log(d);
                                        document.getElementById("tcinfo").innerHTML = d;
                                    }
                                });
                            }, 500);
                            setTimeout(function(){
                                var id = $("#sid").val();
                                var course = $("#course").val();
                                $.ajax({
                                    url: "/Certificates/transfercertificatedataentryautofillscript",
                                    type: "post",
                                    data: {no: no, id: id, course: course},
                                    success: function(d) {
                                        const a = JSON.parse(d);
                                        var myEle = document.getElementById("data[0]");if(myEle){ 
                                            myEle.innerHTML= a[0];
                                        }
                                        var myEle = document.getElementById("data[1]");if(myEle){ myEle.innerHTML= a[1];}
                                        var myEle = document.getElementById("data[2]");if(myEle){ myEle.innerHTML= a[2];}
                                        var myEle = document.getElementById("data[3]");if(myEle){ myEle.innerHTML= a[3];}
                                        var myEle = document.getElementById("data[4]");if(myEle){ myEle.innerHTML= a[4];}
                                        var myEle = document.getElementById("data[5]");if(myEle){ 
                                            
                                            var date=a[5];
                                            var parsedDate = Date.parse(date);
                                            if (isNaN(date) && !isNaN(parsedDate)) 
                                            {
                                                var s = myEle.getAttribute("name");
                                                if(s == "dob")
                                                {
                                                   let a1 = changedob(a[5], "data[5]");
                                                }
                                                console.log(date);
                                            }
                                            else
                                            {
                                                myEle.innerHTML= a[5];
                                            }
                                        }
                                        var myEle = document.getElementById("data[6]");if(myEle){ myEle.innerHTML= a[6];}
                                        var myEle = document.getElementById("data[7]");if(myEle){ myEle.innerHTML= a[7];}
                                        var myEle = document.getElementById("data[8]");if(myEle){ myEle.innerHTML= a[8];}
                                        var myEle = document.getElementById("data[9]");if(myEle){ myEle.innerHTML= a[9];}
                                        var myEle = document.getElementById("data[10]");if(myEle){ myEle.innerHTML= a[10];}
                                        var myEle = document.getElementById("data[11]");if(myEle){ myEle.innerHTML= a[11];}
                                        var myEle = document.getElementById("data[12]");if(myEle){ myEle.innerHTML= a[12];}
                                        var myEle = document.getElementById("data[13]");if(myEle){ myEle.innerHTML= a[13];}
                                        var myEle = document.getElementById("data[14]");if(myEle){ myEle.innerHTML= a[14];}
                                        var myEle = document.getElementById("data[15]");if(myEle){ myEle.innerHTML= a[15];}
                                        var myEle = document.getElementById("data[16]");if(myEle){ myEle.innerHTML= a[16];}
                                        var myEle = document.getElementById("data[17]");if(myEle){ myEle.innerHTML= a[17];}
                                        var myEle = document.getElementById("data[18]");if(myEle){ myEle.innerHTML= a[18];}
                                        var myEle = document.getElementById("data[19]");if(myEle){ myEle.innerHTML= a[19];}
                                        var myEle = document.getElementById("data[20]");if(myEle){ myEle.innerHTML= a[20];}
                                        var myEle = document.getElementById("data[21]");if(myEle){ myEle.innerHTML= a[21];}
                                        var myEle = document.getElementById("data[22]");if(myEle){ myEle.innerHTML= a[22];}
                                        var myEle = document.getElementById("data[23]");if(myEle){ myEle.innerHTML= a[23];}
                                        var myEle = document.getElementById("data[24]");if(myEle){ myEle.innerHTML= a[24];}
                                        var myEle = document.getElementById("data[25]");if(myEle){ myEle.innerHTML= a[25];}
                                        var myEle = document.getElementById("data[26]");if(myEle){ myEle.innerHTML= a[26];}
                                        var myEle = document.getElementById("data[27]");if(myEle){ myEle.innerHTML= a[27];}
                                        var myEle = document.getElementById("data[28]");if(myEle){ myEle.innerHTML= a[28];}
                                        var myEle = document.getElementById("data[29]");if(myEle){ myEle.innerHTML= a[29];}
                                        var myEle = document.getElementById("data[30]");if(myEle){ myEle.innerHTML= a[30];}
                                        var myEle = document.getElementById("data[31]");if(myEle){ myEle.innerHTML= a[31];}
                                        // console.log(d);
                                        // document.getElementById("tcinfoscript").innerHTML = d;
                                    }
                                });
                                
                            }, 500);
                            
                        }
                    });
                    $.ajax({
                        url: "/Certificates/feecaluclation",
                        type: "post",
                        data: {no: no},
                        success: function(d) {
                            var d1=d;
                            if(d==1)
                            {
                                var myEle = document.getElementById("feestatus");if(myEle){ myEle.innerHTML= "Student Eligible for TC";}
                                document.getElementById("feestatus").style.backgroundColor = "green";
                                document.getElementById("feestatus").style.color = "white";
                            }
                            else
                            {
                                var myEle = document.getElementById("feestatus");if(myEle){ myEle.innerHTML= "Student Not Eligible for TC";}
                                document.getElementById("feestatus").style.backgroundColor = "red";
                                document.getElementById("feestatus").style.color = "white";
                            }
                            $.ajax({
                                url: "/Certificates/tcissuedchecking",
                                type: "post",
                                data: {no: no},
                                success: function(d) {
                                    if(d==1)
                                    {
                                        var myEle = document.getElementById("tcstatus");if(myEle){ myEle.innerHTML=  "TC not at issued";}
                                        document.getElementById("tcstatus").style.backgroundColor = "green";
                                        document.getElementById("tcstatus").style.color = "white";
                                        
                                    }
                                    else
                                    {
                                        var myEle = document.getElementById("tcstatus");if(myEle){ myEle.innerHTML= "TC Already issued, you can not issue the certificate";}
                                        document.getElementById("tcstatus").style.backgroundColor = "red";
                                        document.getElementById("tcstatus").style.color = "white";
                                        
                                    }
                                    if(d1==1 && d==1)
                                    {
                                        setTimeout(function(){
                                            var no = $("#no").val();
                                            var id = $("#sid").val();
                                            var course = $("#course").val();
                                            $.ajax({
                                                url: "/Certificates/transfercertificatedataentryoperatorid",
                                                type: "post",
                                                data: {no: no, id: id, course: course},
                                                success: function(d) {
                                                    var a='.$_SESSION["user_id"].';
                                                    if(a!=d)
                                                    {
                                                        $("#button").show();
                                                    }
                                                }
                                            });
                                        }, 500);
                                    }
                                    else
                                    {
                                        $("#button").hide();
                                    }
                                }
                            });
                        }
                    });
                }
                function changedob(date, id)
                {
                    $.ajax({
                        url: "/Certificates/datemnew",
                        type: "post",
                        data: {date: date},
                        success: function(d) {
                            let d1=d;
                            var myEle = document.getElementById(id);if(myEle){ myEle.innerHTML= d1;}
                            $.ajax({
                                url: "/Certificates/dobtotext",
                                type: "post",
                                data: {date: d1},
                                success: function(d) {
                                    let d1=d;
                                    var myEle = document.getElementById("dobtext");if(myEle){ myEle.innerHTML= d1;}
                                }
                            });
                        }
                    });
                    setTimeout(function(){
                        // let myEle = document.getElementById("data[0]");
                        // var a = myEle[0].getAttribute("name");
                        // alert(a);
                    }, 500);
                }
                function getuserid()
                {
                    var no = $("#no").val();
                    $.ajax({
                        url: "/Accounts/getuserid",
                        type: "post",
                        data: {no: no},
                        success: function(d) {
                            if(d != "fail")
                            {
                                document.getElementById("sid").value = d;
                                
                                $("#btn_reg").show();
                            }
                            else
                            {
                                $("#btn_reg").hide();
                            }
                        }
                    });
                }
            </script>';
            if(isset($_GET['status']))
            {
                if($_GET['status'] == 1)
                {
                    echo '<script>swal("", "Inserted Successfully", "success");</script>';
                }
                else if($_GET['status'] == 2)
                {
                    echo '<script>swal("", "Updated Successfully", "success");</script>';
                }
                else
                {
                    echo '<script>swal("", "Something went Wrong.. Please try again later..", "error");</script>';
                }
            }
            if(isset($_GET['no']))
            {
                echo '
                    <script>
                        $("#no").val("'.$_GET['no'].'");
                        getusername();
                    </script>';
            }
        }
    }
    public static function savetransfercertificateissuingpage()
    {
        if($_SESSION['user_role'] != '' && ($_SESSION['user_role'] == 6 || $_SESSION['user_role'] == 4 || $_SESSION['user_role'] == 5))
        {
            $data = Homem::getdata("SELECT * FROM `user_master` WHERE `id`='$_POST[sid]' AND `no`='$_POST[no]'");
            if(sizeof($data) == 1)
            {
                $id = $data[0]["id"];
                date_default_timezone_set('Asia/Kolkata'); 
                $time = date('H:i:s A');
                $date = date('Y-m-d');
                $tcdata = Homem::getdata("SELECT * FROM `stdnt_tcinfo` WHERE `sid`='$id'");
                $tcinfo = $tcdata[0]['data'];
                $tcno = static::tcno();
                if(sizeof($tcdata) == 1)
                {
                    Homem::insert("INSERT INTO `stdnt_tcdetails_issued` (`id`, `tc_no`, `sid`, `data`, `extra_data`, `fk_user_id`, `etime`, `edate`, `status`) VALUES (NULL, '$tcno', '$id', '$tcinfo', '', '$_SESSION[user_id]', '$time', '$date', '1')");
                }
                echo '<script>window.location = "/Certificates/transfercertificateissuingpage?status=1";</script>';
            }
        }
    }
    public static function transfercertificateentrypage()
    {
        if($_SESSION['user_role'] == 5 || $_SESSION['user_role'] == 6 || $_SESSION['user_role'] == 4 || $_SESSION['user_role'] == 8)
        {
            $course = Inputs::optionsdb(Homem::getdata("SELECT * FROM `degree_name_master`"), 'id', 'code');
            $dept = Inputs::optionsdb(Homem::getdata("SELECT * FROM `degree_dept_master`"), 'id', 'name');
            $medieum = Inputs::optionsdb(Homem::getdata("SELECT * FROM `medium`"), 'id', 'name');
            $table = '';
            {
                $date = date('Y-m-d');
                // $blood = Homem::getdata("SELECT * FROM `stdnt_normalfee` WHERE (`entry_date`='$date' OR `edit_date`='$date') AND (`entry_id`='$_SESSION[user_id]' OR `edit_id`='$_SESSION[user_id]') AND `fk_org_id`='$_SESSION[org_id]'");
                $blood = Homem::getdata("SELECT * FROM stdnt_normalfee sn JOIN user_master um ON um.id=sn.no WHERE (sn.entry_date='$date' OR sn.edit_date='$date') AND (sn.entry_id='$_SESSION[user_id]' OR sn.edit_id='$_SESSION[user_id]') AND sn.fk_org_id='$_SESSION[org_id]'");
                $table = '';
            }
            echo static::css();
            echo '<body>';
            echo $_SESSION['menu'];
            echo '
                <div class="clearfix"></div>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-lg-2"> 
                            </div>
                            <div class="col-lg-8">
                                <form action="/Certificates/savetransfercertificateentrypage" method="POST" enctype="multipart/form-data">
                                    <section class="box" style="margin-top: 30px;">
                                        <header class="panel_header">
                                            <h5 class="title pull-left">Transfer Certificate Data Filling</h5>
                                        </header>
                                        <div class="content-body"> 
                                            <div class="row">
                                                <div class="col-lg-6">
                                                    <div class="form-group">   
                                                        <input type="text" name="no" id="no" class="form-control" placeholder="Hallticket Number" onchange="getusername()" required>                                         
                                                    </div>
                                                </div>  
                                                <div class="col-lg-6">
                                                    <div class="form-group">   
                                                        <input type="text" name="name" id="name" class="form-control" placeholder="Student Name"  required readonly>                                         
                                                    </div>
                                                </div>                            
                                            </div>   
                                            <div class="row">
                                                <div class="col-lg-12">
                                               
                                                    <div id="tcinfo"></div>
                                                    <div id="tcinfoscript"></div>
                                                </div>
                                            </div>
                                            <!--
                                            <div class="row" id="modifylink" style="display:none;">
                                                    <div class="col-lg-12">
                                                        <div class="float-lg-right"><a href="javascript:void(0);" onclick="updatecontactdetails()">Change Contact Information</a></div> 
                                                    </div>
                                            </div>-->
                                            <div class="row"> 
                                                <div class="col-lg-12">
                                                    <div class="form-group"> 
                                                        <input type="hidden" id="gender" name="gender" class="form-control" required>
                                                        <input type="hidden" id="course" name="course" class="form-control" required>
                                                        <input type="hidden" id="dept" name="dept" class="form-control" required>
                                                        <input type="hidden" name="sid" id="sid" class="form-control" placeholder="user id" required>
                                                        <input type="hidden" name="edit_id" id="edit_id" class="form-control" placeholder="edit id">                                         
                                                    </div>
                                                </div>                            
                                            </div> 
                                            <div class="row">
                                                <div class="col-md-12">  
                                                    <div class="form-group">
                                                        <button id="btn_reg" class="btn btn-primary pull-right" type="submit" style="background-color: #002366 !important;">Submit</button>
                                                    </div>
                                                </div>
                                            </div>  
                                        </div>
                                    </selection>
                                </form>
                            </div>
                            <div class="col-lg-2">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2"></div>
                            <div class="col-lg-8">
                            '.$table.'
                            </div>
                            <div class="col-lg-2"></div>
                        </div>
                    </div>
                
                ';
            echo '</body>';
            echo static::script();
            echo '
            <script>
                $(document).ready(function(){
                    var div = document.createElement("div");
                    div.id = "addcoplayerinner1";
                    document.getElementsByTagName("body")[0].appendChild(div);
                    $("#addcoplayerinner1").load("/Accounts/addcoplayerinner");
                });
                function updatecontactdetails()
                {
                    $("#addcoplayerinner").modal("show");
                }
                function getusername()
                {
                    var no = $("#no").val();
                    $.ajax({
                        url: "/Accounts/getusernamemobileemail",
                        type: "post",
                        data: {no: no},
                        success: function(d) {
                            const a = JSON.parse(d);
                            document.getElementById("name").value = a[0]["name"];
                            document.getElementById("course").value = a[0]["fk_course_id"];
                            document.getElementById("dept").value = a[0]["fk_dept_id"];
                            document.getElementById("gender").value = a[0]["gender"];
                            if(a[0]["id"] != "")
                            {
                                $("#modifylink").show();
                            }
                            getuserid();
                            <!--setTimeout(function(){ $("#id").val(a[0]["id"]); }, 500);-->
                            setTimeout(function(){
                                var id = $("#sid").val();
                                var course = $("#course").val();
                                $.ajax({
                                    url: "/Certificates/transfercertificateentrypagemain",
                                    type: "post",
                                    data: {no: no, id: id, course: course},
                                    success: function(d) {
                                        // console.log(d);
                                        document.getElementById("tcinfo").innerHTML = d;
                                    }
                                });
                            }, 500);
                            setTimeout(function(){
                                var id = $("#sid").val();
                                var course = $("#course").val();
                                $.ajax({
                                    url: "/Certificates/transfercertificatedataentryautofillscript",
                                    type: "post",
                                    data: {no: no, id: id, course: course},
                                    success: function(d) {
                                        const a = JSON.parse(d);
                                        var myEle = document.getElementById("data[0]");if(myEle){ myEle.value= a[0];}
                                        var myEle = document.getElementById("data[1]");if(myEle){ myEle.value= a[1];}
                                        var myEle = document.getElementById("data[2]");if(myEle){ myEle.value= a[2];}
                                        var myEle = document.getElementById("data[3]");if(myEle){ myEle.value= a[3];}
                                        var myEle = document.getElementById("data[4]");if(myEle){ myEle.value= a[4];}
                                        var myEle = document.getElementById("data[5]");if(myEle){ myEle.value= a[5];}
                                        var myEle = document.getElementById("data[6]");if(myEle){ myEle.value= a[6];}
                                        var myEle = document.getElementById("data[7]");if(myEle){ myEle.value= a[7];}
                                        var myEle = document.getElementById("data[8]");if(myEle){ myEle.value= a[8];}
                                        var myEle = document.getElementById("data[9]");if(myEle){ myEle.value= a[9];}
                                        var myEle = document.getElementById("data[10]");if(myEle){ myEle.value= a[10];}
                                        var myEle = document.getElementById("data[11]");if(myEle){ myEle.value= a[11];}
                                        var myEle = document.getElementById("data[12]");if(myEle){ myEle.value= a[12];}
                                        var myEle = document.getElementById("data[13]");if(myEle){ myEle.value= a[13];}
                                        var myEle = document.getElementById("data[14]");if(myEle){ myEle.value= a[14];}
                                        var myEle = document.getElementById("data[15]");if(myEle){ myEle.value= a[15];}
                                        var myEle = document.getElementById("data[16]");if(myEle){ myEle.value= a[16];}
                                        var myEle = document.getElementById("data[17]");if(myEle){ myEle.value= a[17];}
                                        var myEle = document.getElementById("data[18]");if(myEle){ myEle.value= a[18];}
                                        var myEle = document.getElementById("data[19]");if(myEle){ myEle.value= a[19];}
                                        var myEle = document.getElementById("data[20]");if(myEle){ myEle.value= a[20];}
                                        var myEle = document.getElementById("data[21]");if(myEle){ myEle.value= a[21];}
                                        var myEle = document.getElementById("data[22]");if(myEle){ myEle.value= a[22];}
                                        var myEle = document.getElementById("data[23]");if(myEle){ myEle.value= a[23];}
                                        var myEle = document.getElementById("data[24]");if(myEle){ myEle.value= a[24];}
                                        var myEle = document.getElementById("data[25]");if(myEle){ myEle.value= a[25];}
                                        var myEle = document.getElementById("data[26]");if(myEle){ myEle.value= a[26];}
                                        var myEle = document.getElementById("data[27]");if(myEle){ myEle.value= a[27];}
                                        var myEle = document.getElementById("data[28]");if(myEle){ myEle.value= a[28];}
                                        var myEle = document.getElementById("data[29]");if(myEle){ myEle.value= a[29];}
                                        var myEle = document.getElementById("data[30]");if(myEle){ myEle.value= a[30];}
                                        var myEle = document.getElementById("data[31]");if(myEle){ myEle.value= a[31];}
                                        // console.log(d);
                                        // document.getElementById("tcinfoscript").innerHTML = d;
                                    }
                                });
                            }, 500);
                        }
                    });
                }
                function getuserid()
                {
                    var no = $("#no").val();
                    $.ajax({
                        url: "/Accounts/getuserid",
                        type: "post",
                        data: {no: no},
                        success: function(d) {
                            if(d != "fail")
                            {
                                document.getElementById("sid").value = d;
                                
                                $("#btn_reg").show();
                            }
                            else
                            {
                                $("#btn_reg").hide();
                            }
                        }
                    });
                }
            </script>';
            if(isset($_GET['status']))
            {
                if($_GET['status'] == 1)
                {
                    echo '<script>swal("", "Inserted Successfully", "success");</script>';
                }
                else if($_GET['status'] == 2)
                {
                    echo '<script>swal("", "Updated Successfully", "success");</script>';
                }
                else
                {
                    echo '<script>swal("", "Something went Wrong.. Please try again later..", "error");</script>';
                }
            }
            if(isset($_GET['no']))
            {
                echo '
                    <script>
                        $("#no").val("'.$_GET['no'].'");
                        getusername();
                    </script>';
            }
        }
    }
    public static function savetransfercertificateentrypage()
    {
        if($_SESSION['user_role'] != '' && ($_SESSION['user_role'] == 6 || $_SESSION['user_role'] == 4 || $_SESSION['user_role'] == 5))
        {
            if(sizeof(Homem::getdata("SELECT * FROM `user_master` WHERE `id`='$_POST[sid]' AND `no`='$_POST[no]'")) == 1)
            {
                date_default_timezone_set('Asia/Kolkata'); 
                $time = date('Y-m-d H:i:s A');
                $data = array();
                $data = $_POST['data'];
                $d = json_encode($data);
                if(sizeof(Homem::getdata("SELECT * FROM `stdnt_tcinfo` WHERE `sid`='$_POST[sid]'")) == 0)
                {
                    Homem::insert("INSERT INTO `stdnt_tcinfo` (`id`, `sid`, `data`, `etime`, `fk_user_id`, `status`) VALUES (NULL, '$_POST[sid]', '$d', '$time', '$_SESSION[user_id]', '1')");
                }
                else
                {
                    Homem::insert("UPDATE `stdnt_tcinfo` SET `data`='$d', `etime`='$time', `fk_user_id`='$_SESSION[user_id]' WHERE `sid`='$_POST[sid]'");
                }
                echo '<script>window.location = "/Certificates/transfercertificateentrypage?status=1";</script>';
            }
        }
    }
    public static function tccertificateprint()
    {
        if($_SESSION['user_role'] == 5 || $_SESSION['user_role'] == 6 || $_SESSION['user_role'] == 4 || $_SESSION['user_role'] == 8)
        {

            $data = Homem::getdata("SELECT sti.*, um.fk_course_id FROM stdnt_tcdetails_issued sti JOIN user_master um ON um.id=sti.sid WHERE sti.sid='$_GET[editid]'");
            $tc = $data[0]["data"];
            // echo json_encode($data);
            $size=22;
            if($_SESSION['org_id'] == 1)
            {
                if($data[0]["fk_course_id"] <4)
                {
                    $size=25;
                }
                if($data[0]["fk_course_id"] ==4)
                {
                    $size=22;
                }
                if($data[0]["fk_course_id"] >4)
                {
                    $size=28;
                }
            }
            
            $b = static::transfercertificateheading($data[0]["fk_course_id"]);
            $a = '
            <style>td { vertical-align: top;}</style>
            <div style="border-style: solid; border-width: thick; padding: 2px;">
            <div style="border-style: solid; border-width: thin;">
            <div style="padding: 10px;">
            <div style="line-height: 1.2; font-family: Times New Roman; font-size: 25px; margin-top: -10px;">
            <table width="100%">
                <tbody>
                    '.static::transfercertificateheader().'
                    '.$b.'
                    '.static::transfercertificatenumber($data[0]["fk_course_id"]).'
                </tbody>
            </table>
            </div>
            <div style="line-height: 1.2; font-family: Times New Roman; font-size: '.$size.'px;">
            <table width="100%" style="vertical-align: top;">
                '.static::transfercertificatebody('1', $data[0]["fk_course_id"]).'
            </table>
            </div>
            <tr><td><br /><p style=" text-align:right; margin-right: 20px; font-family: Cambria; font-size: 30px;"><b>PRINCIPAL</b></p></td></tr>
            </div></div></div>';
            echo static::css();
            echo '<body>';
            echo $_SESSION['menu'];
            echo '
                <div class="clearfix"></div>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-lg-2"> 
                            </div>
                            <div class="col-lg-8">
                                <form action="/Certificates/savetransfercertificateentrypage" method="POST" enctype="multipart/form-data">
                                    <section class="box" style="margin-top: 30px;">
                                        <header class="panel_header">
                                            <h5 class="title pull-left">Transfer Certificate For Print</h5>
                                        </header>
                                        <div class="content-body" style="margin-top:-20px;"> 
                                            <div class="row">
                                                <div class="col-lg-12">
                                                    <div class="print-this">'.$a.'</div>
                                                    <div id="tcinfo"></div>
                                                    <div id="tcinfoscript"></div>
                                                </div>
                                            </div>
                                        </div>
                                    </selection>
                                </form>
                            </div>
                            <div class="col-lg-2">
                            </div>
                        </div>
                    </div>
                
                ';
            echo '</body>';
            echo static::script();
            echo '
            <script>
                $(document).ready(function(){
                    var div = document.createElement("div");
                    div.id = "addcoplayerinner1";
                    document.getElementsByTagName("body")[0].appendChild(div);
                    $("#addcoplayerinner1").load("/Accounts/addcoplayerinner");
                });
                setTimeout(function(){
                    // var id = $("#sid").val();
                        // var course = $("#course").val();
                        // $.ajax({
                        //     url: "/Certificates/transfercertificateissueingpagemain",
                        //     type: "post",
                        //     data: {},
                        //     success: function(d) {
                        //         // console.log(d);
                        //         // document.getElementById("tcinfo").innerHTML = d;
                        //     }
                    // });
                    var d=`'.$tc.'`;
                    const a = JSON.parse(d);
                    var myEle = document.getElementById("sno");if(myEle){ myEle.innerHTML= "'.$data[0]["id"].'";}
                    var myEle = document.getElementById("issuedate");if(myEle){ myEle.innerHTML= "'.static::datem($data[0]["edate"]).'";}
                    var myEle = document.getElementById("tcno");if(myEle){ myEle.innerHTML= "'.$data[0]["tc_no"].'";}
                    var myEle = document.getElementById("data[0]");if(myEle){ myEle.innerHTML= a[0];}
                    var myEle = document.getElementById("data[1]");if(myEle){ myEle.innerHTML= a[1];}
                    var myEle = document.getElementById("data[2]");if(myEle){ myEle.innerHTML= a[2];}
                    var myEle = document.getElementById("data[3]");if(myEle){ myEle.innerHTML= a[3];}
                    var myEle = document.getElementById("data[4]");if(myEle){ myEle.innerHTML= a[4];}
                    var myEle = document.getElementById("data[5]");if(myEle)
                    { 
                            var date=a[5];
                            var parsedDate = Date.parse(date);
                            if (isNaN(date) && !isNaN(parsedDate)) {
                                const myArray = date.split("-");
                                var alt = myArray[2]+"-"+myArray[1]+"-"+myArray[0];
                                myEle.innerHTML= alt;
                                var s = myEle.getAttribute("name");
                                if(s == "dob")
                                {
                                    let a1 = changedob(a[5], "data[5]");
                                }
                                // myEle.innerHTML= alt;
                            }
                            else
                            {
                                myEle.innerHTML= a[5];
                            }
                       }
                    var myEle = document.getElementById("data[6]");if(myEle){ 
                        var date=a[6];
                            var parsedDate = Date.parse(date);
                            if (isNaN(date) && !isNaN(parsedDate)) {
                                const myArray = date.split("-");
                                var alt = myArray[2]+"-"+myArray[1]+"-"+myArray[0];
                                myEle.innerHTML= alt;
                                var s = myEle.getAttribute("name");
                                if(s == "dob")
                                {
                                    let a1 = changedob(a[6], "data[6]");
                                }
                                // myEle.innerHTML= alt;
                            }
                            else
                            {
                                myEle.innerHTML= a[6];
                            }
                    }
                    var myEle = document.getElementById("data[7]");if(myEle){ 
                            var date=a[7];
                            var parsedDate = Date.parse(date);
                            if (isNaN(date) && !isNaN(parsedDate)) {
                                const myArray = date.split("-");
                                var alt = myArray[2]+"-"+myArray[1]+"-"+myArray[0];
                                myEle.innerHTML= alt;
                            }
                            else{myEle.innerHTML= a[7];}
                        }
                    var myEle = document.getElementById("data[8]");if(myEle){ 
                        var date=a[8];
                        var parsedDate = Date.parse(date);
                        if (isNaN(date) && !isNaN(parsedDate)) {
                            const myArray = date.split("-");
                            var alt = myArray[2]+"-"+myArray[1]+"-"+myArray[0];
                            myEle.innerHTML= alt;
                        }
                        else{myEle.innerHTML= a[8];}}
                    var myEle = document.getElementById("data[9]");if(myEle){ myEle.innerHTML= a[9];}
                    var myEle = document.getElementById("data[10]");if(myEle){ myEle.innerHTML= a[10];}
                    var myEle = document.getElementById("data[11]");if(myEle){ myEle.innerHTML= a[11];}
                    var myEle = document.getElementById("data[12]");if(myEle){ myEle.innerHTML= a[12];}
                    var myEle = document.getElementById("data[13]");if(myEle){ myEle.innerHTML= a[13];}
                    var myEle = document.getElementById("data[14]");if(myEle){ myEle.innerHTML= a[14];}
                    var myEle = document.getElementById("data[15]");if(myEle){ myEle.innerHTML= a[15];}
                    var myEle = document.getElementById("data[16]");if(myEle){ myEle.innerHTML= a[16];}
                    var myEle = document.getElementById("data[17]");if(myEle){ myEle.innerHTML= a[17];}
                    var myEle = document.getElementById("data[18]");if(myEle){ myEle.innerHTML= a[18];}
                    var myEle = document.getElementById("data[19]");if(myEle){ myEle.innerHTML= a[19];}
                    var myEle = document.getElementById("data[20]");if(myEle){ 
                        var date=a[20];
                        var parsedDate = Date.parse(date);
                        if (isNaN(date) && !isNaN(parsedDate)) {
                            const myArray = date.split("-");
                            var alt = myArray[2]+"-"+myArray[1]+"-"+myArray[0];
                            myEle.innerHTML= alt;
                        }
                        else{myEle.innerHTML= a[20];}
                    }
                    var myEle = document.getElementById("data[21]");if(myEle){ myEle.innerHTML= a[21];}
                    var myEle = document.getElementById("data[22]");if(myEle){ myEle.innerHTML= a[22];}
                    var myEle = document.getElementById("data[23]");if(myEle){ myEle.innerHTML= a[23];}
                    var myEle = document.getElementById("data[24]");if(myEle){ myEle.innerHTML= a[24];}
                    var myEle = document.getElementById("data[25]");if(myEle){ myEle.innerHTML= a[25];}
                    var myEle = document.getElementById("data[26]");if(myEle){ myEle.innerHTML= a[26];}
                    var myEle = document.getElementById("data[27]");if(myEle){ myEle.innerHTML= a[27];}
                    var myEle = document.getElementById("data[28]");if(myEle){ myEle.innerHTML= a[28];}
                    var myEle = document.getElementById("data[29]");if(myEle){ myEle.innerHTML= a[29];}
                    var myEle = document.getElementById("data[30]");if(myEle){ myEle.innerHTML= a[30];}
                    var myEle = document.getElementById("data[31]");if(myEle){ myEle.innerHTML= a[31];}
                    
                }, 500);
                function changedob(date, id)
                {
                    var date=date;
                    const myArray = date.split("-");
                    var d1 = myArray[2]+"-"+myArray[1]+"-"+myArray[0];
                    var myEle = document.getElementById(id);if(myEle){ myEle.innerHTML= d1;}
                    $.ajax({
                        url: "/Certificates/dobtotext",
                        type: "post",
                        data: {date: d1},
                        success: function(d) {
                            let d1=d;
                            var myEle = document.getElementById("dobtext");if(myEle){ myEle.innerHTML= d1;}
                        }
                    });

                    setTimeout(function(){
                        // let myEle = document.getElementById("data[0]");
                        // var a = myEle[0].getAttribute("name");
                        // alert(a);
                    }, 500);
                }
            </script>';
            if(isset($_GET['status']))
            {
                if($_GET['status'] == 1)
                {
                    echo '<script>swal("", "Inserted Successfully", "success");</script>';
                }
                else if($_GET['status'] == 2)
                {
                    echo '<script>swal("", "Updated Successfully", "success");</script>';
                }
                else
                {
                    echo '<script>swal("", "Something went Wrong.. Please try again later..", "error");</script>';
                }
            }
        }
    }
    public static function feecaluclation()
    {
        $no = Homem::getdata("SELECT * FROM `user_master` WHERE `no`='$_POST[no]'");
        $id = $no[0]['id'];
        $paid = Homem::getdata("SELECT SUM(`amount`) as sum FROM `stdnt_normalfee` WHERE `no`='$id'");
        $actual = Homem::getdata("SELECT SUM(`feeamount`) as sum FROM `stdnt_feemaster` WHERE `no`='$id'");
        if($paid[0]['sum'] >= $actual[0]['sum'])
        {
            echo '1';
        }
        else
        {
            echo '0';
        }
    }
    private static function tcfront()
    {
        date_default_timezone_set('Asia/Kolkata'); 
        $date =  date('Y'); 
        return $date;
    }
    public static function tcno()
    {
        date_default_timezone_set('Asia/Kolkata'); 
        $date =  date('Y-');
        $query = "SELECT * FROM `stdnt_tcdetails_issued` WHERE `tc_no` LIKE '%$date%'";
        $data = Homem::getdata($query);
        $count = sizeof($data);
        $new = $count+1;
        $rno = static::tcfront().'-'.$new;
        $data = Homem::getdata("SELECT * FROM `stdnt_tcdetails_issued` WHERE `tc_no`='$rno'");
        if(sizeof($data) == 0)
        {
            return $rno;
        }
        else
        {
            return 'retry';
        }

    }
    public static function tcissuedchecking()
    {
        $no = Homem::getdata("SELECT * FROM `user_master` WHERE `no`='$_POST[no]'");
        $id = $no[0]['id'];
        $data = Homem::getdata("SELECT * FROM `stdnt_tcdetails_issued` WHERE `sid`='$id'");
        if(sizeof($data) == 0)
        {
            echo '1';
        }
        else
        {
            echo '0';
        }
        //Y193028266
    }
}