Exemplo n.º 1
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)
{
}
Exemplo n.º 2
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();
Exemplo n.º 3
0
                 $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');
             $tpl->block('EACH_CHART_PAGO');
         }
         if ($uc->get('tipo') <= 2) {
             $tpl->block('CONSUMOANALITICO');
         }
     } else {
         $tpl->CONTEUDO = "<div class='alerta' align='center' style='height:200px;padding-top:100px'>Você não tem permissão para acessar os dados ";
         $tpl->CONTEUDO .= "desta Unidade Consumidora. <a href='resumo_index.php?ano={$anoAtual}'><b>Clique aqui para voltar.</b></a></div>";
     }
 } else {
     header("Location: udd_relatorioUC.php");
 }
Exemplo n.º 4
0
 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');
     $tpl->block('EACH_CHART_PAGO');
     /************************************
     					  INFOS DE GRÁFICOS
 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;
 }