Esempio n. 1
0
 				MOSTRAR TOTAIS MENSAIS
 			**********************************/
 for ($i = 1; $i <= 12; $i++) {
     $tpl->UCMESTOTAL = tratarValor($totalMensal[$i], true);
     $tpl->block('EACH_MESUCTOTAL');
     $tpl->MESANO = getMesNome($i);
     $tpl->AREA_VAL = $totalMensal[$i];
     $tpl->MEDTOT_VAL = $mediaMensal;
     if ($i < 12) {
         $tpl->COMA = ",";
     } else {
         $tpl->COMA = "";
     }
     $tpl->block('EACH_AREACHART');
 }
 $tpl->UOTOTAL = tratarValor($totalMensal[13], true);
 $chrt_index = 0;
 foreach ($tipoVal as $tp) {
     $tpl->CHRT_TIPO_NOME = $tp['nome'];
     $tpl->CHRT_INDEX = $chrt_index;
     $chrt_index++;
     $ar_med = round(array_sum($tp['mes']) / getDivisorParaMedia($tp['mes']), 2);
     for ($i = 1; $i <= 12; $i++) {
         $tpl->MESANO = getMesNome($i);
         $tpl->AR_VAL = $tp['mes'][$i] > 0 ? $tp['mes'][$i] : 0;
         $tpl->COMA = $i < 12 ? ',' : '';
         $tpl->AR_MED = $ar_med;
         $tpl->block('EACH_AR_VAL');
     }
     $tpl->block('EACH_AR_CHART');
     $tpl->block('EACH_TIPO_CHART');
Esempio n. 2
0
                    $tpl->block('TIPO_CONS_CHART');
                }
                $tpl->block('EACHTIPO');
            }
            /*
             * Mostrar dados em tabela Geral e Montar Gráfico
             * 
             */
            $mediaUo = $relatorio->average($totalGeral);
            $chart_val = "";
            foreach ($totalGeral as $key => $totalmes) {
                $tpl->TOTMESVAL = tratarValor($totalmes, true);
                $chart_val .= ",['" . getMesNome($key) . "', {$totalmes}, {$mediaUo}]";
                $tpl->block('TOTMESBLOCK');
            }
            $tpl->CHARTVAL = $chart_val;
            $tpl->TOTMEDIA = tratarValor($mediaUo, true);
            $tpl->block('RESULTS');
        } else {
            $tpl->block('NORESULTS');
        }
    }
}
$sql = "SELECT id,nome,unidade FROM daee_udds ORDER BY unidade";
$query = mysql_query($sql);
while ($uo = mysql_fetch_array($query)) {
    $uoNome = $uo['unidade'] . " | " . $uo['nome'];
    $tpl->UOFORMNOME = $uoNome;
    $tpl->UOFORMID = $uo['id'];
    $tpl->block('EACHUOFORM');
}
Esempio n. 3
0
                foreach ($exercicio as $mes) {
                    if ($hasConsumo) {
                        $totCons += $mes['consumo'];
                    }
                    $totPago += $mes['valor'];
                }
                if ($hasConsumo) {
                    $exArray[$exArrayIndex]['cons'] = $totCons / $meses_count;
                    $varCons = $exArrayIndex > 0 ? round(($exArray[$exArrayIndex]['cons'] / $exArray[$exArrayIndex - 1]['cons'] - 1) * 100) / 100 : 0;
                    $tpl->TOTCONS = tratarValor($totCons, false);
                    $tpl->MEDCONS = tratarValor($exArray[$exArrayIndex]['cons'], false);
                    $tpl->VARCONS = getPorcentagem($varCons * 100, true);
                    $tpl->block('SHOW_CONS');
                }
                $exArray[$exArrayIndex]['pago'] = $totPago / $meses_count;
                $varPago = $exArrayIndex > 0 ? round(($exArray[$exArrayIndex]['pago'] / $exArray[$exArrayIndex - 1]['pago'] - 1) * 100) / 100 : 0;
                $tpl->TOTPAGO = tratarValor($totPago, true);
                $tpl->MEDPAGO = tratarValor($exArray[$exArrayIndex]['pago'], true);
                $tpl->VARPAGO = getPorcentagem($varPago * 100, true);
                $tpl->block('EACH_ANO_RESUMO');
                $exArrayIndex++;
                //				var_dump($exercicio);
            }
        } else {
            header("Location: udd_relatorioUC.php");
        }
    } else {
        header("Location: udd_relatorioUC.php");
    }
}
$tpl->show();
Esempio n. 4
0
 $i = 1;
 while ($res = mysql_fetch_array($query_cont)) {
     $contrato = new Contrato($res['id']);
     $tpl->AUTOS = $i . " - " . $contrato->geraNome();
     $tpl->PERIODO = getMesNome($mes_ref, false) . "/" . $ano_ref;
     $notas = $contrato->getAllNotasByRef($mes_ref, $ano_ref, false);
     if (count($notas) > 0) {
         if ($notas[0]['id'] != null) {
             foreach ($notas as $nota) {
                 $tpl->NOTANUM = $nota['numero'];
                 $tpl->UO = $nota['unidade'];
                 $tpl->UC = $nota['rgi'] . " - [ <small>" . $nota['compl'] . "</small> ]";
                 $tpl->EMPRESA = $nota['nome'];
                 $tpl->DATAREF = getMesNome($nota['mes_ref']) . "/" . $nota['ano_ref'];
                 $tpl->CONSUMO = tratarValor($nota['consumo']);
                 $tpl->VALOR = tratarValor($nota['valor'], true);
                 $tpl->EMISSAO = setDateDiaMesAno($nota['emissao']);
                 $tpl->LANCTO = ExplodeDateTime($nota['criado'], true);
                 $tpl->SUBMIT = '<input type="button" value="EDITAR" class="button" name="ope_editarNota.php?chave=' . $nota['id'] . '" />';
                 $tpl->NOTAID = $nota['id'];
                 $tpl->block('EACH_NOTAS');
             }
         } else {
             $tpl->block('SEM_NOTAS');
         }
     }
     //$tpl->SQL = $notas;
     $tpl->block("EACH_CONTRATO");
     $i++;
 }
 $tpl->block("TABLE_BODY");
Esempio n. 5
0
        $sql .= "GROUP BY uc.id ORDER BY n.ano_ref DESC, soma DESC LIMIT 50";
        $query = mysql_query($sql);
        if (mysql_num_rows($query) > 0) {
            $tpl->TIPONOME = $ucTipos[$getTipo];
            $tpl->GETANO = $ano;
            $medida = $relatorio->getTipoMedida($getTipo);
            $x = 1;
            while ($linha = mysql_fetch_array($query)) {
                $tpl->NO = $x;
                $tpl->UCNOME = $linha['rgi'] . " - " . $linha['compl'];
                $tpl->TOOLTIP = $linha['rua'] . " - " . $linha['nome'];
                //$tpl->EMPRESA   = $linha['nome'];
                $tpl->UC = $linha['unidade'];
                $tpl->UCID = $linha['id'];
                $tpl->TOTAL = tratarValor($linha['soma'], true);
                $tpl->TOTAL .= $relatorio->temConsumo($getTipo) ? "<br /><span class='blue'>{$medida} " . tratarValor($linha['consumo']) . "</span>" : "";
                $tpl->block('EACHUC');
                $x++;
            }
            $tpl->block('RESULTS');
        } else {
            $tpl->block('NORESULTS');
        }
    }
}
/*
 * MONTAR FORM
 * 
 */
for ($i = 0; $i < count($ucTipos); $i++) {
    $tpl->TPINDEX = $i;
Esempio n. 6
0
$chartIndex = 0;
$ordem = 1;
foreach ($uos as $uo) {
    if ($uo['ano_ref'] != $anoAtual) {
        $tpl->ANO = $anoAtual;
        $tpl->CHART_VALS = $chartVals;
        $tpl->CHART_INDEX = $chartIndex;
        $tpl->block('EACH_ANO');
        $tpl->block('CHART_JS');
        $tpl->block('CHART_DIVS');
        $ordem = 1;
        $chartIndex++;
        $chartVals = "['Unidades', 'Valor']";
    }
    $tpl->UOORDEM = $ordem++;
    $tpl->UONOME = $uo['unidade'] . " - " . $uo['nome'];
    $tpl->UOID = $uo['id'];
    $tpl->TOTAL = tratarValor($uo['total'], true);
    $tpl->block('EACHUO');
    $chartVals .= ",['" . $uo['unidade'] . "'," . $uo['total'] . "]";
    $anoAtual = $uo['ano_ref'];
}
if ($anoAtual == end($anos)) {
    $tpl->ANO = $anoAtual;
    $tpl->CHART_VALS = $chartVals;
    $tpl->CHART_INDEX = $chartIndex;
    $tpl->block('EACH_ANO');
    $tpl->block('CHART_JS');
    $tpl->block('CHART_DIVS');
}
$tpl->ANOATUAL = Date('Y');
Esempio n. 7
0
<?php

$tpl->addFile('CONTEUDO', 'html_libs/painel_home.html');
$relatorio = new Relatorio();
$geral = $relatorio->getGerais();
$tpl->LANCDESDE = ExplodeDateTime2($geral['first']);
$tpl->DADOSDESDE = getMesNome($geral['dados_desde']['mes_ref'], true) . "/" . $geral['dados_desde']['ano_ref'];
$default = array();
$default['notas'] = 0;
foreach ($geral['total_geral'] as $ucTipo) {
    $tpl->UCNOTAQTD = tratarValor($ucTipo['cnt']);
    $tpl->VALTOTAL = tratarValor($ucTipo['val'], true);
    $medida = $relatorio->getTipoMedida($ucTipo['tipo']);
    if ($medida != "Min" && $medida != "Mb" && $medida != "NDA") {
        $tpl->UCMEDIDA = $medida;
        $tpl->CONSTOTAL = tratarValor($ucTipo['cons']);
        $tpl->CONSMEDIA = tratarValor($ucTipo['cons'] / $ucTipo['cnt']);
        $tpl->block('SHOWCONS');
        $tpl->block('SHOWCONS2');
    }
    $tpl->VALMEDIA = tratarValor($ucTipo['val'] / $ucTipo['cnt'], true);
    $tpl->UCTIPONOME = $relatorio->getTipoNome($ucTipo['tipo']);
    $tpl->block('EACHUCTIPO');
    $default['notas'] += $ucTipo['cnt'];
}
$tpl->NUMNOTAS = tratarValor($default['notas']);
$tpl->UOQTD = $geral['unidades'][0];
$tpl->UCQTD = $geral['unidades'][1];
Esempio n. 8
0
		<td width="12%"><img src="images/logo-daee.png" height="57px" /></td>
		<td width="73%" align="center" valign="middle" ><h3 style="margin:0;padding:0;">Sistema de Gerenciamento de Despesas com Utilidade Pública
		<br />DEPARTAMENTO DE ÁGUAS E ENERGIA ELÉTRICA<br /><small>Rua Boa Vista, 175 - 1°andar B - 3293-8543 - CEP01014-000 - São Paulo - SP</small></h3></td>
		<td width="15%" style="text-align: right;"><img src="images/logo-sigup.jpg" height="67px" /></td>
		</tr></table>
	';
$mpdf->SetHTMLHeader($header);
$footer = '
		<table width="100%" style="border-top: 1px solid #000000; font-family: serif;"><tr>
		<td width="25%" align="left"><span class="serif-small">Relatório SIGUP : ' . $sigla . '</span></td>
		<td width="50%" align="center" valign="middle" ><span class="serif-small">Emissão: ' . Date('d/m/Y') . '</span></td>
		<td width="25%" align="right" style="text-align: right;"><span class="serif-small">' . getMesNome($mes, false) . ' de ' . $ano . '</span></td>
		</tr></table>	
	';
$mpdf->SetHTMLFooter($footer);
$head = '<h2>Relatório <span class="bold-blue">' . getMesNome($mes, false) . ' de ' . $ano . '</span> de <span class="bold-blue">' . $sigla . '</span></h2>';
$paragrafo1 = '<p>O(a) <span class="bold-blue">' . $nome . '</span> possui <b>' . $ucQtd . '</b> unidades consumidoras.</p>';
$paragrafo2 = '<p>Em ' . getMesNome($mes, false) . ' de ' . $ano . ' o(a) ' . $sigla . ' teve um total de <b>R$' . tratarValor($total, true) . '</b> de despesas com Utilidade Pública. Este total engloba valores 
				de ' . sizeof($tipos) . ' tipos de consumo, como demonstrados na tabela a seguir:</p>';
$tabela1 = '<table width="100%"><tr><th height="35" style="background-color:#00b2ec; color: white;">TIPO DE CONSUMIDORAS</th><th align="center" style="background-color:#00b2ec; color: white;">TOTAL (R$)</th></tr>' . $linha_tab . '</table>';
$legenda1 = '<p><small>Tabela 1 : Despesas por tipo de consumidora do ' . $sigla . ' de ' . getMesNome($mes, true) . '/' . $ano . '</small></p>';
$paragrafo3 = '<p>Em virtude deste ser o primeiro exercício mensal cadastrado e controlado pelo SIGUP, pode-se considerar este como o ponto de partida para as análises de relatórios. Exclusivamente neste relatório não há demonstração de variações e outros cálculos devido ao fato de não termos dados anteriores cadastrados.</p>';
$fim = execucao();
$tempo = number_format($fim - $inicio, 6);
$html_all = $head . $paragrafo1 . $paragrafo2 . $tabela1 . $legenda1 . $paragrafo3;
$mpdf->WriteHTML($stylesheet, 1);
$mpdf->WriteHTML($html_all);
//$mpdf->WriteHTML("asa");
$exec = "Tempo de Execução: <b>" . $tempo . "</b> segundos";
$filename = "Relatorio " . $insta->get("sigla") . " - " . $ano . " " . getMesNome($mes);
$mpdf->Output($filename, "D");
Esempio n. 9
0
    $tpl->BDCOLOR = $cores[$tipo];
    $ucSomas = $uo->getUcSomaByType($tipo, $anoAtual);
    $totais[0] = $totais[1] = 0;
    if ($ucSomas != null) {
        foreach ($ucSomas as $uc) {
            $tpl->UCRGI = $uc['rgi'];
            $tpl->UCNOME = $uc['compl'] . " - " . $uc['rua'];
            $tpl->UCTIPO = $rel->getTipoNome($uc['tipo']);
            $tpl->UCCHAVE = sha1($uc['id']);
            $tpl->ANOATUAL = $anoAtual;
            $tpl->STATUS = getAtivoText($uc['ativo']);
            $tpl->CONSUMO = tratarValor($uc['SUM(n.consumo)']);
            $tpl->VALOR = tratarValor($uc['SUM(n.valor)'], true);
            $tpl->block('EACH_UC');
            $totais[0] += $uc['SUM(n.consumo)'];
            $totais[1] += $uc['SUM(n.valor)'];
        }
    }
    $tpl->UCTIPOIND = $rel->getTipoNome($tipo);
    $tpl->TOTCONSUMO = tratarValor($totais[0]);
    $tpl->TOTVALOR = tratarValor($totais[1], true);
    $tpl->block('EACH_TIPO');
}
$fim = execucao();
$tempo = number_format($fim - $inicio, 6);
$tpl->EXECTIME = "Tempo de Execução: <b>" . $tempo . "</b> segundos";
$tpl->show();
function getAtivoText($ativo)
{
    return $ativo == 1 ? '<font color="green">Ativo</font>' : '<font color="red">Inativo</font>';
}
Esempio n. 10
0
 $media['cons_ant'] += $consant;
 $media['pago_ant'] += $pagoant;
 $media['cons_post'] += $conspost;
 $media['pago_post'] += $pagopost;
 if ($i == 13) {
     // MOSTRAR MÉDIAS
     $r = $r == 1 ? 2 : $r;
     $s = $s == 1 ? 2 : $s;
     $tpl->CHART_CONSANT = $media_consant = round($media['cons_ant'] / ($r - 1) * 100) / 100;
     $tpl->CHART_PAGOANT = $media_pagoant = round($media['pago_ant'] / ($r - 1) * 100) / 100;
     $tpl->CHART_CONSPOST = $media_conspost = round($media['cons_post'] / ($s - 1) * 100) / 100;
     $tpl->CHART_PAGOPOST = $media_pagopost = round($media['pago_post'] / ($s - 1) * 100) / 100;
     $tpl->CONSANT = tratarValor($media_consant);
     $tpl->PAGOANT = tratarValor($media_pagoant, true);
     $tpl->CONSPOST = tratarValor($media_conspost);
     $tpl->PAGOPOST = tratarValor($media_pagopost, true);
     $tpl->COMA = "";
 } else {
     $tpl->COMA = ",";
 }
 if ($conspost != 0 && $pagopost != 0 && $consant != 0 && $pagoant != 0) {
     $cons_varia = $conspost * 100 / $consant - 100;
     $pago_varia = $pagopost * 100 / $pagoant - 100;
 } else {
     $cons_varia = $pago_varia = 0;
 }
 $tpl->CONSVARIA = getPorcentagem($cons_varia, true);
 $tpl->PAGOVARIA = getPorcentagem($pago_varia, true);
 $tpl->block('EACH_CONSANALITICO');
 $tpl->block('EACH_PAGOANALITICO');
 $tpl->block('EACH_CHART_CONS');
Esempio n. 11
0
        echo $infos['rgi'] . ' - ' . $infos['compl'];
        ?>
</dd>
                    <dt>MÊS REF.</dt>
                    <dd><?php 
        echo getMesNome($infos['mes_ref']) . "/" . $infos['ano_ref'];
        ?>
</dd>                    
                    <dt>VALOR</dt>
                    <dd><?php 
        echo tratarValor($infos['valor'], true);
        ?>
</dd>
                    <dt>CONSUMO</dt>
                    <dd><?php 
        echo tratarValor($infos['consumo']);
        ?>
</dd>
                </dl>
            <?php 
    } else {
        echo "Não foi possível encontrar nota com ID {$notaid}.";
    }
} else {
    ?>
        
            <h1>DELETAR</h1>
            Insira o ID da nota:
            <form method="post" >
                <input type="text" name="delid" id="inputNotaid" />
                <input type="button" name="go" id="go" value="Pesquisar" />
Esempio n. 12
0
     $tpl->MESNOME = getMesNome($linha['mes_ref']);
     $tpl->block('MESLABEL');
     $tpl->VAL = tratarValor($linha['valor'], true);
     $tpl->block('VALBLOCK');
     $tpl->CONS = tratarValor($linha['consumo']);
     $tpl->block('CONSBLOCK');
     $info['nome'] = $linha['rgi'] . " - " . $linha['compl'];
     $info['tipo'] = $linha['tipo'];
     $info['unidade'] = $linha['unidade'];
     $info['valor'][] = $linha['valor'];
     $info['consumo'][] = $linha['consumo'];
     $info['chartval'] .= ",['" . getMesNome($linha['mes_ref']) . "'," . $linha['valor'] . "]";
     $info['chartcon'] .= ",['" . getMesNome($linha['mes_ref']) . "'," . $linha['consumo'] . "]";
 }
 $tpl->MEDIAVAL = tratarValor($relatorio->average($info['valor']), true);
 $tpl->MEDIACONS = tratarValor($relatorio->average($info['consumo']));
 $tpl->CHARTVAL = $info['chartval'];
 $tpl->CHARTCON = $relatorio->temConsumo($info['tipo']) ? $info['chartcon'] : "";
 $tpl->TIPOMEDIDA = $relatorio->getTipoMedida($info['tipo']);
 $tpl->block('TABLEROWVAL');
 if ($relatorio->temConsumo($info['tipo'])) {
     $tpl->block('TABLEROWCONS');
 }
 $tpl->UCNOME = $info['nome'];
 /*
  * Colocar default em primeiro lugar em SELECT
  * 
  */
 $tpl->UCFORMNOME = $relatorio->getTipoNome($info['tipo']) . " | " . $info['nome'] . " | " . $info['unidade'];
 $tpl->UCFORMID = $ucid;
 $tpl->block('EACHUCFORM');
Esempio n. 13
0
    		**************************/
    $tpl->CHART_INDEX = $i;
    $tpl->CHART_TIPO_NOME = "Gastos de " . $tiposArray[$i] . " por Unidade";
    $z = 1;
    foreach ($eachUoByType[$i] as $nome => $val) {
        $tpl->CHART_UO = $nome;
        $tpl->CHART_VAL = $val != null ? $val : 0;
        $tpl->CHART_COMA = $z == count($eachUoByType[$i]) ? "" : ",";
        $tpl->block('EACH_CHART_VAL');
        $z++;
    }
    $tpl->block('CHART_JS');
    $tpl->block('CHART_DIVS');
    $y = $i;
}
$tpl->TOTALPAGO = tratarValor($totalPago, true);
$tpl->UCTOTAL = $uctotal;
/**************************
		MOSTRAR GRÁFICO GERAL
	**************************/
$x = 1;
$tpl->CHART_INDEX = $y + 1;
$tpl->CHART_TIPO_NOME = "Gráfico Total de Gastos por Unidades";
foreach ($eachTotalPorUnidade as $nome => $val) {
    $tpl->CHART_UO = $nome;
    $tpl->CHART_VAL = $val != null ? $val : 0;
    $tpl->CHART_COMA = $x == count($eachTotalPorUnidade) ? "" : ",";
    $tpl->block('EACH_CHART_VAL');
    $x++;
}
$tpl->block('CHART_JS');
Esempio n. 14
0
     while ($marker = mysql_fetch_array($query, MYSQL_ASSOC)) {
         /*
          * MOSTRAR DADOS PARA GRÁFICO
          */
         $tpl->SEQUENCIA = $indice;
         $tpl->LATLONG = $marker['latitude'] . ", " . $marker['longitude'];
         $tpl->GETCOLOR = getColor($marker['consumo']);
         $tpl->GETRADIUS = getRadiusValor($marker['valor']);
         /*
          * MOSTRAR DADOS PARA INFOWINDOWS 
          */
         $tpl->RANK = $indice + 1;
         $tpl->UOSIGLA = $marker['unidade'];
         $tpl->UONOME = $marker['nome'];
         $tpl->TOTALCONS = tratarValor($marker['consumo']);
         $tpl->TOTALPAGO = tratarValor($marker['valor'], true);
         $tpl->TIPOMEDIDA = $relatorio->getTipoMedida($tipo);
         $tpl->UOCIDADE = $marker['cidade'];
         $tpl->UCQTD = $marker['ucqtd'];
         $tpl->NTQTD = $marker['nqtd'];
         $tpl->block('MAPMARKERS');
         $tpl->block('INFOWINDOWS');
         $indice++;
     }
 }
 $tpl->TIPONOME = $tipos[$tipo];
 $tpl->block('MAPCONTAINER');
 /*
  * Fazer form com 1 item a mais
  */
 $formTipo = '<select name="tipo">';
Esempio n. 15
0
            foreach ($result as $key => $row) {
                $filtro[$key] = $row['varValor'];
            }
            array_multisort($filtro, SORT_DESC, $result);
            //MOSTRAR
            $no = 1;
            $temConsumo = $relatorio->temConsumo($getTipo);
            $medida = $relatorio->getTipoMedida($getTipo);
            foreach ($result as $res) {
                $tpl->UONOME = $res['unidade'];
                $tpl->UOID = $res['uoid'];
                $tpl->UOANO = $_POST['ano_form'];
                $tpl->ANT = tratarValor($res[$mes_ant]['valor'], true);
                $tpl->ANT .= $temConsumo ? "<br /><span class='blue'>{$medida} " . tratarValor($res[$mes_ant]['consumo']) . "</span> " : "";
                $tpl->POST = isset($res[$mes]) ? tratarValor($res[$mes]['valor'], true) : "0";
                $tpl->POST .= $temConsumo && isset($res[$mes]) ? "<br /><span class='blue'>{$medida} " . tratarValor($res[$mes]['consumo']) . "</span> " : "<br /><span class='blue'>0</span>";
                $tpl->VAR = $res['varValor'] > 0 ? "↑ " . getPorcentagem($res['varValor'], true) : "↓ " . getPorcentagem($res['varValor'], true);
                $tpl->VAR .= $temConsumo ? $res['varConsumo'] > 0 ? "<br />↑ " . getPorcentagem($res['varConsumo'], true) : "<br />↓ " . getPorcentagem($res['varConsumo'], true) : "";
                $tpl->NO = $no;
                $no++;
                $tpl->block('EACHUO');
            }
            $tpl->block('RESULTS');
        } else {
            $tpl->block('NORESULTS');
        }
    }
}
function ordenaVariacao($a, $b)
{
}
Esempio n. 16
0
 /************************************
 			      MONTAR GRÁFICOS E TABELAS
 			************************************/
 for ($i = 1; $i <= 12; $i++) {
     $tpl->MESANALITICO = getMesNome($i);
     /************************************
     					   INFOS DE TABELAS
     			************************************/
     $tpl->CONSANT = tratarValor($uoTotal[$start - 1]['consumo'][$i]);
     $tpl->CONSPOST = tratarValor($uoTotal[$start]['consumo'][$i]);
     $consant = $uoTotal[$start - 1]['consumo'][$i] > 0 ? $uoTotal[$start - 1]['consumo'][$i] : 1;
     $consatu = $uoTotal[$start]['consumo'][$i] > 0 ? $uoTotal[$start]['consumo'][$i] : 0;
     $tpl->CONSVARIA = $uoTotal[$start - 1]['consumo'][$i] > 0 ? getPorcentagem($consatu * 100 / $consant - 100, true) : "--";
     $tpl->block('EACH_CONSALL');
     $tpl->PAGOANT = tratarValor($uoTotal[$start - 1]['valor'][$i], true);
     $tpl->PAGOPOST = tratarValor($uoTotal[$start]['valor'][$i], true);
     $pagoant = $uoTotal[$start - 1]['valor'][$i] > 0 ? $uoTotal[$start - 1]['valor'][$i] : 1;
     $pagoatu = $uoTotal[$start]['valor'][$i] > 0 ? $uoTotal[$start]['valor'][$i] : 0;
     $tpl->PAGOVARIA = $uoTotal[$start - 1]['valor'][$i] > 0 ? getPorcentagem($pagoatu * 100 / $pagoant - 100, true) : "--";
     $tpl->block('EACH_PAGOALL');
     /************************************
     					   INFOS DE GRÁFICOS
     			************************************/
     $tpl->CHART_CONSANT = $uoTotal[$start - 1]['consumo'][$i];
     $tpl->CHART_CONSPOST = $uoTotal[$start]['consumo'][$i];
     $tpl->COMA = $i < 12 ? "," : "";
     $tpl->CHART_PAGOANT = $uoTotal[$start - 1]['valor'][$i];
     $tpl->CHART_PAGOPOST = $uoTotal[$start]['valor'][$i];
     $tpl->MED_PAGO = $med_pago;
     $tpl->MED_CONS = $med_cons;
     $tpl->block('EACH_CHART_CONS');
Esempio n. 17
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]);
        $tpl->SOMAPAGOANO = tratarValor($pagoAnoTotal[$x], true);
        $x++;
        $tpl->block("EACH_TIPO");
    }
}
$fim = execucao();
$tempo = number_format($fim - $inicio, 6);
$tpl->EXECTIME = "Tempo de Execução: <b>" . $tempo . "</b> segundos";
$tpl->show();
 private function constructVarTable($array)
 {
     $table = '<table width="100%"><tr><th height="35pt">UNIDADE CONSUMIDORA</th><th>TIPO</th><th align="right">' . strtoupper(getMesNome($this->mes_a)) . '</th><th align="right">' . strtoupper(getMesNome($this->mes)) . '</th>';
     $table .= '<th align="right">VARIAÇÃO</th></tr>';
     $rowMais = "";
     $rowMenos = "";
     foreach ($array as $arr) {
         if ($arr['anterior'] > 0) {
             $varia = $arr['atual'] * 100 / $arr['anterior'] - 100;
             $row = '<tr><td><small><b>' . $arr['rgi'] . '</b> - ' . $arr['compl'] . '</small></td><td><small>' . $this->ucTipos[$arr['tipo']] . '</small></td>';
             $row .= '<td align="right"><small>' . tratarValor($arr['anterior'], true) . '</small></td><td align="right"><small>' . tratarValor($arr['atual'], true) . '</small></td>';
             $row .= '<td align="right"><small>' . getPorcentagem($varia, true) . '</small></td></tr>';
             if (round($varia) > 0) {
                 $rowMais .= $row;
             } elseif (round($varia) < 0) {
                 $rowMenos .= $row;
             }
         }
     }
     $closeTable = '</table>';
     $ret[0] = $table . $rowMais . $closeTable;
     $ret[1] = $table . $rowMenos . $closeTable;
     return $ret;
 }