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

include 'dbc.php';

$cname=$_REQUEST["cname"];
$userid=$_SESSION["userid"];
$today=date("Y-m-d");
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		
		
		 $my=$month_name . " " . $year;
		 
	


?>
<!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="content mt-3">

           


          

            <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_name=$_POST["month_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 > Adm# </th>";
echo "<th > Studnet Name </th>";
echo "<th > Father Name </th>";
echo "<th > Class Name </th>";
echo "<th colspan=3> Fee Rec</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 "<th > Totaal Fee Rec </th>";

echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
									$sql = "SELECT * FROM rec_fee where  month_period='$month_name' and user_id='$userid' order by desc id";
$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['feerec'] .  "</td>";
   echo "<td>" .$row['fee1rec'] .  "</td>";
   echo "<td>" .$row['fee2rec'] .  "</td>";
   echo "<td>" .$row['fee3rec'] .  "</td>";
   echo "<td>" .$row['fee4rec'] .  "</td>";
   echo "<td>" .$row['fee5rec'] .  "</td>";
   echo "<td>" .$row['fee6rec'] .  "</td>";
   echo "<td>" .$row['totalfeerec'] .  "</td>";
  echo "</tr>";

$trecord=$trecord + 1;
$tfeerec=$tfeerec + $row['feerec'];
$tfee1rec=$tfee1rec + $row['fee1rec'];
$tfee2rec=$tfee2rec + $row['fee2rec'];
$tfee3rec=$tfee3rec + $row['fee3rec'];
$tfee4rec=$tfee4rec + $row['fee4rec'];
$tfee5rec=$tfee5rec + $row['fee5rec'];
$tfee6rec=$tfee6rec + $row['fee6rec'];
$ttotalfeerec=$ttotalfeerec + $row['totalfeerec'];

  }
   echo "<tr>";
	echo "<td colspan=4 align=right><b>" ."Total Records::". $trecord ."</b></td>";
	
	  	
		echo "<td><b>" .$tfeerec . "</b></td>";
		echo "<td><b>" .$tfee1rec . "</b></td>";
		echo "<td><b>" .$tfee2rec . "</b></td>";
		echo "<td><b>" .$tfee3rec . "</b></td>";
		echo "<td><b>" .$tfee4rec . "</b></td>";
		echo "<td><b>" .$tfee5rec . "</b></td>";
		echo "<td><b>" .$tfee6rec . "</b></td>";
		echo "<td><b>" .$ttotalfeerec . "</b></td>";
		
	  echo "</tr>";
  ?>
                                       
                                    </tbody>
                                </table>
                            </div>


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

    <!-- Right Panel -->

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

</body>

</html>
<?php
}
?>