<?php include "header_with_out_nav.php"; 

$btnSave=$_GET['btnSave'];

$college_id=$_GET['college_id'];

$course_name=$_GET['course_name'];

$subject=$_GET['subject'];

$college_type=$_GET['college_type'];

$Course_Details=$_GET['Course_Details'];

$Gender=$_GET['Gender'];

$Category=$_GET['Category'];

$feesview=$_GET['feesview'];

$day=$_GET['day'];

$month=$_GET['month'];

$year=$_GET['year'];

if($login_session!=''){

?>

<style>

body{

text-transform:uppercase;

font-size:12px;

}

</style>

<br /></br>

<?php //if($btnSave==""){ ?>

<form name="form1" action="stu_att_1.php" method="get"  class="form-horizontal" role="form">

	  <table cellpadding=2 cellspacing=0 border=1 bordercolor=#FFFFCC bgcolor="" align=center class="table table-bordered table-striped">

				

		

		<tr>

          <td class=color3>Select College</td>

		  <td class=color2><?php

							

$queryy = "SELECT * FROM college_name where session='$session' and code='$code'";

$numresultsy=mysql_query($queryy);

$resulty= mysql_query($queryy) or die("Couldn't execute query");

?>

              <select name="college_id" class="chosen-select form-control" id="college_id" required onchange='this.form.submit()'>

                <option value="">Select</option>

                <?php

while ( $a_roww = mysql_fetch_row( $resulty ) )

 {?>

                <option

                 <?php 

				 $cn_id=$a_roww[2];

				 if($cn_id==$college_id){

				  ?>selected<?php } ?>

                  

                   value="<?php echo $a_roww[2];?>" >( <?php echo $a_roww[2];?> ) <?php echo $a_roww[1];?></option>

                <?php } ?>

            </select></td>

	    </tr>

		<tr>

          <td width="116" class=color3>College Type</td>

		  <td width="190" class=color2><select name="college_type" class="chosen-select form-control" required="required" onchange='this.form.submit()'>

              <?php
$query = "SELECT * FROM ctype where session='$session' and code='$code' ORDER BY id";
$numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);
$result = mysql_query($query) or die("Couldn't execute query");
while ( $a_row = mysql_fetch_row( $result ) )

 {?>
          <option value="<?php echo $rty=$a_row[1]; ?>" <?php 
				 if($college_type==$rty){
				  ?>selected<?php } ?>><?php echo $a_row[2]; ?></option>
<?php } ?>

                  

                 

            </select>          </td>

	    </tr>

		

		<tr>

          <td class=color3> Course Name</td>

		  <td class=color2>

          <select name="course_name"  required onchange='this.form.submit()' class="chosen-select form-control">

                                            

                                            <?php $queryy = "SELECT * FROM course_name where college_id='$college_id' && ctype='$college_type' and session='$session' and code='$code'  Order by id";

$numresultsy=mysql_query($queryy);

$resulty= mysql_query($queryy) or die("Couldn't execute query");

 ?>

	<option value="">Select</option>

	 <?php

while ( $a_roww = mysql_fetch_row( $resulty ) )

 {?>

                  <option 

                 <?php 

				 $Course_id=$a_roww[0];

				 if($Course_id==$course_name){

				  ?>selected<?php } ?> 

                  value="<?php echo $a_roww[0];?>" ><?php echo $a_roww[1];?></option>

                  <?php } ?>

</select>         </td>

	    </tr>

          <tr>

		  <td class=color3>Select Year</td>

		  <td class=color2><select name="Course_Details" title="Select  Year/Semester" class="chosen-select form-control" required>

	

     <?php $queryy = "SELECT * FROM seme_year where course_name='$course_name' and session='$session' and code='$code' Order by id";

$numresultsy=mysql_query($queryy);

$resulty= mysql_query($queryy) or die("Couldn't execute query");

 ?>

	<option value="">Select</option>

	 <?php

while ( $a_roww = mysql_fetch_row( $resulty ) )

 {?>

                  <option

                 <?php 

				 $Course_Detailss=$a_roww[1];

				 if($Course_Detailss==$Course_Details){

				  ?>selected<?php } ?>

                  

                   value="<?php echo $a_roww[1];?>" ><?php echo $a_roww[1];?></option>

                  <?php } ?>

    

    

</select></td>

	    </tr>

		<tr>

		  <td class=color3>Subject Name</td>

		  <td class=color2>

           <select name="subject"  onchange='this.form.submit()' class="chosen-select form-control">

                                            

                                            <?php $queryy = "SELECT * FROM subject where college_code='$college_id' && college_type='$college_type' && course_name='$course_name' and session='$session' and code='$code' Order by id";

$numresultsy=mysql_query($queryy);

$resulty= mysql_query($queryy) or die("Couldn't execute query");

 ?>

	

    <option <?php 

				 

				 if($subject==''){

				  ?>selected<?php } ?> value="">All</option>

	 <?php

while ( $a_roww = mysql_fetch_row( $resulty ) )

 {?>

                  <option 

                 <?php 

				 $Course_id=$a_roww[1];

				 if($Course_id==$subject){

				  ?>selected<?php } ?> 

                  value="<?php echo $a_roww[1];?>" ><?php echo $a_roww[1];?></option>

                  <?php } ?>

</select>        </td>

		</tr>

         <tr>

    <td><div align="right">Date</div></td>

    <td><select name="day"  required="required" class="chosen-select form-control">

          <option value="<?php echo $date_array[mday];?>"><?php echo $date_array[mday];?></option>

            <option <?php if($day=='1'){ ?>selected<?php } ?> value="1">1</option>

            <option <?php if($day=='2'){ ?>selected<?php } ?> value="2">2</option>

            <option <?php if($day=='3'){ ?>selected<?php } ?> value="3">3</option>

          <option <?php if($day=='4'){ ?>selected<?php } ?> value="4">4</option>

          <option <?php if($day=='5'){ ?>selected<?php } ?> value="5">5</option>

          <option <?php if($day=='6'){ ?>selected<?php } ?> value="6">6</option>

          <option <?php if($day=='7'){ ?>selected<?php } ?> value="7">7</option>

          <option <?php if($day=='8'){ ?>selected<?php } ?>value="8">8</option>

          <option <?php if($day=='9'){ ?>selected<?php } ?>value="9">9</option>

          <option <?php if($day=='10'){ ?>selected<?php } ?>value="10">10</option>

          <option <?php if($day=='11'){ ?>selected<?php } ?>value="11">11</option>

          <option <?php if($day=='12'){ ?>selected<?php } ?>value="12">12</option>

          <option <?php if($day=='13'){ ?>selected<?php } ?>value="13">13</option>

          <option <?php if($day=='14'){ ?>selected<?php } ?>value="14">14</option>

          <option <?php if($day=='15'){ ?>selected<?php } ?>value="15">15</option>

          <option <?php if($day=='16'){ ?>selected<?php } ?>value="16">16</option>

          <option <?php if($day=='17'){ ?>selected<?php } ?>value="17">17</option>

          <option <?php if($day=='18'){ ?>selected<?php } ?>value="18">18</option>

          <option <?php if($day=='19'){ ?>selected<?php } ?>value="19">19</option>

          <option <?php if($day=='20'){ ?>selected<?php } ?>value="20">20</option>

          <option <?php if($day=='21'){ ?>selected<?php } ?>value="21">21</option>

          <option <?php if($day=='22'){ ?>selected<?php } ?>value="22">22</option>

          <option <?php if($day=='23'){ ?>selected<?php } ?>value="23">23</option>

          <option <?php if($day=='24'){ ?>selected<?php } ?>value="24">24</option>

          <option <?php if($day=='25'){ ?>selected<?php } ?>value="25">25</option>

          <option <?php if($day=='26'){ ?>selected<?php } ?>value="26">26</option>

          <option <?php if($day=='27'){ ?>selected<?php } ?>value="27">27</option>

          <option <?php if($day=='28'){ ?>selected<?php } ?>value="28">28</option>

          <option <?php if($day=='29'){ ?>selected<?php } ?>value="29">29</option>

          <option <?php if($day=='30'){ ?>selected<?php } ?>value="30">30</option>

          <option <?php if($day=='31'){ ?>selected<?php } ?>value="31">31</option>

          </select>

        <select name="month"  required="required" class="chosen-select form-control">

          <option value="<?php echo $date_array[mon];?>"><?php echo $date_array[mon];?></option>

          <option <?php if($month=='1'){ ?>selected<?php } ?> value="1">1</option>

          <option <?php if($month=='2'){ ?>selected<?php } ?> value="2">2</option>

          <option <?php if($month=='3'){ ?>selected<?php } ?> value="3">3</option>

          <option <?php if($month=='4'){ ?>selected<?php } ?> value="4">4</option>

          <option <?php if($month=='5'){ ?>selected<?php } ?> value="5">5</option>

          <option <?php if($month=='6'){ ?>selected<?php } ?> value="6">6</option>

          <option <?php if($month=='7'){ ?>selected<?php } ?> value="7">7</option>

          <option <?php if($month=='8'){ ?>selected<?php } ?> value="8">8</option>

          <option <?php if($month=='9'){ ?>selected<?php } ?> value="9">9</option>

          <option <?php if($month=='10'){ ?>selected<?php } ?> value="10">10</option>

          <option <?php if($month=='11'){ ?>selected<?php } ?> value="11">11</option>

          <option <?php if($month=='12'){ ?>selected<?php } ?> value="12">12</option>

        </select>

          <select name="year"  required="required" class="chosen-select form-control">

          <option value="<?php echo $date_array[year]; ?>"><?php echo $date_array[year]; ?></option>

            <option <?php if($year=='2017'){ ?>selected<?php } ?>value="2017">2017</option>

            <option <?php if($year=='2018'){ ?>selected<?php } ?>value="2018">2018</option>

            <option <?php if($year=='2019'){ ?>selected<?php } ?>value="2019">2019</option>

            <option <?php if($year=='2020'){ ?>selected<?php } ?>value="2020">2020</option>

          </select> </td>

  </tr> 

        <tr> 

			<td class=color3></td>

			<td class=color2><input type="submit" name="btnSave" value="Get  List"  class="btn btn-info" ></td>

		</tr>

	</table>

</form>

<?php //}else { 

if($btnSave!=""){

?>

<br/>

<center><a href="subject_wise_report.php" style="font-size:16px; text-align:center; background-color:#FF0000; color:; padding:5px;">BACK TO SEARCH</a></center><br/>

<table width="80%" border="1" cellspacing="0" cellpadding="4" align="center">

      <tr>

        <td colspan="5" style="border:none;padding:2px; height:20; color:#990000; background-repeat:repeat-x;"><div align="left"><font face=Verdana, Geneva, sans-serif>Attendance - Student</font></div></td>

      </tr>

<form action="att.php" method="post"  name="class_d_m_y" >

<input name="day" type="hidden" value="<?php echo $day; ?>"/>

<input name="month" type="hidden" value="<?php echo $month; ?>"/>

<input name="year" type="hidden" value="<?php echo $year; ?>"/>

<input name="college_id" type="hidden" value="<?php echo $college_id; ?>"/>

<input name="college_type" type="hidden" value="<?php echo $college_type; ?>"/>

<input name="course_name" type="hidden" value="<?php echo $course_name; ?>"/>

<input name="Course_Details" type="hidden" value="<?php echo $Course_Details; ?>"/>

<input name="subject" type="hidden" value="<?php echo $subject; ?>"/>

<tr>

  <td bgcolor="#FFFF99">No</td>

    <td bgcolor="#FFFF99">Roll No</td>

    <?php /*?><td bgcolor="#FFFF99">Photo</td><?php */?>

    <td bgcolor="#FFFF99"><span class="style1">Student Name</span></td>

    <td bgcolor="#FFFF99"><div align="center"><span class="style1">Status</span></div></td>

  </tr>

 <?php

  $query = "SELECT * FROM class2 WHERE college='$college_id' and `CourseType`='$college_type' and `Course`='$course_name' and `Course_Details`='$Course_Details' and class_app LIKE '%$subject%' and college_roll!='' and session='$session' and code='$code' order by id";

$numresults=mysql_query($query);

$result = mysql_query($query) or die("Couldn't execute query1");

$counter=1;

?>

    <?php while ( $a_row = mysql_fetch_array( $result ) )

 { 

 $pid=$a_row['college_roll'];

$date_u=$day."-".$month."-".$year;

 $query_update = "SELECT * FROM att where sid='$pid' and date='$date_u' and college_id='$college_id' and college_type='$college_type' and course_name='$course_name' and Course_Details='$Course_Details' and subject='$subject' and session='$session' and code='$code'";

$numresults_update=mysql_query($query_update);

$result_u = mysql_query($query_update) or die("Couldn't execute query2");

$a_rowu = mysql_fetch_row( $result_u );

$id=$a_rowu[0];

$statuss=$a_rowu[2];



 ?> <tr>

      <td><?php echo $counter; ?></td>

      <td><?php echo $a_row['college_roll']; ?></td>

      <?php /*?><td><img src="../uploads/<?php echo $a_row['class_std_ing'];?>" width="30" height="30" id="ImgPhoto" style="border-width:0px;"></td><?php */?>

      <td><?php 

 echo $a_row['StudentName'];

?>   

<style>

.greenText{ background-color:green; color:#FFFFFF; }



.blueText{ background-color:blue;   color:#FFFFFF;}



.redText{ background-color:red;  color:#FFFFFF;}

.yText{ background-color:#FFCC00;  color:#FFFFFF;}

</style>

<input type="hidden" name="id[]" value="<?php echo $id; ?>">

<input type="hidden" name="sid[]" value="<?php echo $pid; ?>">

<input type="hidden" name="date[]" value="<?php echo $_GET['day'];?>-<?php echo $_GET['month'];?>-<?php echo $_GET['year']; ?>">

<input type="hidden" name="classt[]" value="<?php echo $class_t_ad; ?>">

<input type="hidden" name="section[]" value="<?php echo $section; ?>"></td>

  <td  ><div align="center">

  <select name="status[]" onchange="this.className=this.options[this.selectedIndex].className"

    <?php $cdate=date('D'); if($cdate=='Sun'){?>class="blueText"<?php }elseif($statuss=='P'){ ?> class="greenText" <?php }elseif($statuss=='A'){ ?> class="redText" <?php }elseif($statuss=='H'){ ?> class="blueText" <?php }elseif($statuss=='L'){ ?> class="yText" <?php }elseif($statuss==""){ ?> class="greenText" <?php }?>>

  <option value="P" class="greenText" <?php if($statuss=='P'){ ?> selected="selected" <?php }?> >Present</option>

  <option value="A" class="redText" <?php if($statuss=='A'){ ?> selected="selected" <?php }?>>Absent</option>

  <option value="H" class="blueText"<?php $cdate=date('D'); if($cdate=='Sun'){?>selected="selected" <?php }elseif($statuss=='H'){ ?> selected="selected" <?php }?>>Holiday</option>

  <option value="L" class="yText" <?php if($statuss=='L'){ ?> selected="selected" <?php }?>>Leave</option>

  </select>

 </div></td>



    </tr>

   

  

   

    

 

 <?php  $counter++; }

 $date_u=$day."-".$month."-".$year;

  $query_c = "SELECT * FROM att where date='$date_u' and college_id='$college_id' and college_type='$college_type' and course_name='$course_name' and Course_Details='$Course_Details' and subject='$subject' and session='$session' and code='$code'";

$numresults_c=mysql_query($query_c);

$result_c = mysql_query($query_c) or die("Couldn't execute query");

$a_rowc = mysql_fetch_row( $result_c );

$ccc=$a_rowc[1];

 ?>

 

  <tr>

    <td  >&nbsp;</td>

   

    <?php /*?><td  >&nbsp;</td><?php */?>

    <td  >&nbsp;</td>

    <td  ><?php //echo $ccc.'*****'; ?></td>

    <td   ><?php if($ccc==""){ ?><input type="submit" name="Feed" value="Feed"  style="width:80"/>

            &nbsp;

            <input type="reset" name="Submit" value="Clear"  style="width:80"/><?php } elseif($ccc!=""){ ?><input type="submit" name="Update" value="Update"  style="width:80"/>

            &nbsp;

            <input type="reset" name="Submit" value="Clear"  style="width:80"/><?php } ?></td>

    </tr> 

 <?php }}  $counter++;?>

</form></table>

<?php 

include "footer.php"; ?>