<?php
require_once '../../gerador/dompdf/autoload.inc.php'; // Caminho ajustado para DOMPDF sem Composer

use Dompdf\Dompdf;
use Dompdf\Options;


function exportar(){


$options = new Options();
$options->set('defaultFont', 'Arial');

date_default_timezone_set('America/Sao_Paulo');
$dompdf = new Dompdf($options);

$html = '<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="UTF-8">
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
        }
        .container {
            width: 90%;
            margin: auto;
            text-align: left;
        }
        h2 {
            background-color: #333;
            color: white;
            padding: 10px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 8px;
        }
        th {
            background-color: #444;
            color: white;
        }
        .section-title {
            font-weight: bold;
            background-color: #ddd;
            padding: 5px;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>Demonstrativo de Resultado - Janeiro 2025</h2>
        <p><strong>Empresa:</strong> MATRIZ</p>
        <p><strong>Loja:</strong> CASA DO CABELEIREIRO - LOJA 02</p>
        
        <table>
            <thead>
                <tr>
                    <th>Descrição</th>
                    <th>Valor (R$)</th>
                </tr>
            </thead>
            <tbody>
                <tr class="section-title">
                    <td colspan="2">Receita</td>
                </tr>
                <tr><td>Total das Vendas</td><td>91.513,49</td></tr>
                <tr><td>Custo das Vendas</td><td>60.402,76</td></tr>
                <tr><td>Lucro Bruto</td><td>31.110,73</td></tr>
                
                <tr class="section-title">
                    <td colspan="2">Despesas</td>
                </tr>
                <tr><td>Folha de Pagamento</td><td>12.407,26</td></tr>
                <tr><td>Aluguel</td><td>6.147,00</td></tr>
                <tr><td>Plano de Saúde</td><td>13.446,28</td></tr>
                <tr><td>Impostos</td><td>20.054,89</td></tr>
                
                <tr class="section-title">
                    <td colspan="2">Resultado</td>
                </tr>
                <tr><td>Lucro Líquido</td><td>-29.005,10</td></tr>
            </tbody>
        </table>
    </div>
</body>
</html>';

$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$dompdf->stream("DRE_Janeiro_2025.pdf", ["Attachment" => false]);



}

exportar();