function Gerar()
 {
     @session_start();
     $this->__pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $this->__titulo = "Software Patch - Listagem";
     foreach ($_GET as $var => $val) {
         // passa todos os valores obtidos no GET para atributos do objeto
         $this->{$var} = $val === "" ? null : $val;
     }
     $this->addBanner("http://ieducar.dccobra.com.br/intranet/imagens/nvp_top_intranet.jpg", "http://ieducar.dccobra.com.br/intranet/imagens/nvp_vert_intranet.jpg", "Intranet");
     $this->addCabecalhos(array("Software", "Data Patch"));
     // Filtros de Foreign Keys
     $opcoes = array("" => "Selecione");
     if (class_exists("clsPmicontrolesisSoftware")) {
         $objTemp = new clsPmicontrolesisSoftware();
         $lista = $objTemp->lista();
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes["{$registro['cod_software']}"] = "{$registro['nm_software']}";
             }
         }
     } else {
         echo "<!--\nErro\nClasse clsPmicontrolesisSoftware nao encontrada\n-->";
         $opcoes = array("" => "Erro na geracao");
     }
     $this->campoLista("ref_cod_software", "Software", $opcoes, $this->ref_cod_software);
     // outros Filtros
     $this->campoData("data_patch", "Data Patch", $this->data_patch, false);
     // Paginador
     $this->__limite = 20;
     $this->__offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->__limite - $this->__limite : 0;
     $obj_software_patch = new clsPmicontrolesisSoftwarePatch();
     $obj_software_patch->setOrderby("data_patch DESC");
     $obj_software_patch->setLimite($this->__limite, $this->__offset);
     $lista = $obj_software_patch->lista(null, null, $this->ref_cod_software, $this->data_patch_ini, $this->data_patch_fim, null, null, 1);
     $total = $obj_software_patch->_total;
     // monta a lista
     if (is_array($lista) && count($lista)) {
         foreach ($lista as $registro) {
             // muda os campos data
             $registro["data_patch_time"] = strtotime(substr($registro["data_patch"], 0, 16));
             $registro["data_patch_br"] = date("d/m/Y", $registro["data_patch_time"]);
             $registro["data_cadastro_time"] = strtotime(substr($registro["data_cadastro"], 0, 16));
             $registro["data_cadastro_br"] = date("d/m/Y H:i", $registro["data_cadastro_time"]);
             $registro["data_exclusao_time"] = strtotime(substr($registro["data_exclusao"], 0, 16));
             $registro["data_exclusao_br"] = date("d/m/Y H:i", $registro["data_exclusao_time"]);
             // pega detalhes de foreign_keys
             if (class_exists("clsFuncionario")) {
                 $obj_ref_funcionario_cad = new clsFuncionario($registro["ref_funcionario_cad"]);
                 $det_ref_funcionario_cad = $obj_ref_funcionario_cad->detalhe();
                 if (is_object($det_ref_funcionario_cad["idpes"])) {
                     $det_ref_funcionario_cad = $det_ref_funcionario_cad["idpes"]->detalhe();
                     $registro["ref_funcionario_cad"] = $det_ref_funcionario_cad["nome"];
                 } else {
                     $pessoa = new clsPessoa_($det_ref_funcionario_cad["idpes"]);
                     $det_ref_funcionario_cad = $pessoa->detalhe();
                     $registro["ref_funcionario_cad"] = $det_ref_funcionario_cad["nome"];
                 }
             } else {
                 $registro["ref_funcionario_cad"] = "Erro na geracao";
                 echo "<!--\nErro\nClasse nao existente: clsFuncionario\n-->";
             }
             if (class_exists("clsFuncionario")) {
                 $obj_ref_funcionario_exc = new clsFuncionario($registro["ref_funcionario_exc"]);
                 $det_ref_funcionario_exc = $obj_ref_funcionario_exc->detalhe();
                 if (is_object($det_ref_funcionario_exc["idpes"])) {
                     $det_ref_funcionario_exc = $det_ref_funcionario_exc["idpes"]->detalhe();
                     $registro["ref_funcionario_exc"] = $det_ref_funcionario_exc["nome"];
                 } else {
                     $pessoa = new clsPessoa_($det_ref_funcionario_exc["idpes"]);
                     $det_ref_funcionario_exc = $pessoa->detalhe();
                     $registro["ref_funcionario_exc"] = $det_ref_funcionario_exc["nome"];
                 }
             } else {
                 $registro["ref_funcionario_exc"] = "Erro na geracao";
                 echo "<!--\nErro\nClasse nao existente: clsFuncionario\n-->";
             }
             if (class_exists("clsPmicontrolesisSoftware")) {
                 $obj_ref_cod_software = new clsPmicontrolesisSoftware($registro["ref_cod_software"]);
                 $det_ref_cod_software = $obj_ref_cod_software->detalhe();
                 $registro["ref_cod_software"] = $det_ref_cod_software["nm_software"];
             } else {
                 $registro["ref_cod_software"] = "Erro na geracao";
                 echo "<!--\nErro\nClasse nao existente: clsPmicontrolesisSoftware\n-->";
             }
             $this->addLinhas(array("<a href=\"controlesis_software_patch_det.php?cod_software_patch={$registro["cod_software_patch"]}\">{$registro["ref_cod_software"]}</a>", "<a href=\"controlesis_software_patch_det.php?cod_software_patch={$registro["cod_software_patch"]}\">{$registro["data_patch_br"]}</a>"));
         }
     }
     $this->addPaginador2("controlesis_software_patch_lst.php", $total, $_GET, $this->nome, $this->__limite);
     $this->acao = "go(\"controlesis_software_patch_cad.php\")";
     $this->nome_acao = "Novo";
     $this->largura = "100%";
 }