<?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 | Baixa de Consumos</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.261.27.1">
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.261.27.1">

  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.261.27.1">
  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.261.27.1">
  <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="dist/css/custom.css?versao=3.261.27.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.261.27.1">
  <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.261.27.1" />
  <link rel="stylesheet" type="text/css" href="dist/css/sisplan.adjustDataTableButtons.css?versao=3.261.27.1" />
  <link rel="stylesheet" type="text/css" href="dist/css/sisplan.newColorsButtons.css?versao=3.261.27.1" />
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.261.27.1">
  <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.261.27.1" />
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.261.27.1">
  <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.261.27.1">
  <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.261.27.1">
  <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.261.27.1">
  <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.261.27.1">

  <style>
    #tabelaBaixas tbody tr td {
      padding-top: 0.425rem !important;
      padding-bottom: 0.425rem !important;
    }

    #tabelaBaixas thead th {
      position: sticky !important;
      top: 0 !important;
      z-index: 10 !important;
    }

    tbody .input-default {
      height: 1.5625rem !important;
    }

    .buttonExcel {
      margin-left: 0rem !important;
    }

    .fa-clipboard-check {
      font-size: 12.5pt;
    }
  </style>
</head>

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

    <div class="content-wrapper">
      <div class="content-header">
        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-sm-6 flex">
              <h1 class="m-0 text-dark">Baixa de Consumos</h1>
              <button class="btnTutorial" id="tutorial">
                <i class="fas fa-question-circle"></i>
              </button>
            </div>
          </div>
        </div>
        <div class="card col-12 mt-3 container-fluid">
          <div id="abaGeral">
            <form class="row card-body d-flex justify-content-start" style="padding-bottom: 5px !important;">
              <div class="col-lg-4 col-12 form-group">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtOF">Número OF: *</label>
                <div class="input-group">
                  <input type="text" class="input-default focus form-control" aria-describedby="produtoError" id="txtOF" name="txtOF" placeholder="Número OF">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnOF" name="btnOF" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaOF" name="btnLimpaOF" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>

              <div class="col-lg-4 col-12 form-group">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtParte">Parte:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtParte" name="txtParte" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnParte" name="btnParte" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaParte" name="btnLimpaParte" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>

              <div class="col-lg-4 col-12 form-group">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtAplicacao">Aplicação:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtAplicacao" name="txtAplicacao" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnAplicacao" name="btnAplicacao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaAplicacao" name="btnLimpaAplicacao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>

              <div class="col-lg-4 col-12 form-group">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtGrupo">Grupo:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtGrupo" name="txtGrupo" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnGrupo" name="btnGrupo" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaGrupo" name="btnLimpaGrupo" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>

              <div class="col-lg-4 col-12 form-group">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtSubGrupo">Subgrupo:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtSubGrupo" name="txtSubGrupo" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnSubGrupo" name="btnSubGrupo" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaSubGrupo" name="btnLimpaSubGrupo" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>

              <div class="col-lg-4 col-12 form-group">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtSetor">Setor:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtSetor" name="txtSetor" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnSetor" name="btnSetor" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaSetor" name="btnLimpaSetor" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>

              <div class="col-lg-4 col-12 form-group">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtDeposito">Depósito: *</label>
                <div class="input-group">
                  <input type="text" class="input-default focus form-control validate" id="txtDeposito" name="txtDeposito" placeholder="Depósito">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnDeposito" name="btnDeposito" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaDeposito" name="btnLimpaDeposito" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>

              <div class="col-lg-4 col-12 form-group">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtCliente">Cliente:</label>
                <div class="input-group">
                  <input type="text" class="input-default focus form-control" aria-describedby="produtoError" id="txtCliente" name="txtCliente" placeholder="Cliente">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnCliente" name="btnCliente" data-button="absolute" type="button" title="A consulta retornará somente clientes do tipo terceiro."><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaCliente" name="btnLimpaCliente" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>

              <div class="col-lg-4 col-12 form-group">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtTipoBaixa">Tipo Baixa:</label>
                <div class="input-group">
                  <input type="text" class="input-default focus form-control" aria-describedby="produtoError" id="txtTipoBaixa" name="txtTipoBaixa" placeholder="Tipo Baixa">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnTipoBaixa" name="btnTipoBaixa" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaTipoBaixa" name="btnLimpaTipoBaixa" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>

              <div class="col-lg-4 col-12 form-group">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtQualidade">Qualidade:</label>
                <div class="input-group">
                  <input type="text" class="input-default focus form-control" aria-describedby="produtoError" id="txtQualidade" name="txtQualidade" placeholder="Qualidade">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnQualidade" name="btnQualidade" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaQualidade" name="btnLimpaQualidade" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>

              <div class="col-lg-1 col-12 form-group">
                <label data-error="wrong" data-success="right" for="txtPrecoSped">Preço SPED:</label>
                <input type="text" class="input-default focus form-control" id="txtPrecoSped" style="text-align: right !important" aria-describedby="codError" name="txtPrecoSped" class="form-control" placeholder="0.00">
              </div>

              <div class="col-lg-1 col-12 form-group">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtMovimento">Movimento:</label>
                <input type="text" class="input-default focus form-control" aria-describedby="produtoError" id="txtMovimento" name="txtMovimento" placeholder="0">
              </div>
            </form>

            <div>
              <div class="row" style="margin: 3.125px 0px 0px 12.5px !important;">
                <div class="row col-12" id="divTabelaConsumos">
                  <h5 class="col-12">Consumos</h5>
                  <div class="col-lg-12 table-responsive" style="max-height: 360px">
                    <table id="tabelaConsumos" class="table table-sm-sisp table-select table-hover" style="white-space: nowrap;"  width="100%">
                      <thead>
                      </thead>
                      <tbody>
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>

              <div class="col-lg-12 col-12 form-group">
                <div class="d-flex col-5 align-items-end">
                  <div class="form-group col-4">
                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtBarra">Barra:</label>
                    <input type="text" class="input-default focus" aria-describedby="produtoError" id="txtBarra" name="txtBarra" placeholder="Barra">
                  </div>
                  <div class="form-group col-2">
                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtRetornoEstoque">Retorno Est.:</label>
                    <input type="text" class="input-default focus text-right apenasFloat" aria-describedby="produtoError" id="txtRetornoEstoque" name="txtRetornoEstoque" placeholder="0.0000">
                  </div>
                  <div class="d-block form-group">
                    <button class="btn btnVerde ml-1" style="padding: 6px!important;" id="btnConfirmarBarra" name="btnConfirmarBarra" data-button="absolute" type="button"><i class="fas fa-check"></i> Confirmar</button>
                  </div>
                </div>

                <div id="nav_estRes_baixas" class="col-sm-12 mt-3">
                  <nav class="col-lg-12" style="z-index:9999;">
                    <div class="nav nav-tabs d-flex flex-nowrap" id="nav-tab" role="tablist" style="text-decoration: none; max-width: none!important; white-space: nowrap!important; overflow-x: auto!important; overflow-y: hidden">
                      <a class="nav-link abaLink active" id="tabLotes" data-toggle="tab" href="" role="tab" aria-controls="divLotes" aria-selected="true">Estoque/Reserva</a>
                      <a class="nav-link abaLink" id="tabBaixas" data-toggle="tab" href="" role="tab" aria-controls="divBaixas" aria-selected="false">Baixas</a>
                    </div>
                  </nav>

                  <div class="tab-content col-lg-12 px-0 mt-4" id="nav-tabContent">

                    <div id="divLotes" class="tab-pane fade show active" role="tabpanel" aria-labelledby="tabLotes">
                      <div class="row col-12" id="divEstReserva" style="margin: 0px!important; padding: 0px!important; white-space: nowrap;">
                        <div class="col-lg-12 table-responsive" style="max-height: 500px;">
                          <table id="tabelaEstReserva" class="table table-sm-sisp table-select table-hover table-sele" width="100%">
                            <thead width="100%">
                            </thead>
                            <tbody>
                            </tbody>
                          </table>
                        </div>
                      </div>
                      <div id="divBotoesEstRes" class="d-flex col-12 px-0 mt-2 justify-content-end">
                        <button class="btn btnVerde btn-sisp d-none" id="btnGravar"><i class="fas fa-save"></i> Gravar</button>
                        <button class="btn btn-primary btn-sisp marginBtnH d-none" id="btnControleItens"><i class="fas fa-cogs"></i> Controle de Itens</button>
                        <button class="btn btn-danger btn-sisp marginBtnH d-none" id="btnFinalizar"><i class="fas fa-clipboard-check"></i> Finalizar</button>
                        <button class="btn btn-secondary btn-sisp marginBtnH mr-1 d-none" id="btnReabrir"><i class="fas fa-folder-open"></i> Reabrir</button>
                      </div>
                    </div>

                    <div id="divBaixas" class="tab-pane fade" role="tabpanel" aria-labelledby="tabBaixas">
                      <div class="row col-12" id="divBaixasContainer" style="margin: 0px!important; padding: 0px!important; white-space: nowrap;">
                        <div class="col-lg-12 table-responsive mt-4" style="max-height: 500px">
                          <table id="tabelaBaixas" class="table table-sm-sisp table-select table-hover" width="100%">
                            <thead width="100%">
                            </thead>
                            <tbody>
                            </tbody>
                          </table>
                        </div>
                      <div id="divBotoesBaixa" class="d-flex col-12 px-0 mt-2 justify-content-end">
                        <button class="btn btn-danger btn-sisp mr-1 d-none" id="btnEstornar"><i class="fas fa-undo-alt"></i> Estornar</button>
                      </div>
                    </div>

                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="modal fade pr-0" data-backdrop="static" id="modal-controle-itens">
      <div class="modal-dialog m-0 mt-3 d-flex justify-content-center" style="min-width: 100%; min-height: 100%">
        <div class="modal-content" style="height: 100vh!important; width: 89%!important">
          <div class="modal-header">
            <h4 class="modal-title">Controle de Itens</h4>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body p-1" id="modal-scroll">
              <div class="row col-lg-12 col-12 m-0 p-0 mt-2">
                
                <div class="form-group col-lg-4 col-12 d-none">
                  <label class="labelGeral" for="txtIdCI">Id:</label>
                  <div class="input-group" id="search-setor">
                    <input type="text" class="input-default focus form-control classCI" id="txtIdCI" aria-describedby="codError" name="txtIdCI" class="form-control" placeholder="Id">
                    <div class="input-group-append">
                      <button class="btn bg-danger classCI" id="btnIdCI" name="btnIdCI" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger classCI" id="btnLimpaIdCI" name="btnLimpaIdCI" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>

                <div class="form-group col-lg-4 col-12">
                  <label class="labelGeral" for="txtCodigoCI">Código:</label>
                  <div class="input-group" id="search-setor">
                    <input type="text" class="input-default focus form-control classCI" id="txtCodigoCI" aria-describedby="codError" name="txtCodigoCI" class="form-control" placeholder="Código">
                    <div class="input-group-append">
                      <button class="btn bg-danger classCI" id="btnCodigoCI" name="btnCodigoCI" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger classCI" id="btnLimpaCodigoCI" name="btnLimpaCodigoCI" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>

                <div class="form-group col-lg-4 col-12">
                  <label class="labelGeral" for="txtCorCI">Cor:</label>
                  <div class="input-group" id="search-setor">
                    <input type="text" class="input-default focus form-control classCI" id="txtCorCI" aria-describedby="codError" name="txtCorCI" class="form-control" placeholder="Cor">
                    <div class="input-group-append">
                      <button class="btn bg-danger classCI" id="btnCorCI" name="btnCorCI" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger classCI" id="btnLimpaCorCI" name="btnLimpaCorCI" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>

                <div class="form-group col-lg-4 col-12">
                  <label class="labelGeral" for="txtAplicacaoCI">Aplicação:</label>
                  <div class="input-group" id="search-setor">
                    <input type="text" class="input-default focus form-control classCI" id="txtAplicacaoCI" aria-describedby="codError" name="txtAplicacaoCI" class="form-control" placeholder="Aplicação">
                    <div class="input-group-append">
                      <button class="btn bg-danger classCI" id="btnAplicacaoCI" name="btnAplicacaoCI" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger classCI" id="btnLimpaAplicacaoCI" name="btnLimpaAplicacaoCI" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>

                <div class="form-group col-lg-4 col-12">
                  <label class="labelGeral" for="txtSetorCI">Setor:</label>
                  <div class="input-group" id="search-setor">
                    <input type="text" class="input-default focus form-control classCI" id="txtSetorCI" aria-describedby="codError" name="txtSetorCI" class="form-control" placeholder="Setor">
                    <div class="input-group-append">
                      <button class="btn bg-danger classCI" id="btnSetorCI" name="btnSetorCI" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger classCI" id="btnLimpaSetorCI" name="btnLimpaSetorCI" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>

                <div class="form-group col-lg-3 col-12">
                  <label class="labelGeral" for="txtParteCI">Parte:</label>
                  <div class="input-group" id="search-Parte">
                    <input type="text" class="input-default focus form-control classCI" id="txtParteCI" aria-describedby="codError" name="txtParteCI" class="form-control" placeholder="Parte">
                    <div class="input-group-append">
                      <button class="btn bg-danger classCI" id="btnParteCI" name="btnParteCI" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <button class="btn bg-danger classCI" id="btnLimpaParteCI" name="btnLimpaParteCI" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>
                </div>

                <div class="form-group col-lg-1 col-12">
                  <label class="labelGeral" for="txtUnidadeCI">Unidade:</label>
                  <input type="text" class="input-default focus form-control" disabled id="txtUnidadeCI" aria-describedby="codError" autocomplete="off" name="txtUnidadeCI" class="form-control" placeholder="UN">
                </div>

                <div class="form-group col-lg-1 col-12">
                  <label class="labelGeral" for="txtConsumoUniCI">Cons. Uni.:</label>
                  <input type="text" class="input-default focus form-control apenasFloat" disabled id="txtConsumoUniCI" aria-describedby="codError" name="txtConsumoUniCI" class="form-control" placeholder="0.0000">
                </div>

                <div class="form-group col-lg-1 col-12">
                  <label class="labelGeral" for="txtConsumoCI">Consumo:</label>
                  <input type="text" class="input-default focus form-control classCI apenasFloat" id="txtConsumoCI" aria-describedby="codError" name="txtConsumoCI" class="form-control" placeholder="0.0000">
                </div>

                <div class="form-group col-lg-1 col-12">
                  <label class="labelGeral" for="txtConsumoOrigCI">Cons. Orig.:</label>
                  <input type="text" class="input-default focus form-control" disabled id="txtConsumoOrigCI" aria-describedby="codError" name="txtConsumoOrigCI" class="form-control" placeholder="0.0000">
                </div>

                <div class="form-group col-lg-1 col-12">
                  <label class="labelGeral" for="txtBaixadoCI">Baixado:</label>
                  <input type="text" class="input-default focus form-control" disabled id="txtBaixadoCI" aria-describedby="codError" name="txtBaixadoCI" class="form-control" placeholder="0.0000">
                </div>

              </div>

              <div class="col-lg-12 col-12 d-flex align-items-center mt-2 pt-1" style="z-index: 9999!important;">
                <button class="btn btnVerde btn-sisp" id="btnIncluirCI" title="Clique para incluir um novo item"><i class="fas fa-plus"></i> Incluir</button>
                <button class="btn btn-primary btn-sisp ml-1" id="btnAlterarCI" title="Clique para alterar um item"><i class="fas fa-pencil-alt"></i> Alterar</button>
                <button class="btn btn-danger btn-sisp ml-1" id="btnExcluirCI" title="Clique para excluir um item"><i class="fas fa-trash"></i> Excluir</button>
                <button class="btn btnVerde btn-sisp d-none" id="btnConfirmarCI" title="Clique para confirmar uma inclusão/alteração"><i class="fas fa-check"></i> Confirmar</button>
                <button class="btn btn-danger btn-sisp ml-1 d-none" id="btnDesistirCI" title="Clique para desistir de uma inclusão/alteração"><i class="fas fa-times"></i> Desistir</button>
              </div>

              <div class="row col-12" style="margin: 1rem 0px 0px 0px !important; padding: 0px!important; white-space: nowrap; height: 20rem;">
                <div class="col-lg-12 table-responsive" id="tabControleItens">
                  <table id="tabelaControleItens" class="table table-sm-sisp table-select table-hover" width="100%">
                    <thead>
                    </thead>
                    <tbody>
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
            <div class="modal-footer">
              <button class="btn btn-danger btn-sisp" id="btnFecharCI" title="Clique para gravar os dados">Fechar</button>
            </div>
          </div>
        </div>
      </div>

    <?php
    include_once('../../modais.php');
    ?>
    <aside class="control-sidebar control-sidebar-dark">
    </aside>
    <?php include_once('../../modais.php'); ?>
  </main>

  <script src="plugins/jquery/jquery.min.js?versao=3.261.27.1"></script>
  <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.261.27.1"></script>
  <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.261.27.1"></script>
  <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.261.27.1"></script>
  <script src="plugins/sweetalert2/sweetalert2.min.js?versao=3.261.27.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.261.27.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.261.27.1"></script>
  <script src="dist/js/adminlte.min.js?versao=3.261.27.1"></script>
  <script src="dist/js/requisicoes.js?versao=3.261.27.1"></script>
  <script src="dist/js/cliente/entidade.js?versao=3.261.27.1"></script>
  <script src="dist/js/loadingoverlay.min.js?versao=3.261.27.1"></script>
  <script src="dist/js/valida_cpf_cnpj.js?versao=3.261.27.1"></script>
  <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.261.27.1"></script>
  <script src="dist/js/sisplan.js?versao=3.261.27.1"></script>
  <script src="utils/funcoes.js?versao=3.261.27.1"></script>
  <script src="utils/cookies.js?versao=3.261.27.1"></script>
  <script src="dist/js/jquery.maskMoney.min.js?versao=3.261.27.1"></script>
  <script src="dist/js/driver.min.js?versao=3.261.27.1"></script>
  <script src="dist/js/dataTables.keyTable2.js?versao=3.261.27.1"></script>
  <script type="text/javascript" src="config.js?versao=3.261.27.1"></script>
  <script src="plugins/select2/js/select2.full.min.js?versao=3.261.27.1"></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('BAIXA_CONSUMOS');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

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

      await insereJavaScriptPagina(sArquivo);

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

</html>