<?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"];

  


  
  
  
  
?>
<!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 -->

    <!-- Right Panel -->

    <div id="right-panel" class="right-panel">

        <!-- Header-->
        <header id="header" class="header">

             <?php include("includes/accounts_menu.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">

           


            
            <!--/.col-->

            
            <!--/.col-->

            
            <!--/.col-->

            
           
		   
		    <!--/.col-->

            
             

            


          
					
					
					
					
					

          

           
			
			
			<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 Expenses 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"];
$today=date("Y-m-d");
$username=$_SESSION["username"];


?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
                                       echo "<tr>";
									  
echo "<th > Date </th>";
echo "<th > Voucher# </th>";
echo "<th > Sub Type  </th>";
echo "<th > Accounts Name </th>";
echo "<th > Discription </th>";
echo "<th > Amount </th>";
echo "<th > User</th>";


echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
									$sql = "SELECT * FROM expense_voucher where  month_name = '$my' and mtype='Expense' and user_id='$userid' order by date";
$result=$conn->query($sql);
                                       while($row = $result->fetch_assoc())
 
  {
  $tr_no = $row['tr_no'];	
 
  echo "<tr>";
 echo "<td>" .$row['date'] . "</td>";

echo "<td>" .$row['tr_no'] . "</td>";

  echo "<td>" .$row['stype'] .  "</td>";

   echo "<td>" .$row['acc_name_dr'] .  "</td>";
   echo "<td>" .$row['discription'] .  "</td>";
   echo "<td>" .$row['amount'] .  "</td>";
   echo "<td>" .$row['username'] .  "</td>";
 echo"<th> <a href ='Print_Exp_Voucher.php?tr_no=$tr_no'>"?><button type="button" class="btn btn-primary">  Print Voucher </button><?php "</a>";
		  echo"<th> <a href ='Del_Exp_Voucher.php?tr_no=$tr_no'>"?><button type="button" class="btn btn-primary">  Del Voucher </button><?php "</a>";
  echo "</tr>";

$trecord1=$trecord1 + 1;
$tfeerec=$tfeerec + $row['amount'];
$tst=$tst + $row['whamount'];
  }
  
   echo "<tr>";
	echo "<td colspan=3 align=right><b>" ."Total Records::". $trecord1 ."</b></td>";
		echo "<td><b>" .$tfeerec . "</b></td>";
		echo "<td></td>";
		echo "<td><b>" .$tst . "</b></td>";
		
		
		
	  echo "</tr>";
	   
  ?>
                                       
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
					
					
					
					
					
					
					
					
					
					
					
        </div> <!-- .content -->
    </div><!-- /#right-panel -->

    <!-- Right Panel -->

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

</body>

</html>
<?php
}
?>