<?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>Total Receivable Details Report</center> </strong>
                            </div>
                            <div class="card-body">
							<?php

include 'dbc.php';


$userid=$_SESSION["userid"];
$cname=$_POST["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 "<th > Fee Bal</th>";
echo "<th > $feedisc1</th>";
echo "<th > $feedisc2</th>";
echo "<th > $feedisc3</th>";
echo "<th > $feedisc4</th>";
echo "<th > $feedisc5</th>";
echo "<th > $feedisc6</th>";


echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
									$sql = "SELECT * FROM admission where  user_id='$userid' order by std_rollno";
$result=$conn->query($sql);
                                       while($row = $result->fetch_assoc())
 
  {
 
   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 "<td>" .$row['bal'] .  "</td>";
   echo "<td>" .$row['feebal1'] .  "</td>";
 echo "<td>" .$row['feebal2'] .  "</td>";
 echo "<td>" .$row['feebal3'] .  "</td>";
 echo "<td>" .$row['feebal4'] .  "</td>";
 echo "<td>" .$row['feebal5'] .  "</td>";
 echo "<td>" .$row['feebal6'] .  "</td>";

  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; 
   echo "<tr>";
	echo "<td colspan=8 align=right><b>" ."Total Records::". $trecord ."</b></td>";
	echo "<td><b>" .$bal . "</b></td>";
	  	echo "<td><b>" .$feebal1 . "</b></td>";
		echo "<td><b>" .$feebal2 . "</b></td>";
		echo "<td><b>" .$feebal3 . "</b></td>";
		echo "<td><b>" .$feebal4 . "</b></td>";
		echo "<td><b>" .$feebal5 . "</b></td>";
		echo "<td><b>" .$feebal6 . "</b></td>";
	  echo "</tr>";
	  
	  echo "<tr>";
	echo "<td colspan=8 align=right><b>" ."Total Balance:" ."</b></td>";
	echo "<td colspan=8 align=left><b>" . $totalbal ."</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
}
?>