<!DOCTYPE html>
<html>

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

  <!-- Theme style -->
  <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.255.15.1">
  <link rel="stylesheet" href="../dist/css/custom.css?versao=3.255.15.1">
  <link rel="stylesheet" href="../dist/css/sisplan.css?versao=3.255.15.1">
  <link rel="stylesheet" type="text/css" href="../plugins/datatables-keytable/css/keyTable.bootstrap4.min.css">
  <!-- Toastr -->
  <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?versao=3.255.15.1">
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.255.15.1">
  <link rel="shortcut icon" href="../favicon.ico">
  <link rel="stylesheet" type="text/css" href="../dist/css/driver.min.css?versao=3.255.15.1" />
  <link rel="stylesheet" href="../dist/css/jquery-ui.css?versao=3.255.15.1">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">


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

  .card {
    box-shadow: none !important;
    border-radius: 0 !important;
    margin-bottom: 0 !important;
  }

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

  .fa-angle-right,
  .fa-angle-down {
    color: #343a40;
  }

  .header-content-page .title-page,
  .title-content-page .title,
  .title-page {
    font-size: 20px;
    line-height: normal;
    font-weight: 500;
    color: #343a40;
    margin: 0;
    font-family: Roboto, Arial, sans-serif;
  }

  #DadosGerais>.card,
  #obs>.card {
    background: #f7f7f7;
  }
</style>


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

  <script type="text/javascript" src="../config.js"></script>
  <div class="wrapper">

    <?php
    include_once('../../../menu.php');
    ?>

    <div class="content-wrapper">
      <div class="content-header">
        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-sm-6">
              <h3 class="col-mb=2"></h3>
            </div>
            <div class="col-sm-6">
              <!-- <ol class="breadcrumb float-sm-right">
                <li class="breadcrumb-item"><a href="../pagar">Pagar</a></li>
                <li class="breadcrumb-item active">Cadastro</li>
              </ol> -->
            </div>
          </div>
          <div class="row">
            <div class="col-12">
              <div class="card" style="height:auto;">
                <div class="card-header bg-dark">
                  <div class="row flex">
                    <h4 class="text-white">Cadastro Contas a Pagar </h4>
                    <!-- <div class="d-flex justity-content-between"> -->
                    <button title="Tutorial" class="btn btn-info btn-sm ml-2" id="tutorial">
                      <i class="fas fa-question-circle"></i>
                    </button>
                    <div class="col-md-2 col-12 py-1 ml-auto d-none" id="labelParcela">
                      <label style="color: red;font-size: 20px;color: red;margin: 0;"></label>
                      <!-- </div> -->
                    </div>
                  </div>
                </div>
                <fieldset>
                  <div class="card-body" style="padding-left: 0rem!important; padding-right: 0rem!important;">
                    <form id="msform" name="msform">
                      <div class="card card-header" role="tab" id="geral">
                        <a style="width:100%;" data-toggle="collapse" data-parent="#DadosGerais" href="#DadosGerais" aria-expanded="true" aria-controls="collapseOne1">
                          <div class="row">
                            <div style="max-width:20px;margin-top:auto; margin-bottom: auto" class="col-1">
                              <i class="fas fa-angle-down"></i>
                            </div>
                            <div class="col-11">
                              <h4 class="title-page">
                                Dados Gerais
                              </h4>
                            </div>
                          </div>
                        </a>
                      </div>
                      <div class="collapse show" id="DadosGerais">
                        <div class="card card-body">
                          <div class="col-12 py-3 px-3">
                            <div class="icheck-primary">
                              <input type="checkbox" id="cbDataEntradaIgualVencto">
                              <label for="cbDataEntradaIgualVencto">Entrada igual ao mês do vencimento</label>
                            </div>
                          </div>
                          <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="dados-tab">
                            <input type="text" required class="input-default focus form-control validate d-none" id="txtEmpId" name="txtEmpId">
                            <input type="text" class="d-none" id="txtNum_ap">
                            <div class="form-row col-12 m-1">
                              <div class="form-group col-md-6 col-xl-1 col-lg-2 col-12" id="NotaFiscalInfoTour">
                                <label>Nota Fiscal *</label>
                                <div class="relative">
                                  <input type="text" maxlength="10" autocomplete="off" value="" class="input-default focus form-control validate" required="required" pattern="[0-9]+$" id="txtNotaFiscal" name="txtNotaFiscal">
                                </div>
                              </div>

                              <div class="form-group col-md-2 col-12 d-none" id="DupliInfoTour">
                                <label>Dupli</label>
                                <div class="relative">
                                  <input type="text" maxlength="10" autocomplete="off" value="" class="input-default focus form-control validate" pattern="[0-9]+$" id="txtDupli" name="txtDupli" readonly>
                                </div>
                              </div>

                              <div class="form-group group-default col-md-3 col-lg-2 col-xl-2 col-12">
                                <label>Data de Emissão</label>
                                <div class="relative" id="DataEmissao">
                                  <input type="date" max="2500-12-31" class="input-default focus form-control validate" id="txtDTemissao" name="txtDTemissao">
                                </div>
                              </div>

                              <div class="col-md-3 col-lg-2 col-xl-2 col-12 divDtEntrada">
                                <div class="flex justify-content-between">
                                  <label>Data de Entrada</label>
                                </div>
                                <div class="relative" id="DataEmissao">
                                  <input type="date" max="2500-12-31" class="input-default focus form-control validate" id="txtDTentrada" name="txtDTentrada">
                                </div>
                              </div>

                              <div class="col-md-6 col-lg-4 col-xl-5 col-12" id="FornecedorInfoTour">
                                <label data-error="wrong" data-success="right" for="txtFornecedor">Fornecedor *</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtFornecedor" name="txtFornecedor" class="form-control" placeholder="Fornecedor">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btn-Fornecedor" name="btn-Fornecedor" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btn-limpa-Fornecedor" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>

                              <div class="d-none">
                                <input type="text" autocomplete="off" maxlength="13" value="" class="input-default focus form-control validate" id="txtValorPago" name="txtValorPago">
                              </div>

                              <div class="form-group group-default col-md-3 col-lg-3 col-xl-2 col-12" id="divStatus">
                                <label for="Sstatus">Status *</label>
                                <div class="relative">
                                  <select id="txtStatus" name="txtStatus" class="input-default focus form-control validate" required>
                                    <option value="" selected>Selecione uma opção</option>
                                    <option value="DUPL" id="1">Duplicata</option>
                                    <option value="ANTE" id="2">Antecipação</option>
                                    <option value="ORCA" id="3">Orçamento</option>
                                  </select>
                                </div>
                              </div>
                              <div class="col-md-3 col-12" id="ClasseInfoTour">
                                <label data-error="wrong" data-success="right" for="txtClasse">Classe *</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" required class="input-default focus form-control" id="txtClasse" name="txtClasse" class="form-control" placeholder="Classe">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btn-Classe" name="btn-Classe" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btn-limpa-Classe" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>
                              <div class="col-md-3 col-12 form-group" id="BancoInfoTour">
                                <label data-error="wrong" data-success="right" for="txtBanco">Banco *</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtBanco" name="txtBanco" class="form-control" placeholder="Banco">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btn-Banco" name="btn-Banco" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btn-limpa-Banco" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>

                              <div class="col-md-3 col-12 form-group" id="ContaInfoTour">
                                <label data-error="wrong" data-success="right" for="txtConta">Conta *</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtConta" name="txtConta" class="form-control" placeholder="Conta">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btn-Conta" name="btn-Conta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btn-limpa-Conta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>
                              <div class="col-md-3 col-lg-12 col-xl-3 col-12 form-group" id="SituacaoInfoTour">
                                <label data-error="wrong" data-success="right" for="txtSituacao">Situação *</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtSituacao" name="txtSituacao" class="form-control" placeholder="Situação">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btn-Situacao" name="btn-Situacao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btn-limpa-Situacao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>

                              <div class="form-group group-default col-md-2 col-12" id="ValorInfoTour">
                                <label>Valor Total *</label>
                                <div class="relative">
                                  <input type="text" autocomplete="off" maxlength="10" value="" class="input-default focus form-control validate" id="txtValor" name="txtValor">
                                </div>
                              </div>
                              <input type="text" autocomplete="off" class="input-default focus form-control d-none" id="txtLancamento" name="txtLancamento" class="form-control">

                              <div class="form-group group-default col-md-2 col-12 divParcela" id="ValorParcelaInfoTour">
                                <label>Valor Parcela</label>
                                <div class="relative">
                                  <input type="text" autocomplete="off" maxlength="10" value="" class="input-default focus form-control validate" id="txtValorParcela" name="txtValorParcela">
                                </div>
                              </div>
                              <div class="form-group group-default col-md-2 col-12 divParcela" id="ParcelaInfoTour">
                                <label>Parcelas *</label>
                                <div class="relative">
                                  <input type="text" autocomplete="off" value="1" class="input-default focus form-control validate" id="txtParcela" name="txtParcela">
                                </div>
                              </div>
                              <div class="form-group group-default col-md-2 col-12 divParcela" id="IntervaloDiasInfoTour">
                                <label>Intervalo dias </label>
                                <div class="relative">
                                  <input type="text" autocomplete="off" value="" class="input-default focus form-control validate" id="txtIntervaloDias" name="txtIntervaloDias" value="0">
                                </div>
                              </div>
                              <div class="form-group group-default col-md-2 col-12">
                                <label>1º Vencimento</label>
                                <div class="relative">
                                  <input type="date" max="2500-12-31" class="input-default focus form-control validate" id="txtDTvencimento" name="txtDTvencimento">
                                  <input type="date" max="2500-12-31" class="input-default focus form-control validate d-none" id="txtDTvencimentoBase" name="txtDTvencimentoBase">
                                </div>
                              </div>
                              <div class="form-group group-default col-md-2 col-12 mt-4 divParcela">
                                <div class="icheck-primary" style="margin-top: 27px;">
                                  <input type="checkbox" id="cbVenctoMesmoDia"> <label for="cbVenctoMesmoDia">Vencimento no mesmo dia</label>
                                </div>
                              </div>
                              <div class="form-group group-default col-md-2 col-12">
                                <label for="Sstatus">Tipo Documento</label>
                                <div class="relative">
                                  <select id="txtTipoDocumento" name="txtTipoDocumento" class="input-default focus form-control validate" <option value="" selected>Selecione uma opção</option>
                                    <option value="01">01 - Boleto mesmo banco</option>
                                    <option value="02">02 - Boleto outros bancos</option>
                                    <option value="03">03 - Tributos com código de barras</option>
                                    <option value="04">04 - Transferência mesmo banco</option>
                                    <option value="05">05 - Transferência outros bancos</option>
                                    <option value="06">06 - Pix</option>
                                  </select>
                                </div>
                              </div>
                              <div class="form-group group-default col-md-3 col-lg-6 col-xl-3 col-12" id="divOcorrencia">
                                <label data-error="wrong" data-success="right" for="txtOcorrencia">Ocorrência</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtOcorrencia" name="txtOcorrencia" class="form-control" placeholder="Ocorrência">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnOcorrencia" name="btnOcorrencia" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btnLimpaOcorrencia" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>
                              <div class="form-group group-default col-xl-4 col-12" id="divBarraBoleto">
                                <label data-error="wrong" data-success="right" for="txtBarraBoleto">Barra Boleto</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtBarraBoleto" name="txtBarraBoleto" class="form-control" placeholder="Barra Boleto">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnGerarBoleto" type="button">Gerar</button>
                                  </div>
                                </div>
                              </div>
                              <div class="form-group col-xl-3 col-12 divEmpresa">
                                <label for="txtEmpresa">Empresa:</label>
                                <div class="relative">
                                  <select class="drilldown-item form-control focus" id="txtEmpresa" style="border-color: #a9a9a9" disabled>
                                  </select>
                                </div>
                              </div>
                              <div class="form-row col-12 m-0 p-0">
                                <div class="form-group group-default col-md-2 col-12">
                                  <label>Banco Favorecido</label>
                                  <div class="relative">
                                    <input type="text" autocomplete="off" value="" class="input-default focus form-control validate" id="txtBancoFavor" name="txtBancoFavor" placeholder="Banco">
                                  </div>
                                </div>
                                <div class="form-group group-default col-md-2 col-12">
                                  <label>Conta Favorecido</label>
                                  <div class="relative">
                                    <input type="text" autocomplete="off" value="" class="input-default focus form-control validate" id="txtContaFavor" name="txtContaFavor" placeholder="Conta">
                                  </div>
                                </div>
                                <div class="form-group group-default col-md-1 col-12">
                                  <label>Dígito</label>
                                  <div class="relative">
                                    <input type="text" autocomplete="off" value="" class="input-default focus form-control validate" id="txtDigitoContaFavor" name="txtDigitoContaFavor" placeholder="Dígito">
                                  </div>
                                </div>
                                <div class="form-group group-default col-md-2 col-12">
                                  <label>Agência Favorecido</label>
                                  <div class="relative">
                                    <input type="text" autocomplete="off" value="" class="input-default focus form-control validate" id="txtAgenciaFavor" name="txtAgenciaFavor" placeholder="Agência">
                                  </div>
                                </div>
                                <div class="form-group group-default col-md-1 col-12">
                                  <label>Dígito</label>
                                  <div class="relative">
                                    <input type="text" autocomplete="off" value="" class="input-default focus form-control validate" id="txtDigitoAgenciaFavor" name="txtDigitoAgenciaFavor" placeholder="Dígito">
                                  </div>
                                </div>
                                <div class="form-group group-default col-md-2 col-12 d-flex align-items-end justify-content-start">
                                  <button class="btn btn-primary btn-sisp" id="btnBuscarEntidade" title="Clique para buscar o banco, conta e agência do cliente informado">Buscar da Entidade</button>
                                </div>
                              </div>
                              <div class="form-group group-default col-md-1 col-12 divParcela">
                                <input id="btnGerarAp" type="button" style="font-size:15px; float: left; margin-top: 23px;" class="btn btn-danger btn-sisp action-button" value="Gerar AP's">
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="card card-header" role="tab" id="observacao">
                        <a style="width:100%;" data-toggle="collapse" data-parent="#obs" href="#obs" aria-expanded="true" aria-controls="collapseOne1">
                          <div class="row">
                            <div style="max-width:20px;margin-top:auto; margin-bottom: auto" class="col-1">
                              <i class="fas fa-angle-right"></i>
                            </div>
                            <div class="col-11">
                              <h4 class="title-page">
                                Observação
                              </h4>
                            </div>
                          </div>
                        </a>
                      </div>
                      <div class="collapse" id="obs">
                        <div class="card card-body">
                          <div class="form-row pt-2">
                            <div class="form-group group-default col-12">
                              <label>Observação</label>
                              <textarea style="resize: none" id="txtObs" placeholder="Observação" class="input-default focus form-control validate" rows="4"></textarea>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="col-12" style="margin-top: 10px">
                        <table id="tabelaParcelas" class="table table-responsive-sm table-select table-hover" width="100%">
                          <thead>
                            <tr>
                            </tr>
                          </thead>
                          <tbody>
                          </tbody>
                        </table>
                      </div>
                      <div class="group-button mr-2">
                        <input id="btnGravar" type="submit" style="font-size:15px;" class="btn btn-danger btn-sisp action-button" value="Gravar">
                        <button type="button" id="btnVoltar" style="font-size:15px;" class="btn btn-success btn-sisp action-button-previous" data-dismiss="modal">Voltar</button>
                      </div>
                    </form>
                  </div>
                </fieldset>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="modal fade" id="modalGerarBoleto" tabindex="-1" role="dialog" aria-labelledby="modalGerarBoleto" aria-hidden="true">
      <div class="modal-dialog modal-lg">
        <div class="modal-content">
          <div class="modal-header">
            <h4 class="modal-title">Gerar Barra Boleto</h4>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body p-4">
            <div class="form-row col-12">
              <div class="form-group col-12">
                <label data-error="wrong" data-success="right" for="txtLinhaDigitavel">Linha Digitável:</label>
                <div class="input-group">
                  <input type="text" class="input-default focus form-control" id="txtLinhaDigitavel" name="txtLinhaDigitavel" class="form-control" placeholder="Linha Digitável">
                </div>
              </div>
              <div class="col-lg-3 col-6" style="margin-top:5px">
                <button id="btnConfirmarBoleto" type="button" class="btn btn-primary btn-block mt-2">
                  Confirmar
                </button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>


    <aside class="control-sidebar control-sidebar-dark">

    </aside>
    <?php
    include_once('../../../modais.php');
    ?>
    <?php include_once('../../../menu_fiscal.php'); ?>
  </div>

  <script src="../plugins/jquery/jquery.min.js?versao=3.255.15.1"></script>
  <script src="../dist/js/jquery.maskMoney.min.js?versao=3.255.15.1"></script>
  <script src="../plugins/jquery-ui/jquery-ui.min.js?versao=3.255.15.1"></script>
  <script type="text/javascript" src="../dist/js/jquery.dataTables.js?versao=3.255.15.1"></script>
  <script type="text/javascript" src="../dist/js/dataTables.bootstrap4.min.js?versao=3.255.15.1"></script>
  <script src="../plugins/sweetalert2/sweetalert2.min.js?versao=3.255.15.1"></script>
  <script src="../plugins/toastr/toastr.min.js?versao=3.255.15.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.255.15.1"></script>
  <script src="../dist/js/adminlte.min.js?versao=3.255.15.1"></script>
  <script src="../dist/js/requisicoes.js?versao=3.255.15.1"></script>
  <script src="../dist/js/loadingoverlay.min.js?versao=3.255.15.1"></script>
  <script src="../dist/js/valida_cpf_cnpj.js?versao=3.255.15.1"></script>
  <script src="../plugins/jquery-validation/jquery.validate.min.js?versao=3.255.15.1"></script>
  <script src="../dist/js/dataTables.keyTable.js?versao=3.255.15.1"></script>
  <script src="../dist/js/sisplan.js?versao=3.255.15.1"></script>
  <script src="../utils/funcoes.js?versao=3.255.15.1"></script>
  <script src="../utils/cookies.js?versao=3.255.15.1"></script>
  <script src="../dist/js/driver.min.js?versao=3.255.15.1"></script>
  <script>
    $(document).ready(async function() {
      if (getCookie('usuario') == "") {
        window.location.href = `${BASE_URI}/login`;
        return;
      }

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

      ipInterno = IP_INTERNO;
      ipExterno = IP_EXTERNO;
      basicAuth = BASIC_AUTH;
      sArquivo = `${BASE_URI}/pages/pagar/cadastro_pagar/pagar.js?versao=3.255.15.1`;
      const nomeTela = ('<?php echo basename(__FILE__) ?>').replace('.php', '');

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

      const permissaoUsuarioLogado = await permissaoAcessos("PAGAR");

      if (permissaoUsuarioLogado.INCLUI == 'N') {
        await criaMensagemErro("Sem permissão para incluir!", () => {
          window.location.href = `${BASE_URI}/pagar`
        });
        return;
      }

      await insereJavaScriptPagina(sArquivo);

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

</html>