<?php

Include("includes/con_cliente.php");

 require_once('connection.php');
    session_start();

    if(isset($_SESSION['User']))
    {
        $query="select * from tbusuario where nomeuser='".$_SESSION['User']."'";
        $result=mysqli_query($con,$query);
        $resultado = mysqli_fetch_assoc($result);
        $r_resultado = $resultado;
        //echo $resultado["nome"] .'<br>';
    }
    else
    {
        header("location:index.php");
    }
?>


<html>
 <head>

    	<meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <title>Sistema SCA - Grupo BRO</title>

        <link rel="stylesheet" href="node_modules/bootstrap/compiler/bootstrap.css">
        <link rel="stylesheet" href="node_modules/bootstrap/compiler/styler.css">

        <!--<link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" /> -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
        <link rel="stylesheet" href="https://cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/build/css/bootstrap-datetimepicker.css" />

        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.js"></script>
        <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="https://cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/src/js/bootstrap-datetimepicker.js"></script>


 </head>
    <body >

        <nav class="navbar fixed-top navbar-expand-lg navbar-dark" style="background-color: #3333ff;">
          <!--<a class="navbar-brand" href="#">SCA</a> -->
          <a class="navbar-brand" href="menu.php">
                <img src="img/logomarca.png" width="50" height="40" class="d-inline-block align-center" alt="">
                SCA - Orçamentos - Inclusão de Orçamentos
          </a>

          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>

          </button>
          <div class="collapse navbar-collapse" id="navbarTogglerDemo02">
            <ul class="navbar-nav mr-auto mt-2 mt-lg-0">
            </ul>
            <form class="form-inline my-2 my-lg-0">
                <button type="button" class="btn btn-warning btn-sm" href="cv.php" style = "margin:2px;">
                <a href="lstvservicosabertos.php" style="color:inherit"> Novo Orçamento </a></button>
              <button type="button" class="btn btn-danger btn-sm" href="cv.php" style = "margin:2px;">
                <a href="morcamentos.php" style="color:inherit"> Voltar </a></button>
            </form>
          </div>
        </nav>

    	

<script type="text/javascript">
    $(function () {
        $('#datetimepicker6').datetimepicker({
            format: 'L'
        });
        $('#datetimepicker7').datetimepicker({
            format: 'L'

        });
        
    });
</script>




        <?php
        $connect = mysqli_connect('127.0.0.1', 'root', 'fcf2778@', 'administrativo');
        if(mysqli_connect_errno($connect)){
        echo 'Falha ao conectar com o Banco de Dados !'.mysqli_connect_error();}


        $result= mysqli_query($connect, "SELECT * FROM tborcsint ORDER BY SitOrcamento");
        ?>

    <div style="margin-top: 7rem">    
        <div class="container">
            <!--<h4 class="page-header">Veículos Cadastrados</h4> --> 
            <div class="table-responsive">
                    <!--<table style="font-size: 9px;" class="table table-striped table-bordered table-hover table-condensed"> -->
                    <table style="font-size: 9px; overflow: auto;" class="table table-striped table-responsive-md btn-table table-hover table-bordered">
                        <thead class="table-warning">
                            <tr>
                               <!-- <th>Id</th> -->
                                <th>Empresa</th>
                                <th>Nr.</th>
                                <th>Paciente</th>
                                <th>Médico</th>
                                <th>Convênio</th>
                                <th>Hospital</th>
                                <th>Material</th>
                                <th>Tipo</th>
                                <th>Valor R$</th>
                                <th>Status</th>
                            </tr>
                        </thead>
                        <?php while($rows = mysqli_fetch_array($result)): ?>
                        <tr>
                           <!-- <td style="width: 30px;"><?php echo $rows['id']; ?></td> -->
                            <!--<td style="text-align: center;vertical-align:middle"><?php echo date ("d/m/y", strtotime($rows['data'])); ?></td> -->
                            <td style="text-align: center;vertical-align:middle"><?php echo $rows['Empresa']; ?></td>
                            <td style="text-align: center;vertical-align:middle"><?php echo $rows['NrOrcSistema']; ?></td>
                            <td style="text-align: center;vertical-align:middle"><?php echo $rows['paciente']; ?></td>
                            <td style="text-align: center;vertical-align:middle"><?php echo $rows['Medico']; ?></td>
                            <td style="text-align: center;vertical-align:middle"><?php echo $rows['Convenio']; ?></td>
                            <td style="text-align: center;vertical-align:middle"><?php echo $rows['Hospital']; ?></td>
                            <td style="text-align: center;vertical-align:middle"><?php echo $rows['Material']; ?></td>
                            <td style="text-align: center;vertical-align:middle"><?php echo $rows['Tipo']; ?></td>
                            <td style="text-align: center;vertical-align:middle"><?php echo number_format(($rows['VlrOrc']),2, ',', '.'); ?></td>
                            <td style="text-align: center;vertical-align:middle"><?php echo $rows['SitOrcamento']; ?></td>
                            <td style="text-align: center;vertical-align:middle"><a href="srvaltera.php?id=<?php echo $rows['id']; ?>">Evoluir</a> </td>
                            <td style="text-align: center;vertical-align:middle"><a href="srvencerrar.php?id=<?php echo $rows['id']; ?>">Encerrar</a></td>
                        </tr>
                        <?php endwhile; ?>
                    </table>
                   
            </div>
        </div>
    </div>

            
    <script src="js/jquery.js"></script> 
    <script src="js/bootstrap.min.js"></script>

    </body>
    <footer class="page-footer font-small text-primary "style="margin-top: 6rem">
          <div class="footer-copyright text-center py-3">© 2019 Copyright: Brasil Ortopedia
          </div>
    </footer>

        <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>


</html>