<?php
session_start();

require_once 'financeiro/Boleto.php';

$boleto = new Boletos();

$enviar = $_POST['enviar'];
$lojaConsultar = $_POST['loja'];

$total = 0;
$diaAtual2 = date('Y-m-d') ;
?>

<!DOCTYPE html>
<html>
<head>

<?php include_once 'head.html' ?>

<title></title>
</head>

<body>

<?php include_once 'header.php'; ?>



<h4>

<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-file-earmark-bar-graph-fill" viewBox="0 0 16 16">
  <path d="M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707A1 1 0 0 0 13.707 4L10 .293A1 1 0 0 0 9.293 0M9.5 3.5v-2l3 3h-2a1 1 0 0 1-1-1m.5 10v-6a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5m-2.5.5a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5zm-3 0a.5.5 0 0 1-.5-.5v-2a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5z"/>
</svg>

DUPLICATAS SELECIONADAS PARA BAIXA</h4>

<hr>
<p></p>

<form action="financeiro/baixarBoleto.php" method="post">

<input type="hidden" name="boletos" value='<?php echo json_encode($enviar);?>'>
<input type="hidden" name="loja" value='<?= $lojaConsultar; ?>'>

<span>
	
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-exclamation-diamond-fill text-warning" viewBox="0 0 16 16">
  <path d="M9.05.435c-.58-.58-1.52-.58-2.1 0L.436 6.95c-.58.58-.58 1.519 0 2.098l6.516 6.516c.58.58 1.519.58 2.098 0l6.516-6.516c.58-.58.58-1.519 0-2.098zM8 4c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995A.905.905 0 0 1 8 4m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>
</svg>

<b> DATA DA BAIXA </span><input type="date" name="datapagamento" value="<?= $diaAtual2 ;?>"> 
FORMA PAGAMENTO: 
<select name="tipoPagamento">
    <option value="ESPÉCIE" selected>Espécie</option>
    <option value="CARTÃO">Cartão</option>
    <option value="PIX">Pix</option>
    <option value="DEPOSITO">Depósito</option>
</select>


<p></p>
</b>

<hr>


<p></p>
<table class="table table-striped tabelaindex" >

    <thead class="table-dark" align="left">

       <!-- <th> ID </th>-->
        <th>FORNECEDOR</th>
        <th>VALOR</th>
       
    </thead>

<p></p>

<?php

foreach ($enviar as $dado) {
$boletoImprimir = $boleto->boletoPorNumero($dado);

foreach ($boletoImprimir as $boleto2){

$valor = $boleto2[1];
$fornecedor  = $boleto2[0];

}

$total = $total + $valor;

?>

<tr>
	<?php //echo $dado?>
<td>

<?php echo $fornecedor;  ?>

</td>
	<td> R$

<?php echo number_format($valor, 2, ',', '.');  ?>

</td>


</tr>

<?php }?>

<tr>
	<td> <b> TOTAL: R$ <?php echo number_format($total, 2, ',', '.'); ?></b></td>
	<td></td>
	<td></td>
	<td></td>
	<td></td>

</tr>

</table>


<hr>

<h6 class="text-danger">

<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-exclamation-lg" viewBox="0 0 16 16">
  <path d="M7.005 3.1a1 1 0 1 1 1.99 0l-.388 6.35a.61.61 0 0 1-1.214 0zM7 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0"/>
</svg>


"O sistema realizará a baixa na conta ITAU correspondente à loja. <br> Não é possível aplicar descontos ou acréscimos diretamente. Para isso, utilize o SOFTSHOP."


</h6>


<hr>

<input type="submit" name="" value="FINALIZAR BAIXA" class="btn btn-danger" onclick="return confirm('Deseja Baixar os títulos listados ?')">
</form>


<?php include_once 'footer.php' ?>