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

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

    $id= $_REQUEST['id'];
	
	
  
?>
<!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-md-14">
                        <div class="card">
                            <div class="card-header">
                                <strong class="card-title">Return Item </strong>
                            </div>
                            <div class="card-body">
											
										<?php
include 'dbc.php';



$userid=$_SESSION["userid"];


$class_name=$_POST["class_name"];



$sql = "select * from invoice_details where  inv_no='$id' and user_id='$userid' order by id";
$result=$conn->query($sql);
?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
   

   echo "</tr>";
echo "<tr>";
echo "<th bgcolor=yellow> Date </th>";
echo "<th bgcolor=yellow> Invoice No </th>";
echo "<th bgcolor=yellow> Item Code </th>";
echo "<th bgcolor=yellow> Barcode </th>";
echo "<th bgcolor=yellow> Item Name </th>";
echo "<th bgcolor=yellow>Rate </th>";
echo "<th bgcolor=yellow> Qty </th>";
echo "<th bgcolor=yellow> Amount </th>";
echo "<th bgcolor=yellow> User </th>";
echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
while($ppp = $result->fetch_assoc())
{
   $id = $ppp['id'];	
   echo "<tr>";
    echo "<td width=20%>"  .$ppp["date"] . "</td>" ;
	 echo "<td width=20%>"  .$ppp["inv_no"] . "</td>" ;
   echo "<td width=20%>"  .$ppp["item_no"] . "</td>" ;
   
   echo "<td width=20%>"  .$ppp["barcode"] . "</td>" ;
   echo "<td width=15%>"  .$ppp["item_name"] . "</td>" ;
   echo "<td width=15%>"  .$ppp["srate"] . "</td>" ;
    echo "<td width=15%>"  .$ppp["qty"] . "</td>" ;
    echo "<td width=10%>"  .$ppp["amount"] . "</td>" ;
	echo "<td width=10%>"  .$ppp["username"] . "</td>" ;
	 echo"<th> <a href ='Del_Invoice_Item1.php?id=$id'>"?><button type="button" class="btn btn-primary">  Del </button><?php "</a>";
   echo "</tr>";
    $cnt=$cnt + 1;
	$tfeerec=$tfeerec + $ppp['amount'];

   }
    echo "<tr>";
 echo "<th width=20% colspan=8>" ."Toatl Items    :     " .$cnt . "</th>";
 echo "</tr>";
  echo "<tr>";
 echo "<th width=20% colspan=8>" ."Toatl Amount    :     " .$tfeerec . "</th>";
 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
}

?>