Ejemplo n.º 1
0
    if ($conts[0]['id'] != null) {
        $qtdCont = count($conts);
        $z = 1;
        foreach ($conts as $cont) {
            $contrato = new Contrato($cont['id']);
            //$tpl->CONTNOME		= "-------- ".$contrato->geraNome(). " --------";
            $rgis = $contrato->getAllUcs(true);
            if ($rgis[0]['id'] != null) {
                $qtdRgi = count($rgis);
                $w = 1;
                foreach ($rgis as $rgi) {
                    $uc = new UnidadeConsumidora($rgi['id']);
                    $tpl->RGID = $rgi['id'];
                    $tpl->DISABLE_OPT = "";
                    $tpl->RGI = $uc->get('rgi');
                    $tpl->RGINOME = $uc->getEndereco() . " ~> " . $uc->getNome();
                    $tpl->block('EACH_RGI');
                    if ($z < $qtdCont) {
                        $tpl->MS_COMA = ",";
                    } elseif ($z == $qtdCont) {
                        $tpl->MS_COMA = $w < $qtdRgi ? "," : "";
                    }
                    $w++;
                    $tpl->block('MAGIC_SUGGEST');
                }
            }
            //$tpl->block('EACH_OPTGROUP');
        }
    }
}
/*****************************************************
Ejemplo n.º 2
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)'];
         $ucqtd++;
         $tpl->block("EACH_UC");
     }
     $tpl->UCQTD = $ucqtd;
     //$tpl->TIPO_NOME .= " " . $ucqtd;
     $tpl->SOMACONSANO = tratarValor($consAnoTotal[$x]);
Ejemplo n.º 3
0
 if ($_SESSION['bacia'] == $uc->get('uo')->get('id') || $_SESSION['nivel'] == 1) {
     $tpl->addFile('CONTEUDO', 'html_libs/resumo_uc.html');
     /*********************************
     		  MOSTRAR INFORMAÇÕES DO RELATÓRIO
     		 *********************************/
     $rel = new Relatorio();
     $cores = $rel->cores;
     $tpl->UCCOLOR = $cores[$uc->get('tipo')];
     $tpl->ANO = $anoAtual;
     $tpl->ANO_ANT = $anoAnterior;
     $tpl->TIPOCONS = $uc->getTipoMedida();
     $tpl->RGI = $uc->get('rgi');
     $tpl->NOME = $uc->getNome();
     $tpl->TIPONOME = $uc->getTipoNome();
     $tpl->EMPRESA = $uc->get('empresa')->getNome() . " CNPJ " . $uc->get('empresa')->transformCnpj($uc->get('empresa')->get('cnpj'));
     $tpl->ENDERECO = $uc->getEndereco() . " - " . $uc->getCidadeNome();
     $tpl->CONTRATO = $contrato->geraNome();
     $tpl->UNIDADE = $uc->get('uo')->getSigla();
     $eachMes = $uc->getExercicioMensal($anoAtual);
     $mesConsTotal = 0;
     $mesPagoTotal = 0;
     $z = 1;
     $somaAnt = $somaPost = 0;
     foreach ($eachMes as $mes) {
         $mesConsTotal += $mes['consumo'];
         $mesPagoTotal += $mes['valor'];
         $tpl->MESSOMA = strtoupper(getMesNome($mes['mes_ref']));
         $tpl->CONSSOMA = tratarValor($mes['consumo']);
         $tpl->PAGOSOMA = tratarValor($mes['valor'], true);
         if ($z > 1 && $z <= count($eachMes)) {
             $divisor = $eachMes[$z - 1]['valor'] == 0 ? 1 : $eachMes[$z - 1]['valor'];