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

include 'dbc.php';


$userid=$_SESSION["userid"];
$month=$_POST["month"];

$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 > Studnet Name </th>";
echo "<th > Father Name </th>";
echo "<th > Class Name </th>";
echo "<th colspan=3> Fee Bal</th>";
echo "<th colspan=3> $feedisc1</th>";
echo "<th colspan=3> $feedisc2</th>";
echo "<th colspan=3> $feedisc3</th>";
echo "<th colspan=3> $feedisc4</th>";
echo "<th colspan=3> $feedisc5</th>";
echo "<th colspan=3> $feedisc6</th>";


echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
									$sql = "SELECT * FROM issueslip where  month_name='$month' and user_id='$userid' order by class_name,cls_sec,adm_no";
$result=$conn->query($sql);
                                       while($row = $result->fetch_assoc())
 
  {
 
   echo "<tr>";
echo "<td>" .$row['adm_no'] . "</td>";

  echo "<td>" .$row['std_name'] .  "</td>";
 echo "<td>" .$row['fname'] . "</td>";
 echo "<td>" .$row['class_name'] . ":" .$row['cls_sec'] .  "</td>";

  echo "<td>" .$row['mfee'] .  "</td>";
   echo "<td>" .$row['feerec'] .  "</td>";
   echo "<td>" .$row['feebal'] .  "</td>";
    echo "<td>" .$row['fee1'] .  "</td>";
   echo "<td>" .$row['fee1rec'] .  "</td>";
   echo "<td>" .$row['fee1bal'] .  "</td>";
    echo "<td>" .$row['fee2'] .  "</td>";
   echo "<td>" .$row['fee2rec'] .  "</td>";
   echo "<td>" .$row['fee2bal'] .  "</td>";
   echo "<td>" .$row['fee3'] .  "</td>";
   echo "<td>" .$row['fee3rec'] .  "</td>";
   echo "<td>" .$row['fee3bal'] .  "</td>";
   echo "<td>" .$row['fee4'] .  "</td>";
   echo "<td>" .$row['fee4rec'] .  "</td>";
   echo "<td>" .$row['fee4bal'] .  "</td>";
   echo "<td>" .$row['fee5'] .  "</td>";
   echo "<td>" .$row['fee5rec'] .  "</td>";
   echo "<td>" .$row['fee5bal'] .  "</td>";
    echo "<td>" .$row['fee6'] .  "</td>";
   echo "<td>" .$row['fee6rec'] .  "</td>";
   echo "<td>" .$row['fee6bal'] .  "</td>";
  echo "</tr>";

$trecord=$trecord + 1;
$tbal=$tbal + $row['mfee'];
$tfeerec=$tfeerec + $row['feerec'];
$tfeebal=$tfeebal + $row['feebal'];
$tfee1=$tfee1 + $row['fee1'];
$tfee1rec=$tfee1rec + $row['fee1rec'];
$tfee1bal=$tfee1bal + $row['fee1bal'];

$tfee2=$tfee2 + $row['fee2'];
$tfee2rec=$tfee2rec + $row['fee2rec'];
$tfee2bal=$tfee2bal + $row['fee2bal'];

$tfee3=$tfee3 + $row['fee3'];
$tfee3rec=$tfee3rec + $row['fee3rec'];
$tfee3bal=$tfee3bal + $row['fee3bal'];

$tfee4=$tfee4 + $row['fee4'];
$tfee4rec=$tfee4rec + $row['fee4rec'];
$tfee4bal=$tfee4bal + $row['fee4bal'];

$tfee5=$tfee5 + $row['fee5'];
$tfee5rec=$tfee5rec + $row['fee5rec'];
$tfee5bal=$tfee5bal + $row['fee5bal'];

$tfee6=$tfee6 + $row['fee6'];
$tfee6rec=$tfee6rec + $row['fee6rec'];
$tfee6bal=$tfee6bal + $row['fee6bal'];
  }
  $totalbal = $bal + $feebal1 + $feebal2 + $feebal3 + $feebal4 + $feebal5 + $feebal6; 
   echo "<tr>";
	echo "<td colspan=4 align=right><b>" ."Total Records::". $trecord ."</b></td>";
	
	  	echo "<td><b>" .$tbal . "</b></td>";
		echo "<td><b>" .$tfeerec . "</b></td>";
		echo "<td><b>" .$tfeebal . "</b></td>";
		
		echo "<td><b>" .$tfee1 . "</b></td>";
		echo "<td><b>" .$tfee1rec . "</b></td>";
		echo "<td><b>" .$tfee1bal . "</b></td>";
		
		echo "<td><b>" .$tfee2 . "</b></td>";
		echo "<td><b>" .$tfee2rec . "</b></td>";
		echo "<td><b>" .$tfee2bal . "</b></td>";
		
		echo "<td><b>" .$tfee3 . "</b></td>";
		echo "<td><b>" .$tfee3rec . "</b></td>";
		echo "<td><b>" .$tfee3bal . "</b></td>";
		
		echo "<td><b>" .$tfee4 . "</b></td>";
		echo "<td><b>" .$tfee4rec . "</b></td>";
		echo "<td><b>" .$tfee4bal . "</b></td>";
		
		echo "<td><b>" .$tfee5 . "</b></td>";
		echo "<td><b>" .$tfee5rec . "</b></td>";
		echo "<td><b>" .$tfee5bal . "</b></td>";
		echo "<td><b>" .$tfee6 . "</b></td>";
		echo "<td><b>" .$tfee6rec . "</b></td>";
		echo "<td><b>" .$tfee6bal . "</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
}
?>