<?php include "includes/header.php";?>

<?php include "includes/navbar.php";?>

  <div id="wrapper">

    <!-- Sidebar -->
   <?php include "includes/sidebar.php";?>

    <div id="content-wrapper">

      <div class="container-fluid">

        <!-- Breadcrumbs-->
        <ol class="breadcrumb">
          <li class="breadcrumb-item">
            <a href="#">Ola</a>
          </li>
          <li class="breadcrumb-item active"><?php echo $_SESSION['nome'];?></li>
        </ol>

        <!-- Icon Cards-->
        <div class="row">		
		  <div class="container">             
             <!-- Button trigger modal -->

<h2><i>Documentos de vendas(cotação, factura e recibos)</i></h2>
 <br> <br>
 <div class="container-fluid">

<!-- Breadcrumbs-->

<!-- DataTables Example -->
<div class="card mb-3">
  <div class="card-header">
    <i class="fas fa-table"></i>
    <b>Lista de clientes</b></div>
  <div class="card-body">
    <div class="table-responsive">
      <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
        <thead>
          <tr>
            <th>Item</th>
            <th>Nome</th>
            <th>Tipo Documento</th>
            <th>Total</th>
             <th>Data</th>
            <th>Imprimir</th>
          </tr>
        </thead>
       
        <tbody>
            
          <?php 
          $item =1;
          $listar = $database->query("SELECT * FROM vendas_documento");
          while($row = $database->fetch_assoc($listar)){
                 $id = $row['id'];
                 $tipo = $row['tipo'];
                 $carrinha = $row['carrinha'];
            ?>
           <tr>   
            <td><?php echo $item++;?></td>
            <td><?php echo $row['cliente'];?></td>
            <td><?php echo $row['tipo'];?></td>
            <td><?php echo number_format($row['total'],2,",",".");?></td>
            <td><?php echo $row['tipo'];?></td>
                   
<?php 
if($tipo == 'cotacao'){
  ?>
  <td>
    <button type="button" class="btn btn-warning btn-sm">
  <a href="cotacaoFinal.php?carrinha=<?php echo $carrinha;?>" target="_blank" style="text-decoration:none; color:white"><span>Cotacao <i class="fas fa-fw fa-print"></i></span></a>
</button></td>
<?php }elseif($tipo == 'proforma'){
  ?>
  <td>
    <button type="button" class="btn btn-info btn-sm">
  <a href="facturaFinal.php?carrinha=<?php echo $carrinha;?>" target="_blank" style="text-decoration:none; color:white"><span>Factura <i class="fas fa-fw fa-print"></i></span></a>
</button></td>

<?php }else{
  ?>
<td>
<button type="button" class="btn btn-success btn-sm"><a href="reciboFinal.php?carrinha=<?php echo $carrinha;?>" target="_blank" style="text-decoration:none; color:white"><span> Recibo <i class="fas fa-fw fa-print"></i></span></a></button></td>

<?php }
?>


        

          
          </tr>
        
        <?php }
          
          ?>  

         
      
   
               </tbody>
      </table>
    </div>
  </div>
  <div class="card-footer small text-muted">Jonas Dinis Chambela</div>
</div>



</div>

        </div>
      </div>
      <!-- /.container-fluid -->
		  </div>

		 </div>
        
        
        </div>

     
        

      <!-- /.container-fluid -->

      <!-- Sticky Footer -->
      <?php include "includes/footer.php";?>

    </div>
    <!-- /.content-wrapper -->

  </div>
  <!-- /#wrapper -->

  <!-- Scroll to Top Button-->
  <a class="scroll-to-top rounded" href="#page-top">
    <i class="fas fa-angle-up"></i>
  </a>

  <!-- Logout Modal-->
 <?php include "includes/logout_modal.php";?>

  <!-- Bootstrap core JavaScript-->
  <script src="vendor/jquery/jquery.min.js"></script>
  <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

  <!-- Core plugin JavaScript-->
  <script src="vendor/jquery-easing/jquery.easing.min.js"></script>

  <!-- Page level plugin JavaScript-->
  <script src="vendor/chart.js/Chart.min.js"></script>
  <script src="vendor/datatables/jquery.dataTables.js"></script>
  <script src="vendor/datatables/dataTables.bootstrap4.js"></script>

  <!-- Custom scripts for all pages-->
  <script src="js/sb-admin.min.js"></script>

  <!-- Demo scripts for this page-->
  <script src="js/demo/datatables-demo.js"></script>
  <script src="js/demo/chart-area-demo.js"></script>

</body>

</html>
