$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 = ""; } $z++; $tpl->block('EACH_CHART_SERVICO'); $tipoVal[$tipo]['nome'] = $ucTipo->getTipoNome(); $tipoVal[$tipo]['mes'][1] = 0; $tipoVal[$tipo]['mes'][2] = 0; $tipoVal[$tipo]['mes'][3] = 0; $tipoVal[$tipo]['mes'][4] = 0; $tipoVal[$tipo]['mes'][5] = 0; $tipoVal[$tipo]['mes'][6] = 0; $tipoVal[$tipo]['mes'][7] = 0;
$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"); } $y; $totalPago = 0; for ($i = 0; $i < count($eachTotal); $i++) { $tpl->TIPOTOTAL = tratarValor($eachTotal[$i], true); $tpl->BLOCK('EACH_TIPOTOTAL');