<?php include('parent/callMe.php');?>
<?php include('Sessioncheck.php');?>

<?php 

$termID=$_REQUEST['term_id'];

$STDStudents=ltrim($_GET['students'], 'undefined,');

//getting branch details 


$branch=getBranch($m);

$classID=$_REQUEST['class_id'];
$feestatus=$_REQUEST['fee'];
$sectionID=$_REQUEST['section'];
$branchID=$_SESSION['branch'];
$sessionID=$_REQUEST['session'];
$monthId=$_REQUEST['month'];


  if($STDStudents!=NULL){
    
      $WorkAssignListings = explode(",",$STDStudents);
  }



 $m->where("branch_id", $_SESSION['branch']);
 $m->where("term_id", $_REQUEST['term_id']);
 $TermName=$m->get("eduportal_exam_terms");


 $sql3 = " select * from  eduportal_datesheet_details as detail, eduportal_datesheet_subject_day as day where detail.class_id='$classID' and detail.Dsheet_detail_id=day.detail_sheet_id and detail.term_id='$termID' and detail.branch_id='$branchID' order by day.id ASC";
 $subjects = $m->query($sql3);
 //print_r($sql3);

?>

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Favicons-->
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />
<title>Print Roll Number Slips</title>
<!-- Favicons-->
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />

<script type="text/javascript">
  //window.print();
</script>
<style> 
  
.section{width:32%; height:auto;float:left;border-right: 2px solid black;border-right-style:dotted;padding-right:1%;margin-left:1%;}
tr th {background-color:gray;text-align:center;font-size:14px;border:1px solid black;}
tr td {border-bottom:1px solid black;border-left:1px solid black;padding:.8%;}

  
@media print {
    #Header, #Footer { display: none !important; }
}
@media screen
   {
      p.bodyText {font-family:verdana, arial, sans-serif;}
   }

   @media print
   {
      p.bodyText {font-family:georgia, times, serif;}
   }
   @media screen, print
   {
      p.bodyText {font-size:10pt}
   }
   @media print {
  a[href]:after {
    content: none !important;
  }
}


  body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #FAFAFA;
    font-weight:bold;
    font-size:15px;
    /*font: 12pt "Tahoma";*/
}
* {
    box-sizing: border-box;
    -moz-box-sizing: border-box;
}
.page {
    width: 21cm;
    min-height:29.7cm;        
    padding-left:5mm;
    padding-top:1.3mm;
    padding-bottom:35mm;
    margin: 10mm auto;
    border: 1px #D3D3D3 solid;
    border-radius: 5px;
    background: white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}
/*.subpage {
    width: 21cm;
    height:29.7cm;
 
    
}*/

@page {
    size: A4 portrait;
    margin: 0;
}
@media print {
    html, body {
        width:21cm;
        height:29.7;        
    }
    .page {
        margin: 0;
        border: initial;
        border-radius: initial;
        width: initial;
        min-height: initial;
        box-shadow: initial;
        background: initial;
        page-break-after: blue;
    }
}


  </style>

</head>
<body>



<?php


$SelectedStudents=$WorkAssignListings;

for($k=0;$k<count($SelectedStudents);$k++){


       $stdID=$SelectedStudents[$k];
  

       $sql = "SELECT * FROM edu_student_details as std WHERE std.status='0' and std.student_id='$stdID' and std.branch_id=".$_SESSION['branch']. " ";

    if($_REQUEST['class_id']!=NULL){ 

    if($_REQUEST['class_id']=="All"){
      $sql;
    } else {
    $sql .= " AND std.class_id = '" .$_REQUEST['class_id']. "' ";

    }

    if($_REQUEST['section']=="All"){
      $sql;
    } else {
    $sql .= " AND std.section_id =" . $_REQUEST['section']. " ";

    }


     $WorkAssignValue = $m->query($sql);
  }
?>


  <div class="">
    <div class="page" style="">
      




<div style="height: 25.7cm;"> 

<div style="width: 95%;">
  
   
   
  <div style="width: 100%;">
        
      <div style="width: 15%;float: left;">
            <img src="<?php echo DOMAIN.AgentDirectory;?>img/<?php echo $branch[0]['logo']; ?>" style="height:70px;width:70px;" />    
      </div>

      <div style="width:70%;font-size:25px;text-align: center;float: left;margin-top: 10px;"><?php echo $branch[0]['Branch_Name'];?>
      <p style="font-size:11px; text-align: center;">  <?php echo $branch[0]['Branch_Location'];?> </p>
      </div>

      <div style="width: 15%;float: left;">
            <?php if($WorkAssignValue[0]['image']!=NULL){ ?>

            <img src="<?php echo DOMAIN;?>Production/students_pics/<?php echo $WorkAssignValue[0]['image'];?>" id="preview" class="img-thumbnail" style="width: 70px;height: 70px;"   />

         <?php }else { ?>   

             <img src="<?php echo DOMAIN;?>Production/images/studenticon.png" id="preview" class="img-thumbnail" style="width: 70px;height: 70px;" />


         <?php } ?>    
      </div>

      </div>
       
<p style="text-align: center;">Roll No Slip</p>

   <table width="100%" style="font-size:11px;" cellspacing="0">  
   
   
      <tr>  
         <td width="20%" style="border:none;"> Name   </td>
         <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo $WorkAssignValue[0]['first_name'];?>  </td>
         
         <td width="20%" style="border:none;"> Father   </td>
         <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo $WorkAssignValue[0]['last_name'];?>  </td>

      </tr>
 
    
  <tr>  
     <td width="20%" style="border:none;"> Class </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;"> <?php 
      if($_REQUEST['class_id']!=NULL) {
     echo getClassName($m,$_GET['class_id']);
       } else {
     echo getClassName($m,$WorkAssignValue[0]['class_id']);
       }?></td>
     
     <td width="20%" style="border:none;"> Section  </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo getSectionName($m,$WorkAssignValue[0]['section_id']);?>  </td>

  </tr>

  
       
  <tr>  

   
     <td width="20%" style="border:none;">  Roll No  </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;">  <?php echo $WorkAssignValue[0]['candidate_roll_no'];?>  </td>

     <td width="20%" style="border:none;">  Fee Status </td>
     <td width="30%" style="border-bottom: 1px solid black;text-align:center;border-left:none;"> 

      
      <!--  <?php 

              

       if($WorkAssignValue[0]['paid_status']==0 || $WorkAssignValue[0]['paid_status']=="0"){ ?>    

                  
                          Unpaid 
                          

                 <?php } else { ?>    


                  

                          Paid 

                          


                 <?php }  ?>  -->
      </td>
  
  </tr>

     
      

   
   </table>

   <h3 style="text-align: center;">Date Sheet for (<?php echo $TermName[0]['term_title'];?>)</h3>

   <table width="100%" style="font-size:12px;margin-top:0%;" cellspacing="0">  
   

      <tr>  
         <th width=""> Subjects </th>
         <th width=""> Day </th>
         <th width="" style="text-align:center;border-right:1px solid gray;">  Date </th>
      </tr>

<?php foreach ($subjects as $subject) { 

  $m->where("branch_id", $_SESSION['branch']);
  $m->where("subject_id", $subject['subject_id']);
  $subjectName=$m->get("eduportal_subject_config");

 
  $m->where("day_id", $subject['day_id']);
  $dayName=$m->get("eduportal_days_config");


    $subjectNames;

  if ($subject['subject_id']=="Subject" || $subject['subject_id']=="Leave") {
    
    $subjectNames="LEAVE";

  } else {

    $subjectNames=$subjectName[0]['subject'];
  }


  ?> 

      <tr>      
         <td width=""> <?php echo $subjectNames; ?></td>
         <td width=""> <?php echo $dayName[0]['day_name']; ?></td>
         <td width="" style="text-align:center;border-right:1px solid gray;"> <?php echo date("d-M-Y",strtotime($subject['date_exm']));?></td>
      </tr>   
     
<?php } ?>

     
 

   </table>




   



<!-- ending section  -->

</div>

<?php if ($_REQUEST['syllabus']=="Yes") {?>
  
 <div style="width: 95%;">
  
   <h3 style="text-align: center;">Syllabus (<?php echo $TermName[0]['term_title'];?>)</h3>

   <table width="100%" style="font-size:12px;margin-top:0%;" cellspacing="0">  
   

      <tr>  
         <th width="30%"> Subjects </th>
         
         <th width="0%" style="text-align:center;border-right:1px solid gray;">  Syllabus </th>
      </tr>


<?php 

          if($sectionID=="All"){

              $m->where("branch_id", $_SESSION['branch']);
              $m->where("session_id", $_REQUEST['session']);
              $m->where("class_id", $_REQUEST['class_id']);
            /*  $m->where("section_id", $_REQUEST['section']);*/
              $m->where("term_id", $_REQUEST['term_id']);          

              $TermSyllabus = $m->get("eduportal_syllabus_management");
            } else {

              $m->where("branch_id", $_SESSION['branch']);
              $m->where("session_id", $_REQUEST['session']);
              $m->where("class_id", $_REQUEST['class_id']);
              $m->where("section_id", $_REQUEST['section']);
              $m->where("term_id", $_REQUEST['term_id']);          

              $TermSyllabus = $m->get("eduportal_syllabus_management");

            }

foreach ($TermSyllabus as $Syllabus) { 

  $m->where("branch_id", $_SESSION['branch']);
  $m->where("subject_id", $Syllabus['subjects_id']);
  $subjectName=$m->get("eduportal_subject_config");

 


  ?> 

      <tr>      
         <td width=""> <?php echo $subjectName[0]['subject']; ?></td>
       
         <td width="" style="border-right:1px solid gray;"> <?php echo $Syllabus['syllabus']; ?></td>
      </tr>   
     
<?php } ?>

     <tr>
       <td width="100%" colspan="2" style="text-align:center;border:none;"> <br>  

      <?php echo $brid[0]['rollNo_slip_note']; ?>
      
    
        </td>
     </tr>
 

   </table>

</div>
<?php } ?>


        </div>    
         
   </div>



<?php  
}
 ?>

</body>
</html>