<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Sisplan Web | Relatório Financeiro por Classe Gerencial</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.259.1.1">

  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.259.1.1">
  <link rel="stylesheet" href="dist/css/custom.css?versao=3.259.1.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.259.1.1">
  <link rel="stylesheet" href="dist/css/sisplan.newColorsButtons.css?versao=3.259.1.1">
  <link rel="stylesheet" href="dist/css/sisplan.adjustDataTableButtons.css?versao=3.259.1.1">
  <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.259.1.1">
  <link rel="stylesheet" type="text/css" href="plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.259.1.1">
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.259.1.1">
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.259.1.1">
  <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.259.1.1">
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.259.1.1" />
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.259.1.1">
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.259.1.1">
  <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.259.1.1">
  <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.259.1.1">
  <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.259.1.1" />
</head>
<style>
  .table.dataTable tbody td {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .table.dataTable thead th {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  table.dataTable {
    margin-top: 0.3125rem !important;
  }
</style>

<body class="hold-transition sidebar-mini layout-fixed">
  <main class="wrapper">

    <div class="content-wrapper">
      <div class="content-header">
        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-sm-6 d-flex align-items-center">
              <h1 class="m-0 text-dark">Relatório Financeiro por Classe Gerencial</h1>

              <button type="button" class="btn btn-info btn-sm ml-2" title="Tutorial" id="tutorial">
                <i class="fas fa-question-circle"></i>
              </button>
            </div>
          </div>
          <div class="row">
            <div class="col-12">
              <fieldset>
                <div class="row">
                  <div class="col-12">
                    <div class="buttons">
                      <button class="btn btnFiltros btn-sisp" id="btnFiltros" style="height: 38px!important; max-height: 38px!important" type="button"><span class="fas fa-filter"></span> Filtros</button>
                      <button class="btn btnFiltros btn-sisp dropdown-toggle" style="height: 38px!important; max-height: 38px!important" type="button" id="dropdownDashboard" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <i class="fas fa-chart-line"></i>
                        Dash
                      </button>
                      <div class="dropdown-menu" aria-labelledby="dropdownDashboard">
                        <a class="dropdown-item" id="graficoVazio" style="cursor: pointer">Nenhum</a>
                        <a class="dropdown-item" id="graficoColuna" style="cursor: pointer">Coluna</a>
                        <a class="dropdown-item" id="graficoBarra" style="cursor: pointer">Barra</a>
                        <a class="dropdown-item" id="graficoPizza" style="cursor: pointer">Pizza</a>
                        <a class="dropdown-item" id="graficoLinha" style="cursor: pointer">Linha</a>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="row d-flex justify-content-center" style="margin-top: 20px;">
                  <div class="col-6" id="graficoRelFinanceiroClasseGer">
                  </div>
                  <div class="col-6" id="graficoRelFinanceiroClasseGer1">
                  </div>
                </div>
                <div class="card-body" id="divTabelaFinanceiroClasse">
                  <div class="card col-sm-12 p-3">
                    <div class="row">
                      <div class="col-sm-8 table-responsive">
                        <table id="tabelaFinanceiroClasse" class="table table-sm-sisp table-select table-hover" width="100%">
                          <thead>
                          </thead>
                          <tbody>
                          </tbody>
                        </table>
                        <div class="d-flex justify-content-end d-none">
                          <button id="btnImprimirFinanceiroClasse" class="btn-sisp btn btn-danger d-none mt-1"><i class="fas fa-print"></i> Imprimir</button>
                        </div>
                      </div>
                      <div class="col-sm-4">
                        <div class="col-sm-12 align-items-center mb-4">
                          <div class="col-sm-12 text-center">
                            <h5 class="text-bold">RESUMO</h5>
                          </div>
                          <div class="row justify-content-center">
                            <div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                              <div class="col col-lg">
                                <div id="valortotalReceber" class="info-box d-flex align-items-center">
                                  <span class="info-box-icon text-white spanDollar" style="background-color:var(--info-box-success); height: 5vh"><i class="fas fa-dollar-sign"></i></span>
                                  <div class="info-box-content">
                                    <span class="info-box-text text-lg" style="height: 2vh">Total Receber</span>
                                    <span class="info-box-number text-lg text-bold" style="height: 2vh" id="txt_val_receber_total">0,00</span>
                                  </div>
                                </div>
                              </div>
                            </div>
                            <div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                              <div class="col col-lg">
                                <div id="valortotalPagar" class="info-box d-flex align-items-center">
                                  <span class="info-box-icon text-white spanDollar" style="background-color:var(--info-box-danger); height: 5vh"><i class="fas fa-dollar-sign"></i></span>
                                  <div class="info-box-content">
                                    <span class="info-box-text text-lg" style="height: 2vh">Total Pagar</span>
                                    <span class="info-box-number text-lg text-bold" style="height: 2vh" id="txt_val_pagar_total">0,00</span>
                                  </div>
                                </div>
                              </div>
                            </div>
                            <div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6 d-flex">
                              <div class="col col-lg">
                                <div id="valortotalFinal" class="info-box d-flex align-items-center">
                                  <span class="info-box-icon text-white spanDollar" id="spanTotalFinal" style="background-color:var(--info-box-primary); height: 5vh"><i class="fas fa-dollar-sign"></i></span>
                                  <div class="info-box-content">
                                    <span class="info-box-text text-lg text-bold" style="height: 2vh">Total Final</span>
                                    <span class="info-box-number text-lg text-bold" style="height: 2vh" id="txt_val_final_total">0,00</span>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="col-sm-12 align-items-start mt-4">
                          <div class="col-sm-12 text-center">
                            <h5 class="text-bold">MAIS INFORMAÇÕES</h5>
                          </div>
                          <div class="row col-12 p-0">
                            <div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                              <div class="col col-lg">
                                <div id="valortotalReceberFixo" class="info-box d-flex align-items-center">
                                  <span class="info-box-icon text-white spanDollar" style="background-color:var(--info-box-success); height: 5vh"><i class="fas fa-dollar-sign"></i></span>
                                  <div class="info-box-content">
                                    <span class="info-box-text text-lg" style="height: 2vh">Total Receber Fixo</span>
                                    <span class="info-box-number text-lg text-bold" style="height: 2vh" id="txt_val_receber_fixo_total">0,00</span>
                                  </div>
                                </div>
                              </div>
                            </div>
                            <div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                              <div class="col col-lg">
                                <div id="valortotalPagarFixo" class="info-box d-flex align-items-center">
                                  <span class="info-box-icon text-white spanDollar" style="background-color:var(--info-box-danger); height: 5vh"><i class="fas fa-dollar-sign"></i></span>
                                  <div class="info-box-content">
                                    <span class="info-box-text text-lg" style="height: 2vh">Total Pagar Fixo </span>
                                    <span class="info-box-number text-lg text-bold" style="height: 2vh" id="txt_val_pagar_fixo_total">0,00</span>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                          <div class="row col-12 p-0">
                            <div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                              <div class="col col-lg">
                                <div id="valortotalReceberVariavel" class="info-box d-flex align-items-center">
                                  <span class="info-box-icon text-white spanDollar" style="background-color:var(--info-box-success); height: 5vh"><i class="fas fa-dollar-sign"></i></span>
                                  <div class="info-box-content">
                                    <span class="info-box-text text-lg" style="height: 2vh">Total Rec. Variável</span>
                                    <span class="info-box-number text-lg text-bold" style="height: 2vh" id="txt_val_receber_variavel_total">0,00</span>
                                  </div>
                                </div>
                              </div>
                            </div>
                            <div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                              <div class="col col-lg">
                                <div id="valortotalPagarVariavel" class="info-box d-flex align-items-center">
                                  <span class="info-box-icon text-white spanDollar" style="background-color:var(--info-box-danger); height: 5vh"><i class="fas fa-dollar-sign"></i></span>
                                  <div class="info-box-content">
                                    <span class="info-box-text text-lg" style="height: 2vh">Total Pagar Variável </span>
                                    <span class="info-box-number text-lg text-bold" style="height: 2vh" id="txt_val_pagar_variavel_total">0,00</span>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-sm-8 table-responsive mt-4">
                        <table id="tabelaDadosFinanceiro" class="table table-sm-sisp table-select table-hover" width="100%">
                          <thead>
                          </thead>
                          <tbody>
                          </tbody>
                        </table>
                        <div class="d-flex justify-content-end">
                          <button id="btnImprimirDadosFinanceiro" class="btn-sisp btn btn-danger d-none mt-1"><i class="fas fa-print"></i> Imprimir</button>
                        </div>
                      </div>
                      <div class="col-sm-4 align-items-start mt-4 text-center">
                        <h5 class="text-bold">OBSERVAÇÃO FINANCEIRO</h5>
                        <div class="col-sm-12">
                          <span id="txtObsFinanceiro" class="text-semibold text-lg"></span>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </fieldset>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div id="modal-filtros" class="modal" tabindex="-1" role="dialog">
      <div class="modal-dialog modal-xl" role="document">
        <div class="modal-content" id="modalBody">
          <div class="modal-header">
            <h4 class="modal-title">Filtros</h4>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body">
            <div class="row">
              <div class="col-md-4 col-sm-6 col-12">
                <label data-error="wrong" data-success="right" for="dtReceitaDe">Receita De/Até: </label>
                <div class="relative">
                  <div class="input-group">
                    <input type="date" max="2500-12-31" value="2025-07-01" class="input-default focus form-control" id="dtReceitaDe" name="dtReceitaDe" class="form-control">
                    <input type="date" max="2500-12-31" value="2025-07-15" class="input-default focus form-control" id="dtReceitaAte" name="dtReceitaAte" class="form-control">
                  </div>
                </div>
              </div>
              <div class="col-md-4 col-sm-6 col-12">
                <label data-error="wrong" data-success="right" for="dtPagtoDe">Pagamentos De/Até: </label>
                <div class="relative">
                  <div class="input-group">
                    <input type="date" max="2500-12-31" value="2025-07-01" class="input-default focus form-control" id="dtPagtoDe" name="dtPagtoDe" class="form-control">
                    <input type="date" max="2500-12-31" value="2025-07-15" class="input-default focus form-control" id="dtPagtoAte" name="dtPagtoAte" class="form-control">
                  </div>
                </div>
              </div>
              <div class="col-md-4 col-sm-6 col-12 mt-4 pt-1">
                <button class="btn btn-danger btn-sisp" type='button' id="btnSelecionarEmpresas">Selecionar Empresas</button>
              </div>
            </div>
            <div class="row">


              <div class="col-md-4 col-sm-4 col-12 mt-2">
                <label data-error="wrong" data-success="right" for="txtFornecedor">Fornecedor: </label>
                <div class="relative">
                  <div class="input-group">
                    <select class="js-example-programmatic js-states form-control" id="txtFornecedor" name="txtFornecedor" multiple="multiple"></select>
                    <div class="input-group-append">
                      <button class="btn bg-danger" id="btnFornecedor" name="btnFornecedor" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger" id="btnLimpaFornecedor" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>
              </div>

              <div class="col-md-4 col-sm-4 col-12 mt-2">
                <label data-error="wrong" data-success="right" for="txtClasse">Classe Gerencial: </label>
                <div class="relative">
                  <div class="input-group">
                    <select class="js-example-programmatic js-states form-control" id="txtClasse" name="txtClasse" multiple="multiple"></select>
                    <div class="input-group-append">
                      <button class="btn bg-danger" id="btnClasse" name="btnClasse" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger" id="btnLimpaClasse" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>
              </div>

              <div class="col-md-2 col-sm-2 col-12 mt-2">
                <div class="form-group">
                  <label>Operação: </label>
                  <select class="form-control select2 select2-danger" id="selectOperacao" name="selectOperacao" data-dropdown-css-class="select2-danger" style="width: 100%;">
                    <option selected="selected" value="">Todas</option>
                    <option value="E">Entradas</option>
                    <option value="S">Saídas</option>
                  </select>
                </div>
              </div>
            </div>
          </div>
          <div class="modal-footer justify-content-start pl-0">
            <div class="row col-12">
              <div class="col-md-4 col-sm-4 col-12">
                <!-- <label for="txtOrdem">Opção de Relatório:</label>
                <div class="relative d-flex align-items-center">
                  <select id="txtOrdem" class="input-default focus custom-select">
                  </select>
                  <button class="btn btn-sm btn-success ml-2 btnEdicaoRelatorio" title="Edição de ordenações">
                    <i class="fas fa-check"></i>
                  </button>
                </div> -->
              </div>
              <div class="col-6 col-lg-8 d-flex justify-content-end align-items-end pr-0">
                <div class="d-flex">
                  <button id="btnConsultar" class="btn btn-primary btn-sisp" type="button">
                    <span class="fas fa-search"></span> Consultar
                  </button>
                  <button class="btn btn-danger btn-sisp marginBtnH" id="btnLimparFiltros">
                    <span class="fas fa-trash"></span> Limpar Filtros
                  </button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
      <!-- Control sidebar content goes here -->
    </aside><!-- /.control-sidebar -->
  </main><!-- /.wrapper -->
  <?php include_once('../../modais.php'); ?>

  <script src="plugins/jquery/jquery.min.js?versao=3.259.1.1"></script>
  <script src="dist/js/jquery.maskMoney.min.js?versao=3.259.1.1"></script>
  <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.259.1.1"></script>
  <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.259.1.1"></script>
  <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.259.1.1"></script>
  <script src="plugins/sweetalert2/sweetalert2.min.js?versao=3.259.1.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.259.1.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.259.1.1"></script>
  <script src="dist/js/adminlte.min.js?versao=3.259.1.1"></script>
  <script src="dist/js/requisicoes.js?versao=3.259.1.1"></script>
  <script src="dist/js/loadingoverlay.min.js?versao=3.259.1.1"></script>
  <script src="dist/js/valida_cpf_cnpj.js?versao=3.259.1.1"></script>
  <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.259.1.1"></script>
  <script src="dist/js/dataTables.keyTable.js?versao=3.259.1.1"></script>
  <script src="dist/js/sisplan.js?versao=3.259.1.1"></script>
  <script src="utils/funcoes.js?versao=3.259.1.1"></script>
  <script src="utils/cookies.js?versao=3.259.1.1"></script>
  <script src="dist/js/driver.min.js?versao=3.259.1.1"></script>
  <script src="config.js?versao=3.259.1.1"></script>
  <script src="plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.259.1.1"></script>
  <script src="plugins/select2/js/select2.full.min.js?versao=3.259.1.1"></script>
  <script src="graficos/graficos.js?versao=3.259.1.1"></script>
  <script src="plugins/high-charts/highcharts.js"></script>
  <script src="plugins/high-charts/highcharts-3d.js"></script>
  <script src="plugins/high-charts/cylinder.js"></script>
  <script src="plugins/high-charts/exporting.js"></script>
  <script src="plugins/high-charts/export-data.js"></script>
  <script>
    $(document).ready(async function() {
      if (getCookie('usuario') == "") {
        window.location.href = `${BASE_URI}/login`;
        return;
      }

      let usuario = getCookie('usuario');
      let empresa = getCookie('empresa');

      ipInterno = IP_INTERNO;
      ipExterno = IP_EXTERNO;
      basicAuth = BASIC_AUTH;

      const temAcesso = await temAcessoTela('RELFINANCEIROCLASSEGER');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

      sArquivo = `${BASE_URI}/pages/relfinanceiroclasseger/relfinanceiroclasseger.js?versao=3.259.1.1`;
      const nomeTela = ('<?php echo basename(__FILE__) ?>').replace('.php', '');

      await insereJavaScriptPagina(sArquivo);

      habilitaCamposObrigatoriosTela(nomeTela);
    });
  </script>

</body>

</html>