<?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 | Fechamento de Comissão</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">
  <!--e1Google 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="dist/css/PesquisaVariosSelect2.css?versao=3.255.7.1">
  <link rel="stylesheet" href="dist/css/cadastro.css?versao=3.255.7.1">
  <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.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">
  <!-- Google Font: Source Sans Pro -->
  <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">
  <style>
    .border-Field .textoBorda {
      font-size: 1.1em !important;
      text-align: left !important;
      width: auto;
      padding: 0 10px;
      border-bottom: none;
    }

    .border-Field {
      border: 1px solid var(--font-color) !important;
      padding: 0 1.0em 0 1.0em !important;
      margin: 0 0 0 0 !important;
      -webkit-box-shadow: 0px 0px 0px 0px #000;
      box-shadow: 0px 0px 0px 0px #000;
      border-radius: 3px !important;
    }

    #progressbar li {
      width: 50%;
    }

    .actionButton {
      font-size: 15px;
      background: #3ca2d3;
      font-weight: bold;
      color: white;
      border: 0 none;
      border-radius: 0px;
      cursor: pointer;
      padding: 10px 5px;
      margin: 10px 5px;
      float: right;
    }

    .imprimirButton {
      font-size: 15px;
      background: #616161;
      font-weight: bold;
      color: white;
      border: 0 none;
      border-radius: 0px;
      cursor: pointer;
      padding: 10px 5px;
      margin: 10px 5px;
      float: right;
    }

    .lancarPagarButton {
      font-size: 15px;
      background: #3ca2d3;
      font-weight: bold;
      color: white;
      border: 0 none;
      border-radius: 0px;
      cursor: pointer;
      padding: 10px 5px;
      margin: 10px 5px;
      float: right;
    }

    .excluirButton {
      font-size: 15px;
      background: #c2121a;
      font-weight: bold;
      color: white;
      border: 0 none;
      border-radius: 0px;
      cursor: pointer;
      padding: 10px 5px;
      margin: 10px 5px;
      float: right;
    }

    .rodapeBotoes {
      border: 0 none;
      padding: 0 40px 0 40px;
      width: 94%;
      margin: 0 3% 20px 3%;
      position: relative;
      display: flex;
      align-items: end;
      justify-content: end;
    }

    .rodapeBotoes2 {
      border: 0 none;
      padding: 0 40px 0 40px;
      width: 94%;
      margin: 0 3% 20px 3%;
      position: relative;
      display: flex;
      align-items: end;
      justify-content: space-between;
    }

    .dateContainer {
      border: 0 none;
      padding: 0 40px 0 40px;
      width: 94%;
      margin: 0 3% 20px 3%;
      position: relative;
      display: flex;
      align-items: end;
      justify-content: end;
    }

    .checkboxContainer {
      border: 0 none;
      padding: 20px 40px 20px 40px;
      width: 94%;
      margin: 0 3% 0 3%;
      position: relative;
      display: flex;
      align-items: end;
      justify-content: start;
    }

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

    #tabelaResumo_length {
      label {
        opacity: 0;
      }
    }

    .theme-dark {
      --color-fat: rgba(142, 126, 15, 0.75);
      --color-lan: rgba(53, 162, 17, 0.75);
      --color-rec: rgba(16, 148, 154, 0.75);
      --color-dev: rgba(71, 63, 235, 0.75);
      --color-chq: rgba(238, 53, 53, 0.75);
      --color-man: rgba(238, 53, 53, 0.75);
      --color-font-datatable: 'white';
    }

    .theme-light {
      --color-fat: rgba(142, 126, 15, 0.5);
      --color-lan: rgba(53, 162, 17, 0.5);
      --color-rec: rgba(16, 148, 154, 0.5);
      --color-dev: rgba(71, 63, 235, 0.5);
      --color-chq: rgba(238, 53, 53, 0.5);
      --color-man: rgba(238, 53, 53, 0.5);
      --color-font-datatable: 'white';
    }
  </style>
</head>

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


    <div id="myModal" class="modal" tabindex="-1" role="dialog">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <h5 id="myModalLabel" class="modal-title"></h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body">
            <p id="myModalText"></p>
          </div>
          <div class="modal-footer">
            <button id="btnYes" type="button" class="btn btn-primary">Sim</button>
            <button id="btnNo" type="button" class="btn btn-secondary" data-dismiss="modal">Não</button>
          </div>
        </div>
      </div>
    </div>

    <div class="content-wrapper">
      <section class="content">
        <div class="content-header">
          <div class="container-fluid">
            <div class="row mb-2">
              <div class="col-sm-6 flex">
              </div>
              <div class="col-sm-6">
              </div>
            </div>
          </div>
          <div class="row justify-content-center mt-0">
            <div class="col-12 text-center p-0 mt-3 mb-2">
              <div class="card px-0 pt-4 pb-0 mt-3 mb-3">
                <div class="card-header text-center flex" style="border: none!important;box-shadow:none!important;">
                  <h2>Fechamento de Comissão
                    <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>
                  </h2>
                </div>
                <div class="row">
                  <div class="col-md-12 mx-0">
                    <form id="msform">
                      <ul id="progressbar">
                        <li class="active" id="account" style="font-size: 100%;"><strong>Geral</strong></li>
                        <li id="confirm" style="font-size: 100%;"><strong>Finalização</strong></li>
                      </ul>
                      <fieldset class="abas">
                        <div class="form-card" id="formcard1">
                          <h2 class="fs-title">Dados Gerais</h2>
                          <div class="form-row">
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" data-success="right" for="dtVencimentoDe">Vencimento de/até: </label>
                              <div class="input-group">
                                <input type="date" max="2500-12-31" class="input-default focus form-control mr-3" id="dtVencimentoDe" value="1200-01-01" name="dtVencimentoDe" class="form-control">
                                <input type="date" max="2500-12-31" class="input-default focus form-control" id="dtVencimentoAte" value="2500-12-31" name="dtVencimentoAte" class="form-control">
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" data-success="right" for="dtPagamentoDe">Pagamento de/até: </label>
                              <div class="input-group">
                                <input type="date" max="2500-12-31" class="input-default focus form-control mr-3" id="dtPagamentoDe" value="1200-01-01" name="dtPagamentoDe" class="form-control">
                                <input type="date" max="2500-12-31" class="input-default focus form-control" id="dtPagamentoAte" value="2500-12-31" name="dtPagamentoAte" class="form-control">
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" data-success="right" for="dtEmissaoDe">Emissão de/até: </label>
                              <div class="input-group">
                                <input type="date" max="2500-12-31" class="input-default focus form-control mr-3" id="dtEmissaoDe" value="1200-01-01" name="dtEmissaoDe" class="form-control">
                                <input type="date" max="2500-12-31" class="input-default focus form-control" id="dtEmissaoAte" value="2500-12-31" name="dtEmissaoAte" class="form-control">
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" data-success="right" for="txtFaturaDe">Fatura de/até: </label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control mr-3" id="txtFaturaDe" name="txtFaturaDe" class="form-control" placeholder="000000">
                                <input type="text" class="input-default focus form-control" id="txtFaturaAte" name="txtFaturaAte" class="form-control" placeholder="999999">
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtRepresentante">Representante:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtRepresentante" name="txtRepresentante" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnRepresentante" name="btnRepresentante" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaRepresentante" name="btnLimpaRepresentante" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtEntidade">Entidade Representante:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtEntidade" name="txtEntidade" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnEntidade" name="btnEntidade" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaEntidade" name="btnLimpaEntidade" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtTipoRepresentante">Tipo Representante:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtTipoRepresentante" name="txtTipoRepresentante" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnTipoRepresentante" name="btnTipoRepresentante" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaTipoRepresentante" name="btnLimpaTipoRepresentante" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtRegiaoRepresentante">Região Representante:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtRegiaoRepresentante" name="txtRegiaoRepresentante" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnRegiaoRepresentante" name="btnRegiaoRepresentante" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaRegiaoRepresentante" name="btnLimpaRegiaoRepresentante" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtPedido">Pedido:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtPedido" name="txtPedido" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnPedido" name="btnPedido" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaPedido" name="btnLimpaPedido" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtTipoPedido">Tipo Pedido:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtTipoPedido" name="txtTipoPedido" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnTipoPedido" name="btnTipoPedido" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaTipoPedido" name="btnLimpaTipoPedido" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtColecaoPedido">Coleção Pedido:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtColecaoPedido" name="txtColecaoPedido" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnColecaoPedido" name="btnColecaoPedido" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaColecaoPedido" name="btnLimpaColecaoPedido" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-0"></div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtMoeda">Moeda:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtMoeda" name="txtMoeda" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnMoeda" name="btnMoeda" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaMoeda" name="btnLimpaMoeda" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtClasse">Classe Gerencial:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtClasse" name="txtClasse" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnClasse" name="btnClasse" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaClasse" name="btnLimpaClasse" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtConta">Conta:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtConta" name="txtConta" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnConta" name="btnConta" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaConta" name="btnLimpaConta" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtHistorico">Histórico:</label>
                              <input type="text" class="input-default focus form-control" id="txtHistorico" aria-describedby="classeError" name="txtHistorico" class="form-control" placeholder="Histórico">
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtDuplicata">Duplicata:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtDuplicata" name="txtDuplicata" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnDuplicata" name="btnDuplicata" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaDuplicata" name="btnLimpaDuplicata" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtCliente">Cliente:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtCliente" name="txtCliente" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnCliente" name="btnCliente" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaCliente" name="btnLimpaCliente" type="button">
                                    <i class="m-0 p-0 fas fa-trash"></i>
                                  </button>
                                </div>
                              </div>
                            </div>
                            <div class="form-group col-lg-3 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="txtGrupoCliente">Grupo Cliente:</label>
                              <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtGrupoCliente" name="txtGrupoCliente" multiple="multiple">
                                </select>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnGrupoCliente" name="btnGrupoCliente" data-button="absolute" type="button">
                                    <i class="m-0 p-0 fas fa-search"></i>
                                  </button>
                                  <button class="btn bg-danger" id="btnLimpaGrupoCliente" name="btnLimpaGrupoCliente" 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="selectEstado">Estado:</label>
                              <div class="input-group">
                                <select class="input-default focus form-control" data-dropdown-css-class="select2-danger" id="selectEstado" aria-describedby="tipoError" class="custom-select focus">
                                  <option selected value=""></option>
                                  <option value="AC">AC</option>
                                  <option value="AL">AL</option>
                                  <option value="AM">AM</option>
                                  <option value="AP">AP</option>
                                  <option value="BA">BA</option>
                                  <option value="CE">CE</option>
                                  <option value="DF">DF</option>
                                  <option value="ES">ES</option>
                                  <option value="GO">GO</option>
                                  <option value="MA">MA</option>
                                  <option value="MG">MG</option>
                                  <option value="MS">MS</option>
                                  <option value="MT">MT</option>
                                  <option value="PA">PA</option>
                                  <option value="PB">PB</option>
                                  <option value="PE">PE</option>
                                  <option value="PI">PI</option>
                                  <option value="PR">PR</option>
                                  <option value="RJ">RJ</option>
                                  <option value="RN">RN</option>
                                  <option value="RO">RO</option>
                                  <option value="RR">RR</option>
                                  <option value="RS">RS</option>
                                  <option value="SC">SC</option>
                                  <option value="SE">SE</option>
                                  <option value="SP">SP</option>
                                  <option value="TO">TO</option>
                                </select>
                              </div>
                            </div>
                            <div class="form-group col-lg-1 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="selectFiltro">Filtro:</label>
                              <div class="input-group">
                                <select class="input-default focus form-control" data-dropdown-css-class="select2-danger" id="selectFiltro" aria-describedby="tipoError" class="custom-select focus">
                                  <option value="">Todos</option>
                                  <option selected value="P">Pendente</option>
                                  <option value="G">Pago</option>
                                  <option value="T">Pendente/Pago</option>
                                </select>
                              </div>
                            </div>
                            <div class="form-group col-lg-1 col-12">
                              <label data-error="wrong" class="labelGeral" data-success="right" for="selectStatusRepresentante">Representante:</label>
                              <div class="input-group">
                                <select class="input-default focus form-control" data-dropdown-css-class="select2-danger" id="selectStatusRepresentante" aria-describedby="tipoError" class="custom-select focus">
                                  <option value="">Todos</option>
                                  <option selected value="S">Ativos</option>
                                  <option value="N">Inativos</option>
                                </select>
                              </div>
                            </div>
                            <div class="form-group col-lg-10 col-12 d-flex align-items-end mt-0">
                              <fieldset class="form border-Field" style="margin-bottom: 0px!important; padding-left: 0px!important; margin-left: 0px!important">
                                <div class="d-flex justify-content-around">
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbFaturamento" id="cbFaturamento" checked>
                                    <label class="form-check-label" for="cbFaturamento">Faturamento</label>
                                  </div>
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbRecebimento" id="cbRecebimento" checked>
                                    <label class="form-check-label" for="cbRecebimento">Recebimento</label>
                                  </div>
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbManual" id="cbManual" checked>
                                    <label class="form-check-label" for="cbManual">Manual</label>
                                  </div>
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbDevolucao" id="cbDevolucao" checked>
                                    <label class="form-check-label" for="cbDevolucao">Devolução</label>
                                  </div>
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbEstorno" id="cbEstorno" checked>
                                    <label class="form-check-label" for="cbEstorno">Estorno</label>
                                  </div>
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbConsiderarIR" id="cbConsiderarIR" checked>
                                    <label class="form-check-label" for="cbConsiderarIR">Considerar IR</label>
                                  </div>
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbConsiderarISS" id="cbConsiderarISS" checked>
                                    <label class="form-check-label" for="cbConsiderarISS">Considerar ISS</label>
                                  </div>
                                </div>
                              </fieldset>
                            </div>
                            <div class="form-group col-lg-2 col-12">
                              <button class="btn btn-danger btn-sisp w-100" type='button' id="btnSelecionarEmpresas" style="margin-top: 28px;">Selecionar Empresas</button>
                            </div>
                            <div class="form-group col-lg-12 col-12 d-flex align-items-end">
                              <fieldset class="form border-Field" style="margin-bottom: 0px!important; padding-left: 0px!important; margin-left: 0px!important">
                                <div class="d-flex justify-content-around">
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbComZeradaFat" id="cbComZeradaFat">
                                    <label class="form-check-label" for="cbComZeradaFat">Comissão zerada fat</label>
                                  </div>
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbComZeradaRec" id="cbComZeradaRec">
                                    <label class="form-check-label" for="cbComZeradaRec">Comissão zerada rec</label>
                                  </div>
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbComAntecipada" id="cbComAntecipada">
                                    <label class="form-check-label" for="cbComAntecipada">Comissão antecipada</label>
                                  </div>
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbAnteciparTitulos" id="cbAnteciparTitulos">
                                    <label class="form-check-label" for="cbAnteciparTitulos">Antecipar Títulos Pagos</label>
                                  </div>
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbDesconsiderarSaldo" id="cbDesconsiderarSaldo">
                                    <label class="form-check-label" for="cbDesconsiderarSaldo">Desconsiderar Saldo</label>
                                  </div>
                                  <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                    <input type="checkbox" class="form-check-input" name="cbDesconsiderarFechamento" id="cbDesconsiderarFechamento">
                                    <label class="form-check-label" for="cbDesconsiderarFechamento">Desconsiderar Fechamento</label>
                                  </div>
                                </div>
                              </fieldset>
                            </div>
                          </div>
                        </div>
                        <div class="rodapeBotoes">
                          <!-- <button type="button" id="btnVoltar" style="font-size:15px;" class="btn-sisp action-button-previous my-0" data-dismiss="modal">Voltar</button> -->
                          <button type="button" id="btnConsultar" style="font-size:15px;" class="btn-sisp next actionButton m-0" data-dismiss="modal">Consultar</button>
                        </div>
                      </fieldset>
                      <fieldset class="abas">
                        <div class="checkboxContainer">
                          <fieldset class="form border-Field" style="margin-bottom: 0px!important; padding-left: 0px!important; margin-left: 0px!important">
                            <div class="d-flex justify-content-around">
                              <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                <input type="checkbox" class="form-check-input" name="cbMarcarTodos" id="cbMarcarTodos">
                                <label class="form-check-label" for="cbMarcarTodos">Marcar Todos</label>
                              </div>
                              <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                <input type="checkbox" class="form-check-input" name="cbMarcarRec" id="cbMarcarRec">
                                <label class="form-check-label" for="cbMarcarRec">Marcar REC</label>
                              </div>
                              <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                <input type="checkbox" class="form-check-input" name="cbMarcarFat" id="cbMarcarFat">
                                <label class="form-check-label" for="cbMarcarFat">Marcar FAT</label>
                              </div>
                              <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                <input type="checkbox" class="form-check-input" name="cbMarcarDev" id="cbMarcarDev">
                                <label class="form-check-label" for="cbMarcarDev">Marcar DEV</label>
                              </div>
                              <div class="icheck-primary" style="margin-top: 0.5rem !important; margin-bottom: 0.5rem !important;">
                                <input type="checkbox" class="form-check-input" name="cbMarcarMan" id="cbMarcarMan">
                                <label class="form-check-label" for="cbMarcarMan">Marcar MAN</label>
                              </div>
                            </div>
                          </fieldset>
                        </div>
                        <div class="form-card" id="datatables">
                          <h2>Receber</h2>
                          <div class="row col-12" style="margin: 0px!important; padding: 0px!important;">
                            <div class="col-lg-12 table-responsive card-body" style="max-height: 500px">
                              <table id="tabelaReceber" class="table table-sm table-select table-hover" width="100%">
                                <thead>
                                </thead>
                                <tbody>
                                </tbody>
                              </table>
                            </div>
                          </div>
                        </div>
                        <div class="checkboxContainer">
                          <div class="row">
                            <button type="button" id="btnExcluirLinhas" style="font-size:15px;" class="btn-sisp excluirButton my-0" data-dismiss="modal" title="Excluir linhas selecionadas">Excluir Linhas</button>
                            <button type="button" id="btnEstornarPagto" style="font-size:15px;" class="btn-sisp excluirButton my-0" data-dismiss="modal">Estornar Pagamento</button>
                            <button type="button" id="btnDescontarComissao" style="font-size:15px;" class="btn-sisp excluirButton my-0" data-dismiss="modal">Descontar Comissão de Faturamento</button>
                            <!-- <button type="button" id="btnLancarEstorno" style="font-size:15px;" class="btn-sisp excluirButton my-0" data-dismiss="modal">Lançar Estorno</button> -->
                          </div>
                        </div>
                        <div class="form-card" id="datatables">
                          <div class="row col-12" style="margin: 0px!important; padding: 0px!important;">
                            <h2>Resumo</h2>
                            <div class="col-lg-12 table-responsive card-body" style="max-height: 450px">
                              <table id="tabelaResumo" class="table table-sm table-select table-hover" width="100%">
                                <thead>
                                </thead>
                                <tbody>
                                </tbody>
                              </table>
                            </div>
                          </div>
                        </div>
                        <div class="dateContainer">
                          <button type="button" id="btnLancarPagar" style="font-size:15px;" class="btn-sisp lancarPagarButton my-0" data-dismiss="modal">Lançar Pagar</button>
                        </div>
                        <div class="dateContainer">
                          <div class="col-auto text-left">
                            <label data-error="wrong" class="labelGeral" data-success="right" for="dtFechamento">Fechamento:</label>
                            <input type="date" class="input-default focus form-control" id="dtFechamento" aria-describedby="classeError" value="<?php echo date('Y-m-d'); ?>" name="dtFechamento" class="form-control">
                          </div>
                          <div class="col-auto text-left">
                            <label data-error="wrong" class="labelGeral" data-success="right" for="dtCompetencia">Competência:</label>
                            <input type="date" class="input-default focus form-control" id="dtCompetencia" aria-describedby="classeError" value="<?php echo date('Y-m-d'); ?>" name="dtCompetencia" class="form-control">
                          </div>
                          <div class="col-auto text-left">
                            <label data-error="wrong" class="labelGeral" data-success="right" for="dtVenctoPagar">Vencimento Pagar:</label>
                            <input type="date" class="input-default focus form-control" id="dtVenctoPagar" aria-describedby="classeError" value="<?php echo date('Y-m-d'); ?>" name="dtVenctoPagar" class="form-control">
                          </div>
                          <div class="col-auto text-left">
                            <label data-error="wrong" class="labelGeral" data-success="right" for="txtValorSelPago">Valor sel a ser pago:</label>
                            <input type="text" class="input-default focus form-control" id="txtValorSelPago" aria-describedby="classeError" name="txtValorSelPago" class="form-control" placeholder="0.00" disabled>
                          </div>
                          <div class="col-auto text-left">
                            <label data-error="wrong" class="labelGeral" data-success="right" for="txtValorTotPago">Valor total a ser pago:</label>
                            <input type="text" class="input-default focus form-control" id="txtValorTotPago" aria-describedby="classeError" name="txtValorTotPago" class="form-control" placeholder="0.00" disabled>
                          </div>
                        </div>
                        <div class="rodapeBotoes2">
                          <div class="d-flex align-items-end">
                            <div class="col-auto text-left row">
                              <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 class="col-auto">
                                <button type="button" id="btnImprimir" style="font-size:15px;" class="btn-sisp imprimirButton my-0" data-dismiss="modal">Imprimir</button>
                              </div>
                            </div>
                            <div class="col-auto">
                              <div class="row">
                                <button type="button" id="btnVoltar" style="font-size:15px;" class="btn-sisp action-button-previous previous my-0" data-dismiss="modal">Voltar</button>
                                <button type="button" id="btnFechamento" style="font-size:15px;" class="btn-sisp action-button my-0" data-dismiss="modal">Fechamento</button>
                              </div>
                            </div>
                          </div>
                      </fieldset>
                    </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>
    </div>
  </div>

  <div class="modal fade" id="modal-duplicatas" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="modal-duplicatas" aria-hidden="true">
    <div class="modal-dialog modal-xl">
      <div class="modal-content">
        <div class="modal-header">
          <h4 class="modal-title" id="tituloDesdobra">Duplicatas com problemas no lançamento de comissão</h4>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
          <div class="col-12">
            <div class="card">
              <div class="col-sm-12 table-responsive card-body">
                <table id="tabelaDuplicatas" class="table table-sm table-select table-hover" width="100%">
                  <thead>
                  </thead>
                  <tbody>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
          <div class="modal-footer justify-content-start">
            <button class="btn bg-gradient-danger btn-sisp ml-auto" data-dismiss="modal" id="btnFecharDuplicatas">Fechar</button>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="modal fade" id="modal-descontar-comissao" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="modal-duplicatas" aria-hidden="true">
    <div class="modal-dialog modal-xl">
      <div class="modal-content">
        <div class="modal-header">
          <h4 class="modal-title" id="tituloDesdobra">Desconto de Comissão no Faturamento</h4>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
          <div class="card-body">
            <div class="form-row col-lg-12 col-12">
              <div class="form-group col-lg-4 col-12">
                <label data-error="wrong" data-success="right" for="dtVencimentoDesconto">Pagamento de/até: </label>
                <div class="input-group">
                  <input type="date" max="2500-12-31" class="input-default focus form-control mr-3" id="dtVencimentoDescontoDe" value="1200-01-01" name="dtVencimentoDescontoDe" class="form-control">
                  <input type="date" max="2500-12-31" class="input-default focus form-control" id="dtVencimentoDescontoAte" value="2500-12-31" name="dtVencimentoDescontoAte" class="form-control">
                </div>
              </div>
              <div class="form-group col-lg-4 col-12">
                <label data-error="wrong" data-success="right" for="dtPagamentoDesconto">Pagamento de/até: </label>
                <div class="input-group">
                  <input type="date" max="2500-12-31" class="input-default focus form-control mr-3" id="dtPagamentoDescontoDe" value="1200-01-01" name="dtPagamentoDescontoDe" class="form-control">
                  <input type="date" max="2500-12-31" class="input-default focus form-control" id="dtPagamentoDescontoAte" value="2500-12-31" name="dtPagamentoDescontoAte" class="form-control">
                </div>
              </div>
              <div class="form-group col-lg-4 col-12">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtClienteDesconto">Cliente:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtClienteDesconto" name="txtClienteDesconto" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnClienteDesconto" name="btnClienteDesconto" data-button="absolute" type="button">
                      <i class="m-0 p-0 fas fa-search"></i>
                    </button>
                    <button class="btn bg-danger" id="btnLimpaClienteDesconto" name="btnLimpaClienteDesconto" 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="txtRepresentanteDesconto">Representante:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtRepresentanteDesconto" name="txtRepresentanteDesconto" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnRepresentanteDesconto" name="btnRepresentanteDesconto" data-button="absolute" type="button">
                      <i class="m-0 p-0 fas fa-search"></i>
                    </button>
                    <button class="btn bg-danger" id="btnLimpaRepresentanteDesconto" name="btnLimpaRepresentanteDesconto" 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="txtCoordenadorDesconto">Coordenador:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtCoordenadorDesconto" name="txtCoordenadorDesconto" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnCoordenadorDesconto" name="btnCoordenadorDesconto" data-button="absolute" type="button">
                      <i class="m-0 p-0 fas fa-search"></i>
                    </button>
                    <button class="btn bg-danger" id="btnLimpaCoordenadorDesconto" name="btnLimpaCoordenadorDesconto" 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="txtDuplicataDesconto">Duplicata:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtDuplicataDesconto" name="txtDuplicataDesconto" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnDuplicataDesconto" name="btnDuplicataDesconto" data-button="absolute" type="button">
                      <i class="m-0 p-0 fas fa-search"></i>
                    </button>
                    <button class="btn bg-danger" id="btnLimpaDuplicataDesconto" name="btnLimpaDuplicataDesconto" type="button">
                      <i class="m-0 p-0 fas fa-trash"></i>
                    </button>
                  </div>
                </div>
              </div>
              <div class="form-group col-lg-3 col-12">
                <label data-error="wrong" class="labelGeral" data-success="right" for="selectBuscarCanceladasDesconto">Buscar com status cancelada:</label>
                <div class="input-group">
                  <select class="input-default focus form-control" data-dropdown-css-class="select2-danger" id="selectBuscarCanceladasDesconto" aria-describedby="tipoError" class="custom-select focus">
                    <option selected value="N">Não</option>
                    <option value="S">Sim</option>
                  </select>
                </div>
              </div>
              <div class="form-group col-lg-3 col-12">
                <label data-error="wrong" class="labelGeral" data-success="right" for="selectStatusComissaoDesconto">Comissão:</label>
                <div class="input-group">
                  <select class="input-default focus form-control" data-dropdown-css-class="select2-danger" id="selectStatusComissaoDesconto" aria-describedby="tipoError" class="custom-select focus">
                    <option selected value="">Todas</option>
                    <option value="P">Pagas</option>
                    <option value="N">Não pagas</option>
                  </select>
                </div>
              </div>
              <div class="form-group col-lg-2 col-12">
                <button class="btn btn-primary btn-sisp w-100" type='button' id="btnConsultarDesconto" style="margin-top: 28px;">Consultar</button>
              </div>
            </div>
            <div class="col-12">
              <div class="col-sm-12 table-responsive card-body">
                <table id="tabelaDesconto" class="table table-sm table-select table-hover" width="100%">
                  <thead>
                  </thead>
                  <tbody>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
        <div class="modal-footer justify-content-start">
          <button class="btn bg-gradient-success btn-sisp" id="btnGravarDesconto">Gravar</button>
          <button class="btn bg-gradient-danger btn-sisp ml-auto" data-dismiss="modal" id="btnFecharDesconto">Fechar</button>
        </div>
      </div>
    </div>
  </div>

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

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->
  </div>

  <!-- jQuery -->
  <script src="plugins/jquery/jquery.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/cliente/entidade.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/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/jquery.maskMoney.min.js?versao=3.255.7.1"></script>
  <script src="dist/js/driver.min.js?versao=3.255.7.1"></script>
  <script src="dist/js/dataTables.keyTable2.js?versao=3.255.7.1"></script>
  <script type="text/javascript" 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');

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

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

      const permissaoUsuarioLogado = await permissaoAcessos("FECHAMENTO_REPCOMISSAO");

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

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

      const nomeTela = ('<?php echo basename(__FILE__) ?>').replace('.php', '');
      habilitaCamposObrigatoriosTela(nomeTela);
    });
  </script>
</body>

</html>