Ejemplo n.º 1
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)'];
         $ucqtd++;
         $tpl->block("EACH_UC");
     }
     $tpl->UCQTD = $ucqtd;
     //$tpl->TIPO_NOME .= " " . $ucqtd;
Ejemplo n.º 2
0
 $getAno = $_GET['ano'];
 //$tpl->UCID  = $ucid;
 $tpl->GETANO = $getAno;
 $uo = new Unidade($uoid);
 $consChart = array();
 if ($uo->getSigla() != "") {
     $ucs = $uo->getAllUcs();
     $tpl->UONOME = $uo->getSigla() . " - " . $uo->getNome();
     $tpl->UOFORMNOME = $uo->getSigla() . " | " . $uo->getNome();
     $tpl->UOFORMID = $uoid;
     $tpl->block('EACHUOFORM');
     $arrayUcs;
     foreach ($ucs as $ucid) {
         $uc = new UnidadeConsumidora($ucid);
         $arrayUcs[$uc->get('tipo')][$uc->get('id')]['rgi'] = $uc->get('rgi');
         $arrayUcs[$uc->get('tipo')][$uc->get('id')]['nome'] = $uc->getNome();
         $arrayUcs[$uc->get('tipo')][$uc->get('id')]['empresa'] = $uc->get('empresa')->getNome();
         $arrayUcs[$uc->get('tipo')][$uc->get('id')]['mensal'] = $uc->getExercicioMensal($getAno);
     }
     $totalGeral[1] = 0;
     $totalGeral[2] = 0;
     $totalGeral[3] = 0;
     $totalGeral[4] = 0;
     $totalGeral[5] = 0;
     $totalGeral[6] = 0;
     $totalGeral[7] = 0;
     $totalGeral[8] = 0;
     $totalGeral[9] = 0;
     $totalGeral[10] = 0;
     $totalGeral[11] = 0;
     $totalGeral[12] = 0;
Ejemplo n.º 3
0
 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> ";
         //. $uc->getVariacaoDoMes(1, 2013)
         $tpl->TIPOCONS = $uc->getTipoMedida();
         $exerc_atu = $uc->getExercicioMensal($start);
         $exerc_ant = $uc->getExercicioMensal($start - 1);
         $mes_atu = Date('n');
         $tpl->ANO_ANT = $start - 1;
         $tpl->ANO = $start;
         $tpl->MED_LAB = 'Média ' . $start;
         for ($i = 1; $i <= 12; $i++) {
             if (array_key_exists($i, $exerc_ant)) {
                 $ucArray[$ucid][$start - 1]['consumo'][$i] = $exerc_ant[$i]['consumo'];
                 $ucArray[$ucid][$start - 1]['valor'][$i] = $exerc_ant[$i]['valor'];
             } else {
                 $ucArray[$ucid][$start - 1]['consumo'][$i] = 0;
                 $ucArray[$ucid][$start - 1]['valor'][$i] = 0;
Ejemplo n.º 4
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.º 5
0
 $id = mysql_fetch_array($queryVerif)['id'];
 $uc = new UnidadeConsumidora($id);
 $contrato = $uc->get('contrato');
 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']);