<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Sisplan Web | Posição de Contas a Pagar</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.264.14.1">

    <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.264.14.1">
    <link rel="stylesheet" href="dist/css/custom.css?versao=3.264.14.1">
    <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.264.14.1">
    <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.264.14.1">
    <link rel="stylesheet" type="text/css" href="plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.264.14.1">
    <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.264.14.1">
    <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.264.14.1">
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.264.14.1">
    <!-- <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.264.14.1"> -->
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.264.14.1" />
    <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.264.14.1">
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
    <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.264.14.1">
    <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.264.14.1">
    <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.264.14.1">
    <style>
        .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;
            border-radius: 3px !important;
        }

        .form-group {
            margin-bottom: 5px;
        }

        .icheck-primary {
            margin-top: 0px !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 Posição de Contas a Pagar</h1>
                            <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>
                        </div>
                        <div class="col-sm-6">
                            <!-- <ol class="breadcrumb float-sm-right">
                                
                                <li class="breadcrumb-item active">Relatório de Posição Contas a Pagar</li>
                            </ol> -->
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12">
                            <fieldset>
                                <div class="row">
                                    <div class="col-12">
                                        <div class="buttons">
                                            <button class="btn btn-success btn-sisp" id="btnFiltrosRel" type="button"><span class="fas fa-filter"></span> Filtros</button>
                                            <button id="btnImprimir" class="btn-sisp btn btn-danger"><i class="fas fa-print"></i> Imprimir</button>
                                        </div>
                                    </div>
                                </div>
                                <div class="card-body">
                                    <div class="card">
                                        <div class="row">
                                            <div class="col-sm-6 d-flex justify-content-center align-items-center" style="height: 100%;">
                                                <div id="graficoRelPosCtasPag" class="mt-5" style="width: 100%;"></div>
                                            </div>
                                            <div class="col-sm-6 d-flex justify-content-center align-items-center" style="height: 100%;">
                                                <div id="graficoRelPosCtasPag1" class="mt-5" style="width: 100%;"></div>
                                            </div>
                                        </div>
                                        <div class="col-sm-12 table-responsive card-body">
                                            <table id="tabelaPosicaoCtasPag" class="table table-sm table-select table-hover" style="white-space: nowrap" width="100%"></table>
                                            <thead>
                                                <tr></tr>
                                            </thead>
                                            <tbody>
                                                <tr></tr>
                                            </tbody>
                                        </div>
                                    </div>
                                </div>
                            </fieldset>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="modal-filtros" class="modal" tabindex="-1" role="dialog">
            <div class="modal-dialog modal-xl" role="document">
                <div class="modal-content" id="modalBody">
                    <div class="modal-header col-12">
                        <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="form-row">
                            <div class="row col-lg col-md col-12 justify-content-center">
                                <div class="col-lg col-md col-12 d-flex mb-3 mb-lg-0" style="padding: 0px;">
                                    <div class="col-12">
                                        <label for="txtData">Data:</label>
                                        <div class="relative">
                                            <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control validate" id="txtData">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-auto col-md-auto col-auto mt-0 mt-lg-3">
                                    <fieldset class="form border-Field p-0">
                                        <legend class="textoBorda pb-0 mb-0">Filtro</legend>
                                        <div class="form-row justify-content-center">
                                            <div class="icheck-primary mr-3"><input type="radio" id="rdEmissao" checked name="rdfiltro" value="0"><label class="labelCheck" for="rdEmissao">Emissão</label></div>
                                            <div class="icheck-primary mr-3"><input type="radio" id="rdEntrada" name="rdfiltro" value="1"><label class="labelCheck" for="rdEntrada">Entrada</label></div>
                                            <div class="icheck-primary"><input type="radio" id="rdCompetencia" name="rdfiltro" value="2"><label class="labelCheck" for="rdCompetencia">Competência</label></div>
                                        </div>
                                    </fieldset>
                                </div>
                                <div class="col-lg-auto col-md-auto col-auto mt-0 mt-lg-3">
                                    <fieldset class="form border-Field p-0">
                                        <legend class="textoBorda pb-0 mb-0">Tipo</legend>
                                        <div class="form-row justify-content-center">
                                            <div class="icheck-primary mr-2"><input type="checkbox" class="configCheckBusca" value="AP" checked id="cbAP"><label class="labelCheck" for="cbAP"> A.P.</label></div>
                                            <div class="icheck-primary mr-2"><input type="checkbox" class="configCheckBusca" value="ANTE" id="cbAntecipacao"><label class="labelCheck" for="cbAntecipacao"> Antecipação</label></div>
                                            <div class="icheck-primary mr-2"><input type="checkbox" class="configCheckBusca" value="ORCA" id="cbOrcamento"><label class="labelCheck" for="cbOrcamento"> Orçamento</label></div>
                                            <div class="icheck-primary mr-2"><input type="checkbox" class="configCheckBusca" value="CHEQ" id="cbCheque"><label class="labelCheck" for="cbCheque">Cheque</label></div>
                                        </div>
                                    </fieldset>
                                </div>
                                <div class="col-lg-auto col-md-auto col-auto mt-0 mt-lg-3" style="margin-top: 2px">
                                    <button id="btnCarregaEmpresas" class="btn btn-danger col-lg-12 col-md-12 col-12 mt-2" style="margin-top: 10px !important;">Selecionar Empresas</button>
                                </div>
                            </div>

                            <div class="row col-lg-12 col-12">
                                <div class="col-lg-4 col-12 form-group mt-3 mt-lg-2">
                                    <div class="icheck-primary d-flex"><input type="checkbox" value="S" class="checkfiltros" id="cbConsideraSituacao" data-placement="top" checked><label for="cbConsideraSituacao" data-toggle="tooltip" data-placement="top" title="Se marcado, considera apenas os registro de situação selecionados na pesquisa, se desmarcado, desconsidera os registros selecionados na pesquisa e filtra por todos os outros registros de situação."></label>
                                        <label style="padding-left: 0 !important;" data-error="wrong" id="lblInputSituacao" data-success="right" for="txtSituacao">Situacao: </label>
                                    </div>
                                    <div class="relative">
                                        <div class="input-group">
                                            <select class="js-example-programmatic js-states form-control" id="txtSituacao" name="txtSituacao" multiple="multiple"></select>
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnSituacao" name="btnSituacao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaSituacao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-4 col-12 form-group mt-3 mt-lg-2">
                                    <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtBanco">Banco: </label>
                                    <div class="relative">
                                        <div class="input-group">
                                            <select class="js-example-programmatic js-states form-control" id="txtBanco" name="txtBanco" multiple="multiple"></select>
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnBanco" name="btnBanco" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaBanco" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-4 col-12 form-group mt-3 mt-lg-2">
                                    <div class="icheck-primary d-flex"> <input type="checkbox" value="S" class="checkfiltros" id="cbConsideraFornecedor" checked><label for="cbConsideraFornecedor" data-toggle="tooltip" data-placement="top" title="Se marcado, considera apenas os fornecedores selecionadas na pesquisa, se desmarcado, desconsidera os fornecedores selecionados na pesquisa e filtra por todas as outros fornecedores."></label>
                                        <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtFornecedor">Fornecedor: </label>
                                    </div>
                                    <div class="relative">
                                        <div class="input-group">
                                            <select class="js-example-programmatic js-states form-control" id="txtFornecedor" name="txtFornecedor" multiple="multiple"></select>
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnFornecedor" name="btnFornecedor" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaFornecedor" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row col-lg-12 col-12 form-group">
                                <div class="col-lg-4 col-12 form-group mt-3 mt-lg-2">
                                    <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtClasse">Classe Ger.: </label>
                                    <div class="relative">
                                        <div class="input-group">
                                            <select class="js-example-programmatic js-states form-control" id="txtClasse" name="txtClasse" multiple="multiple"></select>
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnClasse" name="btnClasse" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaClasse" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-4 col-12 form-group mt-3 mt-lg-2">
                                    <div class="icheck-primary d-flex"> <input type="checkbox" value="S" class="checkfiltros" id="cbConsideraHistorico" checked><label for="cbConsideraHistorico" data-toggle="tooltip" data-placement="top" title="Se marcado, considera apenas os históricos selecionados na pesquisa, se desmarcado, desconsidera os históricos selecionados na pesquisa e filtra por todos os outros históricos."></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="btnHistorico" name="btnHistorico" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaHistorico" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-4 col-12 form-group mt-3 mt-lg-2">
                                    <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtRamoAtividade">Ramo Ativ.: </label>
                                    <div class="relative">
                                        <div class="input-group">
                                            <select class="js-example-programmatic js-states form-control" id="txtRamoAtividade" name="txtRamoAtividade" multiple="multiple"></select>
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnRamoAtividade" name="btnRamoAtividade" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaRamoAtividade" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row col-lg-12 col-12">
                                <div class="col-lg-4 col-12 form-group mt-3 mt-lg-2">
                                    <div class="icheck-primary"> <input type="checkbox" value="S" class="checkfiltros" id="cbConsideraGrupoCli" checked><label for="cbConsideraGrupoCli" data-toggle="tooltip" data-placement="top" title="Se marcado, considera apenas os grupos de clientes selecionados na pesquisa, se desmarcado, desconsidera os grupos selecionados na pesquisa e filtra por todos os outros grupos de clientes."></label>
                                        <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtGrupoCli">Grupo Cliente:</label>
                                    </div>
                                    <div class="relative">
                                        <div class="input-group">
                                            <select class="js-example-programmatic js-states form-control" id="txtGrupoCli" name="txtGrupoCli" multiple="multiple"></select>
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnGrupoCli" name="btnGrupoCli" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaGrupoCli" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-4 col-12 form-group mt-3 mt-lg-2">
                                    <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtCentroCusto">Centro Custo:</label>
                                    <div class="relative">
                                        <div class="input-group">
                                            <select class="js-example-programmatic js-states form-control" id="txtCentroCusto" name="txtCentroCusto" multiple="multiple"></select>
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnCentroCusto" name="btnCentroCusto" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaCentroCusto" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-4 col-12 form-group mt-3 mt-lg-2">
                                    <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="btnMoeda" name="btnMoeda" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaMoeda" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row col-lg-12 col-12">
                                <div class="col-lg-4 col-12 form-group mt-3 mt-lg-2">
                                    <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtConta">Conta:</label>
                                    <div class="relative">
                                        <div class="input-group">
                                            <select class="js-example-programmatic js-states form-control" id="txtConta" name="txtConta" multiple="multiple"></select>
                                            <div class="input-group-append">
                                                <button class="btn bg-danger" id="btnConta" name="btnConta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                <button class="btn bg-danger" id="btnLimpaConta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer justify-content-start pl-0 pr-3">
                        <div class="form-row col-lg-12 col-12">
                            <div class="col-lg-4 col-12 form-group">
                                <label for="txtOrdem">Opção de Relatório:</label>
                                <div class="relative d-flex align-items-center">
                                    <select id="txtOrdem" class="input-default focus custom-select">
                                    </select>
                                    <button class="btn btn-sm btn-success ml-2 btnEdicaoRelatorio" title="Edição de ordenações">
                                        <i class="fas fa-check"></i>
                                    </button>
                                </div>
                            </div>
                            <div class="col-lg-8 col-md-12 col-12 form-group d-flex justify-content-end align-items-end pr-2">
                                <button class="btn btn-primary btn-sisp mr-2" id="btnLimpaFiltros" style="background-color: #B22222; border-color: #B22222">
                                    <span class="fas fa-trash"></span> Limpar Filtros
                                </button>
                                <button id="btnConsultar" class="btn btn-primary btn-sisp" type="button">
                                    <span class="fas fa-search"></span> Consultar
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


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

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

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

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

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

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

            await insereJavaScriptPagina(sArquivo);

            habilitaCamposObrigatoriosTela(nomeTela);

            $(function() {
                $('[data-toggle="tooltip"]').tooltip()
            })
        });
    </script>

</body>

</html>