<!-- <?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>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="dist/css/custom.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="dist/css/dataTables.bootstrap4.min.css?versao=3.2512.9.1" type="text/css" />
  <link rel="stylesheet" href="dist/css/driver.min.css?versao=3.2512.9.1" type="text/css" />
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="dist/css/sisplan.newColorsButtons.css?versao=3.2512.9.1" type="text/css" />
  <link rel="stylesheet" href="dist/css/sisplan.adjustDataTableButtons.css?versao=3.2512.9.1" type="text/css" />
  <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.2512.9.1" type="text/css">
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="plugins/overlayScrollbars/css/OverlayScrollbars.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>
  <link rel="shortcut icon" href="favicon.ico">
</head>
<style>
  #tabelaRecalculo td div button {
    padding: .0rem .5rem;
    margin: .0rem;
  }

  #tabelaRecalculo td {
    padding: 5px 8px !important;
  }

  .textoBorda {
    font-size: 1.0em !important;
    text-align: left !important;
    width: auto;
    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;
    border-radius: 4px;
  }

  .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;
    margin-top: 3px;
  }

  .input-custo-rec,
  .input-valor-rec,
  .input-maquina-rec {
    height: 1.5625rem;
  }
</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 flex">
              <h1 class="m-0 text-dark">Recálculo de Preço de Terceiros </h1>
              <button type="button" title="Tutorial" class="btn btn-info btn-sm ml-2" id="tutorial" style="color: white;">
                <i class="fas fa-question-circle"></i>
              </button>
            </div>
          </div>
        </div>
        <div class="card col-12 container-fluid">
          <div id="campostour">
            <div class="row card-body d-flex justify-content-start">
              <div class="form-group col-lg-4 col-12">
                <label data-error="wrong" data-success="right" for="dtDe">Período de/até:</label>
                <div class="relative">
                  <div class="input-group">
                    <input type="date" max="2500-12-31" class="input-default focus form-control" 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="Empresa">
                  <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="Setor">
                  <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="Coleção">
                  <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="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">
                <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-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" style="align-items: baseline;">
                      <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">
                      <button class="btn btn-primary btn-sisp" id="btnConsultar"><span class="fas fa-search"></span> Consultar</button>
                    </div>
                    <div class="input-group col-12">
                      <button class="btn btn-secondary btn-sisp btn-custos" disabled id="btnCustoAtual"><span class="fas fa-cogs"></span> Atualizar custo atual</button>
                    </div>
                    <div class="input-group col-12">
                      <button class="btn btn-primary btn-sisp btn-custos" disabled id="btnCustoNovo"><span class="fas fa-cogs"></span> 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" style="max-height: 400px">
                  <table id="tabelaRecalculo" class="table table-sm-sisp table-select table-hover" width="100%">
                    <thead>
                    </thead>
                    <tbody>
                    </tbody>
                  </table>
                </div>
              </div>
              <div class="col-12 mt-4">
                <button class="btn btn-sisp btnVerde d-none" id="btnGravar"><span class="fas fa-save"></span> Gravar</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <aside class="control-sidebar control-sidebar-dark">
  </aside>
  <?php
  include_once('../../modais.php');
  ?>
  <script src="plugins/jquery/jquery.min.js?versao=3.2512.9.1"></script>
  <script src="dist/js/jquery.maskMoney.min.js?versao=3.2512.9.1"></script>
  <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.2512.9.1"></script>
  <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.2512.9.1"></script>
  <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.2512.9.1"></script>
  <script src="plugins/sweetalert2/sweetalert2.min.js?versao=3.2512.9.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.2512.9.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.2512.9.1"></script>
  <script src="dist/js/adminlte.min.js?versao=3.2512.9.1"></script>
  <script src="dist/js/requisicoes.js?versao=3.2512.9.1"></script>
  <script src="dist/js/loadingoverlay.min.js?versao=3.2512.9.1"></script>
  <script src="dist/js/valida_cpf_cnpj.js?versao=3.2512.9.1"></script>
  <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.2512.9.1"></script>
  <script src="dist/js/dataTables.keyTable.js?versao=3.2512.9.1"></script>
  <script src="dist/js/sisplan.js?versao=3.2512.9.1"></script>
  <script src="utils/funcoes.js?versao=3.2512.9.1"></script>
  <script src="utils/cookies.js?versao=3.2512.9.1"></script>
  <script src="dist/js/driver.min.js?versao=3.2512.9.1"></script>
  <script src="config.js?versao=3.2512.9.1"></script>
  <script src="plugins/select2/js/select2.full.min.js?versao=3.2512.9.1"></script>
  <script src="plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.2512.9.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.2512.9.1`;

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

      await insereJavaScriptPagina(sArquivo);

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

</html>