$ucArray; $uoArray; if (isset($_GET['chave'])) { $chave = $_GET['chave']; if (strlen($chave) == 40) { $svc = isset($_GET['svc']) && $_GET['svc'] > 0 ? $_GET['svc'] : 0; $start = isset($_GET['start']) && $_GET['start'] >= 2010 ? $_GET['start'] : Date('Y'); $tpl->addFile('CONTEUDO', 'html_libs/udd_uoCharts.html'); $queryVerif = mysql_query("SELECT id FROM daee_udds WHERE SHA1(id) = '" . $_GET['chave'] . "'"); if (mysql_num_rows($queryVerif) == 1) { $id = mysql_fetch_array($queryVerif)['id']; /********************************* MOSTRAR INFORMAÇÕES DO RELATÓRIO **********************************/ $uo = new Unidade($id); if (in_array($svc, $uo->getTiposServicos())) { $tpl->PERIODO = $start; $tpl->UOSIGLA = $uo->getSigla(); $numMeses = 12 * (Date('Y') - $start) + Date('n'); $ucTipo = new UnidadeConsumidora(0, null, null, null, null, null, null, null, null, null, null, $svc); $tpl->TIPONOME = $ucTipo->getTipoNome(); $ucids = $ucTipo->getMesmoTipoPorUO($id); $tpl->UCQTD = count($ucids); $tpl->RGISINSTA = ""; /********************************* MONTAR ARRAY COM TODOS OS VALORES **********************************/ foreach ($ucids as $ucid) { $uc = new UnidadeConsumidora($ucid); $tpl->RGISINSTA .= "<br />" . $uc->getAtivoText() . " - <a href='udd_ucDetalhes.php?chave=" . sha1($uc->get('id')) . "'>"; $tpl->RGISINSTA .= $uc->get('rgi') . " - " . $uc->getNome() . "</a> ";
$anoAtual = isset($_GET['ano']) ? $_GET['ano'] : Date('Y'); $tipoVal; if (isset($_GET['chave'])) { $chave = $_GET['chave']; if (strlen($chave) == 40) { $tpl->addFile('CONTEUDO', 'html_libs/udd_uoDetalhes.html'); $queryVerif = mysql_query("SELECT id FROM daee_udds WHERE SHA1(id) = '" . $_GET['chave'] . "'"); if (mysql_num_rows($queryVerif) == 1) { $id = mysql_fetch_array($queryVerif)['id']; /********************************* MOSTRAR INFORMAÇÕES DO RELATÓRIO *********************************/ $uo = new Unidade($id); $tpl->UOSIGLA = $uo->getSigla(); $tpl->UONOME = $uo->getNome(); $uoTipoServicos = $uo->getTiposServicos(); $tpl->UOUCQTD = $uo->getQtdUc(); $tpl->ANO_ATU = $anoAtual; $tpl->TIPOSSERVICOS = ""; $z = 0; if (count($uoTipoServicos) > 0) { foreach ($uoTipoServicos as $tipo) { $ucTipo = new UnidadeConsumidora(0, null, null, null, null, null, null, null, null, null, null, $tipo); $mesmoTipo = $uo->getUcPorTipo($tipo); $tpl->TIPOSSERVICOS .= "<br /> - <b><font color='navy'>" . $ucTipo->getTipoNome() . "</font></b>: <a href='udd_uoCharts.php?chave=" . $_GET['chave'] . "&svc={$tipo}&start=" . $anoAtual . "'>"; $tpl->TIPOSSERVICOS .= "Relatório " . $anoAtual . " de " . count($mesmoTipo) . " UC(s)</a>"; $tpl->TIPOSERVICO = $ucTipo->getTipoNome(); $tpl->CHART_VALOR = $uo->getTotalPorTipo($tipo, $anoAtual); if ($z < count($uoTipoServicos)) { $tpl->COMA1 = ","; } else {
MOSTRAR MENU COM ANOS ***********************/ $iMin = 2012; $iCalc = $anoAtual - 5; $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);