}
$sqlTipos = "SELECT DISTINCT(tipo) FROM daee_uddc";
$queryTipos = mysql_query($sqlTipos);
$anoAtual = isset($_GET['ano']) ? $_GET['ano'] : Date('Y');
$consTotal;
$pagoTotal;
$consAnoTotal;
$pagoAnoTotal;
$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();
 $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'];
             $tpl->UCMESVAL = tratarValor($val, true);
             $index++;
         } else {
$inicio = execucao();
$tpl = new Template('html_libs/template.html');
$tpl->addFile('SECONDMENU', 'html_libs/udd_secondMenu.html');
$tpl->addFile('CONTEUDO', 'html_libs/udd_relatorioUO.html');
$tpl->addFile('JSCRIPT', 'cssjs_libs/js_parts/js_udd_relatorioUO.html');
$anoAtual = isset($_GET['ano']) ? $_GET['ano'] : Date('Y');
$sqlTipos = "SELECT DISTINCT(tipo) FROM daee_uddc ORDER BY tipo";
$queryTipos = mysql_query($sqlTipos);
$tpl->DISTINCT_TYPE = $numtipos = mysql_num_rows($queryTipos);
$tpl->ANO = $anoAtual;
$x = 0;
$eachTotal;
$tiposArray;
while ($tipos = mysql_fetch_array($queryTipos)) {
    $ucTipo = new UnidadeConsumidora(0, null, null, null, null, null, null, null, null, null, null, $tipos['tipo']);
    $tpl->DISTINCT_NOME = $ucTipo->getTipoNome();
    $tpl->block("EACH_DISTINCT");
    $eachTotal[$x] = 0;
    $tiposArray[] = $ucTipo->getTipoNome();
    $x++;
}
$sqlUo = "SELECT id FROM daee_udds ORDER BY id";
$queryUo = mysql_query($sqlUo);
$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'];
Example #4
0
 $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']);
         $tpl->PAGOSOMA = tratarValor($mes['valor'], true);
*/
redirectByPermission(1);
// SETAR PERMISSÃO DA PÁGINA
$inicio = execucao();
$tpl = new Template('html_libs/template.html');
$tpl->addFile('SECONDMENU', 'html_libs/udd_secondMenu.html');
$tpl->addFile('JSCRIPT', 'cssjs_libs/js_parts/js_rel_evolServico.html');
$tpl->addFile('CONTEUDO', 'html_libs/rel_evolServico.html');
$tiposArray;
$sqlTipos = "SELECT DISTINCT(tipo) FROM daee_uddc ORDER BY tipo";
$queryTipos = mysql_query($sqlTipos);
if (mysql_num_rows($queryTipos) > 0) {
    while ($tipos = mysql_fetch_array($queryTipos)) {
        $ucTipo = new UnidadeConsumidora(0, null, null, null, null, null, null, null, null, null, null, $tipos['tipo']);
        $tpl->TIPOID = $tipos['tipo'];
        $tpl->TIPONOME = $ucTipo->getTipoNome();
        $tiposArray[$tipos['tipo']] = $ucTipo->getTipoNome();
        $tpl->block('EACH_TIPOSERV');
    }
}
if (isset($_GET['servico'])) {
    $tipoServ = $_GET['servico'];
    if (array_key_exists($tipoServ, $tiposArray)) {
        $tpl->TITULO_EVO = $tiposArray[$tipoServ];
        $tpl->block('AREA_CHART');
        $ano_x = Date('Y') - 1;
        $mesAtual = Date('n');
        $tpl->ANO_ANT = "Jan/" . $ano_x;
        $tpl->ANO_ATU = getMesNome($mesAtual) . "/" . ($ano_x + 1);
        $tpl->LEGENDS = "'" . $tiposArray[$tipoServ] . "'";
        for ($i = 1; $i <= 12 + $mesAtual; $i++) {