Ignore:
Timestamp:
06/04/12 16:59:18 (12 years ago)
Author:
viani
Message:

Ticket #2416 - Correção em estilos do arquivo css do gerador de relatórios do workflow

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/inc/report/includes/classes/Listagem.class.php

    r5307 r6413  
    2222 
    2323class Listagem { 
    24       
     24 
    2525    /** 
    2626     * Identificador da Listagem. 
    2727     */ 
    2828    private $idlistagem; 
    29      
     29 
    3030    /** 
    3131     * Tï¿œtulo da Listagem 
    3232     */ 
    3333    private $titulo; 
    34      
     34 
    3535    /** 
    3636     * Array de Colunas. 
    3737     */ 
    3838    private $colunas = array(); 
    39      
     39 
    4040    /** 
    4141     * Array de Linhas de Detalhamento. 
    4242     */ 
    4343    private $linhasdetalhamento = array(); 
    44      
     44 
    4545    /** 
    4646     * Array de Linhas Agrupadas 
    4747     */ 
    4848    private $linhasagrupamento = array(); 
    49      
     49 
    5050    /** 
    5151     * Array de Dados. 
    5252     */ 
    5353    private $dados = array(); 
    54      
     54 
    5555    /** 
    5656     * Exibe Header das Tables. (Tï¿œtulos das Colunas). 
    5757     */ 
    5858    private $showthead = true; 
    59      
     59 
    6060    /** 
    6161     * Array de Totalizadores. 
    6262     */ 
    6363    private $totalizadores = array(); 
    64      
     64 
    6565    /** 
    6666     * Alterado para Protegido nï¿œo serï¿œ instanciado na classe. 
    6767     */ 
    6868    //protected  $form = Formulario; 
    69      
     69 
    7070    /** 
    7171     * Formulï¿œrio de Pesquisa. 
    7272     */ 
    7373    //protected $formpesquisa = Formulario; 
    74      
     74 
    7575    /** 
    7676     * Agrupar Resultados Alfabeticamente (True ou False) 
     
    8282         */ 
    8383    private $arrindicadores = array(); 
    84      
     84 
    8585    /** 
    8686     * Array de Parï¿œmetros 
    8787     */ 
    8888    private $arrparametros = array(); 
    89      
     89 
    9090    /** 
    9191     * Array de Agrupamentos 
    9292     */ 
    9393    private $arragrupamentos = array(); 
    94      
     94 
    9595    /** 
    9696     * SubListagem. 
    9797     */ 
    9898    public $subListagem; 
    99      
     99 
    100100    /** 
    101101     * Indica se este objeto ï¿œ uma SubListagem. 
    102102     */ 
    103103    private $issublist = false; 
    104      
     104 
    105105    /** 
    106106     * Conexao com o Banco de Dados. 
    107107     */ 
    108108    private $conexao; 
    109      
     109 
    110110    /** 
    111111     * SQL da Listagem. 
    112112     */ 
    113113    private $sql; 
    114      
     114 
    115115    /** 
    116116     * Exibir SubTotalizadores 
    117117     */ 
    118118    private $exibesubtotais = false; 
    119      
     119 
    120120    private $exibedivcolunas = true; 
    121      
     121 
    122122    /** 
    123123     * Exibir Totalizadores 
    124124     */ 
    125125    private $_exibetotalizadores = true; 
    126      
     126 
    127127    /** 
    128128     * Exibir Quantidade de Registros Encontrados 
    129129     */ 
    130130    private $_exibeqtdregistros = true; 
    131      
     131 
    132132    /** 
    133133     * Modo DEBUG 
    134134     */ 
    135135    private $_debug = true; 
    136      
     136 
    137137    /** 
    138138     * Array de Erros 
    139139     */ 
    140140    private $_errors = array(); 
    141      
     141 
    142142    /** 
    143143     * Indica se a Listagem Possui algum checkbox 
    144144     */ 
    145145    private $temcheck = false; 
    146      
    147     /** 
    148      * Repetir Tï¿œtulo do Agrupamento.  
     146 
     147    /** 
     148     * Repetir Tï¿œtulo do Agrupamento. 
    149149     */ 
    150150    private $_repetirtituloagrupamento = true; 
    151      
     151 
    152152    /** 
    153153     * Quantidade de Registros da Listagem Principal (Usada somente quando a listagem ï¿œ uma sublistagem.) 
    154154     */ 
    155155    private $_qtdregistroslistagemprincipal = 0; 
    156      
     156 
    157157    /** 
    158158     * Gerar Arquivo CSV. 
    159159     */ 
    160160    private $_temarquivocsv = false; 
    161      
    162      
     161 
     162 
    163163    /** 
    164164     * Exibir Resultados na tela. (Usado quando somente serï¿œ exibido os resultados em CSV). 
    165165     */ 
    166166    private $_exiberesultados = true; 
    167      
     167 
    168168    /** 
    169169     * Gerar Automaticamente Arquivo CSV. 
    170170     */ 
    171171    private $_exibearquivocsv = false; 
    172      
     172 
    173173    /** 
    174174     * Colunas Arquivo CSV. 
    175175     */ 
    176176    private $_colunasarquivo = array(); 
    177      
     177 
    178178    /** 
    179179     * Texto do Arquivo CSV. 
    180180     */ 
    181181    private $_txtarquivocsv = ""; 
    182      
    183      
     182 
     183 
    184184    /** 
    185185     * Array de Totalizadores. 
    186186     */ 
    187187    private $arrtotais = array(); 
    188      
     188 
    189189    /** 
    190190     * Array de SubTotalizadores 
    191191     */ 
    192192    private $arrsubtotais = array(); 
    193       
    194       
     193 
     194 
    195195    /** 
    196196     * Mesagem: Nenhum Resultado Encontrado. 
    197197     */ 
    198198    public $msgnenhumresultado = "Nenhum resultado encontrado."; 
    199      
     199 
    200200    /** 
    201201     * Mensagem: registro(s) encontrado(s) 
    202202     */ 
    203203    public $msgregistros = "registro(s) encontrado(s)."; 
    204      
     204 
    205205    /** 
    206206     * Mensagem: TOTAL: 
    207207     */ 
    208208    public $msgtotalizador = "TOTAL:"; 
    209      
     209 
    210210    /** 
    211211     * Mensagem: SUB-TOTAL; 
    212212     */ 
    213213    public $msgsubtotalizador = "SUB-TOTAL:"; 
    214      
     214 
    215215    private $_mostraLegendaTopo = true; 
    216      
     216 
    217217    private $_mostraLegendaRodape = false; 
    218      
     218 
    219219    private $_exibelinhasvazias = true; 
    220      
     220 
    221221    private $_colunascsv; 
    222      
     222 
    223223    private $_isarray = false; 
    224      
     224 
    225225    private $_totalizadorprecisao = 2; 
    226      
     226 
    227227    /* 
    228228     * ID da Listagem. que foi carregado. 
    229229     */ 
    230230    private $_lstoid = ""; 
    231      
     231 
    232232    private $_url_base_path; 
    233      
     233 
    234234    private $_tmp_file_path = "/tmp/"; 
    235      
    236       
     235 
     236 
    237237    /** 
    238238     * Construᅵᅵo da Classe. 
    239      *  
     239     * 
    240240     * @idlistagem Identificador da Listagem. 
    241241     * @titulo Tï¿œtulo da Listagem. 
     
    250250            $this->subListagem = new Listagem($novoidlistagem,"",$conexao,true); 
    251251            $this->subListagem->setMostrarQuantidadeRegistros(false); 
    252             $this->subListagem->setIdListagem($novoidlistagem);  
     252            $this->subListagem->setIdListagem($novoidlistagem); 
    253253        } 
    254254        $this->setSubListagem($subListagem); 
    255255        $this->setConexao($conexao); 
    256256    } 
    257      
     257 
    258258    /** 
    259259     * Indica se a Listagem ï¿œ uma SubListagem. 
    260      *  
     260     * 
    261261     * @param $value (true,false) 
    262262     */ 
     
    264264        $this->issublist = $value; 
    265265    } 
    266      
     266 
    267267    public function setTotalizadorPrecisao($value) { 
    268268        $this->_totalizadorprecisao = $value; 
    269269    } 
    270      
     270 
    271271    /** 
    272272     * Identificador da Listagem. 
    273      *  
     273     * 
    274274     * @param $value (true,false) 
    275275     */ 
     
    277277        $this->idlistagem = $value; 
    278278    } 
    279      
     279 
    280280    public function setExibirOpcoesDeColunas($value) { 
    281281        $this->exibedivcolunas = $value; 
    282282    } 
    283      
     283 
    284284    /** 
    285285     * Retorna o Identificador da Listagem. 
     
    288288        return $this->idlistagem; 
    289289    } 
    290      
     290 
    291291    public function setUrlBasePath($base_path) { 
    292292        $this->_url_base_path = $base_path; 
     
    295295    /** 
    296296     * Funᅵᅵo Interna para Alterar a Varï¿œavel de Conexï¿œo com o Banco de Dados. 
    297      *  
     297     * 
    298298     * @param $conexao 
    299299     * @return unknown_type 
    300300     */ 
    301301    protected function setConexao($conexao) {  $this->conexao = $conexao;  } 
    302       
     302 
    303303    /** 
    304304     * Funᅵᅵo Interna para Alterar O SQL que serï¿œ executado na listagem. 
    305      *  
     305     * 
    306306     * @param $sql 
    307307     * @return unknown_type 
    308308     */ 
    309309    protected function setSQL($sql) {  $this->sql = $sql;  } 
    310       
     310 
    311311    /** 
    312312     * Funᅵᅵo Interna para Recuperar o SQL que serï¿œ executado na listagem. 
    313      *  
     313     * 
    314314     * @return unknown_type 
    315315     */ 
    316316    public function getSQL() {  return $this->sql;  } 
    317       
     317 
    318318    /** 
    319319     * Funᅵᅵo para Alterar o Tï¿œtulo da Listagem. 
    320      *  
     320     * 
    321321     * @param $titulo 
    322322     * @return unknown_type 
    323323     */ 
    324324    public function setTitulo($titulo) {  $this->titulo = $titulo;  } 
    325      
     325 
    326326    /** 
    327327     * Funᅵᅵo para Alterar a forma de Exibiᅵᅵo da Listagem 
    328      *  
     328     * 
    329329     * @param $exiberesultados 
    330330     * @return unknown_type 
    331331     */ 
    332332    public function setExibirResultadosTela($exiberesultados) {  $this->_exiberesultados = $exiberesultados;  } 
    333      
     333 
    334334    /** 
    335335     * Funᅵᅵo para Alterar a exibiᅵᅵo de linhas que nï¿œo exibem nenhum resultado, (linhas vazias) 
    336      *  
     336     * 
    337337     * @param $exiberesultados 
    338338     * @return unknown_type 
     
    342342    /** 
    343343     * Funᅵᅵo para Alterar o Resultado da SQL executada. 
    344      *  
     344     * 
    345345     * @param $dados 
    346346     * @return unknown_type 
    347347     */ 
    348348    public function setDados($dados) { 
    349         $this->dados = &$dados;   
     349        $this->dados = &$dados; 
    350350        if (is_resource($this->dados)) { 
    351351            $this->_isarray = false; 
     
    354354        } 
    355355    } 
    356      
    357       
     356 
     357 
    358358    /** 
    359359     * Funᅵᅵo utilizada para Executar o SQL e Carregar os dados a serem listados. 
     
    364364        $parser = new SqlParser($sql); 
    365365        $ret_parser = $parser->verificaSql(); 
    366          
     366 
    367367        if ($ret_parser === false) { 
    368368            $msg = $parser->getErro(); 
    369369            $this->adicionarErro($msg,true); 
    370370        } 
    371          
     371 
    372372        $ret_parser = $parser->verificaCondicoes(); 
    373373        if ($ret_parser === false) { 
     
    376376        } 
    377377        $sql = $parser->getSql(); 
    378          
     378 
    379379        try { 
    380380                $this->setSQL($sql); 
     
    384384                if (!$resu) { throw new Exception($this->sql); } 
    385385                $this->setDados($resu); 
    386                  
     386 
    387387                return $resu; 
    388          
     388 
    389389        } catch (exception $e) { 
    390390             $msg = $e->getMessage(); 
    391391             $this->adicionarErro("Erro ao Executar a consulta: $msg",true); 
    392392        } 
    393          
    394     } 
    395      
     393 
     394    } 
     395 
    396396    /** 
    397397     * Funᅵᅵo utilizada para Executar o SQL e Carregar os dados a serem listados. 
     
    401401    public function carregarIDListagem($idlistagem,$previsualizacao = false) { 
    402402 
    403         $sql = "select  
     403        $sql = "select 
    404404                    lstoid, 
    405405                    lstversao, 
     
    427427                    lstexclusao, 
    428428                    lstexibe_resultados 
    429                 from  
    430                     listagem.listagem  
     429                from 
     430                    listagem.listagem 
    431431                where lstidlistagem = '$idlistagem'"; 
    432432        $resu = pg_query($this->conexao,$sql); 
    433          
     433 
    434434        $this->setIdListagem($idlistagem); 
    435          
     435 
    436436        $arquivo = $_SERVER['PHP_SELF']; 
    437          
     437 
    438438        if (stristr($arquivo,"cad_listagem.php")) { 
    439439           $arquivo = "null"; 
     
    442442        if (pg_num_rows($resu)) { 
    443443            $dados = pg_fetch_object($resu); 
    444              
     444 
    445445            $lstexclusao = $dados->lstexclusao; 
    446              
     446 
    447447            if (($lstexclusao) && ($arquivo != "null")) { 
    448448                $this->_debug = true; 
    449449                $this->adicionarErro("Esta Consulta estï¿œ inativada, contate o suporte tï¿œcnico de sistemas.",true); 
    450450            } 
    451              
     451 
    452452            $lstoid = $dados->lstoid; 
    453453            $this->_lstoid = $lstoid; 
    454              
    455               
     454 
     455 
    456456        /*    if ($arquivo != "null") { 
    457457                $sql = "select lsdoid from listagem_dependencia where lsdlstoid = '$lstoid' and lsdarquivo ilike '%$arquivo%'"; 
    458458                $res_dependencia = pg_query($this->conexao,$sql); 
    459459                $qtd_dependencia = pg_num_rows($res_dependencia); 
    460                  
    461                  
     460 
     461 
    462462                if ($qtd_dependencia == 0) { 
    463463                        $sql = "insert into listagem_dependencia (lsdlstoid,lsdarquivo,lsdacesso) values ($lstoid,'$arquivo',now())"; 
     
    471471            } 
    472472            */ 
    473              
    474              
     473 
     474 
    475475            $sql = html_entity_decode( $dados->lstsql, ENT_QUOTES); 
    476              
     476 
    477477            $this->sql = $sql; 
    478              
     478 
    479479           // if ($previsualizacao) { $addsql = " limit 20"; } 
    480480 
    481             $sql_par = "select  
     481            $sql_par = "select 
    482482                            lspoid, 
    483483                            lsplstoid, 
     
    485485                            lsptipo, 
    486486                            lspvalor_padrao, 
    487                             lspobrigatorio  
    488                         from  
    489                             listagem.listagem_parametro  
    490                         where  
     487                            lspobrigatorio 
     488                        from 
     489                            listagem.listagem_parametro 
     490                        where 
    491491                            lsplstoid = $lstoid "; 
    492492            $resu_par = pg_query($this->conexao,$sql_par); 
    493              
     493 
    494494            while ($parametro = pg_fetch_object($resu_par)) { 
    495495                $idparametro = $parametro->lspidparametro; 
     
    499499                $obrigatorio = $parametro->lspobrigatorio; 
    500500                $valor_padrao = $parametro->lspvalor_padrao; 
    501                  
     501 
    502502                $this->adicionarParametro($idparametro,$tipo,$obrigatorio,$valor,$valor_padrao); 
    503                  
     503 
    504504                if ($previsualizacao) { 
    505505                        $this->setParametro($idparametro,$valor_padrao); 
    506506                } 
    507507            } 
    508              
    509             $sql_par = "select  
     508 
     509            $sql_par = "select 
    510510                            lsioid, 
    511511                            lsilstoid, 
     
    515515                            lsilegenda, 
    516516                            lsilegenda_csv, 
    517                             lsicondicao  
    518                         from  
    519                             listagem.listagem_indicador  
     517                            lsicondicao 
     518                        from 
     519                            listagem.listagem_indicador 
    520520                        where lsilstoid = $lstoid "; 
    521521            $resu_par = pg_query($this->conexao,$sql_par); 
    522              
     522 
    523523            while ($indicador = pg_fetch_object($resu_par)) { 
    524524                $idindicador = $indicador->lsiidindicador; 
     
    528528                $legenda_csv = html_entity_decode($indicador->lsilegenda_csv, ENT_QUOTES); 
    529529                $legenda     = html_entity_decode($indicador->lsilegenda, ENT_QUOTES); 
    530                  
    531                  
    532                 if ($legenda_csv == "") {  
     530 
     531 
     532                if ($legenda_csv == "") { 
    533533                        $legenda_csv = $legenda; 
    534534                } 
    535535                $this->adicionarIndicador($idindicador,$condicao,$tipo,$imagem,$legenda,$legenda_csv); 
    536536            } 
    537              
    538              
    539             $this->setTitulo($dados->lsttitulo);    
     537 
     538 
     539            $this->setTitulo($dados->lsttitulo); 
    540540            $this->setMensagemTotalizador($dados->lstmsg_totalizador); 
    541             $this->setMensagemRegistrosEncontrados($dados->lstmsg_registrosencontrados);                 
     541            $this->setMensagemRegistrosEncontrados($dados->lstmsg_registrosencontrados); 
    542542            $this->setMensagemSubTotalizador($dados->lstmsg_subtotalizador); 
    543543            $this->setMensagemNenhumResultado($dados->lstmsg_nenhumresultado); 
    544              
     544 
    545545            if ($dados->lstagrupamento_campo != "") { 
    546546                if ($dados->lstagrupamento_titulo == "") { 
     
    554554                    $lstexibe_titagrupamento = false; 
    555555                } 
    556                  
    557                  
     556 
     557 
    558558                if ($dados->lstexibe_agrupamento_alfabetico == "t") { 
    559559                        $lstexibe_agrupamento_alfabetico = true; 
     
    564564                $this->setAgruparAlfabeticamente($lstexibe_agrupamento_alfabetico); 
    565565            } 
    566              
     566 
    567567            if ($dados->lstexibe_csv == "f") { 
    568568                $lstexibe_csv = false; 
     
    585585                $lstexibe_subtotais = true; 
    586586            } 
    587             if ($dados->lstexibe_header == "f") {  
     587            if ($dados->lstexibe_header == "f") { 
    588588                $showthead = false; 
    589589            } else { 
     
    618618            $this->_exibetotalizadores = $lstexibe_totalizadores; 
    619619            $this->_exiberesultados = $lstexibe_resultados; 
    620              
    621              
    622              
    623             $sql_colunas = "select  
     620 
     621 
     622 
     623            $sql_colunas = "select 
    624624                                lslcoid, 
    625625                                lslclstoid, 
     
    642642                                lslcsubtotalizador_condicao, 
    643643                                lslccheckbox_condicao 
    644                             from  
    645                                 listagem.listagem_coluna  
    646                             where  
    647                                 lslclstoid = $lstoid  
     644                            from 
     645                                listagem.listagem_coluna 
     646                            where 
     647                                lslclstoid = $lstoid 
    648648                            order by lslcordem"; 
    649649            $resu_colunas = pg_query($this->conexao,$sql_colunas); 
    650              
     650 
    651651            while ($coluna = pg_fetch_object($resu_colunas)) { 
    652652               // print_r($coluna); 
     
    661661                $link = $coluna->lslclink; 
    662662                $link_condicao = $coluna->lslclink_condicao; 
    663                  
     663 
    664664                $idcoluna       =  html_entity_decode($idcoluna, ENT_QUOTES); 
    665665                $titulo         =  html_entity_decode($titulo, ENT_QUOTES); 
     
    667667                $link           =  html_entity_decode($link, ENT_QUOTES); 
    668668                $link_condicao  =  html_entity_decode($link_condicao, ENT_QUOTES); 
    669                 
     669 
    670670                if ($coluna->lslccalculada == "t") { 
    671671                    $lslccalculada = true; 
     
    693693                    $lslclink_blank = false; 
    694694                } 
    695                  
     695 
    696696                if ($coluna->lslcexibe_csv == "t") { 
    697697                    $lslcexibe_csv = true; 
     
    699699                    $lslcexibe_csv = false; 
    700700                } 
    701                  
     701 
    702702                if ($lslcexibe_csv) { 
    703                         $this->_colunascsv .= "$idcoluna,";  
    704                 } 
    705                  
    706                  
     703                        $this->_colunascsv .= "$idcoluna,"; 
     704                } 
     705 
     706 
    707707                if (($tipo == "text") || ($tipo == "data") || ($tipo == "hora") || ($tipo == "int") || ($tipo == "moeda")) { 
    708                      
     708 
    709709                    if (($tipo == "int") && ($lslccheckbox)) { 
    710710                        if ($lstexibe_checkbox) { 
     
    713713                    } else { 
    714714                        //echo "idcoluna: $idcoluna -> $lslcnowrap"; 
    715                         $this->adicionarColuna($idcoluna,$titulo,$html,$tipo,$align,$width,$lslcnowrap,$lslcvisivel);                            
     715                        $this->adicionarColuna($idcoluna,$titulo,$html,$tipo,$align,$width,$lslcnowrap,$lslcvisivel); 
    716716                    } 
    717                             
     717 
    718718                    if ($link != "") { 
    719719                        $this->adicionarLink($idcoluna,$link,$link_condicao,$lslclink_blank); 
    720720                    } 
    721                         
     721 
    722722                    if ($lslccalculada) { 
    723723                        $this->adicionarTotalizador($idcoluna,$condicao_totalizador,$condicao_subtotalizador); 
     
    725725                } 
    726726            } 
    727              
     727 
    728728        } else { 
    729729                $this->_debug = true; 
    730730            $this->adicionarErro("Listagem nï¿œo encontrada."); 
    731731        } 
    732              
     732 
    733733 
    734734    } 
     
    745745        } 
    746746    //    if ($this->issublist) { 
    747             if (is_object($this->subListagem)) {  
     747            if (is_object($this->subListagem)) { 
    748748                $ret = $ret + $this->subListagem->getQuantidadeRegistros(); 
    749749            } 
     
    754754    /** 
    755755     * Funᅵᅵo para Alterar a Mensagem de Registros Encontrados. 
    756      *  
     756     * 
    757757     * @param $msg 
    758758     */ 
    759759    public function setMensagemRegistrosEncontrados($msg) { $this->msgregistros = $msg; } 
    760      
     760 
    761761    /** 
    762762     * Funᅵᅵo para Alterar a Mensagem de Total de Registros Encontrados. 
    763      *  
     763     * 
    764764     * @param $msg 
    765765     */ 
    766766    public function setMensagemTotalizador($msg) { $this->msgtotalizador = $msg; } 
    767      
     767 
    768768    /** 
    769769     * Funᅵᅵo para Alterar a Mensagem de Sub-Total de Registros Encontrados 
    770      *  
     770     * 
    771771     * @param $msg 
    772772     */ 
    773773    public function setMensagemSubTotalizador($msg) { $this->msgsubtotalizador = $msg; } 
    774       
     774 
    775775    /** 
    776776     * Funᅵᅵo para Alterar a Mensagem de "Nenhum Resultado Encontrado". 
    777      *  
     777     * 
    778778     * @param $msg 
    779779     */ 
     
    782782        /** 
    783783         * Funᅵᅵo que Indica se a Listagem ï¿œ Agrupada Alfabeticamente 
    784          *  
     784         * 
    785785         * @param value (true ou false) 
    786786         */ 
     
    788788        $this->agruparAlfabeticamente = $value; 
    789789    } 
    790      
     790 
    791791    /** 
    792792     * Funᅵᅵo para Alterar a Opᅵᅵo de Exibir os Sub-Totais de uma Listagem. 
    793      *  
     793     * 
    794794     * @param $value (true ou false) 
    795795     */ 
     
    797797        $this->exibesubtotais = $value; 
    798798    } 
    799      
     799 
    800800    public function setMostrarTotal($value) { 
    801801        $this->_exibetotalizadores = $value; 
    802802    } 
    803      
     803 
    804804    public function setMostrarLegendaTopo($value) { 
    805805        $this->_mostraLegendaTopo = $value; 
    806806    } 
    807      
     807 
    808808    public function setMostrarLegendaRodape($value) { 
    809809        $this->_mostraLegendaRodape = $value; 
    810810    } 
    811      
    812      
     811 
     812 
    813813    /** 
    814814     * Funᅵᅵo para Alterar a Opᅵᅵo de Exibir a Quantidade de Registros Retornados da Listagem. 
    815      *  
     815     * 
    816816     * @param $exibir (true ou false) 
    817817     */ 
     
    822822    /** 
    823823     * Funᅵᅵo para adicionar uma Coluna na Listagem. 
    824      *  
     824     * 
    825825     * @param $idcoluna 
    826826     * @param $tipo 
     
    846846        } 
    847847    } 
    848      
     848 
    849849    function adicionarColunaCalculada($idcoluna,$tipo,$html,$condicao_total = "1",$condicao_subtotal = "1") { 
    850850        $erro = false; 
     
    858858        } 
    859859    } 
    860      
     860 
    861861    function adicionarLinhaDetalhamento($idlinha,$tipo,$html,$align = "left") { 
    862862        $width = ""; 
     
    866866        array_push($this->linhasdetalhamento,$coluna); 
    867867    } 
    868       
     868 
    869869    /** 
    870870     * Funᅵᅵo para Adicionar uma Coluna com CheckBoxes. 
    871      *  
     871     * 
    872872     * @param $idcoluna 
    873873     * @param $titulo 
     
    887887        array_push($this->colunas,$coluna); 
    888888    } 
    889       
     889 
    890890    /** 
    891891     * Funᅵᅵo utilizada Internamente para verificar se o idcoluna passado jï¿œ foi adicionado a listagem. 
    892      *  
     892     * 
    893893     * @param $idcoluna 
    894894     * @return unknown_type 
     
    903903        return $ret; 
    904904    } 
    905       
     905 
    906906    /** 
    907907     * Adiciona um Link para uma ou mais Colunas. 
    908      *  
     908     * 
    909909     * @param $idcolunas (Ids das colunas separados por vï¿œrgula) 
    910910     * @param $link Link para ser redirecionado. 
     
    929929        } 
    930930    } 
    931      
     931 
    932932    public function RemoverColuna($idcolunas){ 
    933933        $colunas = explode(",",$idcolunas); 
     
    947947        } 
    948948    } 
    949      
    950      
     949 
     950 
    951951    public function adicionarCor($idcolunas,$cor,$condicao = "1") { 
    952952        $colunas = explode(",",$idcolunas); 
     
    967967        } 
    968968    } 
    969       
     969 
    970970    /** 
    971971     * Funᅵᅵo para Adicionar um Indicador (Legenda). 
    972      *  
     972     * 
    973973     * @param $idindicador Cï¿œdigo Interno de Identificaᅵᅵo do Identificador 
    974974     * @param $condicao Condiᅵᅵo em PHP para Exibir o Indicador. 
    975975     * @param $tipo R,Q,T (REDONDO,QUADRADO,TRIANGULO) 
    976      * @param $codigoimagem (1 a 19).  
     976     * @param $codigoimagem (1 a 19). 
    977977     * @param $legenda Legenda 
    978978     * @return unknown_type 
     
    984984        array_push($this->arrindicadores[$idindicador],$Indicador); 
    985985    } 
    986       
     986 
    987987    /** 
    988988     * Funᅵᅵo para Desenhar a Listagem. 
    989      *  
     989     * 
    990990     * @return HTML 
    991991     */ 
     
    998998            $sql =  html_entity_decode($sql, ENT_QUOTES); 
    999999            $this->carregar($sql); 
    1000             
    1001         } 
    1002          
     1000 
     1001        } 
     1002 
    10031003        if ($this->_exibearquivocsv) { 
    10041004                $this->gerarArquivoXLS($this->_colunascsv); 
     
    10091009        $this->escreveFechaList(); 
    10101010    } 
    1011      
     1011 
    10121012    function incluiCssJavascript($addpath = "") { 
    10131013        echo "\n\n<script language=\"Javascript\" type=\"text/javascript\" src=\"$addpath/includes/js/mascaras.js\"></script>\n 
     
    10181018<link rel=\"stylesheet\" href=\"$addpath/includes/css/base_form.css\" media=\"screen\"></link>\n 
    10191019<link rel=\"stylesheet\" href=\"$addpath/includes/css/calendar.css\" media=\"screen\"></link>\n\n"; 
    1020          
    1021     } 
    1022      
     1020 
     1021    } 
     1022 
    10231023    protected function escreveLegenda() { 
    10241024        if ($this->_exiberesultados) { 
    10251025                if (count($this->arrindicadores)) { 
    10261026                $colspan=0; 
    1027                  
     1027 
    10281028                echo  "\n\t<table width='100%' class='TableMoldura''> 
    10291029                                   \n\t\t<tr class='tableSubTitulo'> 
     
    10551055        } 
    10561056    } 
    1057       
     1057 
    10581058    /** 
    10591059     * Funᅵᅵo que desenha o cabeï¿œalho da Listagem. 
    1060      *   
     1060     * 
    10611061     * @return HTML 
    10621062     */ 
    10631063    protected function escreveAbreList() { 
    10641064        $colspan = count($this->colunas); 
    1065          
     1065 
    10661066        $htmldivs = ""; 
    10671067        $html_icone = ""; 
    1068          
     1068 
    10691069        if (!$this->issublist) { 
    10701070                if ($this->_mostraLegendaTopo) { 
     
    10741074 
    10751075            if ($this->_exiberesultados) { 
    1076                  
     1076 
    10771077                if ($this->exibedivcolunas) { 
    10781078                $html_icone = '<b>[<img id="'. $this->idlistagem . '_img_visivel" src="' . $this->_url_base_path . '/images/icones/maisTransparente.gif" OnClick="ListagemShowHide(event,\''. $this->idlistagem . '\',\''. $this->idlistagem . '_img_visivel\');" OnMouseOver="this.style.cursor=\'pointer\';" OnMouseOut="this.style.cursor=\'default\';">]</b>'; 
     
    10801080 
    10811081               // $html_icone .= '&nbsp;&nbsp;<b>[<img id="'. $this->idlistagem . '_img_grafico_visivel" src="images/icones/t1/fileGrafico.jpg" OnClick="ListagemShowHide(event,\''. $this->idlistagem . '\',\''. $this->idlistagem . '_img_grafico_visivel\');" OnMouseOver="this.style.cursor=\'pointer\';" OnMouseOut="this.style.cursor=\'default\';">]</b>'; 
    1082                                  
     1082 
    10831083                $cnt = 0; 
    10841084                $htmlchecks = ""; 
    1085                  
     1085 
    10861086                foreach ($this->colunas as $coluna) { 
    10871087                        $titulo = $coluna->getNome(); 
     
    10911091                    $addvisivel = ""; 
    10921092                    if ($visivel) { $addvisivel = "checked"; } 
    1093                      
     1093 
    10941094                    $adddisabled = ""; 
    10951095                    if ($cnt == 0) { $adddisabled = " disabled"; $cnt = $cnt + 1; } 
    1096                      
     1096 
    10971097                    $htmlchecks .= '<input type="checkbox" class="checkbox" name="' . $idlistagem . '_ck_visivel_' . $idcoluna . '" id="' . $idlistagem . '_ck_visivel_' . $idcoluna . '" OnClick=" document.getElementById(\'' . $idlistagem . '_div_visivel\').style.display = \'none\'; document.getElementById(\'' . $idlistagem . '_div_visivel_load\').style.display = \'\'; alinhaDivDir(\'' .$idlistagem. '_div_visivel_load\'); setTimeout(\'ListagemExibeOcultaColuna(\\\'' . $idlistagem. '\\\',\\\'' .$idcoluna . '\\\');\')" value="' .$idcoluna . '" ' . $addvisivel .$adddisabled . '> ' . $titulo . '<br>'; 
    1098                      
    1099                 } 
    1100                  
    1101  
    1102                 $htmldivs = '<div id="' . $idlistagem. '_div_visivel" class="div_visivel" style="display:none;">   
    1103                                     <table width="100%">           
     1098 
     1099                } 
     1100 
     1101 
     1102                $htmldivs = '<div id="' . $idlistagem. '_div_visivel" class="div_visivel" style="display:none;"> 
     1103                                    <table width="100%"> 
    11041104                                        <tr> 
    11051105                                            <td align="right">' .$html_icone_2. '</td> 
     
    11071107                                        <tr> 
    11081108                                            <td style="padding-left:5px;">' 
    1109 .$htmlchecks .  
     1109.$htmlchecks . 
    11101110' 
    11111111 
     
    11231123                                    </table> 
    11241124                                </div>'; 
    1125              
     1125 
    11261126                   } 
    11271127                } 
    1128          
    1129              
    1130         } 
    1131   
     1128 
     1129 
     1130        } 
     1131 
    11321132        echo  "\n\t$htmldivs<table id='Listagem_" . $this->getIdListagem() . "' width='100%'$addclass> 
    11331133                     \n\t\t<tr class='tableSubTitulo'> 
     
    11351135                     \n\t\t</tr>"; 
    11361136    } 
    1137      
     1137 
    11381138    /** 
    11391139     * Funᅵᅵo que desenha o HTML que fecha a listagem. 
    1140      *  
     1140     * 
    11411141     * @return HTML 
    11421142     */ 
    11431143    protected function escreveFechaList() { 
    11441144        echo  "\n\t</table>"; 
    1145          
     1145 
    11461146        if (!$this->issublist) { 
    11471147                if ($this->_mostraLegendaRodape) { 
     
    11501150        } 
    11511151    } 
    1152      
     1152 
    11531153    public function setAgrupamento($idagrupamento,$titulo = "",$repetirtitulo = false) { 
    11541154        $width = ""; 
     
    11571157        //$html = "{" . $idagrupamento .  "}"; 
    11581158        $html = $idagrupamento; 
    1159         if ($titulo == "") {  
     1159        if ($titulo == "") { 
    11601160                $titulo = "{" . $idagrupamento . "}"; 
    11611161                $repetirtitulo = true; 
     
    11671167        array_push($this->linhasagrupamento,$coluna); 
    11681168    } 
    1169      
     1169 
    11701170    public function setParametro($idparametro,$valor) { 
    11711171        foreach ($this->arrparametros as $k => $parametro) { 
     
    11751175        } 
    11761176    } 
    1177      
     1177 
    11781178    public function adicionarParametro($idparametro,$tipo,$obrigatorio = false,$valor = "",$valortestes = "") { 
    11791179        $parametros = array(); 
     
    11831183        $parametros["obrigatorio"] = $obrigatorio; 
    11841184        $parametros["valor_testes"] = $valortestes; 
    1185          
     1185 
    11861186        if ($this->_debug) { 
    11871187                if (($tipo != "text") && ($tipo != "int") && ($tipo != "data")) { 
     
    11901190                } 
    11911191        } 
    1192          
     1192 
    11931193        if (!$this->isParametro($idparametro)) { 
    11941194            array_push($this->arrparametros,$parametros); 
     
    11991199        } 
    12001200    } 
    1201      
     1201 
    12021202    public function getSQLParametros() { 
    12031203        $sql = $this->sql; 
     
    12131213        return $sqlparametros; 
    12141214    } 
    1215      
     1215 
    12161216    protected function formataSQLParametros() { 
    12171217        $sql = $this->sql; 
    1218          
     1218 
    12191219        $parametrosconsulta = $this->getSQLParametros(); 
    1220          
     1220 
    12211221        foreach ($parametrosconsulta as $parametro_consulta) { 
    12221222            $achou = false; 
     
    12401240            } 
    12411241        } 
    1242          
    1243          
     1242 
     1243 
    12441244        foreach ($this->arrparametros as $parametro) { 
    12451245            $idparametro = $parametro["idparametro"]; 
    12461246            $valor = $parametro["valor"]; 
    12471247            $obrigatorio = $parametro["obrigatorio"]; 
    1248             if (($obrigatorio == "t") && ($valor == "")) {  
     1248            if (($obrigatorio == "t") && ($valor == "")) { 
    12491249                $this->_debug=true; 
    12501250                $this->adicionarErro("Parï¿œmetro '$idparametro ' ï¿œ obrigatï¿œrio.",true); 
     
    12601260        $this->sql = $sql; 
    12611261    } 
    1262      
     1262 
    12631263    protected function isParametro($idparametro) { 
    12641264        $ret = false; 
     
    12701270        return $ret; 
    12711271    } 
    1272      
     1272 
    12731273    protected function isTotalizador($idcoluna) { 
    12741274        $ret = false; 
     
    12801280        return $ret; 
    12811281    } 
    1282      
     1282 
    12831283    function adicionarTotalizador($idcolunas,$condicaototal = "1",$condicaosubtotal = "1") { 
    1284          
     1284 
    12851285        $colunas = explode(",",$idcolunas); 
    12861286        foreach ($colunas as $idcoluna) { 
     
    12911291            } 
    12921292            if (!$erro) { 
    1293                  
     1293 
    12941294                $totalizador = array(); 
    12951295                $totalizador["idcoluna"] = $idcoluna; 
     
    12971297                $totalizador["condicaosubtotal"] = $condicaosubtotal; 
    12981298                $this->totalizadores[$idcoluna] = $totalizador; 
    1299                  
    1300             } 
    1301         } 
    1302          
    1303     } 
    1304      
     1299 
     1300            } 
     1301        } 
     1302 
     1303    } 
     1304 
    13051305    protected function escreveArquivo($arquivo) { 
    13061306        if ($this->_temarquivocsv) { 
     
    13091309        } 
    13101310    } 
    1311      
    1312       
     1311 
     1312 
    13131313    /** 
    13141314     * Funᅵᅵo para desenhar as Linhas da Listagem. 
    1315      *  
     1315     * 
    13161316     * @return HTML 
    13171317     */ 
     
    13221322        $handle = ""; 
    13231323        //$nomeform = $this->formpesquisa->getNome(); 
    1324          
     1324 
    13251325        if ($this->_temarquivocsv) { 
    13261326            if (!$this->issublist) { 
     
    13291329            } 
    13301330        } 
    1331          
     1331 
    13321332        if ($this->showthead) { 
    13331333            if ($this->_exiberesultados) { 
     
    13551355                        $this->_txtarquivo .= "\n"; 
    13561356                $this->escreveArquivo($handle); 
    1357                  
     1357 
    13581358            } 
    13591359        } 
     
    13821382            } 
    13831383            $class= ""; 
    1384              
     1384 
    13851385            $qtdlinhas = 0; 
    1386              
     1386 
    13871387            $qtd_registros = $this->getQuantidadeRegistros(); 
    13881388 
    13891389 
    13901390            for ($qtd_reg = 1;$qtd_reg <= $qtd_registros; $qtd_reg++) { 
    1391                  
     1391 
    13921392                if ($this->_isarray) { 
    13931393                    if ($qtd_reg == 1) { 
    1394                         reset($this->dados);  
     1394                        reset($this->dados); 
    13951395                        $linha = current($this->dados); 
    13961396                    } else { 
     
    14001400                    $linha = pg_fetch_array($this->dados); 
    14011401                } 
    1402              
     1402 
    14031403                $cnt = $cnt + 1; 
    1404                  
     1404 
    14051405                $qtdlinhas = $qtdlinhas + 1; 
    1406                  
     1406 
    14071407                $class = ( $class == "tdc" ) ? "tde" : "tdc"; 
    14081408 
     
    14201420                                $tituloagrupamento = $coluna->replaceValorLinha($coluna->getNome(),$linha); 
    14211421                        } 
    1422                          
     1422 
    14231423                        if ($this->agruparAlfabeticamente) { 
    14241424                            $tituloagrupamento = strtoupper(substr($tituloagrupamento,0,1)); 
     
    14281428                                $newagrupamento = strtoupper($htmlcoluna); 
    14291429                        } 
    1430                          
    1431                          
    1432                          
     1430 
     1431 
     1432 
    14331433                        //AGRUPAMENTO 
    14341434                        $cntcheckspan = 0; 
    14351435                        if ($newagrupamento != $lastagrupamento) { 
    14361436                            $cntagrupamentos = $cntagrupamentos + 1; 
    1437                              
     1437 
    14381438                            $arragrupamentos[$cntagrupamentos] = $newagrupamento; 
    1439                              
     1439 
    14401440                            //TOTALIZADOR SUB-TOTAL DO AGRUPAMENTO. 
    14411441                            if ($this->exibesubtotais) { 
     
    14491449                                             $idcol = $coluna->getIdColuna(); 
    14501450                                             if ($this->isTotalizador($coluna->getIdColuna())) { 
    1451                                                  if (!$mostroutotal) {  
    1452                                                      $addtexto = "<h3>" . $this->msgsubtotalizador . "</h3>";  
    1453                                                      $txtarquivotexto = $this->msgsubtotalizador ;  
    1454                                                      $mostroutotal = true;  
     1451                                                 if (!$mostroutotal) { 
     1452                                                     $addtexto = "<h3>" . $this->msgsubtotalizador . "</h3>"; 
     1453                                                     $txtarquivotexto = $this->msgsubtotalizador ; 
     1454                                                     $mostroutotal = true; 
    14551455                                                 } else { 
    14561456                                                     $addtexto = ""; 
    14571457                                                 } 
    1458                                                  if ($cntcheckspan) {  
    1459                                                    /* for ($j=1; $j< $cntcheckspan; $j++) { 
    1460                                                          echo  "<td id='subtotal_" . $idcol . "_$cntagrupamentos' align='right'>&nbsp;</td>"; 
    1461                                                     }*/ 
    1462                                                      
    1463                                                    // echo  "<td id='subtotal_" . $idcol . "_" . $cntagrupamentos . "' align='right'>&nbsp;</td>"; 
     1458                                                 if ($cntcheckspan) { 
    14641459                                                        if ($this->_temarquivocsv) { 
    14651460                                                                for ($j=1; $j<= $cntcheckspan; $j++) { 
     
    14691464                                                                        $this->_txtarquivo .= ";"; 
    14701465                                                                } 
    1471                                                         }  
    1472                                                  }  
     1466                                                        } 
     1467                                                 } 
    14731468                                                 $cntcheckspan = 0; 
    14741469                                                 $addvisivel = ""; 
     
    14861481                                                 } 
    14871482                                                 if ($this->_exiberesultados) { 
    1488                                                     echo  "<td  id='subtotal_" . $idcol . "_$cntagrupamentos' align='right'$addvisivel>$addtexto<h3>" . $subtotal_valor . "</h3>&nbsp;</td>"; 
     1483                                                    echo  "<td  id='subtotal_" . $idcol . "_$cntagrupamentos' align='right'$addvisivel>$addtexto<h3>" . $subtotal_valor . "</h3></td>"; 
    14891484                                                 } 
    14901485                                                 $this->_txtarquivo .= $subtotal_valor . ";"; 
     
    14971492                                                 } 
    14981493                                                 if ($this->_exiberesultados) { 
    1499                                                     echo  "<td id='subtotal_$idcol" . "_" . $cntagrupamentos . "' $addvisivel>&nbsp;</td>"; 
     1494                                                    echo  "<td id='subtotal_$idcol" . "_" . $cntagrupamentos . "' $addvisivel></td>"; 
    15001495                                                 } 
    15011496                                             } 
     
    15121507                                } 
    15131508                            } 
    1514                              
    1515                              
    1516                              
     1509 
     1510 
     1511 
    15171512                            if (($this->_repetirtituloagrupamento) || (!$mostroutituloagrupamento)) { 
    15181513                                if ($this->_exiberesultados) { 
     
    15271522                                    $mostroutituloagrupamento = true; 
    15281523                            } 
    1529                              
     1524 
    15301525                        } 
    1531                          
     1526 
    15321527                    } 
    1533                      
    1534                 } 
    1535                  
    1536                  
     1528 
     1529                } 
     1530 
     1531 
    15371532                if (count($this->colunas)) { 
    1538                      
     1533 
    15391534                    $addvisivellinha = ""; 
    15401535                    if ($this->_exibelinhasvazias == false) { 
     
    15491544                        } 
    15501545                    } 
    1551                      
     1546 
    15521547                    //if ($exibe_linha) { 
    15531548                        if ($this->_exiberesultados) { 
     
    15611556                                $align = $coluna->getAlign(); 
    15621557                                if ($coluna->getNowrap()) { $addnowrap = " nowrap"; } 
    1563          
     1558 
    15641559                                                        if ($this->issublist) { 
    15651560                                                                $idtd = $cnt -2; 
     
    15681563                                                        } 
    15691564                                $htmlcoluna = $coluna->getHtml($linha,$this->arrindicadores,$class,$idtd); 
    1570                                  
     1565 
    15711566                                if (($coluna->getTipo() == "check") && ($htmlcoluna != "")) { $temcheck = true; $this->temcheck = true; } 
    15721567                            } 
    1573                             if ($this->isTotalizador($coluna->getIdColuna())) {  
     1568                            if ($this->isTotalizador($coluna->getIdColuna())) { 
    15741569                                $condicaototal = $this->totalizadores[$coluna->getIdColuna()]["condicaototal"]; 
    15751570                                $condicaosubtotal = $this->totalizadores[$coluna->getIdColuna()]["condicaosubtotal"]; 
    15761571                                $htmlvalorcoluna = $coluna->getValorHTML($linha); 
    1577                                 if ($condicaototal != "1") {  
     1572                                if ($condicaototal != "1") { 
    15781573                                    $ret_total = $coluna->validaCondicao($condicaototal,$linha,false); 
    15791574                                } else { 
    15801575                                    $ret_total = true; 
    15811576                                } 
    1582                                  
     1577 
    15831578                                if ($ret_total) { 
    15841579                                    $tipo_coluna = $coluna->getTipo(); 
     
    16011596                                    } 
    16021597                                } 
    1603                                 if ($condicaosubtotal != "1") {  
     1598                                if ($condicaosubtotal != "1") { 
    16041599                                    $ret_subtotal = $coluna->validaCondicao($condicaosubtotal,$linha,false); 
    16051600                                } else { 
     
    16401635                                $addvisivel = " style='display: none;' "; 
    16411636                            } 
    1642                              
     1637 
    16431638                            if ($this->_exiberesultados) { 
    16441639                                echo  "\n\t\t\t<td id='td_" . $coluna->getIdColuna() . "_" . $idtd . "' " . $falign . $fwidth .  " align='$align'" . $addnowrap . $addvisivel .  ">" . nl2br($htmlcoluna)  . "</td>"; 
    16451640                            } 
    16461641                        } 
    1647                          
    1648                          
    1649      
     1642 
     1643 
     1644 
    16501645                        //ARQUIVO CSV 
    16511646                        if ($this->_temarquivocsv) { 
     
    16661661                    $this->adicionarErro("Nenhuma coluna foi adicionada.",true); 
    16671662                } 
    1668                  
    1669                                  
     1663 
     1664 
    16701665                if ($this->_temarquivocsv) { 
    16711666                        $this->_txtarquivo .= "\n"; 
    16721667                    $this->escreveArquivo($handle); 
    16731668                } 
    1674                  
     1669 
    16751670                //LINHA ADICIONAL DE OBSERVAᅵᅵES, (DETALHAMENTO) 
    16761671                if (count($this->linhasdetalhamento)) { 
     
    16831678                        $htmlcoluna = ""; 
    16841679                        $htmlcoluna = $coluna->getHtml($linha,$this->arrindicadores,$class,$qtdlinhas - 1); 
    1685                          
     1680 
    16861681                        if ($this->_exiberesultados) { 
    16871682                            if ($htmlcoluna == "") { 
     
    16911686                            echo  "\n\t\t\t<td id='td_" . $coluna->getIdColuna() . "_" . $idtd . "' " . $falign . $fwidth . $addnowrap . " align='$align' colspan='" . count($this->colunas) . "'>" . $htmlcoluna  . "</td>"; 
    16921687                            echo  "\n\t\t</tr>"; 
    1693                              
     1688 
    16941689                        } 
    16951690                        if ($this->_temarquivocsv) { 
     
    17001695                            } 
    17011696                    } 
    1702                      
    1703                 } 
    1704                  
     1697 
     1698                } 
     1699 
    17051700                $lastagrupamento = $newagrupamento; 
    17061701                //$lastval = ""; 
    17071702            } 
    17081703        } 
    1709          
     1704 
    17101705        $this->escreveArquivo($handle); 
    17111706 
    1712         if (count($this->totalizadores)) {             
     1707        if (count($this->totalizadores)) { 
    17131708            if ($this->exibesubtotais) { 
    17141709                if ($this->_exiberesultados) { 
     
    17231718                     $idcol = $coluna->getIdColuna(); 
    17241719                     if ($this->isTotalizador($coluna->getIdColuna())) { 
    1725                           
    1726                          if (!$mostrousubtotal) {  
    1727                              $addtexto = "<h3>" . $this->msgsubtotalizador . "</h3>";  
    1728                              $mostrousubtotal = true;  
     1720 
     1721                         if (!$mostrousubtotal) { 
     1722                             $addtexto = "<h3>" . $this->msgsubtotalizador . "</h3>"; 
     1723                             $mostrousubtotal = true; 
    17291724                             $txtarquivotexto = $this->msgsubtotalizador; 
    17301725                         } else { 
    17311726                             $addtexto = ""; 
    17321727                         } 
    1733                          if ($cntcheckspan) {  
    1734                              
    1735                          /*   for ($j=1; $j< $cntcheckspan; $j++) { 
    1736                                  echo  "<td id='subtotal_$idcol' align='right'>&nbsp;</td>"; 
    1737                             }  
    1738                              
    1739                                 echo  "<td id='subtotal_titulo_$idcol' align='right'>&nbsp;$addtexto</td>";*/ 
     1728                         if ($cntcheckspan) { 
     1729 
    17401730                                if ($this->_temarquivocsv) { 
    17411731                                for ($j=1; $j<= $cntcheckspan; $j++) { 
     
    17451735                                        $this->_txtarquivo .= ";"; 
    17461736                                } 
    1747                                  }  
    1748                          }  
     1737                                 } 
     1738                         } 
    17491739                         $cntcheckspan = 0; 
    17501740                         $addvisivel = ""; 
     
    17621752                             } 
    17631753                             if ($this->_exiberesultados) { 
    1764                                    echo  "<td id='subtotal_$idcol" . "_" . $cntagrupamentos . "' align='right'$addvisivel>$addtexto&nbsp;<h3>" . $subtotal_valor . "</h3>&nbsp;</td>"; 
     1754                                   echo  "<td id='subtotal_$idcol" . "_" . $cntagrupamentos . "' align='right'$addvisivel>$addtexto&nbsp;<h3>" . $subtotal_valor . "</h3></td>"; 
    17651755                             } 
    17661756                             if (in_array($idcol,$this->_colunasarquivo)) { 
     
    17731763                         } 
    17741764                         if ($this->_exiberesultados) { 
    1775                             echo  "<td id='subtotal_$idcol" . "_" . $cntagrupamentos . "' $addvisivel>&nbsp;</td>"; 
     1765                            echo  "<td id='subtotal_$idcol" . "_" . $cntagrupamentos . "' $addvisivel></td>"; 
    17761766                         } 
    17771767                         if ($this->_temarquivocsv) { 
     
    17891779                } 
    17901780            } 
    1791              
    1792              
    1793              
     1781 
     1782 
     1783 
    17941784            if ($this->_exibetotalizadores) { 
    17951785                if ($this->_exiberesultados) { 
     
    17991789                $cntcheckspan = 0; 
    18001790                foreach ($this->colunas as $coluna) { 
    1801                       
     1791 
    18021792 
    18031793                     $idcol = $coluna->getIdColuna(); 
    18041794                     if ($this->isTotalizador($coluna->getIdColuna())) { 
    1805                          if (!$mostroutotal) {  
    1806                              $addtexto = "<h3>" . $this->msgtotalizador .  "</h3>";  
    1807                              $mostroutotal = true;  
     1795                         if (!$mostroutotal) { 
     1796                             $addtexto = "<h3>" . $this->msgtotalizador .  "</h3>"; 
     1797                             $mostroutotal = true; 
    18081798                             $txtarquivotexto = $this->msgtotalizador; 
    18091799                         } else { 
    18101800                             $addtexto = ""; 
    18111801                         } 
    1812                           
    1813                          if ($cntcheckspan) {  
     1802 
     1803                         if ($cntcheckspan) { 
    18141804                            if ($this->_temarquivocsv) { 
    18151805                                for ($j=1; $j<= $cntcheckspan; $j++) { 
     
    18191809                                    $this->_txtarquivo .= ";"; 
    18201810                                } 
    1821                             }  
    1822                          }  
     1811                            } 
     1812                         } 
    18231813                         $cntcheckspan = 0; 
    18241814                         $addvisivel = ""; 
     
    18551845                                $this->_txtarquivo .= ";"; 
    18561846                            } 
    1857                          }  
     1847                         } 
    18581848                     } 
    18591849                } 
     
    18631853                if ($this->_temarquivocsv) { 
    18641854                    $this->_txtarquivo .= "\n"; 
    1865                 }  
    1866             } 
    1867         } 
    1868          
     1855                } 
     1856            } 
     1857        } 
     1858 
    18691859        $this->escreveArquivo($handle); 
    1870          
    1871          
     1860 
     1861 
    18721862        if (!$this->issublist) { 
    18731863            if (is_object($this->subListagem)) { 
    18741864                if ($this->subListagem->getQuantidadeRegistros()) { 
    1875                         $this->subListagem->gerarArquivoXLS();  
     1865                        $this->subListagem->gerarArquivoXLS(); 
    18761866                    ob_start(); 
    18771867                    $this->subListagem->desenhar(); 
     
    18831873                    if ($this->_exiberesultados) { 
    18841874                        echo  "<tr><td colspan='$colspan'>"; 
    1885                         echo  $htmllist;             
     1875                        echo  $htmllist; 
    18861876                        echo  "</td></tr>"; 
    18871877                    } 
     
    18931883            } 
    18941884        } 
    1895          
     1885 
    18961886        $this->escreveArquivo($handle); 
    1897          
    1898          
    1899    /*   
    1900        EXIBIR OS BOTï¿œES DE + E - PARA QUANDO POSSUIR COLUNAS COM CHECKBOXES. COMENTADO POR QUE Nï¿œO FUNCIONA SE TIVER MAIS DE UM FORMULï¿œRIO NA MESMA JANELA. */   
     1887 
     1888 
     1889   /* 
     1890       EXIBIR OS BOTï¿œES DE + E - PARA QUANDO POSSUIR COLUNAS COM CHECKBOXES. COMENTADO POR QUE Nï¿œO FUNCIONA SE TIVER MAIS DE UM FORMULï¿œRIO NA MESMA JANELA. */ 
    19011891        if (!$this->issublist) { 
    19021892            if ($temcheck) { 
     
    19231913            } 
    19241914        } 
    1925          
    1926          
     1915 
     1916 
    19271917 
    19281918        if ($this->_exibeqtdregistros) { 
     
    19461936                echo   "</td>\n\t\t</tr>"; 
    19471937            } 
    1948              
    1949         } 
    1950          
     1938 
     1939        } 
     1940 
    19511941        $this->escreveArquivo($handle); 
    1952          
     1942 
    19531943 
    19541944        if ($this->_temarquivocsv) { 
    19551945                if (!$this->issublist) { 
    1956                  
    1957                          
     1946 
     1947 
    19581948                        fclose($handle); 
    1959                  
     1949 
    19601950                        $link=$tmpfname; 
    1961                          
     1951 
    19621952                        if ($cnt != 0) { 
    19631953                                echo   "\n\t\t<tr class='tableRodapeModelo3'>\n\t\t\t<td colspan='$colspan' align=center>"; 
     
    19771967                        $this->form->addCampoAcao("btn_arquivo","onclick","window.open('gera_csv_to_excel.php?arquivocsv=" . $link . "');"); 
    19781968                        $this->form->addQuadro("quadro_arquivo"); 
    1979                         $this->form->addQuadroButton("quadro_arquivo","btn_arquivo");  
     1969                        $this->form->addQuadroButton("quadro_arquivo","btn_arquivo"); 
    19801970             */ 
    19811971        } 
    1982          
    1983         /*     
    1984           FORMULï¿œRIO    
     1972 
     1973        /* 
     1974          FORMULï¿œRIO 
    19851975        if (!$this->issublist) { 
    19861976            if ($cnt != 0) { 
     
    19911981                    $this->form->displayErros(); 
    19921982                    $htmlform = ob_get_contents(); 
    1993          
     1983 
    19941984                    ob_end_clean(); 
    19951985                    echo  $htmlform; 
     
    20001990            $this->form->fechaForm(); 
    20011991            $htmlform = ob_get_contents(); 
    2002             ob_end_clean();  
     1992            ob_end_clean(); 
    20031993        } */ 
    20041994        //echo  $htmlform; 
    2005          
     1995 
    20061996        $this->arrtotais = $arrtotais; 
    20071997        $this->arrsubtotais = $arrsubtotais_todos; 
    20081998        $this->arragrupamentos = $arragrupamentos; 
    2009          
    2010          
    2011     } 
    2012      
     1999 
     2000 
     2001    } 
     2002 
    20132003    public function setDebug($value) { 
    20142004        $this->_debug = $value; 
    20152005    } 
    2016       
     2006 
    20172007    /** 
    20182008     * Funᅵᅵo usada internamente para adicionar um erro ao formulï¿œrio. 
     
    20252015        $erro = array("msgerro" => $msgerro,"fatal" => $fatal); 
    20262016        array_push($this->_errors,$erro); 
    2027           
     2017 
    20282018        if ($fatal) { 
    20292019            $this->escreveErros(); 
    20302020            exit; 
    20312021        } 
    2032           
     2022 
    20332023    } 
    20342024 
     
    20632053        } 
    20642054    } 
    2065      
     2055 
    20662056    public function gerarArquivoXLS($colunasarquivo = "") { 
    20672057        if ($colunasarquivo == "") { 
     
    20702060                        if ($coluna->getVisibilidade()) { 
    20712061                          $colunasarquivo .= $coluna->getIdColuna() . ","; 
    2072                         }  
     2062                        } 
    20732063                } 
    20742064                $colunasarquivo = substr($colunasarquivo,0,strlen($colunasarquivo)-1); 
     
    20772067        $txtarquivo = ""; 
    20782068        $this->_colunasarquivo = $arcolunas; 
    2079                 $this->_temarquivocsv = true;  
    2080     } 
    2081      
     2069                $this->_temarquivocsv = true; 
     2070    } 
     2071 
    20822072    /* 
    20832073     * Funᅵᅵo utilizada pra somar intervalos de Horas */ 
    20842074    public function somaIntervaloHoras($arrValores){ 
    2085      
     2075 
    20862076        // Somando separadamente os valores 
    20872077        foreach($arrValores as $valor){ 
    2088          
     2078 
    20892079            $arrTmp = explode(':',$valor); 
    2090          
     2080 
    20912081            $seg += $arrTmp[2]; 
    20922082            $min += $arrTmp[1]; 
    2093             $hor += $arrTmp[0];  
    2094         } 
    2095          
     2083            $hor += $arrTmp[0]; 
     2084        } 
     2085 
    20962086        // Tratando os segundos 
    20972087        if( $seg >= 60){ 
    2098          
     2088 
    20992089            $min += floor($seg / 60) ; 
    2100              
     2090 
    21012091            while($seg >= 60){ 
    2102                  
     2092 
    21032093                $seg = $seg - 60; 
    21042094            } 
    2105          
     2095 
    21062096        } 
    21072097        // Tratando os minutos 
    21082098        if( $min >= 60){ 
    2109          
     2099 
    21102100            $hor += floor($min / 60) ; 
    2111              
     2101 
    21122102            while($min >= 60){ 
    2113                  
     2103 
    21142104                $min = $min - 60; 
    21152105            } 
    2116          
    2117         } 
    2118          
     2106 
     2107        } 
     2108 
    21192109        return str_pad($hor,2,'0',STR_PAD_LEFT).':'.str_pad($min,2,'0',STR_PAD_LEFT).':'.str_pad($seg,2,'0',STR_PAD_LEFT); 
    21202110    } 
    2121      
     2111 
    21222112    /** 
    21232113     * Funᅵᅵo que Retorna se a listagem Possui um checkBox adicionado. 
     
    21262116        return $this->temcheck; 
    21272117    } 
    2128      
    2129     /** 
    2130      * Funᅵᅵo que retorna o array com os Totalizadores.  
     2118 
     2119    /** 
     2120     * Funᅵᅵo que retorna o array com os Totalizadores. 
    21312121     */ 
    21322122    public function getTotais() { 
    21332123        return $this->arrtotais; 
    21342124    } 
    2135      
     2125 
    21362126    /** 
    21372127     * Funᅵᅵo que Retorna o array com os Sub-Totalizadores. 
     
    21402130        return $this->arrsubtotais; 
    21412131    } 
    2142      
     2132 
    21432133    /** 
    21442134     * Funᅵᅵo que Retorna o array com os Sub-Totalizadores. 
     
    21472137        return $this->arragrupamentos; 
    21482138    } 
    2149      
     2139 
    21502140    /** 
    21512141     * Funᅵᅵo Interna Utilizada quando a Listagem possui uma sublistagem para guardar quantos registros a listagem principal tem. 
    21522142     */ 
    21532143    protected function setQuantidadeRegistrosListagemPrincipal($value) { 
    2154         $this->_qtdregistroslistagemprincipal = $value;  
    2155     } 
    2156      
     2144        $this->_qtdregistroslistagemprincipal = $value; 
     2145    } 
     2146 
    21572147    /** 
    21582148     * Funᅵᅵo Interna Utilizada quando a Listagem possui uma sublistagem para retornar quantos registros a listagem principal tem. 
     
    21612151        return $this->_qtdregistroslistagemprincipal; 
    21622152    } 
    2163      
     2153 
    21642154    protected function getTextoArquivoCSV() { 
    21652155        return $this->_txtarquivo; 
    21662156    } 
    2167      
     2157 
    21682158    public function autoAdicionarColunas() { 
    21692159        $i = pg_num_fields($this->dados); 
     
    21712161            $fieldname = pg_field_name($this->dados, $j); 
    21722162            $tipo = pg_field_type($this->dados, $j); 
    2173             $this->adicionarColuna("coluna_" .$j,"$fieldname","{" . $fieldname . "}","text","left");   
     2163            $this->adicionarColuna("coluna_" .$j,"$fieldname","{" . $fieldname . "}","text","left"); 
    21742164        } 
    21752165    } 
Note: See TracChangeset for help on using the changeset viewer.