<?php
session_start();
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='index.html'>Sign in </a> First ";
}
else
{


?>
<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->

<head>
   <?php include("includes/header.php") ?>
</head>

<body>


    <!-- Left Panel -->

   <!-- /#left-panel -->

    <!-- Left Panel -->

    <!-- Right Panel -->

    <div id="right-panel" class="right-panel">

        <!-- Header-->
        
        <!-- Header-->

        

        <div class="content mt-3">
            <div class="animated fadeIn">
                <div class="row">

                    <div class="col-md-14">
                        <div class="card">
						<div class="page-title">
                        <h2><center><? echo "" . $_SESSION["userid"]; ?></center></h2>
                    </div>
                            <div class="card-header">
							
                                <strong class="card-title"><center>All Student Family Information Report</center> </strong>
                            </div>
                            <div class="card-body">
							<?php

include 'dbc.php';


$userid=$_SESSION["userid"];
$cname=$_POST["cname"];
?>

  <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
									
                                       echo "<tr>";
echo "<th > Family No </th>";
echo "<th > Studnet Name </th>";
echo "<th > Father Name </th>";
echo "<th > Class Name </th>";
echo "<th > Cell 1 </th>";
echo "<th > Fee</th>";
echo "<th > Total Childs</th>";


echo "</tr>";
?>
 </thead>
 <?php
$sqlfine = "SELECT * FROM familyno where  user_id='$userid'";
$resultfine=$conn->query($sqlfine);
while($rowfine = $resultfine->fetch_assoc())
 
  {
   
$all_name =  "";
$all_class_name =  "";
  $fam_no=$rowfine['fam_no'];

 $trecord=0;
$tmfee=0;
$sql = "SELECT * FROM admission where  user_id='$userid' and barcode='$fam_no' order by class_name,cls_sec,adm_no";
$result=$conn->query($sql);
?>
                              
                                   
									
                                    <tbody>
									<?php
                                       while($row = $result->fetch_assoc())
 
  {
$tmfee =  $tmfee + $row['mfee'];
$all_name =  $all_name .":". $row['std_name'];
$all_class_name =  $all_class_name .":". $row['class_name'];
$fname=$row['fname'];
$cell_1=$row['cell_1'];
 
  
$trecord=$trecord + 1;

  }
   echo "<tr>";
echo "<td>" .$fam_no. "</td>";
  echo "<td>" .$all_name .  "</td>";
 echo "<td>" .$fname . "</td>";
 echo "<td>" .$all_class_name .  "</td>";

 echo "<td>" .$cell_1 .  "</td>";
 echo "<td>" .$tmfee .  "</td>";
 echo "<td>" .$trecord .  "</td>";
  echo "</tr>";

   $ttmfee=$ttmfee +$tmfee;
    $trecord1=$trecord1 +$trecord;
	  }
	  echo "<tr>";
	echo "<td colspan=6 align=right><b>" ."Total Records::". $trecord1 ."</b></td>";
	echo "<td><b>" .$ttmfee . "</b></td>";
	  echo "</tr>";
  ?>
                                       
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>


                </div>
            </div><!-- .animated -->
        </div> <!-- .content -->
    </div><!-- /#right-panel -->

    <!-- Right Panel -->

   <?php include("includes/footermenu.php") ?>

</body>

</html>
<?php
}
?>