Ejemplo n.º 1
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)'];
         $ucqtd++;
         $tpl->block("EACH_UC");
     }
Ejemplo n.º 2
0
 $uoid = (int) $_GET['uo'];
 $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;
Ejemplo n.º 3
0
 $totalMensal[2] = 0;
 $totalMensal[3] = 0;
 $totalMensal[4] = 0;
 $totalMensal[5] = 0;
 $totalMensal[6] = 0;
 $totalMensal[7] = 0;
 $totalMensal[8] = 0;
 $totalMensal[9] = 0;
 $totalMensal[10] = 0;
 $totalMensal[11] = 0;
 $totalMensal[12] = 0;
 $totalMensal[13] = 0;
 // TOTAL DA UO
 foreach ($uoUcs as $uoUcId) {
     $uc = new UnidadeConsumidora($uoUcId);
     $tpl->RGI = $uc->get('rgi');
     $tpl->UCNOME = $uc->getNome();
     $tpl->UCSTATUS = "<br>" . $uc->getAtivoText();
     $tpl->UCTIPO = $uc->getTipoNome();
     $tpl->UCEMPRESA = $uc->get('empresa')->getNome();
     $tpl->UCCHAVE = SHA1($uc->get('id'));
     $tipo = $uc->get('tipo');
     /**********************************
     				MOSTRAR PAGAMENTOS MENSAIS
     			**********************************/
     $pagMensal = $uc->getExercicioMensal($anoAtual);
     $index = 1;
     $totalUc = 0;
     for ($i = 1; $i <= 12; $i++) {
         if (array_key_exists($index, $pagMensal) && $pagMensal[$index]['mes_ref'] == $i) {
             $val = $pagMensal[$index]['valor'];
Ejemplo n.º 4
0
    $conts = $user->getContratos();
    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
 $uo = new Unidade($id);
 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;
Ejemplo n.º 6
0
 $tpl->CHAVE = $chave;
 if (mysql_num_rows($queryVerif)) {
     /***********************
     			 MOSTRAR MENU COM ANOS
     			***********************/
     $iMin = 2012;
     $iCalc = $anoAtual - 5;
     $iFor = $iCalc < $iMin ? $iMin : $iCalc;
     for ($i = $iFor; $i <= Date('Y'); $i++) {
         $tpl->ITEM_MENU_URL = "resumo_uc.php?chave=" . $_GET['chave'] . "&ano=" . $i;
         $tpl->ITEM_MENU_LINK = $i;
         $tpl->block('ITEM_MENU');
     }
     $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'));
Ejemplo n.º 7
0
if (isset($_GET['chave'])) {
    $chave = mysql_real_escape_string($_GET['chave']);
    if (strlen($chave) == 40) {
        $tpl->addFile('CONTEUDO', 'html_libs/udd_ucDetalhes.html');
        $queryVerif = mysql_query("SELECT id FROM daee_uddc WHERE SHA1(id) = '" . $_GET['chave'] . "'");
        $tpl->CHAVE = $chave;
        if (mysql_num_rows($queryVerif)) {
            $id = mysql_fetch_array($queryVerif)['id'];
            $uc = new UnidadeConsumidora($id);
            /*********************************
            		  MOSTRAR INFORMAÇÕES DO RELATÓRIO
            		 *********************************/
            $tpl->ANO = $anoAtual;
            $tpl->ANO_ANT = $anoAtual - 1;
            $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 = $uc->get('contrato')->geraNome();
            $tpl->UNIDADE = $uc->get('uo')->getSigla();
            $eachMes = $uc->getExercicioMensal($anoAtual);
            //print_r($eachMes);
            $mesConsTotal = 0;
            $mesPagoTotal = 0;
            $z = 1;
            $somaAnt = $somaPost = 0;
            foreach ($eachMes as $mes) {
                $mesConsTotal += $mes['consumo'];
                $mesPagoTotal += $mes['valor'];
Ejemplo n.º 8
0
        $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');
    }
} else {
    if ($_GET['form'] == "uo") {
        // FORMULÁRIO PARA UNIDADES OPERACIONAIS
        $tpl->addFile('CONTEUDO', 'html_libs/ger_addUnidadeO-form.html');
        $sql_cidade = "SELECT id,nome FROM sys_cidade";
        $query_cid = mysql_query($sql_cidade);
        while ($res = mysql_fetch_array($query_cid)) {
            $tpl->CIDID = $res['id'];
            $tpl->CIDNOME = $res['nome'];
            $tpl->block("EACH_CIDADE");
        }
        $alerta = "";