<?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 -->

    <?php include("includes/menu.php") ?><!-- /#left-panel -->

    <!-- Left Panel -->

    <!-- Right Panel -->

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

        <!-- Header-->
        <header id="header" class="header">

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

        </header><!-- /header -->
        <!-- Header-->

        <div class="breadcrumbs">
            <div class="col-sm-6">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><? echo "" . $_SESSION["userid"]; ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li class="active"><? echo "" . $_SESSION["username"]; ?></li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
                            <div class="card-header">
							
                                <strong class="card-title"><center>Student Ledger Report</center> </strong>
                            </div>
                            <div class="card-body">
							<?php

include 'dbc.php';


$userid=$_SESSION["userid"];
$cname=$_REQUEST["cname"];

$sql1 = "SELECT * FROM addclass where user_id = '$userid'";
$result1=$conn->query($sql1);
$row1 = $result1->fetch_assoc();
$feedisc1=$row1['feedisc1'] ;
$feedisc2=$row1['feedisc2'] ;
$feedisc3=$row1['feedisc3'] ;
$feedisc4=$row1['feedisc4'] ;
$feedisc5=$row1['feedisc5'] ;
$feedisc6=$row1['feedisc6'] ;
?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
                                       echo "<tr>";
echo "<th > Adm# </th>";
echo "<th > Roll No </th>";
echo "<th > Portal Id </th>";
echo "<th > Studnet Name </th>";
echo "<th > Father Name </th>";
echo "<th > Class Name </th>";
echo "<th > Sec </th>";
echo "<th > Cell 1 </th>";



echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
									$sql = "SELECT * FROM admission where  class_name='$cname' and user_id='$userid' order by adm_no";
$result=$conn->query($sql);
                                       while($row = $result->fetch_assoc())
 
  {
  $adm_no = $row['adm_no'];
   echo "<tr>";
echo "<td>" .$row['adm_no'] . "</td>";
echo "<td>" .$row['std_rollno'] . "</td>";
 echo "<td>" .$row['portal_id'] .  "</td>";
  echo "<td>" .$row['std_name'] .  "</td>";
 echo "<td>" .$row['fname'] . "</td>";
 echo "<td>" .$row['class_name'] .  "</td>";
 echo "<td>" .$row['cls_sec'] .  "</td>";
 echo "<td>" .$row['cell_1'] .  "</td>";
  echo"<th> <a href ='Student_Ledger_Report.php?adm_no=$adm_no'>"?><button type="button" class="btn btn-primary">  Open Ledger Report</button><?php "</a>";
  echo "</tr>";

$trecord=$trecord + 1;
$bal=$bal + $row['bal'];
$feebal1=$feebal1 + $row['feebal1'];
$feebal2=$feebal2 + $row['feebal2'];
$feebal3=$feebal3 + $row['feebal3'];
$feebal4=$feebal4 + $row['feebal4'];
$feebal5=$feebal5 + $row['feebal5'];
$feebal6=$feebal6 + $row['feebal6'];
  }
  $totalbal = $bal + $feebal1 + $feebal2 + $feebal3 + $feebal4 + $feebal5 + $feebal6; 
   
	  
	 
  ?>
                                       
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>


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

    <!-- Right Panel -->

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

</body>

</html>
<?php
}
?>