<?php include_once('../../../config.php') ?>
<?php
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
?>


<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Sisplan Web | Movimentação Bancária</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.2412.10.1">
    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.2412.10.1">

    <!-- Google Font: Source Sans Pro -->
    <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.2412.10.1">
    <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.2412.10.1">
    <link rel="stylesheet" href="dist/css/select.bootstrap.min.css?versao=3.2412.10.1" />
    <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.2412.10.1">
    <link rel="stylesheet" href="dist/css/custom.css?versao=3.2412.10.1">
    <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.2412.10.1">
    <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.2412.10.1" />
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.2412.10.1">
    <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.2412.10.1" />
    <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.2412.10.1">
    <style>
        .info-box-text {
            font-size: 20px;
            font-weight: bold;
            color: grey;
        }

        .form-group {
            margin-bottom: 0;
        }

        .bordaCampos {
            border: solid #e0e4e6;
            border-radius: 4px;
            border-width: 2px;
            padding-top: 2%;
            padding-bottom: 0%;
        }

        .bordaCampos:first-child {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            justify-content: flex-end;
            align-items: center;
        }

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

        .border-Field {
            border: 1.0px solid var(--font-color) !important;
            padding: 0 1.0em 1.0em 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;
            padding-bottom: 0px !important;
        }

        .btnGreen {
            font-size: 15px;
            background-color: #25d366 !important;
            border-color: #25d366 !important;
            color: #fff;
        }

        .btnGreen:hover {
            background-color: #20ae59 !important;
            border-color: #20ae59 !important;
            color: #fff;
        }

        .btn-primary:hover {
            background-color: #0a4f99 !important;
            border-color: #0a4f99 !important;
            color: #fff;
        }
    </style>

</head>

<body class="hold-transition sidebar-mini layout-fixed">
    <div class="wrapper">
        <?php
        include_once('../../../menu.php');
        ?>

        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <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">Movimentação Bancária</h1>
                            <button type="button" class="btn btn-info btn-sm ml-2" style="color: white;" id="tutorial">
                                <i class="fas fa-question-circle"></i>
                            </button>
                        </div><!-- /.col -->
                        <div class="col-sm-6">

                        </div><!-- /.col -->
                    </div><!-- /.row -->
                </div><!-- /.container-fluid -->
            </div>
            <!-- /.content-header -->

            <!-- Main content -->
            <section class="content">

                <div class="card">
                    <div class="card-body">
                        <div class="container-fluid pb-4 pr-4 pl-4 pt-0">
                            <div class="row pb-4">
                                <div class="col-sm-6.5 pt-1 mt-4">
                                    <button id="btn-filtros" class="btn btn-success btn-sisp" type="button" data-toggle="modal" data-target="#modal-filtros"><span class="fas fa-filter"></span> Filtros</button>
                                    <button class="btn btn-danger btn-sisp" id="btnIncluir" data-toggle="modal"><i class="fas fa-plus"></i> Incluir</button>
                                    <button class="btn btn-secondary btn-sisp" id="btnImprimir" data-toggle="modal"><i class="fas fa-print"></i> Imprimir</button>
                                    <button class="btn btn-success btnGreen btn-sisp" disabled id="btnCompensar" data-toggle="modal"><i class="fas fa-check"></i> Compensar</button>
                                    <button class="btn btn-primary btn-sisp" disabled id="btnSaldoContas" data-toggle="modal" title="Este botão chama o Layout RelSaldoConta.FR3."><i class="fas fa-cash"></i> Saldo Contas</button>
                                    <button class="btn btn-danger btn-sisp" id="btnEstCompensacao" disabled data-toggle="modal"><i class="fas fa-ban"></i> Est. Compensação</button>
                                </div>
                                <div class="col-xl-2 col-12">
                                    <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="dtCompensacao">Compensação:</label>
                                    <div class="relative">
                                        <div class="input-group">
                                            <input type="date" max="2500-12-31" value="" disabled class="input-default focus form-control" id="dtCompensacao" name="dtCompensacao" class="form-control">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12 table-responsive">
                                    <table id="tabelaMovimento" class="table table-sm table-select table-hover" width="100%" style="white-space: nowrap;">
                                        <thead>
                                            <tr></tr>
                                        </thead>
                                        <tbody>
                                            <tr></tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="row mt-2 d-none" id="containerTotalizadores">
                                <div class="col-xl-4 col-12 form-group">
                                    <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtSaida">Saída:</label>
                                    <div class="relative">
                                        <div class="input-group">
                                            <input type="text" class="input-default focus form-control" disabled id="txtSaida" name="txtSaida" class="form-control" placeholder="Saída">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xl-4 col-12 form-group">
                                    <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtEntrada">Entrada:</label>
                                    <div class="relative">
                                        <div class="input-group">
                                            <input type="text" class="input-default focus form-control" disabled id="txtEntrada" name="txtEntrada" class="form-control" placeholder="Entrada">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xl-4 col-12 form-group">
                                    <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtSaldo">Saldo:</label>
                                    <div class="relative">
                                        <div class="input-group">
                                            <input type="text" class="input-default focus form-control" disabled id="txtSaldo" name="txtSaldo" class="form-control" placeholder="Saldo">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
            <!-- /.content -->
        </div>
        <div id="modal-filtros" class="modal" tabindex="-1" role="dialog">
            <div class="modal-dialog modal-xl" role="document">
                <div class="modal-content" id="modalBody">
                    <div class="modal-header">
                        <h4 class="modal-title">Filtros</h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-xl-6 col-12 form-group">
                                <fieldset class="form border-Field p-0">
                                    <legend class="textoBorda pb-0 mb-0">Buscar</legend>
                                    <div class="d-flex">
                                        <div class="icheck-primary mr-4 ml-4"><input type="radio" id="rdTodos" name="rdBuscar" value="1"><label class="labelCheck" for="rdTodos">Todos</label></div>
                                        <div class="icheck-primary mr-4"><input type="radio" id="rdPendentes" checked name="rdBuscar" value="2"><label class="labelCheck" for="rdPendentes">Pendentes</label></div>
                                        <div class="icheck-primary mr-4"><input type="radio" id="rdBaixados" name="rdBuscar" value="0"><label class="labelCheck" for="rdBaixados">Baixados</label></div>
                                        <div class="icheck-primary mr-4"><input type="radio" id="rdCompensados" name="rdBuscar" value="0"><label class="labelCheck" for="rdCompensados">Compensados</label></div>
                                    </div>
                                </fieldset>
                            </div>
                            <div class="col-xl-3 col-12 form-group mt-2 pt-1">
                                <button id="btnCarregaEmpresas" class="btn btn-danger col-lg-12 col-md-12 col-12">Selecionar Empresas</button>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-xl-3 col-12 form-group">
                                <label data-error="wrong" data-success="right" for="dtLancamentoDe">Lançamento de/até: </label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control" id="dtLancamentoDe" name="dtLancamentoDe" class="form-control">
                                        <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control" id="dtLancamentoAte" name="dtLancamentoAte" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-12 form-group">
                                <label data-error="wrong" data-success="right" for="dtVencimentoDe">Vencimento de/até: </label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control" id="dtVencimentoDe" name="dtVencimentoDe" class="form-control">
                                        <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control" id="dtVencimentoAte" name="dtVencimentoAte" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-12 form-group">
                                <label data-error="wrong" data-success="right" for="dtContabilizacaoDe">Contabilização de/até: </label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control" id="dtContabilizacaoDe" name="dtContabilizacaoDe" class="form-control">
                                        <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control" id="dtContabilizacaoAte" name="dtContabilizacaoAte" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-12 form-group">
                                <label data-error="wrong" data-success="right" for="txtValorDe">Valor de/até: </label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" id="txtValorDe" name="txtValorDe" class="form-control">
                                        <input type="text" class="input-default focus form-control" id="txtValorAte" name="txtValorAte" class="form-control">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row mt-2">
                            <div class="col-xl-3 col-12 form-group">
                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtConta">Conta:</label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" id="txtConta" name="txtConta" class="form-control" placeholder="Conta">
                                        <div class="input-group-append">
                                            <button class="btn bg-danger" id="btn-ContaConsulta" name="btn-ContaConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                            <button class="btn bg-danger" id="btn-limpa-Conta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-12 form-group">
                                <div class="icheck-primary d-flex"><input type="checkbox" value="S" class="checkfiltros" id="cbConsideraHistorico" data-placement="top" checked><label for="cbConsideraHistorico" data-toggle="tooltip" data-placement="top" title="Se marcado, considera apenas as facções selecionados na pesquisa, se desmarcado, desconsidera as facções selecionados na pesquisa e filtra por todos as outras facções."></label>
                                    <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtHistorico">Histórico: </label>
                                </div>
                                <div class="relative">
                                    <div class="input-group">
                                        <select class="js-example-programmatic js-states form-control" id="txtHistorico" name="txtHistorico" multiple="multiple"></select>
                                        <div class="input-group-append">
                                            <button class="btn bg-danger" id="btn-HistoricoConsulta" name="btn-HistoricoConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                            <button class="btn bg-danger" id="btn-limpa-Historico" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-12 form-group">
                                <div class="icheck-primary d-flex"><input type="checkbox" value="S" class="checkfiltros" id="cbConsideraClasseGer" data-placement="top" checked><label for="cbConsideraClasseGer" data-toggle="tooltip" data-placement="top" title="Se marcado, considera apenas as facções selecionados na pesquisa, se desmarcado, desconsidera as facções selecionados na pesquisa e filtra por todos as outras facções."></label>
                                    <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtClasseGer">Classe Gerencial: </label>
                                </div>
                                <div class="relative">
                                    <div class="input-group">
                                        <select class="js-example-programmatic js-states form-control" id="txtClasseGer" name="txtClasseGer" multiple="multiple"></select>
                                        <div class="input-group-append">
                                            <button class="btn bg-danger" id="btn-ClasseGerConsulta" name="btn-ClasseGerConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                            <button class="btn bg-danger" id="btn-limpa-ClasseGer" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-12 form-group">
                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtMoeda">Moeda:</label>
                                <div class="relative">
                                    <div class="input-group">
                                        <select class="js-example-programmatic js-states form-control" id="txtMoeda" name="txtMoeda" multiple="multiple"></select>
                                        <div class="input-group-append">
                                            <button class="btn bg-danger" id="btn-MoedaConsulta" name="btn-MoedaConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                            <button class="btn bg-danger" id="btn-limpa-Moeda" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row mt-2">
                            <div class="col-xl-3 col-12 form-group">
                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtCliente">Cliente:</label>
                                <div class="relative">
                                    <div class="input-group">
                                        <select class="js-example-programmatic js-states form-control" id="txtCliente" name="txtCliente" multiple="multiple"></select>
                                        <div class="input-group-append">
                                            <button class="btn bg-danger" id="btn-ClienteConsulta" name="btn-ClienteConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                            <button class="btn bg-danger" id="btn-limpa-Cliente" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-12 form-group">
                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtDocumentoFiltro">Documento:</label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" id="txtDocumentoFiltro" name="txtDocumentoFiltro" class="form-control" placeholder="Documento">
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-12 form-group">
                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtLancamento">Lançamento:</label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" id="txtLancamento" name="txtLancamento" class="form-control" placeholder="Lançamento">
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-3 col-12 form-group">
                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtObservacao">Observação:</label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" id="txtObservacao" name="txtObservacao" class="form-control" placeholder="Observação">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <div class="row">
                            <button class="btn btn-primary btn-sisp" id="btnLimparFiltros" style="background-color: #B22222; border-color: #B22222"><span class="fas fa-trash"></span> Limpar Filtros</button> 
                            <button class="btn btn-primary btn-sisp" id="btnConsultar"><span class="fas fa-search"></span> Consultar</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

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

    <!-- jQuery -->
    <script src="plugins/jquery/jquery.min.js?versao=3.2412.10.1"></script>
    <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.2412.10.1"></script>
    <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.2412.10.1"></script>
    <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.2412.10.1"></script>
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>
    <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.2412.10.1"></script>
    <script src="dist/js/adminlte.min.js?versao=3.2412.10.1"></script>
    <script src="dist/js/sisplan.js?versao=3.2412.10.1"></script>
    <script src="plugins/toastr/toastr.min.js?versao=3.2412.10.1"></script>
    <script src="utils/cookies.js?versao=3.2412.10.1"></script>
    <script src="dist/js/requisicoes.js?versao=3.2412.10.1"></script>
    <script src="dist/js/loadingoverlay.min.js?versao=3.2412.10.1"></script>
    <script src="dist/js/driver.min.js?versao=3.2412.10.1"></script>
    <script src="plugins/moment/moment.min.js?versao=3.2412.10.1"></script>
    <script type="text/javascript" src="dist/js/sum().js?versao=3.2412.10.1"></script>
    <script type="text/javascript" src="config.js?versao=3.2412.10.1"></script>
    <script src="dist/js/jquery.maskMoney.min.js?versao=3.2412.10.1"></script>
    <script src="dist/js/jquery.mask.min.js?versao=3.2412.10.1"></script>
    <script src="../plugins/select2/js/select2.full.min.js?versao=3.2412.10.1"></script>
    <script src="utils/funcoes.js?versao=3.2412.10.1"></script>
    <script type="text/javascript" src="config.js?versao=3.2412.10.1"></script>
    <script type="text/javascript" src="modals/modal_anexos.js?versao=3.2412.10.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('MOVIMENTOBANCARIO');
            if (!temAcesso.resultado) {
                toastrAcesso(temAcesso, BASE_URI);
                return;
            }

            sArquivo = `${BASE_URI}/pages/movimentobancario/acesso_movimentobancario/acesso_movimentobancario.js?versao=3.2412.10.1`;
            insereJavaScriptPagina(sArquivo);

        });
    </script>
</body>

</html>