<?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>Daily Sale Income 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 > Invoice.No </th>";
echo "<th > Date </th>";
echo "<th > Item Name </th>";
echo "<th > Unit </th>";
echo "<th > Sale Rate </th>";
echo "<th >Qty </th>";
echo "<th > Amount </th>";
echo "<th > Cost Rate </th>";
echo "<th > Cost Amount </th>";
echo "<th > Income </th>";


echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
									$sql = "SELECT * FROM invoice_details where  date between '$from_date' and '$to_date' and user_id='$userid' order by id desc";
$result=$conn->query($sql);
                                       while($row = $result->fetch_assoc())
 
  {
 $id = $row['inv_no'];
  echo "<tr>";
echo "<td>" .$row['inv_no'] . "</td>";
echo "<td>" .$row['date'] . "</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 "<td>" .$row['prate'] . "</td>";
echo "<td>" .$row['pamount'] . "</td>";
echo "<td>" .$row['diff'] . "</td>";



  echo "</tr>";

$trecord=$trecord + 1;
$tfeerec=$tfeerec + $row['amount'];
$tfeerec1=$tfeerec1 + $row['pamount'];
$tfeerec2=$tfeerec2 + $row['diff'];


  }
  
   echo "<tr>";
	echo "<td colspan=6 align=right><b>" ."Total ::". $trecord ."</b></td>";
		echo "<td><b>" .$tfeerec . "</b></td>";
		echo "<td></td>";
		echo "<td><b>" .$tfeerec1 . "</b></td>";
		echo "<td><b>" .$tfeerec2 . "</b></td>";
	
	
		
		
	  echo "</tr>";
	   
  ?>
                                       
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>

<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 Sale Tax Income 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 > Invoice.No </th>";
echo "<th > Date </th>";
echo "<th > Item Name </th>";
echo "<th > Unit </th>";
echo "<th > Sale Rate </th>";
echo "<th >Qty </th>";
echo "<th > Amount </th>";
echo "<th > Cost Rate </th>";
echo "<th > Cost Amount </th>";
echo "<th > Income </th>";



echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
									$sqlst = "SELECT * FROM invoice_details_st where  date between '$from_date' and '$to_date' and user_id='$userid' order by id desc";
$resultst=$conn->query($sqlst);
                                       while($rowst = $resultst->fetch_assoc())
 
  {
 $id = $rowst['id'];
  echo "<tr>";
echo "<td>" .$rowst['inv_no'] . "</td>";
echo "<td>" .$rowst['date'] . "</td>";
echo "<td>" .$rowst['item_name'] . "</td>";
echo "<td>" .$rowst['rfid'] . "</td>";
echo "<td>" .$rowst['srate'] . "</td>";
echo "<td>" .$rowst['qty'] . "</td>";
echo "<td>" .$rowst['amount'] . "</td>";
echo "<td>" .$rowst['prate'] . "</td>";
echo "<td>" .$rowst['pamount'] . "</td>";
echo "<td>" .$rowst['diff'] . "</td>";


  echo "</tr>";

$trecordst=$trecordst + 1;
$tfeerecst=$tfeerecst + $rowst['amount'];
$tfeerec1st=$tfeerec1st + $rowst['pamount'];
$tfeerec2st=$tfeerec2st + $rowst['diff'];


  }
  
   echo "<tr>";
	echo "<td colspan=6 align=right><b>" ."Total ::". $trecordst ."</b></td>";
		echo "<td><b>" .$tfeerecst . "</b></td>";
		echo "<td></td>";
		echo "<td><b>" .$tfeerec1st . "</b></td>";
		echo "<td><b>" .$tfeerec2st . "</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
}
?>