<?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">
						 <strong class="card-title"> <center> <img src="logo1.jpg" align="middle" /></center></strong>
                        <h2><center><? echo "" . $_SESSION["userid"]; ?></center></h2>
                    </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"];
$adm_no=$_REQUEST["adm_no"];
$class_name=$_POST["class_name"];

$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 bgcolor=#0099FF> No </th>";
echo "<th bgcolor=#0099FF> Date </th>";
echo "<th bgcolor=#0099FF> Admission# </th>";
echo "<th bgcolor=#0099FF> Studnet Name </th>";
echo "<th bgcolor=#0099FF> Items Name </th>";
echo "<th bgcolor=#0099FF> Discription </th>";
echo "<th bgcolor=#0099FF> Rate </th>";
echo "<th bgcolor=#0099FF> Qty </th>";
echo "<th  bgcolor=#0099FF> Invoice Amount</th>";



echo "</tr>";

?>
                                    </thead>
									
                                    <tbody>
									<?php
									$sql = "SELECT * FROM invoice_details where  itemcode='$adm_no' order by id desc";
$result=$conn->query($sql);
                                       while($row = $result->fetch_assoc())

 
  {
 
   echo "<tr>";
echo "<td>" .$row['id'] . "</td>";
echo "<td>" .$row['date'] . "</td>";
echo "<td>" .$row['itemcode'] . "</td>";

  echo "<td>" .$row['barcode'] .  "</td>";
 echo "<td>" .$row['item_name'] . "</td>";
 echo "<td>" .$row['rfid'] .  "</td>";
 echo "<td>" .$row['srate'] .  "</td>";
 echo "<td>" .$row['qty'] .  "</td>";
 echo "<td>" .$row['amount'] .  "</td>";

  echo "</tr>";
 $treceived2=$treceived2 + $row['amount'];
  $tqty2=$tqty2 + $row['qty'];
  
  }
  

 echo "<tr>";
 echo "<th align=right bgcolor=white height=50 colspan=6> Total    :      </th>";
 echo "<th align=center height=50>" .$tqty2 . "</th>" ;
 echo "<th align=center height=50>" .$treceived2 . "</th>" ;
 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
}
?>