$iFor = $iCalc < $iMin ? $iMin : $iCalc; for ($i = $iFor; $i <= Date('Y'); $i++) { $tpl->ITEM_MENU_URL = "resumo_index.php?ano=" . $i; $tpl->ITEM_MENU_LINK = $i; $tpl->block('ITEM_MENU'); } /*********************** MOSTRAR MENU COM ANOS ***********************/ $rel = new Relatorio(); $cores = $rel->cores; $ucTipos = $uo->getTiposServicos(); foreach ($ucTipos as $tipo) { //$tpl->BDCOLOR = "#4096EE"; $tpl->BDCOLOR = $cores[$tipo]; $ucSomas = $uo->getUcSomaByType($tipo, $anoAtual); $totais[0] = $totais[1] = 0; if ($ucSomas != null) { foreach ($ucSomas as $uc) { $tpl->UCRGI = $uc['rgi']; $tpl->UCNOME = $uc['compl'] . " - " . $uc['rua']; $tpl->UCTIPO = $rel->getTipoNome($uc['tipo']); $tpl->UCCHAVE = sha1($uc['id']); $tpl->ANOATUAL = $anoAtual; $tpl->STATUS = getAtivoText($uc['ativo']); $tpl->CONSUMO = tratarValor($uc['SUM(n.consumo)']); $tpl->VALOR = tratarValor($uc['SUM(n.valor)'], true); $tpl->block('EACH_UC'); $totais[0] += $uc['SUM(n.consumo)']; $totais[1] += $uc['SUM(n.valor)']; }