<?php
// require_once "config/init.php";
$inicio = $_GET['inicio'] ?? date('Y-m-01');
$fim = $_GET['fim'] ?? date('Y-m-d');

?>
<?php require "includes/header.php";?>
  <?php include "includes/navbar.php";?>
    <!-- Page Wrapper -->
    <div id="wrapper">

        <!-- Sidebar -->
        <?php include "includes/sidebar.php";?>
        <!-- End of Sidebar -->

        <!-- Content Wrapper -->
        <div id="content-wrapper" class="d-flex flex-column">

            <!-- Main Content -->
            <div id="content">


                <!-- Begin Page Content -->
                <div class="container-fluid">


                    <!-- Content Row -->

                    <div class="row">
               <div class="container">
    <h2>📊 Demonstração de Resultados (DRE)</h2>

    <!-- Formulário de filtro -->
    <form class="row g-3 mb-3" method="get">
        <div class="col-auto">
            <input type="date" name="inicio" class="form-control" value="<?= $inicio ?>">
        </div>
        <div class="col-auto">
            <input type="date" name="fim" class="form-control" value="<?= $fim ?>">
        </div>
        <div class="col-auto">
            <button class="btn btn-primary btn-sm">Filtrar</button>
        </div>
        
    </form>

    <!-- Tabela DRE -->
    <table class="table table-bordered w-50">
        <tr>
            <th>Receitas</th>
            <td><?php echo  $novaVenda->SomaEntrada($inicio,$fim);?> MT</td>
        </tr>
        <tr>
            <th>Despesas</th>
            <td> <?php echo $novaVenda->SomaSaida($inicio,$fim);?> MT</td>
        </tr>
        <tr>
            <th>Lucro Líquido</th>
            <td> <?php echo  $novaVenda->SaldoCaixa($inicio,$fim);?> MT</td>
        </tr>
    </table>

     <div class="card mb-3">
          <div class="card-header">
            <i class="fas fa-chart-area"></i>
            Area Chart</div>
          <div class="card-body">
            <canvas id="myPieChart" width="100%" height="30"></canvas>
          </div>
        </div>
</div>
</div> 

       
            <!-- End of Main Content -->

            <!-- Footer -->
          <?php include "includes/footer.php";?>
            <!-- End of Footer -->

        </div>
        <!-- End of Content Wrapper -->

    </div>
    <!-- End of Page Wrapper -->

    <!-- Scroll to Top Button-->
    <a class="scroll-to-top rounded" href="#page-top">
        <i class="fas fa-angle-up"></i>
    </a>

    <!-- Logout Modal-->
<?php include "includes/logout_modal.php";?>


    <?php include "includes/sweatscripFooter.php";?>
 <!-- Bootstrap core JavaScript-->
  <script src="vendor/jquery/jquery.min.js"></script>
  <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

  <!-- Core plugin JavaScript-->
  <script src="vendor/jquery-easing/jquery.easing.min.js"></script>

  <!-- Page level plugin JavaScript-->
  <script src="vendor/chart.js/Chart.min.js"></script>
  <script src="vendor/datatables/jquery.dataTables.js"></script>
  <script src="vendor/datatables/dataTables.bootstrap4.js"></script>

  <!-- Custom scripts for all pages-->
  <script src="js/sb-admin.min.js"></script>

  <!-- Demo scripts for this page-->
  <script src="js/demo/datatables-demo.js"></script>
  <script src="js/demo/chart-area-demo.js"></script>
  <script src="js/demo/chart-pie-jonas.js"></script>

</body>

</html>













