<?php require "_header.php";
error_reporting(1); ?>
<div id="report-content">

    <?php
    if ($_REQUEST["ID"] != "" && isset($_REQUEST["ID"])) {
        $certificate_no = Escape($_REQUEST["ID"]);
        $student_id = Escape($_REQUEST["student_id"]);
        $header_row_string = "";
        $limit = 1;
        $start = 0;
        $condition = "";
        $order_field = "";
        $order_type = "";

        if ($certificate_no != "") {
            $condition .= " and cm.certificate_no='$certificate_no'";
        }
        if ($student_id != "") {
            $condition .= " and cm.student_id='$student_id'";
        }

        $objrelievingorder = new relievingorderCertificateMgmt();
        $out = $objrelievingorder->getAllRecords($limit, $start, $condition, $order_field, $order_type);
        if (dbRows($out)) {
            $row = dbArray($out);
            extract($row);
        }
    }

    if ($student_gender == 'Male') {
        $var = "His";
        $var2 = "his";
        $var3 = "him";
        $rel = "Son";
        $gn = "He";
    } else {
        $var = "Her";
        $var2 = "her";
        $var3 = "her";
        $char = "Miss.";
        $rel = "Daughter";
        $gn = "She";
        if ($marital_status == 'Married') {
            $char = "Mrs.";
            $rel = "Wife";
        }
    }

    if ($student_active == 'Yes') {
        $active = 'is';
    } else {
        $active = 'was';
    }

    $year_parts = explode('-', $year_name);
    $formatted_year = $year_parts[0] . '/' . substr($year_parts[1], -2);

    $withHeader = isset($_GET['withHeader']) ? $_GET['withHeader'] : 'false';
    ?>

    <?php ob_start(); //starting for 
    ?>
    <table width="90%" style="border:3px solid #000;" cellpadding="3" cellspacing="3" align="center" class="ver12">
    <?php if ($withHeader == 'true') { ?>
        <tr>
            <td colspan="4" align="center">
                <img src="<?php echo $SiteBaseUrl . $CollegeImagePath . $_SESSION["VedantnrCollegeLogo"]; ?>"
                    alt="College Logo" style="width: 80px; height: auto; float: left; margin-right: 10px;">
                    <div style="display: inline-block; vertical-align: middle;">
									<b style="font-size: 30px;"><?php echo $_SESSION["VedantnrCollegeName"]; ?></b><br>
									<?php echo $_SESSION["VedantnrCollegeAddress"]; ?><br>
									Phone: <?php echo $_SESSION["VedantnrCollegePhone"]; ?>&nbsp;&nbsp;
									Email: <?php echo $_SESSION["VedantnrCollegeEmail"]; ?>
								</div>
            </td>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <hr>
            </td>
        </tr>
        <?php } ?>
        <tr style="line-height:20px; ">
            <td style="text-align:left;">&nbsp;</td>
            <td style="text-align:right;"><b>R.O. Certificate No. <u><b><?php print $certificate_no; ?></u></b></td>
        </tr>
        <tr>
            <td colspan="4" style="text-align:center; font-size: 148%;">
                <h2><b><u>RELIEVING ORDER</u></b></h2>
            </td>
        </tr>
        <tr>
            <td colspan="4" style="text-align:center; font-size: 148%;">
                <h5><b><u>TO WHOM IT MAY CONCERN</u></b></h5>
            </td>
        </tr>

        <tr style="line-height:12px">
            <td colspan="2">
                <p style="line-height: 1.6;">This is to certify that <?php echo $char; ?>
                    <b><u><?php echo $student_name; ?></u></b> studied <b><u><?php echo $branch_name; ?></u></b>
                    course in our <b><u><?php echo $_SESSION["VedantnrCollegeName"]; ?>, Mota Sonela</u></b>
                    from
                    <b><u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u></b>
                    to <b><u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u>
                    </b>.
                    <?php echo $gn; ?> has been relieved from
                    <b><u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u></b>
                    after college hourse. During this time period <?php echo $var2; ?> character was good in this
                    institute.
                </p>
                <p style="line-height: 1.6; text-align: center;"> All the best for <?php echo $var2; ?> for bright
                    future.</p>
            </td>
        </tr> <br />
        <tr style="line-height:10px">
            <td style="text-align:left" colspan="1">&nbsp;</td>
        </tr>
        <tr style="line-height:12px">
            <td style="text-align:left"><b>Date of Issue :
                    <?php print date("d/m/Y", strtotime($relievingorder_date)); ?></b></td>
        </tr>
        <tr>
            <td style="text-align:left"><b>Place : Mota Sonela</b></td>
        </tr>
        <tr>
            <td style="text-align:left">&nbsp;</td>

            <td style="text-align:right"><b><span style="padding-right:68px;padding-top:50px;">PRINCIPAL,</span></br>
                    <span
                        style="padding-right:4px;padding-top:50px;"><?php echo $_SESSION['aCollegeName']; ?>,</span><br>
                    <span style="padding-right:21px;padding-top:50px;">Mota Sonela, Lunawada.</span></b></td>
        </tr>

    </table>
    <br />

</div>
<?php $HtmlCode = ob_get_contents();
ob_end_flush();
$HtmlUrl = "student-relievingorder-certificate-report-" . $_SESSION["VedantnrUserId"] . ".html";
$HtmlPath = "report/" . $HtmlUrl;
createHTMLReportPage($header_row_string, $HtmlUrl, $HtmlPath, $HtmlCode, false);
?>
<br />
<form name="frm" id="frm" action="" method="post" align="center">
    <input type="hidden" name="txtFile" id="txtFile" value="<?php echo $HtmlUrl; ?>" />
    <input type="button" name="btnPrint" id="btnPrint" value="Print" onClick="SetPageAction('PRINT');" />
    <input type="button" name="btnPdf" id="btnPdf" value="Create PDF" onclick="SetPageAction('PDF');" />
    <input type="button" name="btnHtml" id="btnHtml" value="Create HTML" onclick="SetPageAction('HTML');" />
    <input type="button" name="btnWord" id="btnWord" value="Create WORD" onclick="SetPageAction('WORD');" />
    <input type="button" name="btnExcel" id="btnExcel" value="Create EXCEL" onclick="SetPageAction('Excel');" />
</form>
<script language="javascript" type="text/javascript">
    function SetPageAction(varAction) {
        if (varAction == "PRINT") {
            document.frm.action = "print/create-print.php";
            document.frm.submit();
        }
        if (varAction == "PDF") {
            document.frm.action = "convertpdf/create-pdf.php";
            document.frm.target = "_blank";
            document.frm.submit();
        }
        else if (varAction == "HTML") {
            document.frm.action = "<?php echo $HtmlPath; ?>";
            document.frm.target = "_blank";
            document.frm.submit();
        }
        else if (varAction == "WORD") {
            document.frm.action = "convertword/create-word.php";
            document.frm.target = "_blank";
            document.frm.submit();
        }
        else if (varAction == "Excel") {
            document.frm.action = "convertword/create-excel.php";
            document.frm.target = "_blank";
            document.frm.submit();
        }
    }
</script>
<?php require "_footer.php"; ?>