<?php

session_start();


include_once "connectdb.php";


$sel=$pdo->prepare('SELECT * FROM param');
$sel->execute(array());
while ($sels=$sel->fetch()) {
  $_SESSION['raison_sociale']=$sels['raison_sociale'];
  $_SESSION['adresse']=$sels['adresse'];
  $_SESSION['tel']=$sels['tel'];
}


?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
	  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome Icons -->
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/adminlte.min.css">
  
  <!-- jQuery -->
    <script src="plugins/jquery/jquery.js"></script>

  <script src="plugins/jquery/jquery.min.js"></script>
  
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>

<!-- daterange picker -->
  <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker.css">
  <!-- iCheck for checkboxes and radio inputs -->
  <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css">
  
  <!-- Select2 -->
  <link rel="stylesheet" href="plugins/select2/css/select2.min.css">
  <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">

<!-- date-range-picker -->
<script src="plugins/daterangepicker/daterangepicker.js"></script>


<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>

<!-- Bootstrap 4 -->

<script src="plugins/sweetalert2/sweetalert2.js"></script>
<script src="plugins/sweetalert2/sweetalert2.all.js"></script>
<script src="plugins/sweetalert2/sweetalert2.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>


<!-- DataTables -->
  




<link rel="stylesheet" href="plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" href="plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <link rel="stylesheet" href="plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
  <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />

  
  
  
   <script src="plugins/datatables/jquery.dataTables.js"></script>
  <script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="plugins/jszip/jszip.min.js"></script>
<script src="plugins/pdfmake/pdfmake.min.js"></script>
<script src="plugins/pdfmake/vfs_fonts.js"></script>
<script src="plugins/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.print.min.js"></script>
    <script src="plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
    <script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
	<style>
		body{margin-top:20px;
		background-color:#eee;
		}

		.card {
		    box-shadow: 0 20px 27px 0 rgb(0 0 0 / 5%);
		}
		.card {
		    position: relative;
		    display: flex;
		    flex-direction: column;
		    min-width: 0;
		    word-wrap: break-word;
		    background-color: #fff;
		    background-clip: border-box;
		    border: 0 solid rgba(0,0,0,.125);
		    border-radius: 1rem;
		}
	</style>
</head>
<body>
	<div class="container">
<div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-body">
                   
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="text-muted">
                                <h5 class="font-size-16 mb-3"><?php echo $_SESSION['raison_sociale']; ?></h5>
                                <h5 class="font-size-15 mb-2">Tel: <?php echo $_SESSION['tel']; ?></h5>
                                <p class="mb-1"><?php echo $_SESSION['adresse']; ?></p>
                            </div>
                        </div>
                        <!-- end col -->
                       
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    
                    <div class="py-2">
                        <h5 class="font-size-15"> Etat des ventes du <?php echo $_SESSION['deb'] ?> au <?php echo $_SESSION['fin'] ?></h5>

                        <div class="table-responsive">
                            <table class="table align-middle table-nowrap table-centered mb-0">
                                <thead>
                                    <tr>
                                        <th>Ticket</th>
                                        <th>Client</th>
                                        <th>Date</th>
                                        <th>Montant</th>
                                        <th>Moyen de paiement</th>
                                    </tr>
                                </thead><!-- end thead -->
                                <tbody>
                                	<?php 
                                	$select=$pdo->prepare('SELECT * FROM tbl_invoice WHERE order_date BETWEEN ? AND ?');
									$select->execute(array($_SESSION['deb'], $_SESSION['fin']));
									//$item=$select->fetch(PDO::FETCH_OBJ)
									    
									    
									    while($item=$select->fetch(PDO::FETCH_OBJ)){
									    	echo('
									    			<tr>
				                                        <th scope="row">'.$item->invoice_id.'</th>
				                                        <td>'.$item->customer_name.'</td>
				                                        <td>'.$item->order_date.'</td>
                                                        <td>'.$item->nap.'</td>
				                                        <td>'.$item->payment_type.'</td>
				                                    </tr>
									    		');
									        
									    }
                                	?>
                                    
                                   
                                  
                                    <!-- end tr -->
                                  
                                    <!-- end tr -->
                                </tbody><!-- end tbody -->
                            </table><!-- end table -->
                        </div><!-- end table responsive -->
                        <div class="d-print-none mt-4">
                            <div class="float-end">
                                <a href="javascript:window.print()" class="btn btn-success me-1"><i class="fa fa-print"></i></a>
                              
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div><!-- end col -->
    </div>
</div>
</body>
</html>