<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Sisplan Web | Relatório de Terceiros</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.2512.4.1">

    <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.2512.4.1">
    <link rel="stylesheet" href="dist/css/custom.css?versao=3.2512.4.1">
    <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.2512.4.1">
    <link rel="stylesheet" href="dist/css/sisplan.adjustDataTableButtons.css?versao=3.2512.4.1">
    <link rel="stylesheet" href="dist/css/sisplan.newColorsButtons.css?versao=3.2512.4.1">
    <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.2512.4.1">
    <link rel="stylesheet" type="text/css" href="plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.2512.4.1">
    <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.2512.4.1">
    <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.2512.4.1">
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.2512.4.1">
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.2512.4.1" />
    <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.2512.4.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="plugins/select2/css/select2.min.css?versao=3.2512.4.1">
    <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.2512.4.1">
    <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.2512.4.1">
    <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.2512.4.1" />

    <style>
        #nav-tab a:hover,
        #nav-tab a {
            color: var(--font-color);
        }

        .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 .5em 1.0em !important;
            margin: 0 0 1.0em 0 !important;
            -webkit-box-shadow: 0px 0px 0px 0px #000;
            box-shadow: 0px 0px 0px 0px #000;
        }

        .col-md-1,
        .col-md-10,
        .col-md-11,
        .col-md-12,
        .col-md-2,
        .col-md-3,
        .col-md-4,
        .col-md-5,
        .col-md-6,
        .col-md-7,
        .col-md-8,
        .col-md-9 {
            padding-right: 7.5px;
            padding-left: 7.5px;
        }

        .borda {
            padding: 10px;
            border: solid #e0e4e6;
            border-radius: 4px;
            border-width: 2px;
        }

        #tabelaFaccaoRelFaccao_wrapper .table.dataTable tbody td {
            white-space: nowrap;
            overflow: hidden;
        }

        #tabelaConsumosRelFaccao_wrapper .table.dataTable tbody td {
            white-space: nowrap;
            overflow: hidden;
        }

        .card {
            box-shadow: none !important;
            border-radius: 0 !important;
            margin-bottom: 0 !important;
        }

        .card-header {
            box-shadow: 0px 1px rgb(0 0 0 / 20%) !important;
        }

        .card-header>a {
            color: black !important;
        }

        .card.card-header {
            border-bottom: 1px dashed #ddd;
            box-shadow: none !important;
        }

        .card-body {
            padding-left: 1.25rem !important;
            padding-top: 0px;
            padding-bottom: 0px;
            padding-right: 1.25rem !important;
        }

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

        .pd0 {
            padding: 0px !important;
        }

        .fa-angle-right,
        .fa-angle-down {
            color: #343a40
        }

        .dataTables_length {
            margin-left: 0.1875rem !important;
        }
    </style>

</head>

<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 flex">
                            <h1 class="m-0 text-dark">Relatório de Terceiros</h1>
                            <button class="btnTutorial" id="btnTutorial">
                                <i class="fas fa-question-circle"></i>
                            </button>
                        </div>
                    </div>
                </div>
                <div class="container-fluid card">
                    <div class="form-row borda" id="lotes">
                        <div class="col-12">

                            <div class="form-row">

                                <div class="col-lg-4 col-sm-6 col-12">
                                    <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelNumeroRelFaccao" for="txtNumeroRelFaccao">Número*: </label>
                                    <div class="relative" style="margin-top: 5px;">
                                        <div class="input-group">
                                            <input type="text" class="input-default focus form-control" id="txtOrdemProducaoRelFaccao" placeholder="Número">
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnOrdemProducaoRelFaccao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaOrdemProducaoRelFaccao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-sm-6 col-12 form-group">
                                    <div class="">
                                        <label for="labelDataSaidaRelFaccao">Data Saída:</label>
                                        <div class="relative">
                                            <input type="date" max="2500-12-31" class="input-default focus form-control validate" id="txtDataSaidaRelFaccao">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-sm-6 col-12">
                                    <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelMovimentoRelFaccao" for="txtMovimentoRelFaccao">Movimento: </label>
                                    <div class="relative" style="margin-top: 5px;">
                                        <div class="input-group">
                                            <select class="js-example-programmatic js-states form-control" id="txtMovimentoRelFaccao" multiple="multiple" disabled>
                                            </select>
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnMovimentoRelFaccao" data-button="absolute" type="button" disabled><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaMovimentoRelFaccao" type="button" disabled><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-sm-6 col-12">
                                    <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelSetorRelFaccao" for="txtSetorRelFaccao">Setor*: </label>
                                    <div class="relative" style="margin-top: 5px;">
                                        <div class="input-group">
                                            <input type="text" class="input-default focus form-control" id="txtSetorRelFaccao" placeholder="Setor">
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnSetorRelFaccao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaSetorRelFaccao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-sm-6 col-12">
                                    <label data-error="wrong" data-success="right" for="labelParteRelFaccao">Parte:</label>
                                    <select style="width:100%;" class="form-control select2 select2-danger focus" data-dropdown-css-class="select2-danger" id="txtParteRelFaccao" aria-invalid="false">
                                        <option value="">Selecione uma opção</option>
                                    </select>
                                </div>

                            </div>
                            <div class="form-row">

                                <div class="col-lg-3 col-sm-6 col-12">
                                    <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelFaccaoRelFaccao" for="txtFaccaoRelFaccao">Facção: </label>
                                    <div class="relative" style="margin-top: 5px;">
                                        <div class="input-group">
                                            <input type="text" class="input-default focus form-control" id="txtFaccaoRelFaccao" placeholder="Facção">
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnFaccaoRelFaccao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaFaccaoRelFaccao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-lg-1 col-sm-6 col-12">
                                    <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelPrecoInvisivelRelFaccao" for="txtPrecoCertoRelFaccao">Preço Fac: </label>
                                    <div class="relative" style="margin-top: 5px;">
                                        <div class="input-group">
                                            <input type="text" class="input-default focus form-control" id="txtPrecoCertoRelFaccao" placeholder="Preço Fac" disabled>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-1 col-sm-6 col-12">
                                    <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelPrecoRelFaccao" for="txtPrecoRelFaccao">Preço: </label>
                                    <div class="relative" style="margin-top: 5px;">
                                        <div class="input-group">
                                            <input type="text" class="input-default focus form-control" id="txtPrecoRelFaccao" placeholder="Preço">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-3 col-sm-6 col-12">
                                    <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelCorRelFaccao" for="txtCorRelFaccao">Cor: </label>
                                    <div class="relative" style="margin-top: 5px;">
                                        <div class="input-group">
                                            <select class="js-example-programmatic js-states form-control" id="txtCorRelFaccao" multiple="multiple">
                                            </select>
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnCorRelFaccao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaCorRelFaccao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-1 col-sm-6 col-12">
                                    <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelPesoRelFaccao" for="txtPesoRelFaccao">Peso: </label>
                                    <div class="relative" style="margin-top: 5px;">
                                        <div class="input-group">
                                            <input type="text" class="input-default focus form-control" id="txtPesoRelFaccao" placeholder="Peso">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-3 col-sm-6 col-12">
                                    <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelLancamentoRelFaccao" for="txtLancamentoRelFaccao">Lançamento: </label>
                                    <div class="relative" style="margin-top: 5px;">
                                        <div class="input-group">
                                            <input type="text" class="input-default focus form-control" id="txtLancamentoRelFaccao" placeholder="Lançamento">
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnLancamentoRelFaccao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaLancamentoRelFaccao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>
                            <div class="form-row mt-0 mt-sm-3">

                                <div class="col-12 d-flex">

                                    <div class="col-lg-6 col-sm-6 col-12" style="padding-left: 0px;">
                                        <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelObservacaoRelFaccao" for="txtObservacaoRelFaccao">Observação: </label>
                                        <div class="relative" style="margin-top: 5px;">
                                            <div class="input-group">
                                                <textarea id="txtObservacaoRelFaccao" style="resize: none; height: 87.5px" class="autoExpand forumPost form-control" rows="2"></textarea>
                                            </div>
                                        </div>
                                    </div>

                                    <fieldset class="form border-Field p-0 d-sm-flex d-block col-sm-6 col-lg-6">
                                        <legend class="textoBorda pb-0 mb-0"><strong>Filtros Consumos</strong></legend>
                                        <!-- <div class="form-row ml-1 mt-1"> -->
                                        <div class="col-12 col-sm-4 form-group mt-lg-2">
                                            <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelLancamentoRelFaccao" for="txtSetorConsumosRelFaccao">Setor: </label>
                                            <div class="relative" id="divSetorConsumosRelFaccao">
                                                <div class="input-group">
                                                    <select class="js-example-programmatic js-states form-control" id="txtSetorConsumosRelFaccao" multiple="multiple"></select>
                                                    <div class="input-group-append">
                                                        <button class="btn bg-danger" id="btnSetorConsumosRelFaccao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                        <button class="btn bg-danger" id="btnLimpaSetorConsumosRelFaccao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-12 col-sm-4 form-group mt-3 mt-lg-2">
                                            <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelLancamentoRelFaccao" for="txtParteConsumosRelFaccao">Parte: </label>
                                            <div class="relative" id="divParteConsumosRelFaccao">
                                                <div class="input-group">
                                                    <select class="js-example-programmatic js-states form-control" id="txtParteConsumosRelFaccao" multiple="multiple"></select>
                                                    <div class="input-group-append">
                                                        <button class="btn bg-danger" id="btnParteConsumosRelFaccao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                        <button class="btn bg-danger" id="btnLimpaParteConsumosRelFaccao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-12 col-sm-4 form-group mt-3 mt-lg-2">
                                            <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" id="labelLancamentoRelFaccao" for="divAplicacaoConsumosRelFaccao">Aplicação: </label>
                                            <div class="relative" id="divAplicacaoConsumosRelFaccao">
                                                <div class="input-group">
                                                    <select class="js-example-programmatic js-states form-control" id="txtAplicacaoConsumosRelFaccao" multiple="multiple"></select>
                                                    <div class="input-group-append">
                                                        <button class="btn bg-danger" id="btnAplicacaoConsumosRelFaccao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                        <button class="btn bg-danger" id="btnLimpaAplicacaoConsumosRelFaccao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </fieldset>
                                </div>
                                <div class="col-12 text-center text-xl-right mb-2" id="botaoConsultaLimpa">
                                    <button type="button" class="btn btn-primary btn-sisp" id="btnConsultarRelFaccao" style="margin-top: 10px;"><i class="fas fa-search"></i> Consultar</button>
                                    <button type="button" class="btn btn-secondary btn-sisp marginBtnH" id="btnImprimirRelFaccao" style="margin-top: 10px;"><i class="fas fa-print"></i> Imprimir</button>
                                    <button type="button" class="btn btnVerde btn-sisp marginBtnH" id="btnGravarPrecoRelFaccao" style="margin-top: 10px;"><i class="fas fa-save"></i> Gravar Preço</button>
                                    <button type="button" class="btn btnVerde btn-sisp marginBtnH" id="btnGravarObservacaoRelFaccao" style="margin-top: 10px;"><i class="fas fa-save"></i> Gravar Observação</button>
                                </div>
                            </div>
                        </div>
                    </div>



                    <div class="card card-header" role="tab">
                        <a style="width:100%;" id="faccaoaba" data-toggle="collapse" data-parent="#multiCollapseExample2" href="#multiCollapseExample2" aria-expanded="true" aria-controls="collapseOne1">
                            <div class="row">
                                <div style="max-width:20px;margin-top:auto; margin-bottom: auto" class="col-1">
                                    <i class="fas fa-angle-right"></i>
                                </div>
                                <div class="col-11">
                                    <h4 class="title-page" style="margin-bottom: 0px!important">
                                        Facção:
                                    </h4>
                                </div>
                            </div>
                        </a>
                    </div>

                    <div class="collapse" id="multiCollapseExample2">
                        <div class="card card-body">
                            <div class="collapse col-12 mx-auto show py-3 pd0" id="abaFaccaoRelFaccao">
                                <div class="row">
                                    <div class="col-sm-12">
                                        <table id="tabelaFaccaoRelFaccao" class="table table-sm-sisp table-select table-hover" width="100%">
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>


                    <div class="card card-header" role="tab" id="abaConsumosRelFaccao">
                        <a style="width:100%;" id="consumosfac" data-toggle="collapse" data-parent="#multiCollapseExample3" href="#multiCollapseExample3" aria-expanded="true" aria-controls="collapseOne1">
                            <div class="row">
                                <div style="max-width:20px;margin-top:auto; margin-bottom: auto" class="col-1">
                                    <i class="fas fa-angle-right"></i>
                                </div>
                                <div class="col-11">
                                    <h4 class="title-page" style="margin-bottom: 0px!important">
                                        Consumos:
                                    </h4>
                                </div>
                            </div>
                        </a>
                    </div>

                    <div class="collapse" id="multiCollapseExample3">
                        <div class="collapse col-12 mx-auto show py-3 pd0" id="abaConsumosRelFaccao">
                            <div class="row">
                                <div class="col-sm-12">
                                    <table id="tabelaConsumosRelFaccao" class="table table-sm-sisp table-select table-hover" width="100%">
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>


                    <div class="card card-header" role="tab">
                        <a style="width:100%;" id="composicaofac" data-toggle="collapse" data-parent="#multiCollapseExample4" href="#multiCollapseExample4" aria-expanded="true" aria-controls="collapseOne1">
                            <div class="row">
                                <div style="max-width:20px;margin-top:auto; margin-bottom: auto" class="col-1">
                                    <i class="fas fa-angle-right"></i>
                                </div>
                                <div class="col-11">
                                    <h4 class="title-page" style="margin-bottom: 0px!important">
                                        Composição:
                                    </h4>
                                </div>
                            </div>
                        </a>
                    </div>

                    <div class="collapse" id="multiCollapseExample4">
                        <div class="collapse col-12 mx-auto show py-3 pd0" id="abaConsumosRelFaccao">
                            <div class="row">
                                <div class="col-sm-12">
                                    <table id="tabelaComposicaoRelFaccao" class="table table-sm-sisp table-select table-hover" width="100%">
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>


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

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

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
        <!-- Control sidebar content goes here -->
    </aside>
    <!-- /.control-sidebar -->
    </div>
    <!-- ./wrapper -->
    <script>
        function formatar(mascara, documento) {
            var i = documento.value.length;
            var saida = mascara.substring(0, 1);
            var texto = mascara.substring(i);

            if (texto.substring(0, 1) != saida) {
                documento.value += texto.substring(0, 1);
            }

        }
    </script>

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

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

    <script src="plugins/jquery/jquery.min.js?versao=3.2512.4.1"></script>
    <script src="dist/js/jquery.maskMoney.min.js?versao=3.2512.4.1"></script>
    <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.2512.4.1"></script>
    <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.2512.4.1"></script>
    <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.2512.4.1"></script>
    <script src="plugins/sweetalert2/sweetalert2.min.js?versao=3.2512.4.1"></script>
    <script src="plugins/toastr/toastr.min.js?versao=3.2512.4.1"></script>
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>
    <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.2512.4.1"></script>
    <script src="dist/js/adminlte.min.js?versao=3.2512.4.1"></script>
    <script src="dist/js/requisicoes.js?versao=3.2512.4.1"></script>
    <script src="dist/js/loadingoverlay.min.js?versao=3.2512.4.1"></script>
    <script src="dist/js/valida_cpf_cnpj.js?versao=3.2512.4.1"></script>
    <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.2512.4.1"></script>
    <script src="dist/js/dataTables.keyTable.js?versao=3.2512.4.1"></script>
    <script src="dist/js/sisplan.js?versao=3.2512.4.1"></script>
    <script src="utils/funcoes.js?versao=3.2512.4.1"></script>
    <script src="utils/cookies.js?versao=3.2512.4.1"></script>
    <script src="dist/js/driver.min.js?versao=3.2512.4.1"></script>
    <script src="config.js?versao=3.2512.4.1"></script>
    <script type="text/javascript" src="plugins/jszip/jszip.min.js?versao=3.2512.4.1"></script>
    <script type="text/javascript" src="plugins/pdfmake/pdfmake.min.js?versao=3.2512.4.1"></script>
    <script type="text/javascript" src="plugins/pdfmake/vfs_fonts.js?versao=3.2512.4.1"></script>
    <script type="text/javascript" src="plugins/datatables-buttons/js/dataTables.buttons.min.js?versao=3.2512.4.1"></script>
    <script type="text/javascript" src="plugins/datatables-buttons/js/buttons.html5.min.js?versao=3.2512.4.1"></script>
    <script src="plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.2512.4.1"></script>
    <script src="plugins/select2/js/select2.full.min.js?versao=3.2512.4.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("RELFACCAO");
            if (!temAcesso.resultado) {
                toastrAcesso(temAcesso, BASE_URI);
                return;
            }

            const permissaoUsuarioLogado = await permissaoAcessos("RELFACCAO");

            if (permissaoUsuarioLogado.INCLUI == 'N') {
                await criaMensagemErro("Sem permissão para utilizar esta tela!", () => {
                    $('#semPermissao').addClass('d-none');
                });
                return;
            }

            const queryString = window.location.href;
            const parametros = queryString.split("/");
            const cliente = parametros[parametros.length - 1];

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

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

        });
    </script>
</body>

</html>