<?php
session_start();
include '../conexao.inc.php';
$sql = "select p.*,i.inscricao,i.email,b.descricao bolsao, b.valor, s.descricao situacao, i.id from pedido p "
                        . " inner join inscricoes i on i.id = p.seq_inscricao"
        . " inner join bolsao b on b.id = i.id_bolsao"
        . " inner join status s on s.seq_status = p.seq_status"
                        . " where i.id=".$_SESSION["id"];
//echo $sql;
$res = mysqli_query($conexao, $sql);
//$rowInscricao = mysqli_fetch_array($res);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <link href="../css/bootstrap.css" rel="stylesheet" type="text/css" />
        <link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="../css/bootstrap-theme.min.css" rel="stylesheet" type="text/css" />


        <script src="../js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
        <script src="../js/prefixfree-1.0.7.js" type="text/javascript"></script>
        <script src="../js/vendor/jquery-1.11.1.js" type="text/javascript"></script>
        <script src="../js/bootstrap.min.js"></script>
      <!--  <script src="../js/main.js"></script> -->
        
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

        <meta charset="UTF-8"/>

        <title>Bolsão Colégio Força Máxima</title>

        <link href="../style.css" rel="stylesheet" type="text/css" />

        <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
      <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
      <!--<script src="../../assets/js/ie-emulation-modes-warning.js"></script>-->

        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->

    </head>

    <body>
        <div class="container">
            
                <div class="table table-responsive" >
                    <table class="table table-hover"  id="tabela" >
                        <thead>
                            <tr>
                                <th>Pedido</th>
                                <th>Descrição</th>
                                <th>Valor</th>
                                <th>Situação</th>
                                <th></th>
                            </tr>
                        </thead>

                        <tbody>
                            <?php
                            if (mysqli_num_rows($res) > 0) {

                                while ($rowP = mysqli_fetch_array($res)) {
                                    echo "<tr>";
                                    echo "<td>" . $rowP["seq_pedido"] . "</td>";
                                    echo "<td>" . $rowP["bolsao"] . "</td>";
                                    echo "<td>R$ " . number_format($rowP['valor'], 2, ',', '.') . "</td> ";
                                    echo "<td>" . $rowP["situacao"] . "</td>";
                                    if($rowP["seq_forma_pagamento"]=="" && $rowP["seq_status"]==1){
                                    echo "<td><a target='_blank' title='Pagar Inscrição' href='pagamentoBolsao.php?i=" . $rowP["id"] . "'>Pagar Inscrição</a> </td>";
                                    }
                                    if($rowP["seq_forma_pagamento"]==1 && $rowP["seq_status"]==1){
                                    echo "<td><a target='_blank' title='Imprimir Boleto' href='imprimirBoleto.php?ID=" . $rowP["id_pedido"] . "'>Imprimir Boleto</a> </td>";
                                    }
                                    if($rowP["seq_status"]==10 || $rowP["seq_status"]==7 || $rowP["seq_status"]==6){
                                    echo "<td><a target='_blank' title='Efetuar novo pagamento' href='novoPedido.php?i=" . $rowP["id"] . "'>Efetuar novo pagamento</a> </td>";
                                    }
                                   if($rowP["seq_status"]==3 ){
                                       
                                    }

                                    echo "<tr>";
                                    next($rowP);
                                }
                            }
                            ?>

                        </tbody>
                    </table>



                </div><!-- HEADER -->

            </div><!--BOX-->
    </body>
</html>