Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ob_start();
- require 'conexao.php';
- require 'class/usuario.class.php';
- require 'class/registro.class.php';
- require 'class/tipoabono.class.php';
- require 'class/periodoapuracao.class.php';
- require 'class/calculadora.class.php';
- require "class/extratobanco.class.php";
- require 'class/saldo.class.php';
- require 'class/abono.class.php';
- require 'vendor/autoload.php';
- if (empty($_SESSION['id'])) {
- header('Location: login.php');
- }
- $dados_post = filter_input_array(INPUT_GET, FILTER_SANITIZE_MAGIC_QUOTES);
- $calculadora = new Calculadora();
- $colaborador = new Usuario();
- $registro = new Registro();
- $periodoApuracao = new PeriodoApuracao();
- $extrato = new Extrato();
- $saldo = new Saldo();
- $abono = new Abono();
- $periodoApuracao->definePeriodoApuracao($dados_post['periodoapuracao_id']);
- $data_final = $periodoApuracao->getDatafinal();
- $colaborador->defineUsuario($dados_post['colaborador_id']);
- $saldoAnt = $saldo->getSaldoAnterior($dados_post['colaborador_id'], date('Y-m-d', strtotime($data_final)));
- $saldo = $extrato->getLancPeriodoApuracao($dados_post['colaborador_id'], $dados_post['periodoapuracao_id']);
- $saldoATranferir = $calculadora->saldoATransferir($saldoAnt, $saldo);
- $dataInical = strtotime($periodoApuracao->getDataInicial());
- $dataFinal = strtotime($periodoApuracao->getDatafinal());
- ?>
- <html>
- <head>
- <title>Relatório de Ponto</title>
- <style>
- *{
- margin: 0px;
- padding: 0px;
- }
- img{
- margin: 5px;
- }
- table{
- border-collapse: collapse;
- width: 100%;
- border: 1px solid rgba(34, 36, 38, 0.15);
- border-radius: 0.28571429rem;
- }
- tr{
- border-top: 1px solid rgba(34, 36, 38, 0.15);
- }
- td{
- width: 11%;
- padding: 3px;
- }
- table tbody tr:nth-child(odd){ background: #CCC; }
- </style>
- </head>
- <body>
- <table>
- <thead>
- <tr>
- <th colspan="2">
- <img alt='Logo 90ti' width="80px" src='<?php echo BASE; ?>assets/img/logo2.png'>
- </th>
- <th colspan="7">
- 90 Tecnologia da Informação Ltda <br>
- Av. do Contorno, 2090, 4º andar <br>
- Belo Horizonte, MG <br>
- CEP 30110-012 <br>
- </th>
- </tr>
- <tr>
- <th colspan="4" style="text-align:left;">
- <br/>
- <strong> Colaborador: </strong> <?php echo $colaborador->getNome(); ?>
- <br/> <br/>
- </th>
- <th colspan="5">
- <br/>
- <strong> Competência: </strong> <?php echo $periodoApuracao->getMesCompetencia(); ?>
- </th>
- </tr>
- <tr>
- <th> Dia </th>
- <th> Sem </th>
- <th> 1ª Ent. </th>
- <th> 1ª Sai. </th>
- <th> 2ª Ent. </th>
- <th> 2ª Sai. </th>
- <th> Sai. Interm. </th>
- <th> Ent. Interm. </th>
- <th> Motiv. Abono </th>
- </tr>
- </thead>
- <tbody>
- <?php for ($dia = $dataInical; $dia <= $dataFinal; $dia += 86400) { ?>
- <tr><td style="text-align: center;"><?php echo date('d/m/Y', $dia); ?></td>
- <td style="text-align: center;"><?php echo $calculadora->diaDaSemana($dia); ?></td>
- <?php for ($x = 1; $x <= 6; $x++) { ?>
- <td style="text-align: center;"><?php
- $reg = $registro->getRegistro($dados_post['colaborador_id'], $x, date('Y-m-d', $dia));
- echo $reg[0]['hora_informada'];
- ?>
- </td>
- <?php } ?>
- <td>
- <?php
- $abonos = $abono->getTipoAbonoDoDia(date('Y-m-d', $dia), $dados_post['colaborador_id']);
- if ($abonos != '-') {
- foreach ($abonos as $value) {
- $res = $value['nome'] . " ";
- echo $res;
- }
- } else {
- echo $abonos;
- }
- ?>
- </td>
- </tr>
- <?php } ?>
- </tbody>
- <tfoot>
- <tr>
- <td colspan="9">
- <?php
- echo "Saldo Anterior: ";
- if ($saldoAnt[0] == '0:00:00') {
- echo $saldoAnt[1] . " C";
- } else {
- echo $saldoAnt[0] . ' D';
- }
- ?>
- <br>
- Total Positivo: <?php echo $saldo[1]; ?>
- <br>
- Total Negavivo: <?php echo $saldo[0]; ?>
- <br>
- Saldo Final: <?php echo $saldoATranferir; ?>
- </td>
- </tr>
- <tr>
- <td colspan="9" style="text-align: center;">
- <br><br>
- ______________________________________________________________<br>
- <?php echo $colaborador->getNome(); ?> <br><br>
- </td>
- </tr>
- </tfoot>
- </table>
- </body>
- </html>
- <?php
- $html = ob_get_clean();
- ob_end_clean();
- $Mpdf = new Mpdf\Mpdf([
- 'default_font_size' => 7,
- 'default_font' => 'dejavusans'
- ]);
- //$nomearq = implode("_", explode(" ", $colaborador->getNome())) . "_fechamento" . date('Ymd');
- $Mpdf->WriteHTML($html);
- //$Mpdf->Output("arquivos/$nomearq.pdf", "F");
- $Mpdf->Output('relatorio', "I");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement