<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>

    <style>
        @media print{
            
            /*.tabletest {*/
            /*    width:100%;*/
            /*}*/
            
            .hide {
                display:none;
            }

        }
    </style>

    <script>
        function printme(){
            window.print();
        }
    </script>

</head>
<body>

<form method="post" action="">
<select class="hide" name="section">
    <option value="">--Select Section--</option>
    <?php $section = $db->getRows("select * from section order by name");
        foreach($section as $sec){?>
        <option value="<?php echo $sec["name"]; ?>"><?php echo $sec["name"]; ?></option>
        <?php } ?>
</select>
<button type="submit" class="hide">Search</button>
<button onclick="printme()" class="hide">Print</button>
</form>

<?php
    $id = $_GET['id'];
    $class = $_GET['class'];

    $wheresection = "";
    if(isset($_POST["section"]) && trim($_POST['section'])!=''){
        $wheresection = " section='$_POST[section]' and ";
    } else {
        if($_GET['section']!=""){
            $wheresection = " section='$_GET[section]' and ";
        }
    }

	$paper = $db->getRow("SELECT * FROM omr_paper WHERE session='".$_SESSION["admin"]["session"]."' and id='$id' ");

    $subomr = $db->getVal("select sub_omr from subject where id='$paper[subject]' ");

    if(count($paper) > 0){

    $allquestions = $db->getRows("select * from omr_question where paper='$id' ");

    $allstudent = $db->getRows("select * from student where class='$class' and $wheresection session='".$_SESSION['admin']['session']."' and status=1 ");
    foreach($allstudent as $stu){    
?>
<div class="container-fluid mydiv">
    
    <div class="row">

    <div class="col-md-12">
        <div style="background:black;width:20px;height:20px;float:left;"></div>
        <div style="background:black;width:20px;height:20px;float:right;"></div>
    </div>
    
    <!--<br><br>-->
    <!--<div class="tab-content">-->

    <!--    <div style="width:100%;">-->

    <!--        <div style="width:100%;float:left;">-->
    <!--            <table cellspacing="0" style="width:100%;color:#d11d53;text-align:center;border-color:#d11d53" border="1">-->
    <!--                <tr>-->
    <!--                    <td style="background:pink;color:black;font-weight:600">Class</td>-->
    <!--                    <td style="background:pink;color:black;font-weight:600">Student's Name</td>-->
    <!--                    <td style="background:pink;color:black;font-weight:600">Subject</td>-->
    <!--                    <td style="background:pink;color:black;font-weight:600;width:100px;">Roll No.</td>-->
    <!--                </tr>-->
    <!--                <tr>-->
                        <!--<td style="height:25px;font-weight:600;"><?php echo $stu['omr']; ?></td>-->
                        <!--<td style="height:25px;font-weight:600;"><?php echo $stu['name']; ?></td>-->
                        <!--<td style="height:25px;font-weight:600;"><?php echo $subomr;?></td>-->
                        <!--<td style="height:25px;font-weight:600;"><?php echo $stu['fincome']; ?></td>-->
                        <td style="height:25px;font-weight:600;"><?php //echo $stu['omr']; ?></td>
                        <td style="height:25px;font-weight:600;"><?php //echo $stu['name']; ?></td>
                        <td style="height:25px;font-weight:600;"><?php //echo $subomr;?></td>
                        <td style="height:25px;font-weight:600;"><?php //echo $stu['fincome']; ?></td>
    <!--                </tr>-->
    <!--            </table>-->
    <!--        </div>-->
    
    <!--    </div>-->

    <!--</div>-->
    <div style="width:950px;color:transparent">.</div>
    
    <div class="col-md-12">

        <table class="table table-bordered table-sm" style="color:#d11d53;text-align:center;float:left;margin-top:0px;width:5%;">
            <tbody>
                <?php   for($i=1;$i<41;$i++){   ?>
                    <tr>
                        <td>
                            <!--<label style='border:solid 1px;width:18px;height:18px;border-radius:50%;border-color:transparent;'><?php echo $i; ?></label>-->
                            <div style="width:20px;height:20px;border-radius:50%;border:solid 1px;padding:5px;margin:3px auto;border-color:transparent;">
                                <label style='margin-top:-8px;position:absolute;margin-left:-5px;'><?php echo $i; ?></label>
                            </div>
                        </td>
                    </tr>
                <?php   }   ?>
            </tbody>
        </table>

        <table class="table table-sm table-borderless" style="color:#d11d53;text-align:center;float:left;margin-top:0px;width:40%;margin-left:10px;border:solid 1px;">
            <tbody>
                <?php   for($i=1;$i<41;$i++){   ?>
                    <tr>
                        <?php foreach( range('A', 'D') as $ele) {
                                echo "<td style='font-weight:bold;text-align:center;'>"; ?>
                                <!--<label style='border:solid 1px;width:18px;height:18px;border-radius:50%;padding-bottom:20px;'>$ele</label>-->

                                <div style="width:20px;height:20px;border-radius:50%;border:solid 1px;padding:5px;margin:3px auto;">
                                    <label style='margin-top:-8px;position:absolute;margin-left:-5px;'><?php //echo $ele; ?></label>
                                </div>

                                <!--<label style='border:solid 1px;width:18px;height:18px;border-radius:50%;'>A</label>-->

                            <?php
                                echo "</td>";
                            }
                        ?>
                    </tr>
                <?php   }   ?>
            </tbody>
        </table>

        <table class="table table-bordered table-sm" style="color:#d11d53;text-align:center;float:left;margin-top:0px;width:5%;margin-left:20px;">
            <tbody>
                <?php   for($i=41;$i<81;$i++){  ?>
                    <tr>
                        <td><?php echo $i; ?></td>
                    </tr>
                <?php   } ?>
            </tbody>
        </table>

        <table class="table table-bordered table-sm" style="color:#d11d53;text-align:center;float:left;margin-top:0px;width:40%;border:solid 1px;margin-left:10px;">
            <tbody>
                <?php   for($i=41;$i<81;$i++){  ?>
                    <tr>
                        <?php foreach( range('A', 'D') as $ele) {
                                echo "<td style='font-weight:bold;'><label style='border:solid 1px;width:18px;height:18px;border-radius:50%;'>$ele</label></td>";
                            }
                        ?>
                    </tr>
                <?php   }   ?>
            </tbody>
        </table>

    </div>

    <div class="col-md-12">
        <div style="background:black;width:20px;height:20px;float:left;bottom:-5px;position:relative;"></div>
        <div style="background:black;width:20px;height:20px;bottom:-5px;position:relative;float:right;"></div>
    </div>    



    
    </div>

</div>
<style>
    @media print {
        .mydiv {page-break-after: always;}
    }
</style>

<?php } 
    }   ?>


</body>
</html>







