<?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';
date_default_timezone_set("Asia/Karachi");
$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;
$userid=$_SESSION["userid"];
include 'dbc.php';

$username=$_SESSION["username"];
$current_file_name = basename($_SERVER['PHP_SELF']);
$sql = "SELECT * FROM adduser where feedisc2 = '$current_file_name' and uname = '$username'";
$result=$conn->query($sql);
$row = $result->fetch_assoc();
$status=$row['feedisc3'] ;

if ($status =="")
{
echo "You are not Authorized This Page <a href='maindashboard.php'>Back </a> ";
}
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="content mt-3">
            <div class="animated fadeIn">
                <div class="row">
<div class="col-lg-4">
                        <div class="card">
                            <div class="card-header"><strong>Fee Receipt</strong><small> Form</small></div>
                            <div class="card-body card-block">
							<form action="Fee_Receipt_Open1_Advance.php" method="post" enctype="multipart/form-data" class="form-group">
							
			
								<div class="col-12">
                                <div class="form-group">
                                  <label for="feedisc1" class=" form-control-label"> Enter Roll No</label>
                                  <input type="text" id="std_rollno" name="std_rollno" placeholder="" class="form-control" autofocus>
                                </div>
								</div>

                                                    </div>
													<div class="card-footer">
                                                        <button type="submit" class="btn btn-primary btn-sm">
                                                            <i class="fa fa-dot-circle-o"></i> Fee Receipt
                                                        </button>
                                                       
                                                    </div>
													
													</form>
                                                </div>
                                            </div>
											
											
											
											<div class="col-lg-4">
                        <div class="card">
                            <div class="card-header"><strong>Fee Receipt</strong><small> Form</small></div>
                            <div class="card-body card-block">
							<form action="Fee_Receipt_Open2_Advance.php" method="post" enctype="multipart/form-data" class="form-group">
							
			
								<div class="col-12">
                                <div class="form-group"><label for="feedisc1" class=" form-control-label"> Enter Name </label><input type="text" id="barcode" name="barcode" placeholder="" class="form-control"></div>
								</div>

                                                    </div>
													<div class="card-footer">
                                                        <button type="submit" class="btn btn-primary btn-sm">
                                                            <i class="fa fa-dot-circle-o"></i> Fee Receipt
                                                        </button>
                                                       
                                                    </div>
													
													</form>
                                                </div>
                                            </div>
											
											
											
											
                    <div class="col-md-14">
                        <div class="card">
                            <div class="card-header">
                                <strong class="card-title">Fee Receipt Voucher</strong>
                            </div>
                            <div class="card-body">
							<?php

include 'dbc.php';


$userid=$_SESSION["userid"];
$sql = "SELECT * FROM addclass where user_id='$userid'";
$result=$conn->query($sql);
?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
                                       echo "<tr>";
echo "<th > Class Name </th>";



echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
                                       while($row = $result->fetch_assoc())
 
  {
  $cname = $row['cname'];	
   echo "<tr>";
echo "<td>" .$row['cname'] . "</td>";



		 ?>
		 
		  
		 <?php
		  echo"<th> <a href ='Open_Student.php?cname=$cname'>"?><button type="button" class="btn btn-primary">  Open Students </button><?php "</a>";
		   
		  
		 
		  
	
  echo "</tr>";


  }
  ?>
                                       
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>


                </div>
            </div><!-- .animated -->
        </div> <!-- .content -->
		<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>Daily Fee Collection Details Report</center> </strong>
                            </div>
                            <div class="card-body">
							<?php

include 'dbc.php';


$userid=$_SESSION["userid"];
$from_date=$_POST["from_date"];
$to_date=$_POST["to_date"];

$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 > Date </th>";
echo "<th > Adm# </th>";
echo "<th > Studnet Name </th>";
echo "<th > Father Name </th>";
echo "<th > Class Name </th>";
echo "<th > Fee </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 rec_fee where  rec_date = '$today' and user_id='$userid' order by id desc";
$result=$conn->query($sql);
                                       while($row = $result->fetch_assoc())
 
  {
  $id = $row['id'];	
   echo "<tr>";
   echo "<td>" .$row['rec_date'] . "</td>";

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"<th> <a href ='Print_Receipt.php?id=$id'>"?><button type="button" class="btn btn-primary">  Print Receipt </button><?php "</a>";
  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'];

  }
  $totalbal = $tfeerec + $tfee1rec + $tfee2rec + $tfee3rec + $tfee4rec + $tfee5rec + $tfee6rec; 
   echo "<tr>";
	echo "<td colspan=5 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 "</tr>";
	   echo "<tr>";
	echo "<td colspan=5 align=right><b> Net Total </b></td>";
	
	  
		echo "<td><b>" .$totalbal . "</b></td>";
		
		
		
	  echo "</tr>";
  ?>
                                       
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>


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

    <!-- Right Panel -->

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

</body>

</html>
<?php
}

}
?>