<?php
    include_once('../../../conexao.php');
    include_once('../../../DAO/relatorios/DAORelatorioMonitoramento.php');
	$DAORelatorioMonitoramento  = new DAORelatorioMonitoramento();
    if (!isset($_SESSION)) {
           session_start();
       }
    $conn = new Conexao();

   $response = $DAORelatorioMonitoramento->empresaDefault();
   foreach($response as $row){
       $emp_razao_social = $row['emp_razao_social'];
       $emp_email        = $row['emp_email'];
       $emp_end          = $row['emp_end'];
       $emp_numero       = $row['emp_numero'];
       $emp_cep          = $row['emp_cep'];
       $emp_bairro       = $row['emp_bairro'];
       $emp_fone         = $row['emp_fone'];
   }
?>   
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paper-css/0.4.1/paper.min.css" integrity="sha512-V+r0ugxPpGraMA2ubEWvqpfcZZAfMAbnSDPeu/6gYFfdxlgJGfCuNTNrZkrjQ0sJBoySdN6uoTVwJ+4P/BeTkg==" crossorigin="anonymous" />
 
 <link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600&display=swap" rel="stylesheet"> 
  <style>
    body   { font-family: calibri }
   /* body   { font-family: 'Open Sans', sans-serif; }*/
	
    h1     {font-size: 40pt; line-height: 18mm}
    h2, h3 { font-size: 20pt; line-height: 7mm }
    h4     { font-size: 32pt; line-height: 14mm }
    h2 + p { font-size: 18pt; line-height: 7mm;font-weight: normal; }
    h3 + p { font-size: 14pt; line-height: 7mm }
    li     { font-size: 11pt; line-height: 5mm; text-transform:uppercase; font-weight:bold;     list-style-type: none; }

    h1      { margin: 0 }
    h1 + ul { margin: 2mm 0 5mm }
    h2, h3  { margin: 0 3mm 3mm 0; float: left }
    h2 + p,
    h3 + p  { margin: 0 0 3mm 50mm }
    h4      { margin: 2mm 0 0 50mm; border-bottom: 2px solid black }
    h4 + ul { margin: 5mm 0 0 50mm }
    article { border: 4px double black; padding: 5mm 10mm; border-radius: 3mm }
    th, td {
  text-align: left;
  padding: 6px;
}

tr:nth-child(even) {
  background-color: #f2f2f2;
}
 
  @page {
    size: A4
  }

.table-responsive:{
height:95%;
}

.sheet {
  overflow: visible;
  height: auto !important;
}
</style>

<body class="A4">
 
  <section class="sheet padding-10mm">
  <h1 style="   font-size:10pt;margin-top: -38px;text-align: right;float: right;"><?php echo date('d/m/Y') ?></h1>
  <ul style="padding-left: 0px;margin-top: -4mm;">
      <li><?php echo $emp_razao_social; ?> <li>
      <li> Mossoró - Rio Grande do Norte </li>
      <li><?php echo $emp_end; ?> , <?php echo $emp_numero; ?>,  <?php echo $emp_bairro; ?>  – CEP: <?php echo $emp_cep; ?>  </li>
      <li>Telefone: <?php echo $emp_fone; ?> </li>
      <li><?php echo $emp_email; ?></li>
 
    </ul>
  
    <h1 style="margin:0 auto; font-weight:bold; text-align:center; font-size:22pt;margin-top: -30px;">RELATÓRIO DE MONITORAMENTO DO USUÁRIO</h1>
    <h1 style="margin:0 auto; font-weight:bold; text-align:center; font-size:11pt;color: #484646;margin-top: -39px;">
            PERÍODO <?php echo date('d/m/Y', strtotime($_POST['filtro-relatorio-monitora-dt-inicial']))?> ATÉ <?php echo date('d/m/Y', strtotime($_POST['filtro-relatorio-monitora-dt-final']))?>  </h1>
 
<ul style="padding-left: 0px;margin-top: -4mm;">
   
      <li>USUÁRIO: <?php echo $_POST['filtro-relatorio-monitora-usu_id'].' - '.$_POST['filtro-relatorio-monitora-usu_id-descricao'] ?></li>
      
    </ul>

<table  class="table table-striped table-responsive" style="width: 100%;margin-top: -13px;border-collapse: collapse;border-spacing: 0;">
  <thead style="text-align: left;">
    <tr>
    
      <th>Data</th>
      <th>Descrição</th>
      <th>Usuário</th>
  
         </tr>
  </thead>
  <tbody>

  <?php 
	$saldo   				 = 0;
	$entrada 			     = 0;
    $saida   				 = 0;
	$showTableTotalPaga 	 = 'display:none;';
	$showTableTotalEmAberto  = 'display:none;';
	$showTableTotalCancelada = 'display:none;';
  	$venda = '';
    $result = $DAORelatorioMonitoramento->relatorioMonitora($_POST['filtro-relatorio-monitora-usu_id'], $_POST['filtro-relatorio-monitora-descricao'], $_POST['filtro-relatorio-monitora-dt-inicial'], $_POST['filtro-relatorio-monitora-dt-final']);  
    foreach($result as $row) {

   
 
        
 
     echo' <tr>
        
           
            
		      	<td style="white-space: nowrap;">'.date('d/m/Y H:m:s', strtotime($row['mon_data']) ).'</td>

            <td>'.''.$row['mon_descricao'].'</td>
            <td style="white-space: nowrap;">'.''.$row['usuario'].'</td>
        </tr>';
	}
	
		$saldo = $entrada - $saida ;  


//		echo '---> '.$_POST['filtro-relatorio-monitora-descricao'] ;

		if ($_POST['filtro-relatorio-monitora-descricao'] == 'PAGA')
		    $showTableTotalPaga = 'display:inline-table;';
		if ($_POST['filtro-relatorio-monitora-descricao'] == 'EM ABERTO')
			$showTableTotalEmAberto = 'display:inline-table;';   
		if ($_POST['filtro-relatorio-monitora-descricao'] == 'CANCELADA')
			$showTableTotalCancelada = 'display:inline-table;';  
		if ($_POST['filtro-relatorio-monitora-descricao'] == ''){
			$showTableTotalPaga = 'display:inline-table;';
			$showTableTotalEmAberto = 'display:inline-table;';
			$showTableTotalCancelada = 'display:inline-table;';  
		}
		
    ?>
    
  </tbody>
</table>


 
 

 


 

  </section>
  
 

</body> 