<?php 
session_start();
include '../../conexao/index.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <?php include 'includes/head.php'; ?>
</head>
<body>
    <div class="main-wrapper">
        <div class="header">
            <?php include 'includes/header.php' ?>
        </div>
        <div class="sidebar" id="sidebar">
            <?php include 'includes/side_bar.php'; ?>
        </div>
        <div class="page-wrapper">
            <div class="content">
                <div class="row">
                    <div class="col-sm-4 col-3">
                        <h4 class="page-title">Ordens de Compra</h4>
                    </div>

                </div>
				<div class="row">
					<div class="col-md-12">
						<div class="table-responsive">
							<table class="table table-border table-striped custom-table datatable mb-0">
								<thead>
									<tr>
										<th>#</th>
										<th>Descricao</th>
										<th>Valor</th>
										<th>Fornecedor</th>
										<th>Prazo</th>
										<th>Modo de Pagamento</th>
										<th>Ver</th>
									</tr>
								</thead>
								<tbody>
									<?php 
										$sql = "SELECT `id`, `descricao`, `valor`, (SELECT nome FROM fornecedor WHERE fornecedor.id = ordem_compra.fornecedor) as fornecedor, `prazo`, `modo` FROM ordem_compra";
										$rs = mysqli_query($db, $sql) or die(mysqli_error($db));
										while ($dados = mysqli_fetch_array($rs)) {
											$v = $dados['valor'];
									?>
										<tr>
											<td><?php echo $dados['id']; ?></td>
											<td><?php echo $dados['descricao']; ?></td>
											<td><?php echo "".number_format($v,2,".",","); ?></td>
											<td><?php echo $dados['fornecedor']; ?></td>
											<td><?php echo $dados['prazo']; ?></td>
											<td><?php echo $dados['modo']; ?></td>
											<td><a href="../oc.php?id_oc=<?php echo $dados['id']; ?>" target="_blank"><img src="../../img/config/iconfinder_system-search_118797 (1).png"></a></td>
										</tr>
									<?php
										}
									?>
									
								</tbody>
							</table>
						</div>
					</div>
                </div>
            </div>
        </div>
    </div>
    <div class="sidebar-overlay" data-reff=""></div>
    <?php include 'includes/footer_plugins.php'; ?>
</body>
<!-- patients23:19-->
</html>