<?php include_once('../../config.php') ?>

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Sisplan Web | Retorno Escritural</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.264.8.1">
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.264.8.1">
  <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.264.8.1" />
  <link href='dist/css/bootstrap.min.css?versao=3.264.8.1'>
  <link rel="stylesheet" href="dist/css/custom.css?versao=3.264.8.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.264.8.1">
  <link rel="stylesheet" type="text/css" href="plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.264.8.1">
  <link rel="stylesheet" type="text/css" href="dist/css/responsive.bootstrap.min.css?versao=3.264.8.1">
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="dist/css/cadastro.css?versao=3.264.8.1">
  <!-- Toastr -->
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.264.8.1">
  <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.264.8.1" />
  <link rel="stylesheet" href="<?php echo BASE_URI; ?>/plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.264.8.1">
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.264.8.1">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  <style>
    #progressbar li {
      list-style-type: none;
      font-size: 12px;
      width: 50%;
      float: left;
      position: relative
    }

    .border-Field .textoBorda {
      font-size: 1.1em !important;
      text-align: left !important;
      width: auto;
      padding: 0 10px;
      border-bottom: none;
    }

    .border-Field {
      border: 1px solid var(--font-color) !important;
      padding: 0 1.0em 0 1.0em !important;
      margin: 0 0 0 0 !important;
      -webkit-box-shadow: 0px 0px 0px 0px #000;
      box-shadow: 0px 0px 0px 0px #000;
    }

    .square {
      height: 25px;
      width: 25px;
    }

    .square-container {
      display: flex;
      align-items: center;
      white-space: nowrap;
    }

    .square-label {
      padding-left: 2%;
      padding-top: 4%;
    }

    #tabelaRetorno thead th {
      background-color: #343a40;
      color: white;
      position: sticky;
      top: 0;
      z-index: 99999 !important;
    }

    #tabelaRetorno tbody,
    #tabelaRetorno thead {
      white-space: nowrap !important;
      text-overflow: ellipsis !important;
      overflow: hidden !important;
    }

    #tabelaSelDupli tbody,
    #tabelaSelDupli thead {
      white-space: nowrap !important;
      text-overflow: ellipsis !important;
      overflow: hidden !important;
    }

    #btnCheckSaldo {
      background-color: var(--buttonCheckMedidas);
      border: 0px;
      margin-left: 4px;
    }

    .totais {
      width: 12%;
      margin-right: 0.5%;
    }

    #msform .action-button-additional {
      background-color: #3CA2D3;
      font-weight: bold;
      color: white;
      border: 0 none;
      border-radius: 0px;
      cursor: pointer;
      padding: 10px 10px;
      margin: 10px 7px 10px 5px;
      float: right;
    }
  </style>
</head>

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

    <div id="myModal" class="modal" tabindex="-1" role="dialog">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <h5 id="myModalLabel" class="modal-title"></h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body">
            <p id="myModalText"></p>
          </div>
          <div class="modal-footer">
            <button id="btnYes" type="button" class="btn btn-primary">Sim</button>
            <button id="btnNo" type="button" class="btn btn-secondary" data-dismiss="modal">Não</button>
          </div>
        </div>
      </div>
    </div>
    <div class="content-wrapper">
      <section class="content">
        <div class="content-header">
          <div class="container-fluid">
            <div class="row mb-2">
              <div class="col-sm-6 flex">
              </div>
              <div class="col-sm-6">

              </div><!-- /.col -->
            </div><!-- /.row -->
          </div>
          <div class="row justify-content-center mt-0">
            <div class="col-10 text-center p-0 mt-3 mb-2">
              <div class="card px-0 pt-4 pb-0 mt-3 mb-3">
                <div class="card-header text-center flex" style="border: none!important;box-shadow:none!important;">
                  <h2>Retorno Escritural
                    <button type="button" class="btn btn-info btn-sm ml-2" title="Tutorial" style="color: white;" id="tutorial">
                      <i class="fas fa-question-circle"></i>
                    </button>
                  </h2>
                </div>
                <div class="row">
                  <div class="col-md-12 mx-0">
                    <form id="msform">
                      <!-- progressbar -->
                      <ul id="progressbar">
                        <li class="active" id="account" style="font-size: 100%;"><strong>Geral</strong></li>
                        <li id="confirm" style="font-size: 100%;"><strong>Baixas</strong></li>
                      </ul> <!-- fieldsets -->
                      <fieldset class="abas" id="fieldset1">
                        <p>Preencha os dados e clique em avançar para realizar a consulta</p>
                        <div class="form-card" id="formcard1" style="height: 500px;">
                          <h2 class="fs-title">Dados Gerais</h2>
                          <div class="form-row col-lg-8 col-md-12 col-sm-12">
                            <div class="form-group col-lg-6 col-md-12">
                              <label for="txtBanco">Banco:</label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control validate" id="txtBanco" name="txtBanco" placeholder="Banco">
                                <div class="input-group-append">
                                  <button class="btn bg-danger create" id="btnBanco" name="btnBanco" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger create" id="btnLimpaBanco" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-6 col-md-12">
                              <label for="txtCarteira">Carteira:</label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control validate" id="txtCarteira" name="txtCarteira" placeholder="Carteira">
                                <div class="input-group-append">
                                  <button class="btn bg-danger create" id="btnCarteira" name="btnCarteira" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger create" id="btnLimpaCarteira" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-6 col-md-12">
                              <label for="txtClasseBaixa">Classe - Baixa:</label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control validate" id="txtClasseBaixa" name="txtClasseBaixa" placeholder="Classe">
                                <div class="input-group-append">
                                  <button class="btn bg-danger create" id="btnClasseBaixa" name="btnClasseBaixa" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger create" id="btnLimpaClasseBaixa" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-6 col-md-12">
                              <label for="txtClasseJuros">Classe - Juros:</label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control validate" id="txtClasseJuros" name="txtClasseJuros" placeholder="Classe">
                                <div class="input-group-append">
                                  <button class="btn bg-danger create" id="btnClasseJuros" name="btnClasseJuros" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger create" id="btnLimpaClasseJuros" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-6 col-md-12">
                              <label for="txtClasseDesconto">Classe - Desconto:</label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control validate" id="txtClasseDesconto" name="txtClasseDesconto" placeholder="Classe">
                                <div class="input-group-append">
                                  <button class="btn bg-danger create" id="btnClasseDesconto" name="btnClasseDesconto" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger create" id="btnLimpaClasseDesconto" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-6 col-md-12">
                              <label for="txtHistorico">Histórico:</label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control validate" id="txtHistorico" name="txtHistorico" placeholder="Histórico">
                                <div class="input-group-append">
                                  <button class="btn bg-danger create" id="btnHistorico" name="btnHistorico" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger create" id="btnLimpaHistorico" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-6 col-md-12">
                              <label for="txtConta">Conta:</label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control validate" id="txtConta" name="txtConta" placeholder="Conta">
                                <div class="input-group-append">
                                  <button class="btn bg-danger create" id="btnConta" name="btnConta" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger create" id="btnLimpaConta" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-md-12">
                              <label for="txtJuros">Juros a partir de:</label>
                              <input type="number" class="input-default focus form-control validate" id="txtJuros" name="txtJuros" placeholder="0.00">
                            </div>
                            <div class="form-group col-lg-3 col-md-12">
                              <label for="txtContabilizacao">Contabilização:</label>
                              <input type="date" class="input-default focus form-control validate" id="txtContabilizacao" name="txtContabilizacao" placeholder="Contabilização">
                            </div>
                            <div class="form-row col-lg-12 col-md-12">
                              <div class="form-group col-10">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtArquivo">Arquivo:</label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control" id="txtArquivo" name="txtArquivo" placeholder="Arquivo" disabled>
                                  <input type="file" id="mdModalUpload" class="d-none">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnArquivo" name="btnArquivo" type="file" for="txtArquivo"><i class="m-0 p-0 fas fa-folder-plus"></i> </button>
                                  </div>
                                </div>
                              </div>
                              <div class="form-group col-2 pt-4 mt-3 pl-4">
                                <label for="cbForcar"><input type="checkbox" id="cbForcar"> Forçar</label>
                              </div>
                              <div class="form-group col-12 d-none">
                                <pre id="fileContent"></pre>
                              </div>
                            </div>
                            <div class="form-group col-lg-8 col-md-12">
                              <label for="txtCaminhoLido">Caminho Arquivo Lido:</label>
                              <input type="text" class="input-default focus form-control validate" id="txtCaminhoLido" name="txtCaminhoLido" placeholder="Caminho">
                            </div>
                            <div class="form-group col-lg-4 col-md-12">
                              <label for="txtInstrucao">Buscar Informações:</label>
                              <select class="drilldown-item form-control select2 select2-danger focus" style="border-color: #a9a9a9" data-dropdown-css-class="select2-danger" name="txtInstrucao" id="txtInstrucao">
                                <option value="D" selected>Duplicata</option>
                                <option value="N">Nr. Banco</option>
                              </select>
                            </div>
                          </div>
                          <div class="form-group col-lg-4 col-md-12 col-sm-12">
                            <div class="col-sm-12 col-md-12 col-lg-12 form-group pl-0">
                              <label data-error="wrong" data-success="right" for="txtDtPagtoDe">Data de Pagamento (de/até): </label>
                              <div class="input-group">
                                <input type="date" max="2500-12-31" class="input-default focus form-control" id="txtDtPagtoDe" name="txtDtPagtoDe">
                                <input type="date" max="2500-12-31" class="input-default focus form-control" id="txtDtPagtoAte" name="txtDtPagtoAte">
                              </div>
                            </div>
                          </div>
                          <div class="form-group col-lg-4 col-md-12 col-sm-12">
                            <div class="col-12" id="tutOpcoes">
                              <fieldset class="form border-Field mb-2 pb-0">
                                <legend class="textoBorda mb-0 pb-0">Opções</legend>
                                <div id="tipoDep" class="row">
                                  <div class="pl-2">
                                    <label for="cbTodasEmpresas"><input type="checkbox" id="cbTodasEmpresas"> Todas empresas</label> <br>
                                    <label for="cbValidarCampos"><input type="checkbox" id="cbValidarCampos"> Validar campos</label> <br>
                                    <label for="cbSomarTarifa"><input type="checkbox" id="cbSomarTarifa"> Somar tarifa no valor pago</label> <br>
                                    <label for="cbCarteiraRegistro"><input type="checkbox" id="cbCarteiraRegistro"> Carteira tem registro</label> <br>
                                    <label for="cbLancarValorCC"><input type="checkbox" id="cbLancarValorCC"> Lançar valor de tarifa no CC</label> <br>
                                    <!-- <label for="cbMsgCC"><input type="checkbox" id="cbMsgCC"> Mensagem conta corrente</label> <br> -->
                                    <label for="cbPossuiIntegracao"><input type="checkbox" id="cbPossuiIntegracao"> Possui integração</label> <br>
                                    <label for="cbUsarClasse"><input type="checkbox" id="cbUsarClasse"> Usar classe gerencial da capa</label> <br>
                                  </div>
                                </div>
                              </fieldset>
                            </div>
                          </div>
                        </div>
                        <input type="button" name="verBaixas" id="verBaixas" class="btn-sisp next action-button" style="background-color: #3ca2d3" value="Ver Baixas" />
                        <!-- <button type="button" name="voltar1" id="voltar1" style="font-size:15px;" class="btn-sisp action-button-previous" data-dismiss="modal">Voltar</button> -->
                      </fieldset>
                      <fieldset class="abas" id="fieldset2">
                        <div class="form-card mx-4" style="width: 96%!important">
                          <fieldset class="form border-Field">
                            <legend class="textoBorda mb-0 pb-0">Duplicatas</legend>
                            <!-- <h2 class="fs-title">Resultados</h2> -->
                            <div class="form-row col-lg-12 col-md-12 col-sm-12 d-flex justify-content-around mb-2">
                              <div class="square-container">
                                <div id="quadDuplDesconto" class="square" style="background-color: #EFF46C"></div>
                                <label for="quadDuplDesconto" class="square-label">Com desconto</label>
                              </div>
                              <div class="square-container">
                                <div id="quadDuplRejeitadas" class="square" style="background-color: #F46262"></div>
                                <label for="quadDuplRejeitadas" class="square-label">Rejeitadas</label>
                              </div>
                              <div class="square-container">
                                <div id="quadDuplCanceladas" class="square" style="background-color: #3C67B0"></div>
                                <label for="quadDuplCanceladas" class="square-label">Canceladas</label>
                              </div>
                              <div class="square-container">
                                <div id="quadDuplDiferenca" class="square" style="background-color: #90ee90"></div>
                                <label for="quadDuplDiferenca" class="square-label">Diferença de valor</label>
                              </div>
                              <div class="square-container">
                                <div id="quadDuplDesAgr" class="square" style="background-color: #8C8C8C"></div>
                                <label for="quadDuplDesAgr" class="square-label">Desdobradas/Agrupadas</label>
                              </div>
                              <div class="square-container pl-4">
                                <div id="quadDuplRegDuplicado" class="square" style="background-color: #63bec8"></div>
                                <label for="quadDuplRegDuplicado" class="square-label">Registro duplicado</label>
                              </div>
                            </div>
                          </fieldset>
                        </div>
                        <div class="col-sm-12 table-responsive card-body" id="tabelaRetornoContainer" style="max-height: 527px; overflow-y: auto; padding-top: 0px">
                          <table id="tabelaRetorno" class="table table-sm table-select table-hover" width="100%">
                            <thead>
                              <tr>
                              </tr>
                            </thead>
                            <tbody>
                            </tbody>
                          </table>
                        </div>
                        <div class="col-sm-12 d-flex pl-3">
                          <input type="button" name="alterarConta" class="action-button-additional mr-auto" value="Alterar Conta Corrente" id="alterarConta">
                        </div>
                        <div class="col-sm-12 d-flex justify-content-between mt-2">
                          <div class="form-row col-12">
                            <div class="form-group totais text-left" style="margin-left: 0.5%">
                              <label for="txtRegArq">Registros do Arquivo:</label>
                              <input type="text" class="input-default focus form-control validate" id="txtRegArq" name="txtRegArq" placeholder="0" disabled>
                            </div>
                            <div class="form-group totais text-left">
                              <label for="txtRegImp">Registros Importados:</label>
                              <input type="text" class="input-default focus form-control validate" id="txtRegImp" name="txtRegImp" placeholder="0" disabled>
                            </div>
                            <div class="form-group totais text-left">
                              <label for="txtTotVal">Valor Total:</label>
                              <input type="text" class="input-default focus form-control validate text-right" id="txtTotVal" name="txtTotVal" placeholder="0" disabled>
                            </div>
                            <div class="form-group totais text-left">
                              <label for="txtTotPag">Valor Pago:</label>
                              <input type="text" class="input-default focus form-control validate text-right" id="txtTotPag" name="txtTotPag" placeholder="0" disabled>
                            </div>
                            <div class="form-group totais text-left">
                              <label for="txtTotSal">Saldo:</label>
                              <input type="text" class="input-default focus form-control validate text-right" id="txtTotSal" name="txtTotSal" placeholder="0" disabled>
                            </div>
                            <div class="form-group totais text-left">
                              <label for="txtTotJur">Juros:</label>
                              <input type="text" class="input-default focus form-control validate text-right" id="txtTotJur" name="txtTotJur" placeholder="0" disabled>
                            </div>
                            <div class="form-group totais text-left">
                              <label for="txtTotDes">Desconto:</label>
                              <input type="text" class="input-default focus form-control validate text-right" id="txtTotDes" name="txtTotDes" placeholder="0" disabled>
                            </div>
                            <div class="form-group text-left" style="width: 12%">
                              <label for="txtTotAcr">Acréscimo:</label>
                              <input type="text" class="input-default focus form-control validate text-right" id="txtTotAcr" name="txtTotAcr" placeholder="0" disabled>
                            </div>
                          </div>
                        </div>
                        <input type="button" name="gravar" class="action-button" value="Confirmar" id="btnConfirmar">
                        <input type="button" name="voltar2" class="previous action-button-previous" value="Voltar" id="voltar2" />
                        <input type="button" name="limparDados" class="action-button-additional" value="Limpar Dados" id="limparDados">
                        <input type="button" name="imprimirDados" class="action-button-additional" value="Imprimir" id="imprimirDados">
                      </fieldset>
                    </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>
    </div>
  </div>


  <div id="modalSelDupli" 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">Seleção de Duplicatas
          </h4>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body pb-0">
          <div class="form-row">
            <div class="col-sm-12 table-responsive card-body">
              <table id="tabelaSelDupli" class="table table-sm table-select table-hover" width="100%">
                <thead>
                  <tr>
                    <th class="th-sm">Número</th>
                    <th class="th-sm">Codcli</th>
                    <th class="th-sm">Nome</th>
                    <th class="th-sm">Nr. Banco</th>
                    <th class="th-sm">Valor Pago</th>
                    <th class="th-sm">Saldo</th>
                    <th class="th-sm">Juros</th>
                    <th class="th-sm">Saldo (sem juros)</th>
                    <th class="th-sm">Data Vencimento</th>
                    <th class="th-sm">Fatura</th>
                    <th class="th-sm">Empresa</th>
                  </tr>
                </thead>
                <tbody>
                </tbody>
              </table>
            </div>
          </div>
          <div class="modal-footer ml-0 pl-0">
            <div class="col-12 d-flex justify-content-between ml-0 pl-0">
              <div class="col-2 d-flex jusitify-content-left ml-0 pl-0">
                <button class="btn btn-primary btn-sisp" id="btnConfirmarSelDupli"> Confirmar</button>
              </div>
              <div class="col-2 d-flex justify-content-left">
                <input type="text" class="input-default focus form-control validate" id="txtSaldoSelDupli" name="txtSaldoSelDupli" placeholder="Saldo">
                <button id="btnCheckSaldo">
                  <i class="fas fa-check ml-1" style="color: red; font-size: 1.2em"></i>
                </button>
              </div>
              <div class="col-8 d-flex justify-content-end">
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div id="modalAlterarConta" class="modal" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-lg" role="document">
      <div class="modal-content" id="modalBody">
        <div class="modal-header">
          <h4 class="modal-title">Alterar Conta Corrente
          </h4>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body pb-0">
          <div class="form-group col-12">
            <label for="txtContaAlterarConta">Conta:</label>
            <div class="input-group">
              <input type="text" class="input-default focus form-control validate" id="txtContaAlterarConta" name="txtContaAlterarConta" placeholder="Conta">
              <div class="input-group-append">
                <button class="btn bg-danger create" id="btnContaAlterarConta" name="btnContaAlterarConta" type="button">
                  <i class="m-0 p-0 fas fa-search"></i>
                </button>
                <button class="btn bg-danger create" id="btnLimpaContaAlterarConta" type="button">
                  <i class="m-0 p-0 fas fa-trash"></i>
                </button>
              </div>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <div class="form-group col-12 pl-3 d-flex justify-content-between">
            <button class="btn btn-primary btn-sisp" id="btnConfirmarAlterarConta"> Confirmar</button>
            <button class="btn btn-danger btn-sisp" id="btnFecharAlterarConta"> Fechar</button>
          </div>
        </div>
      </div>
    </div>
  </div>

  <?php
  include_once('../../modais.php');
  ?>

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->
  </div>

  <!-- jQuery -->
  <script src="plugins/jquery/jquery.min.js?versao=3.264.8.1"></script>
  <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.264.8.1"></script>
  <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.264.8.1"></script>
  <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.264.8.1"></script>
  <!-- SweetAlert2 -->
  <script src="plugins/sweetalert2/sweetalert2.min.js?versao=3.264.8.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.264.8.1"></script>

  <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>

  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.264.8.1"></script>
  <script src="dist/js/adminlte.min.js?versao=3.264.8.1"></script>
  <script src="dist/js/requisicoes.js?versao=3.264.8.1"></script>
  <script src="dist/js/cliente/entidade.js?versao=3.264.8.1"></script>
  <script src="dist/js/loadingoverlay.min.js?versao=3.264.8.1"></script>
  <script src="dist/js/valida_cpf_cnpj.js?versao=3.264.8.1"></script>
  <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.264.8.1"></script>
  <script src="dist/js/sisplan.js?versao=3.264.8.1"></script>
  <script src="utils/funcoes.js?versao=3.264.8.1"></script>
  <script src="utils/cookies.js?versao=3.264.8.1"></script>
  <script src="dist/js/driver.min.js?versao=3.264.8.1"></script>
  <script src="dist/js/jquery.maskMoney.min.js?versao=3.264.8.1"></script>
  <script src="dist/js/jquery.mask.min.js?versao=3.264.8.1"></script>
  <script src="dist/js/dataTables.keyTable2.js?versao=3.264.8.1"></script>
  <script type="text/javascript" src="config.js?versao=3.264.8.1"></script>
  <script>
    $(document).ready(async function() {
      if (getCookie('usuario') == "") {
        window.location.href = `${BASE_URI}/login`;
        return;
      }

      $('#txtContabilizacao').val(formataData(new Date()));

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

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

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

      const permissaoUsuarioLogado = await permissaoAcessos("ESCRETORNO");

      if (permissaoUsuarioLogado.INCLUI == 'N') {
        await criaMensagemErro("Sem permissão!", () => {
          parent.document.querySelector('#listaAbas > .active > a').click();
        });
        return;
      }

      $(window).on("beforeunload", function(e) {
        // e.preventDefault();
        e.stopPropagation();
        return undefined;
      });

      sArquivo = `${BASE_URI}/pages/escretorno/escretorno.js?versao=3.264.8.1`;
      insereJavaScriptPagina(sArquivo);

      const nomeTela = ('<?php echo basename(__FILE__) ?>').replace('.php', '');
      habilitaCamposObrigatoriosTela(nomeTela);
    });
  </script>
</body>

</html>