<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<?php
include('conexao.php');
session_start();

	if(!isset($_SESSION["login"]) || !isset($_SESSION["senha"])){
		header("Location: cuide.php");
		exit;	
	}

?>
<html lang="fr">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>SiGA</title>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
  <link rel="stylesheet" href="assets/css/milligram/milligram.min.css">
  <link rel="stylesheet" href="assets/css/omega.css">
  <link rel="stylesheet" href="assets/css/style.css">
  
</head>
<body id="app">
<?php include("menu.php");?>
<main>

    <section>
        <div class="container">
		Ol&aacute;: <?php include('logado.php');?>
        </div>
    </section>
<?php
	$sql = mysqli_query($mysqli,"SELECT * FROM pagtodriversnregisted WHERE id = (SELECT MAX(id) FROM pagtodriversnregisted where agente = '$Nome')");
	$result = mysqli_fetch_array($sql);
	$id_pag = $result['id'];
	
	$d = $result['dia'];
    $m = $result['mes'];
    $ano = $result['ano'];
    $pago = $result['pago'];
	
	$sql3 = mysqli_query($mysqli,"SELECT * FROM receitas WHERE referencia = '$id_pag' and origem = 'trns'");
	$result3 = mysqli_num_rows($sql3);
	if($result3 < 1) { 
	$stmt = $mysqli->prepare("INSERT INTO receitas (referencia,origem, dia, mes, ano, subcod, codigo, valor) VALUES ('$id_pag','trns','$d','$m','$ano','1141','114105','$pago')");
	if(!$stmt->execute())
	{
	}

	}
	/*else { 
	 echo ("<script>alert('Este recibo ja foi impresso por ". $result2['agente']." !');window.location.href='index.php';</script>");?>
	    <meta http-equiv="refresh" content="1;url=inicio.php"/>
	  }  */
?>     
	&nbsp;&nbsp;&nbsp;&nbsp;<span class="chapter">Forma de pagamento</span><br>
<div class="bloc">
<div class="bloc--content">
<p>

<center>
<div class="modal fade" id="exampleModalToggle" aria-hidden="true" aria-labelledby="exampleModalToggleLabel" tabindex="-1">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalToggleLabel">
          <img src="images/m-pesa..jpg" width="100" height="80"> 
          </h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
        <form  action="https://acliven.it/mpesa/m_transp.php" method="post">
      <div class="modal-body">
        <div class="form-group">
            <input type="text" name="contacto" class="form-control" id="recipient-name" placeholder="Contacto" autofocus autocomplete="off" maxlength="9">
            <input type="text" name="valor" class="form-control" id="recipient-name"value="<?php echo $pago;?>" readonly>
            <input type="hidden" name="nome" class="form-control" id="recipient-name" placeholder="Valor" value="<?php include('logado.php');?>">
          </div>
      </div>
      <div class="modal-footer">
        <button type="submit" class="btn btn-primary" data-bs-target="#exampleModalToggle2" data-bs-toggle="modal" name="Ok" data-bs-dismiss="modal">Processar</button>
      </div>
    </form>
    </div>
  </div>
</div>
<div class="modal fade" id="exampleModalToggle2" aria-hidden="true" aria-labelledby="exampleModalToggleLabel2" tabindex="-1">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content">
      <div class="modal-header">
            
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
          <img src="images/m-pesa..jpg" width="100" height="80">
          <img src="images/wait.gif">
      </div>
      <div class="modal-footer">
       Desenvolvido pela <a href="www.acliven.it">ACLIVEN</a>
      </div>
    </div>
  </div>
</div>
<a href="#"><img src="images/m-pesa..jpg" width="100" height="80" data-bs-toggle="modal" href="#exampleModalToggle" role="button"><br>Pagar por M-Pesa</a>
</center>		
		<br>

<center><a href="printdriversnregisted.php"><img src="../images/metical.jpeg" width="10%" height="10%"></i><br>Dinheiro em m&atilde;o</a></center>

	<?php //}?>

</p>
	</div>
		</form>
</div>
</div>
</main>
<script defer src="https://use.fontawesome.com/releases/v5.8.1/js/all.js" integrity="sha384-g5uSoOSBd7KkhAMlnQILrecXvzst9TdC09/VM+pjDTCM+1il8RHz5fKANTFFb+gQ" crossorigin="anonymous"></script>
<script src="assets/js/omega.js"></script>
</body>
</html>
