$tiposArray[] = $ucTipo->getTipoNome(); $x++; } $sqlUo = "SELECT id FROM daee_udds ORDER BY id"; $queryUo = mysql_query($sqlUo); $uctotal = 0; $eachUoByType; // array para mostrar nos gráficos $eachTotalPorUnidade; // array com cada total por unidade while ($uoArray = mysql_fetch_array($queryUo)) { $uo = new Unidade($uoArray['id']); $tpl->UOID = $uoArray['id']; $tpl->UOSIGLA = $uo->getSigla(); $tpl->UONOME = $uo->getNome(); $tpl->UCQTD = $uo->getQtdUc(); $tpl->UOKEY = sha1($uoArray['id']); $uctotal += $uo->getQtdUc(); $totalUo = 0; for ($i = 0; $i < $numtipos; $i++) { $valor = $uo->getTotalPorTipo($i, $anoAtual); $tpl->TIPOVALOR = $valor > 0 ? "<a href='udd_uoCharts.php?chave=" . sha1($uoArray['id']) . "&svc={$i}&start=" . $anoAtual . "'>" . tratarValor($valor, true) . "</a>" : tratarValor($valor, true); $tpl->BLOCK('EACH_TIPOVALOR'); $totalUo += $valor; $eachTotal[$i] += $valor; $eachUoByType[$i][$uo->getSigla()] = $valor; } $tpl->UOTOTAL = tratarValor($totalUo, true); $eachTotalPorUnidade[$uo->getSigla()] = $totalUo; $tpl->block("EACH_UO"); }
$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 { $tpl->COMA1 = "";
redirectByPermission(3); // SETAR PERMISSÃO DA PÁGINA $tpl = new Template('html_libs/template.html'); $tpl->addFile('SECONDMENU', 'html_libs/ger_secondMenu.html'); if (!isset($_GET['form'])) { $tpl->addFile('CONTEUDO', 'html_libs/ger_addUnidadeIndex.html'); $sql = "SELECT id FROM daee_udds WHERE nome <> '' AND unidade <> ''"; $query = mysql_query($sql); while ($res = mysql_fetch_array($query)) { $udd = new Unidade($res['id']); $tpl->UOID = $udd->get('id'); $tpl->UOSIGLA = $udd->getSigla(); $tpl->UONOME = $udd->getNome(); $tpl->UOEND = $udd->getEndereco(); $tpl->UOCIDADE = $udd->get('cidade'); $tpl->UOUCQTD = $udd->getQtdUc(); $tpl->block('EACH_UO'); } $sql2 = "SELECT id FROM daee_uddc WHERE ativo = 1"; $query2 = mysql_query($sql2); while ($res = mysql_fetch_array($query2)) { $tpl->UCID = $res['id']; $uc = new UnidadeConsumidora($res['id']); $tpl->UCTIPO = $uc->getTipoNome(); $tpl->UCNOME = $uc->getNome(); $tpl->UCEND = $uc->getEndereco(); $tpl->UCCID = $uc->getCidadeNome(); $tpl->UCVINC = $uc->get('uo')->getSigla(); $tpl->UCRGI = $uc->get('rgi'); $tpl->block('EACH_UC'); }