Ejemplo n.º 1
0
$x = 0;
while ($tipos = mysql_fetch_array($queryTipos)) {
    $consTotal[$x] = 0;
    $pagoTotal[$x] = 0;
    $consAnoTotal[$x] = 0;
    $pagoAnoTotal[$x] = 0;
    $ucTipo = new UnidadeConsumidora(0, null, null, null, null, null, null, null, null, null, null, $tipos['tipo']);
    $tpl->TIPO_NOME = $ucTipo->getTipoNome();
    $tpl->ANO = $anoAtual;
    $tpl->MEDIDA = $ucTipo->getTipoMedida();
    $tpl->TIPO_ID = $tipos['tipo'];
    $tpl->block("EACH_TIPOBUTTON");
    if ($tipos['tipo'] == $tipoId) {
        //FAZER APARECER UCS E SEUS RESULTADOS
        $ucqtd = 0;
        foreach ($ucTipo->getMesmoTipo() as $res) {
            //$tpl->UCID		= $res;
            $uc = new UnidadeConsumidora($res);
            $tpl->UCRGI = $uc->get('rgi');
            $tpl->UCCHAVE = sha1($uc->get('id'));
            $tpl->UCNOME = $uc->getNome();
            $tpl->UCEND = $uc->getEndereco();
            $tpl->UCCID = $uc->getCidadeNome();
            $tpl->UCSIGLA = $uc->get('uo')->getSigla();
            $tpl->EMPRESA = $uc->get('empresa')->getNome();
            $tpl->STATUS = $uc->getAtivoText();
            $totalAno = $uc->somaValorNotas($anoAtual);
            $tpl->CONSANO = tratarValor($totalAno['SUM(consumo)'], false);
            $tpl->VALANO = tratarValor($totalAno['SUM(valor)'], true);
            $consAnoTotal[$x] += $totalAno['SUM(consumo)'];
            $pagoAnoTotal[$x] += $totalAno['SUM(valor)'];