<!-- <?php include_once('../../config.php') ?> -->

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Sisplan Web | Receber</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.255.7.1">

  <link rel="stylesheet" href="dist/css/adminlte.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" href="dist/css/PesquisaVariosSelect2.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" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.255.7.1">
  <link rel="shortcut icon" href="favicon.ico">
  <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 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.255.7.1">
  <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.255.7.1">


</head>
<style>
  #msform {
    text-align: start;
    position: relative;
  }

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

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

  .textoBorda {
    font-size: 1.0em !important;
    text-align: left !important;
    width: auto;
    padding: 0 10px;
    font-weight: 700;
    margin-bottom: 5px;
  }

  .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;
  }

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

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

  .btn-custos {
    min-width: 180px !important;
  }
</style>

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

    <div class="content-wrapper">
      <div class="content-header">
        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-sm-6">
              <h3 class='mb-2'></h3>
            </div><!-- /.col -->
            <div class="col-sm-6">
              <ol class="breadcrumb float-sm-right">

                <li class="breadcrumb-item"><a href="../index">Início</a></li>
              </ol>
            </div><!-- /.col -->
          </div><!-- /.row -->

          <div classe="row">
            <div class="col-12">
              <div class="card" style="height:auto;min-height:715px">
                <div class="card-header bg-dark">
                  <div class="row flex">
                    <h4 class="text-white">Recálculo de Preço de Terceiros </h4>
                    <button title="Tutorial" class="btn btn-info btn-sm ml-2" id="tutorial">
                      <i class="fas fa-question-circle"></i>
                    </button>
                  </div>
                </div>
                <div class="card-body my-2">
                  <form id="msform" name="msform">
                    <div class="form-row">
                      <div class="form-group col-lg-4 col-12">
                        <label style="margin-bottom: .1rem;" data-error="wrong" data-success="right" for="dtDe">Período de/até: </label>
                        <div class="relative" style="margin-top: 5px;">
                          <div class="input-group">
                            <input type="date" max="2500-12-31" class="input-default focus form-control mr-3" id="dtDe" value="1200-01-01" name="dtDe" class="form-control">
                            <input type="date" max="2500-12-31" class="input-default focus form-control" id="dtAte" value="2500-12-31" name="dtAte" class="form-control">
                          </div>
                        </div>
                      </div>
                      <div class="form-group col-lg-4 col-12">
                        <label data-error="wrong" data-success="right" for="txtEmpresa">Empresa:
                        </label>
                        <div class="input-group">
                          <input type="text" class="input-default focus form-control controle-edicao" aria-describedby="produtoError" id="txtEmpresa" name="txtEmpresa" placeholder="Tabela">
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnEmpresa" name="btnEmpresa" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaEmpresa" name="btnLimpaEmpresa" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div>
                      <div class="form-group col-lg-4 col-12">
                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtSetor">Setor:</label>
                        <div class="input-group">
                          <input type="text" class="input-default focus form-control controle-edicao" aria-describedby="produtoError" id="txtSetor" name="txtSetor" placeholder="Tabela">
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnSetor" name="btnSetor" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaSetor" name="btnLimpaSetor" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div>
                      <div class="form-group col-lg-4 col-12">
                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtColecao">Coleção:</label>
                        <div class="input-group">
                          <input type="text" class="input-default focus form-control controle-edicao" aria-describedby="produtoError" id="txtColecao" name="txtColecao" placeholder="Tabela">
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnColecao" name="btnColecao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaColecao" name="btnLimpaColecao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div>
                      <!-- <div class="form-group col-lg-4 col-12">
                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtCor">Cor:</label>
                        <div class="input-group">
                          <input type="text" class="input-default focus form-control controle-edicao" aria-describedby="produtoError" id="txtCor" name="txtCor" placeholder="Tabela">
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnCor" name="btnCor" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaCor" name="btnLimpaCor" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div>
                      <div class="form-group col-lg-4 col-12">
                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtTam">Tamanho:</label>
                        <div class="input-group">
                          <input type="text" class="input-default focus form-control controle-edicao" aria-describedby="produtoError" id="txtTam" name="txtTam" placeholder="Tabela">
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnTam" name="btnTam" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaTam" name="btnLimpaTam" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div> -->
                      <div class="form-group col-lg-4 col-12">
                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtParte">Parte:</label>
                        <div class="input-group">
                          <select class="js-example-programmatic js-states form-control" id="txtParte" name="txtParte" multiple="multiple">
                          </select>
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnParte" name="btnParte" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaParte" name="btnLimpaParte" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div>
                      <div class="form-group col-lg-4 col-12">
                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtProduto">Produto:</label>
                        <div class="input-group">
                          <select class="js-example-programmatic js-states form-control" id="txtProduto" name="txtProduto" multiple="multiple">
                          </select>
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnProduto" name="btnProduto" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaProduto" name="btnLimpaProduto" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div>
                      <div class="form-group col-lg-4 col-12">
                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtNumero">Número:</label>
                        <div class="input-group">
                          <select class="js-example-programmatic js-states form-control" id="txtNumero" name="txtNumero" multiple="multiple">
                          </select>
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnNumero" name="btnNumero" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaNumero" name="btnLimpaNumero" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div>
                      <!-- <div class="form-group col-lg-4 col-12"></div>
                      <div class="form-group col-lg-4 col-12"></div> -->
                      <div class="form-group col-lg-4 col-12">
                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtMaquina">Máquina:</label>
                        <div class="input-group">
                          <select class="js-example-programmatic js-states form-control" id="txtMaquina" name="txtMaquina" multiple="multiple">
                          </select>
                          <div class="input-group-append">
                            <button class="btn bg-danger" id="btnMaquina" name="btnMaquina" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                            <button class="btn bg-danger" id="btnLimpaMaquina" name="btnLimpaMaquina" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                          </div>
                        </div>
                      </div>
                      <div class="form-group col-lg-1 col-12">
                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtMov">Movimento:</label>
                        <div class="input-group">
                          <input type="text" class="input-default focus form-control text-right apenasInteiros" aria-describedby="MovError" id="txtMov" name="txtMov" placeholder="0">
                        </div>
                      </div>
                      <div class="form-group col-lg-1 col-12">
                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtMovAnt">Mov. Anterior:</label>
                        <div class="input-group">
                          <input type="text" class="input-default focus form-control text-right apenasInteiros" aria-describedby="MovAntError" id="txtMovAnt" name="txtMovAnt" placeholder="0">
                        </div>
                      </div>
                      <div class="form-group col-lg-1 col-12">
                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtLanctoBaixa">Lancto Baixa:</label>
                        <div class="input-group">
                          <input type="text" class="input-default focus form-control text-right apenasInteiros" aria-describedby="LanctoBaixaError" id="txtLanctoBaixa" name="txtLanctoBaixa" placeholder="0">
                        </div>
                      </div>
                      <div class="form-group col-lg-1 col-12">
                        <label data-error="wrong" class="labelGeral" data-success="right" for="txtLanctoEnvio">Lancto Envio:</label>
                        <div class="input-group">
                          <input type="text" class="input-default focus form-control text-right apenasInteiros" aria-describedby="LanctoEnvioError" id="txtLanctoEnvio" name="txtLanctoEnvio" placeholder="0">
                        </div>
                      </div>
                      <!-- <div class="form-group col-lg-4 col-0"></div> -->
                      <div class="form-group col-lg-4 col-12">
                        <legend class="textoBorda">Opções:</legend>
                        <fieldset class="form border-Field" style="margin-bottom: 0px!important; margin-left: 0px!important">
                          <div class="d-flex flex-column mt-2 mb-1 mx-0">
                            <div class="d-flex flex-row">
                              <div class="icheck-primary">
                                <input type="checkbox" class="form-check-input" name="cbPrecoEstrutura" id="cbPrecoEstrutura">
                                <label class="form-check-label" for="cbPrecoEstrutura">Pegar preço via estrutura código</label>
                              </div>
                              <div class="ml-2" style="height: 22px">
                                <select class="drilldown-item form-control" id="txtTipo" style="border-color: #a9a9a9; height: 28px; font-size: 14px; padding: 2px!important">
                                  <option class="drilldown-item" value="03">03</option>
                                  <option class="drilldown-item" value="04">04</option>
                                  <option class="drilldown-item" value="05">05</option>
                                  <option class="drilldown-item" value="06">06</option>
                                  <option class="drilldown-item" value="07">07</option>
                                  <option class="drilldown-item" value="08">08</option>
                                  <option class="drilldown-item" value="09">09</option>
                                  <option class="drilldown-item" value="10" selected>10</option>
                                  <option class="drilldown-item" value="11">11</option>
                                  <option class="drilldown-item" value="12">12</option>
                                  <option class="drilldown-item" value="13">13</option>
                                  <option class="drilldown-item" value="14">14</option>
                                  <option class="drilldown-item" value="15">15</option>
                                </select>
                              </div>
                            </div>
                            <div class="icheck-primary">
                              <input type="checkbox" class="form-check-input" checked name="cbSomenteNaoPago" id="cbSomenteNaoPago">
                              <label class="form-check-label" for="cbSomenteNaoPago">Buscar somente não pago</label>
                            </div>
                            <div class="icheck-primary">
                              <input type="checkbox" class="form-check-input" name="cbPrecoCorTam" id="cbPrecoCorTam" disabled>
                              <label class="form-check-label" for="cbPrecoCorTam">Preço por cor e tamanho</label>
                            </div>
                            <div class="icheck-primary">
                              <input type="checkbox" class="form-check-input" checked name="cbSomenteSemValores" id="cbSomenteSemValores">
                              <label class="form-check-label" for="cbSomenteSemValores">Buscar somente sem valores</label>
                            </div>
                            <div class="icheck-primary">
                              <input type="checkbox" class="form-check-input" name="cbValorManual" id="cbValorManual">
                              <label class="form-check-label apenasFloat" for="cbValorManual">Inserir valor manual</label>
                            </div>
                          </div>
                        </fieldset>
                      </div>
                      <div class="form-group col-lg-2 col-12">
                        <legend class="textoBorda">Ordem:</legend>
                        <fieldset class="form border-Field" style="margin-bottom: 0px!important; margin-left: 0px!important">
                          <div class="d-flex flex-column mt-2 mb-1 mx-0">
                            <div class="icheck-primary">
                              <input type="radio" name="rdOrdem" id="rdOrdem1" value="0" checked>
                              <label class="form-check-label" for="rdOrdem1">OF/Setor/Data</label>
                            </div>
                            <div class="icheck-primary">
                              <input type="radio" name="rdOrdem" id="rdOrdem2" value="1">
                              <label class="form-check-label" for="rdOrdem2">OF/Cor/Setor/Data</label>
                            </div>
                          </div>
                        </fieldset>
                        <div class="row d-flex justify-content-start">
                          <div class="form-group col-lg-5 col-12 mt-2">
                            <label data-error="wrong" class="labelGeral valorManual d-none" data-success="right" for="txtValorManual">Valor Manual:</label>
                            <div class="input-group">
                              <input type="text" class="input-default focus form-control text-right valorManual d-none apenasFloat" aria-describedby="ValorManualError" id="txtValorManual" name="txtValorManual" placeholder="0">
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="form-group col-lg-5 col-12">
                        <legend class="textoBorda ml-3">Ações:</legend>
                        <fieldset class="form" style="margin-bottom: 0px!important; margin-left: 0px!important">
                          <div class="d-flex flex-column col-lg-9 col-12">
                            <div class="input-group col-12 mb-3">
                              <button class="btn btn-primary btn-sisp" id="btnConsultar"><i class="fas fa-solid fa-search"></i> Consultar</button>
                            </div>
                            <div class="input-group col-12 mb-3">
                              <button class="btn btn-danger btn-sisp btn-custos" disabled id="btnCustoAtual">Atualizar custo atual</button>
                            </div>
                            <div class="input-group col-12 mb-3">
                              <button class="btn btn-danger btn-sisp btn-custos" disabled id="btnCustoNovo">Atualizar custo novo</button>
                            </div>
                          </div>
                        </fieldset>
                      </div>
                      <div class="row col-lg-12 col-12" style="margin: 0px!important; padding: 0px!important;">
                        <div class="col-lg-12 table-responsive card-body" style="max-height: 450px">
                          <table id="tabelaRecalculo" class="table table-sm table-select table-hover" width="100%">
                            <thead>
                            </thead>
                            <tbody>
                            </tbody>
                          </table>
                        </div>
                      </div>
                    </div>
                    <div class="mt-4">
                      <button type="button" id="btnGravar" class="btn btn-sisp btn-danger">Gravar</button>
                    </div>
                  </form>
                </div>
              </div><!-- card-->
            </div><!-- /.col -->
          </div><!-- /.row -->
        </div><!-- /.container-fluid -->
      </div> <!-- /.content-header -->
    </div><!-- /.content-wrapper -->

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

  <!-- ./wrapper -->
  <script src="plugins/jquery/jquery.min.js?versao=3.255.7.1"></script>
  <script src="dist/js/jquery.maskMoney.min.js?versao=3.255.7.1"></script>
  <script src="plugins/jquery-ui/jquery-ui.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/sweetalert2/sweetalert2.min.js?versao=3.255.7.1"></script>
  <script src="plugins/toastr/toastr.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/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/valida_cpf_cnpj.js?versao=3.255.7.1"></script>
  <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.255.7.1"></script>
  <script src="dist/js/dataTables.keyTable.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/driver.min.js?versao=3.255.7.1"></script>
  <script src="config.js?versao=3.255.7.1"></script>
  <script src="plugins/select2/js/select2.full.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>
    $(document).ready(async function() {
      if (getCookie('usuario') == "") {
        window.location.href = `${BASE_URI}/login`;
        return;
      }

      let usuario = getCookie('usuario');
      let empresa = getCookie('empresa');
      const nomeTela = ('<?php echo basename(__FILE__) ?>').replace('.php', '');

      ipInterno = IP_INTERNO;
      ipExterno = IP_EXTERNO;
      basicAuth = BASIC_AUTH;
      sArquivo = `${BASE_URI}/pages/recalculo_of/recalculo_of.js?versao=3.255.7.1`;

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

      await insereJavaScriptPagina(sArquivo);

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

</html>