<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Sisplan Web | Relatório de Baixa de Consumo</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.255.7.1">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.255.7.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" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.255.7.1" />
    <link href='dist/css/bootstrap.min.css?versao=3.255.7.1'>
    <link rel="stylesheet" href="dist/css/custom.css?versao=3.255.7.1">
    <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.255.7.1">
    <link rel="stylesheet" type="text/css" href="plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.255.7.1">
    <link rel="stylesheet" type="text/css" href="dist/css/responsive.bootstrap.min.css?versao=3.255.7.1">
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.255.7.1">
    <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.255.7.1">
    <link rel="stylesheet" href="dist/css/select.bootstrap.min.css?versao=3.255.7.1" />
    <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.255.7.1">
    <!-- Toastr -->
    <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.255.7.1">
    <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.255.7.1" />
    <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.255.7.1">
    <link rel="stylesheet" href="dist/css/cadastro.css?versao=3.255.7.1">
    <!-- Google Font: Source Sans Pro -->
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
    <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;
        }
    </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 Baixa de Consumo</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">

                        </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="btnFiltros" 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-12 d-flex justify-content-center align-items-center" style="height: 100%;">
                                                <div id="graficoRelBaixaConsumos" style="width: 100%;"></div>
                                            </div>
                                        </div>
                                        <div class="col-sm-12 table-responsive card-body">
                                            <table id="tabelaRelBaixaConsumos" 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">
                        <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 py-1 px-0">
                        <div class="card-body pt-0 pb-0">
                            <div class="row">
                                <div class="col-12">
                                    <div class="row mt-2">
                                        <!-- Datas -->
                                        <div class="row col-12">
                                            <div class="col-xl-2 col-12 form-group mb-0">
                                                <label data-error="wrong" data-success="right" for="dtBaixaDe">Baixa De: </label>
                                                <div class="relative">
                                                    <div class="input-group px-0 col-12">
                                                        <input type="date" max="2500-12-31" class="input-default focus form-control" value="1200-01-01" id="dtBaixaDe" name="dtBaixaDe" class="form-control">
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-xl-2 col-12 form-group mb-0">
                                                <label data-error="wrong" data-success="right" for="dtBaixaAte">Até: </label>
                                                <div class="relative">
                                                    <div class="input-group px-0 col-12">
                                                        <input type="date" max="2500-12-31" class="input-default focus form-control" value="2500-12-31" id="dtBaixaAte" name="dtBaixaAte" class="form-control">
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-group ml-3 mr-3 ml-md-0 pl-2 mt-3 mb-0">
                                                <fieldset class="form border-Field mb-0" style="padding-bottom: 10px !important;">
                                                    <legend class="textoBorda mb-0 pb-0">Situação da OF</legend>
                                                    <div class="d-block d-md-inline icheck-primary"><input type="radio" checked="checked" id="radioOFTodas" name="SitOf"><label class="container" for="radioOFTodas">Todas</label> </div>
                                                    <div class="d-block d-md-inline icheck-primary"><input type="radio" id="radioOFPendentes" name="SitOf"><label class="container" for="radioOFPendentes"> Pendentes</label> </div>
                                                    <div class="d-block d-md-inline icheck-primary"><input type="radio" id="radioOFFinalizados" name="SitOf"><label class="container" for="radioOFFinalizados"> Finalizados</label> </div>
                                                </fieldset>
                                            </div>
                                            <div class="form-group ml-3 mr-3 ml-md-0 pl-2 mt-3 mb-0">
                                                <fieldset class="form border-Field mb-0" style="padding-bottom: 10px !important;">
                                                    <legend class="textoBorda mb-0 pb-0">Situação</legend>
                                                    <div class="d-block d-md-inline icheck-primary"><input type="radio" checked="checked" id="radioTodas" name="Situacao"><label class="container" for="radioTodas">Todas</label> </div>
                                                    <div class="d-block d-md-inline icheck-primary"><input type="radio" id="radioPendentes" name="Situacao"><label class="container" for="radioPendentes"> Pendentes</label> </div>
                                                    <div class="d-block d-md-inline icheck-primary"><input type="radio" id="radioBaixados" name="Situacao"><label class="container" for="radioBaixados"> Baixados</label> </div>
                                                </fieldset>
                                            </div>
                                            <!-- vai mais coisa aqui -->
                                        </div>
                                        <!-- começa os campos -->
                                        <div class="row col-12">
                                            <div class="col-xl-4 col-12 form-group">
                                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtGrupos">Grupos: </label>
                                                <div class="relative">
                                                    <div class="input-group">
                                                        <select class="js-example-programmatic js-states form-control" id="txtGrupos" name="txtGrupos" multiple="multiple"></select>
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btn-GruposConsulta" name="btn-GruposConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                            <button class="btn bg-danger" id="btn-limpa-Grupos" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                        </div>
                                                    </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="txtSubGrupos">Sub. Grupos: </label>
                                                <div class="relative">
                                                    <div class="input-group">
                                                        <select class="js-example-programmatic js-states form-control" id="txtSubGrupos" name="txtSubGrupos" multiple="multiple"></select>
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btn-SubGruposConsulta" name="btn-SubGruposConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                            <button class="btn bg-danger" id="btn-limpa-SubGrupos" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                        </div>
                                                    </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="txtCliBlocoK">Cli. Bloco K: </label>
                                                <div class="relative">
                                                    <div class="input-group">
                                                        <select class="js-example-programmatic js-states form-control" id="txtCliBlocoK" name="txtCliBlocoK" multiple="multiple"></select>
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btn-CliBlocoKConsulta" name="btn-CliBlocoKConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                            <button class="btn bg-danger" id="btn-limpa-CliBlocoK" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row col-12">
                                            <div class="col-xl-4 col-12 form-group">
                                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtDeposito">Depósito: </label>
                                                <div class="relative">
                                                    <div class="input-group">
                                                        <select class="js-example-programmatic js-states form-control" id="txtDeposito" name="txtDeposito" multiple="multiple"></select>
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btn-DepositoConsulta" name="btn-DepositoConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                            <button class="btn bg-danger" id="btn-limpa-Deposito" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                        </div>
                                                    </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="txtMaterial">Material: </label>
                                                <div class="relative">
                                                    <div class="input-group">
                                                        <select class="js-example-programmatic js-states form-control" id="txtMaterial" name="txtMaterial" multiple="multiple"></select>
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btn-MaterialConsulta" name="btn-MaterialConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                            <button class="btn bg-danger" id="btn-limpa-Material" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                        </div>
                                                    </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="txtCorMaterial">Cor Material: </label>
                                                <div class="relative">
                                                    <div class="input-group">
                                                        <select class="js-example-programmatic js-states form-control" id="txtCorMaterial" name="txtCorMaterial" multiple="multiple"></select>
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btn-CorMaterialConsulta" name="btn-CorMaterialConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                            <button class="btn bg-danger" id="btn-limpa-CorMaterial" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row col-12">
                                            <div class="col-xl-4 col-12 form-group">
                                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtLinha">Linha: </label>
                                                <div class="relative">
                                                    <div class="input-group">
                                                        <select class="js-example-programmatic js-states form-control" id="txtLinha" name="txtLinha" multiple="multiple"></select>
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btn-LinhaConsulta" name="btn-LinhaConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                            <button class="btn bg-danger" id="btn-limpa-Linha" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                        </div>
                                                    </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="txtColecao">Coleção: </label>
                                                <div class="relative">
                                                    <div class="input-group">
                                                        <select class="js-example-programmatic js-states form-control" id="txtColecao" name="txtColecao" multiple="multiple"></select>
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btn-ColecaoConsulta" name="btn-ColecaoConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                            <button class="btn bg-danger" id="btn-limpa-Colecao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                        </div>
                                                    </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="txtTipoOF">Tipo OF: </label>
                                                <div class="relative">
                                                    <div class="input-group">
                                                        <input type="text" class="input-default focus form-control" id="txtTipoOF" class="form-control" placeholder="Tipo OF">
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btn-TipoOFConsulta" name="btn-TipoOFConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                            <button class="btn bg-danger" id="btn-limpa-TipoOF" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row col-12">
                                            <div class="col-xl-4 col-12 form-group">
                                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtSetor">Setor: </label>
                                                <div class="relative">
                                                    <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="btn-SetorConsulta" name="btn-SetorConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                            <button class="btn bg-danger" id="btn-limpa-Setor" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                        </div>
                                                    </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="txtLote">Lote: </label>
                                                <div class="relative">
                                                    <div class="input-group">
                                                        <select class="js-example-programmatic js-states form-control" id="txtLote" name="txtLote" multiple="multiple"></select>
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btn-LoteConsulta" name="btn-LoteConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                            <button class="btn bg-danger" id="btn-limpa-Lote" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                        </div>
                                                    </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="txtOFs">OFs: </label>
                                                <div class="relative">
                                                    <div class="input-group">
                                                        <select class="js-example-programmatic js-states form-control" id="txtOFs" name="txtOFs" multiple="multiple"></select>
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btn-OFsConsulta" name="btn-OFsConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                            <button class="btn bg-danger" id="btn-limpa-OFs" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer justify-content-start pl-0">
                        <div class="row col-12">
                            <div class="col-xl-4 col-12">
                                <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-6 col-lg-8 d-flex justify-content-end align-items-end pr-0">
                                <div class="d-flex">
                                    <button class="btn btn-primary btn-sisp mr-2" id="btnLimparFiltros" 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>
        </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.255.7.1"></script>
    <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.255.7.1"></script>
    <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.255.7.1"></script>
    <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.255.7.1"></script>
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>
    <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.255.7.1"></script>
    <script src="dist/js/adminlte.min.js?versao=3.255.7.1"></script>
    <script src="dist/js/sisplan.js?versao=3.255.7.1"></script>
    <script src="utils/funcoes.js?versao=3.255.7.1"></script>
    <script src="utils/cookies.js?versao=3.255.7.1"></script>
    <script src="dist/js/requisicoes.js?versao=3.255.7.1"></script>
    <script src="dist/js/loadingoverlay.min.js?versao=3.255.7.1"></script>
    <script src="dist/js/driver.min.js?versao=3.255.7.1"></script>
    <script src="plugins/toastr/toastr.min.js?versao=3.255.7.1"></script>
    <script src="plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.255.7.1"></script>
    <script type="text/javascript" src="dist/js/sum().js?versao=3.255.7.1"></script>
    <script type="text/javascript" src="config.js?versao=3.255.7.1"></script>
    <script type="text/javascript" src="plugins/jszip/jszip.min.js?versao=3.255.7.1"></script>
    <script type="text/javascript" src="plugins/pdfmake/pdfmake.min.js?versao=3.255.7.1"></script>
    <script type="text/javascript" src="plugins/pdfmake/vfs_fonts.js?versao=3.255.7.1"></script>
    <script type="text/javascript" src="plugins/datatables-buttons/js/dataTables.buttons.min.js?versao=3.255.7.1"></script>
    <script type="text/javascript" src="plugins/datatables-buttons/js/buttons.html5.min.js?versao=3.255.7.1"></script>
    <script src="graficos/graficos.js?versao=3.255.7.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('RELBAIXACONSUMOS');
            if (!temAcesso.resultado) {
                toastrAcesso(temAcesso, BASE_URI);
                return;
            }

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

        });
    </script>
</body>

</html>