
Enviado em 03/03/2010 - 10:31h
Bom dia Pessoal, estou com um grande problema. Estou trabalhando em um sistema e nele
<?
include_once('../../include/php/header.php');
include_once('../../include/php/config.php');
include_once('../../include/php/start.php');
?>
<link href="../../include/css/default.css" rel="stylesheet" type="text/css" />
<?
// Segurança de Visualização
include_once('../../include/php/seguranca.php');
$_SESSION['filtro'] = array_merge($_SESSION['filtro'], $seguranca['empresa']);
$rs = array();
$rs = consulta::_analise_gerencial($_SESSION['last_post'],$_SESSION['filtro'],'empresa');
$dados = array();
$total2 = 0;
//Somatorio do total de registro
foreach($rs as $v)
$total2 += $v['tot_reg'];
foreach($rs as $i => $v){
if(isset($_SESSION['last_post']['@empresa*nome']))
$dados[$i][] = $v['nome'];
if(isset($_SESSION['last_post']['@empresa*id_tipo_empresa']))
$dados[$i][] = tipo_empresa::_getNome($v['id_tipo_empresa']);
if(isset($_SESSION['last_post']['@empresa*id_grupo_empresa']))
$dados[$i][] = grupo_empresa::_getNome($v['id_grupo_empresa']);
if(isset($_SESSION['last_post']['@empresa*id_status_empresa']))
$dados[$i][] = status_empresa::_getNome($v['id_status_empresa']);
if(isset($_SESSION['last_post']['@empresa*id_usuario_responsavel']))
$dados[$i][] = usuario::_getNome($v['id_usuario_responsavel']);
if(isset($_SESSION['last_post']['@empresa*id_categoria_empresa']))
$dados[$i][] = categoria_empresa::_getNome($v['id_categoria_empresa']);
if(isset($_SESSION['last_post']['@empresa*id_ramo_empresa']))
$dados[$i][] = ramo_empresa::_getNome($v['id_ramo_empresa']);
if(isset($_SESSION['last_post']['@empresa*uf']))
$dados[$i][] = $v['uf'];
if(isset($_SESSION['last_post']['@empresa*id_cidade']))
$dados[$i][] = cidade::_getNome($v['id_cidade']);
if(isset($_SESSION['last_post']['@tot_reg']))
$dados[$i][] = $v['tot_reg'];
//DADOS DA COLUNA %
if($_SESSION['last_post']['tipo_analise']=='tabela')
$dados[$i][] = number_format($v['tot_reg'] / $total2*100,3). '%';
}
$head = array();
$dime = array();
$er = '^(@[a-zA-Z0-9_+-]+)(@[a-zA-Z0-9_+-]+)?(@[a-zA-Z0-9_+-]+)?\*([a-zA-Z0-9_+-]+)?(\?[a-zA-Z0-9_.=+-\%]+)?';
foreach($_SESSION['last_post'] as $indice => $valor){
if(ereg($er,$indice)){
$head[] = $valor;
$dime[] = 100;
}
}
if(isset($_SESSION['last_post']['@tot_reg'])){
$head[] = $_SESSION['last_post']['@tot_reg'];
$dime[] = 100;
}
//COLUNA %
$head[] = '%';
$dime[] = 100;
$width = 0;
foreach($dime as $v)
$width += $v;
$_SESSION['pizza'][0] = array();
$legend = array();
//coloca todos os dados na sesso
foreach($dados as $i => $v){
if(isset($_SESSION['last_post']['@tot_reg']))
$_SESSION['pizza'][0][] = array_pop($v);
foreach($v as $l)
if($legend[$i]!="")
$legend[$i] .= ", ".$l;
else
$legend[$i] .= $l;
}
//calcula o somatorio dos valores
for($i=0;$i<1;$i++){
$total[$i] = 0;
foreach($_SESSION['pizza'][$i] as $v)
$total[$i] += $v;
}
$ss = new spreadsheet();
$ss->generate($head, $dime, $dados);
if($_SESSION['last_post']['tipo_analise']=='tabela'){
?><div align="center"><div style="width:<?=($width + 20)?>px;"><table width="100%" cellspacing="0" cellpadding="0" class="formulario"><tr><td align="left"><? if(MSIE()=="6.0"){ ?><img title="Vizualizar documento" style="cursor:pointer" src="include/css/default/excel_visualizar.png" border="0" onclick="Docs._veArquivo('../_relatorios/<?=$_SESSION['user_data']['id_usuario'].".xls"?>');" /><? } ?><img title="Baixar documento" style="cursor:pointer" src="include/css/default/excel_baixar.png" border="0" onclick="post_frame.location.href='documentos/download.php?id_spreadsheet=&folder=_relatorios&type=vnd.ms-excel&'" /></td><td align="right" style="white-space:nowrap;">Total de Registros: <input type="text" class="input" style="width:80px; text-align:center;" value="<?=$total2?>" /></td></tr></table></div></div><?
$table = new Tabela();
$table->setDimentions($width,250);
$table->setHead($head);
$table->setColDimentions($dime);
$table->setBody($dados);
$table->setCabecalhoDuplo();
$table->_write();
}else{
?>
<? if(isset($_SESSION['last_post']['@tot_reg'])){ ?>
<? $num_graph = 0; ?>
<table align="center">
<tr>
<td valign="top"><img src="grafico/grafico.php?tipo=<? echo $_SESSION['last_post']['tipo_analise']; ?>&g=<? echo $num_graph; ?>&t=<? echo time(); ?>" /></td>
<td>
<table class="legenda_grafico" cellpadding="6">
<tr>
<td colspan="4" align="center"><strong style="font-size:14px;">Total de Registros</strong></td>
</tr>
<tr>
<td align="center"><strong>Cor</strong></td>
<td align="center"><strong>Total</strong></td>
<td align="center"><strong>%</strong></td>
<td align="center"><strong>Descrição</strong></td>
</tr>
<?
foreach($legend as $i => $l)
echo '<tr><td><img src="grafico/legend.php?i='.(($i) - floor(($i)/10) * 10).'"; style="vertical-align:middle;" /></td>'.'<td align="right">'.$_SESSION['pizza'][$num_graph][$i].'</td><td align="right">'.number_format(($_SESSION['pizza'][$num_graph][$i] / $total[$num_graph])*100,3).'%</td><td>'.$l.'</td></tr>';
?>
<tr>
<td> </td>
<td align="right"><strong><? echo $total[$num_graph]; ?></strong></td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
<? } ?>
<?
}
?>
<?
include_once('../../include/php/header.php');
include_once('../../include/php/config.php');
include_once('../../include/php/start.php');
?>
<link href="../../include/css/default.css" rel="stylesheet" type="text/css" />
<?
// Segurança de Visualização
include_once('../../include/php/seguranca.php');
$_SESSION['filtro'] = array_merge($_SESSION['filtro'], $seguranca['empresa']);
$rs = array();
$rs = consulta::_analise_gerencial($_SESSION['last_post'],$_SESSION['filtro'],'empresa');
$dados = array();
$total2 = 0;
//Somatorio do total de registro
foreach($rs as $v)
$total2 += $v['tot_reg'];
foreach($rs as $i => $v){
if(isset($_SESSION['last_post']['@empresa*nome']))
$dados[$i][] = $v['nome'];
if(isset($_SESSION['last_post']['@empresa*id_tipo_empresa']))
$dados[$i][] = tipo_empresa::_getNome($v['id_tipo_empresa']);
if(isset($_SESSION['last_post']['@empresa*id_grupo_empresa']))
$dados[$i][] = grupo_empresa::_getNome($v['id_grupo_empresa']);
if(isset($_SESSION['last_post']['@empresa*id_status_empresa']))
$dados[$i][] = status_empresa::_getNome($v['id_status_empresa']);
if(isset($_SESSION['last_post']['@empresa*id_usuario_responsavel']))
$dados[$i][] = usuario::_getNome($v['id_usuario_responsavel']);
if(isset($_SESSION['last_post']['@empresa*id_categoria_empresa']))
$dados[$i][] = categoria_empresa::_getNome($v['id_categoria_empresa']);
if(isset($_SESSION['last_post']['@empresa*id_ramo_empresa']))
$dados[$i][] = ramo_empresa::_getNome($v['id_ramo_empresa']);
if(isset($_SESSION['last_post']['@empresa*uf']))
$dados[$i][] = $v['uf'];
if(isset($_SESSION['last_post']['@empresa*id_cidade']))
$dados[$i][] = cidade::_getNome($v['id_cidade']);
if(isset($_SESSION['last_post']['@tot_reg']))
$dados[$i][] = $v['tot_reg'];
//DADOS DA COLUNA %
if($_SESSION['last_post']['tipo_analise']=='tabela')
$dados[$i][] = number_format($v['tot_reg'] / $total2*100,3). '%';
}
$head = array();
$dime = array();
$er = '^(@[a-zA-Z0-9_+-]+)(@[a-zA-Z0-9_+-]+)?(@[a-zA-Z0-9_+-]+)?\*([a-zA-Z0-9_+-]+)?(\?[a-zA-Z0-9_.=+-\%]+)?';
foreach($_SESSION['last_post'] as $indice => $valor){
if(ereg($er,$indice)){
$head[] = $valor;
$dime[] = 100;
}
}
if(isset($_SESSION['last_post']['@tot_reg'])){
$head[] = $_SESSION['last_post']['@tot_reg'];
$dime[] = 100;
}
//COLUNA %
$head[] = '%';
$dime[] = 100;
$width = 0;
foreach($dime as $v)
$width += $v;
$_SESSION['pizza'][0] = array();
$legend = array();
//coloca todos os dados na sesso
foreach($dados as $i => $v){
if(isset($_SESSION['last_post']['@tot_reg']))
$_SESSION['pizza'][0][] = array_pop($v);
foreach($v as $l)
if($legend[$i]!="")
$legend[$i] .= ", ".$l;
else
$legend[$i] .= $l;
}
//calcula o somatorio dos valores
for($i=0;$i<1;$i++){
$total[$i] = 0;
foreach($_SESSION['pizza'][$i] as $v)
$total[$i] += $v;
}
$ss = new spreadsheet();
$ss->generate($head, $dime, $dados);
if($_SESSION['last_post']['tipo_analise']=='tabela'){
?><div align="center"><div style="width:<?=($width + 20)?>px;"><table width="100%" cellspacing="0" cellpadding="0" class="formulario"><tr><td align="left"><? if(MSIE()=="6.0"){ ?><img title="Vizualizar documento" style="cursor:pointer" src="include/css/default/excel_visualizar.png" border="0" onclick="Docs._veArquivo('../_relatorios/<?=$_SESSION['user_data']['id_usuario'].".xls"?>');" /><? } ?><img title="Baixar documento" style="cursor:pointer" src="include/css/default/excel_baixar.png" border="0" onclick="post_frame.location.href='documentos/download.php?id_spreadsheet=&folder=_relatorios&type=vnd.ms-excel&'" /></td><td align="right" style="white-space:nowrap;">Total de Registros: <input type="text" class="input" style="width:80px; text-align:center;" value="<?=$total2?>" /></td></tr></table></div></div><?
$table = new Tabela();
$table->setDimentions($width,250);
$table->setHead($head);
$table->setColDimentions($dime);
$table->setBody($dados);
$table->setCabecalhoDuplo();
$table->_write();
}else{
?>
<? if(isset($_SESSION['last_post']['@tot_reg'])){ ?>
<? $num_graph = 0; ?>
<table align="center">
<tr>
<td valign="top"><img src="grafico/grafico.php?tipo=<? echo $_SESSION['last_post']['tipo_analise']; ?>&g=<? echo $num_graph; ?>&t=<? echo time(); ?>" /></td>
<td>
<table class="legenda_grafico" cellpadding="6">
<tr>
<td colspan="4" align="center"><strong style="font-size:14px;">Total de Registros</strong></td>
</tr>
<tr>
<td align="center"><strong>Cor</strong></td>
<td align="center"><strong>Total</strong></td>
<td align="center"><strong>%</strong></td>
<td align="center"><strong>Descrição</strong></td>
</tr>
<?
foreach($legend as $i => $l)
echo '<tr><td><img src="grafico/legend.php?i='.(($i) - floor(($i)/10) * 10).'"; style="vertical-align:middle;" /></td>'.'<td align="right">'.$_SESSION['pizza'][$num_graph][$i].'</td><td align="right">'.number_format(($_SESSION['pizza'][$num_graph][$i] / $total[$num_graph])*100,3).'%</td><td>'.$l.'</td></tr>';
?>
<tr>
<td> </td>
<td align="right"><strong><? echo $total[$num_graph]; ?></strong></td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
<? } ?>
<?
}
?>
Fscrypt: protegendo arquivos do seu usuário sem a lentidão padrão de criptograr o disco
Faça suas próprias atualizações de pacotes/programas no Void Linux e torne-se um Contribuidor
Como rodar o Folding@home no Linux
Criando um painel de controle (Dashboard) para seu servidor com o Homepage
O Abismo entre o Código e o Chão: Saltos Tecnológicos e a Exclusão Estrutural no Brasil
Utilizando a Ferramenta xcheckrestart no Void Linux
Pisando no acelerador do Linux Mint: Kernel XanMod, zRAM e Ajustes de Swap
Como compilar kernel no Linux Mint
Abrir um arquivo URL pelo Clipper (9)
Seno, Coseno, Tangente em CLIPPER (1)
Inserir uma URL num arquvo pelo Ubuntu (CLIPPER) (0)
VMWare Player não conecta na rede nem consigo intercambiar arquivos (1)









