
Enviado em 03/10/2013 - 17:37h
Prezados....
$sql = " SELECT *
FROM `pre_produto`
left join produto on B1_COD= `pre_produto_produto`
where pre_produto_ano='".$AnoSel."'";
$result = mysql_query($sql, $conexao);
$total = mysql_num_rows($result);
if ($total = 0)
{
echo "<script>alert('Nenhum item encontrado!')</script>";
}else{
//monta o cabecalho
$table .= "<table cellpadding='0' cellspacing='0' border='0' class='display' id='Prod_datatable' width='2325px'>
<thead>
<tr>
<th widht='0' style='display:none'>Código</th>
<th widht='0' style='display:none'>Preço de Venda</th>
<th style='font-size: 9pt;' widht='160'><center>Portfólio</center></th>
<th style='font-size: 9pt;' width='75'>Pedidos em Carteira/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Jan/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Fev/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Mar/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Abr/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Mai/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Jun/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Jul/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Ago/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Set/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Out/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Nov/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Dez/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Total/".$AnoSel."</th>
<th style='font-size: 9pt;' width='75'>Total/".$AnoAnt."</th>
<th style='font-size: 9pt;' width='75'><center>Soja</Center></th>
<th style='font-size: 9pt;' width='75'><center>Milho</Center></th>
<th style='font-size: 9pt;' width='75'><center>Cana de Açúcar</Center></th>
<th style='font-size: 9pt;' width='75'><center>Citros</Center></th>
<th style='font-size: 9pt;' width='75'><center>CaféCenter></th>
<th style='font-size: 9pt;' width='75'><center>HFF *</Center></th>
<th style='font-size: 9pt;' width='75'><center>Cereais de Inverno **</Center></th>
<th style='font-size: 9pt;' width='75'><center>Algodão</Center></th>
<th style='font-size: 9pt;' width='75'><center>Pastagem</Center></th>
<th style='font-size: 9pt;' width='75'><center>Safrinha ***</Center></th>
<th style='font-size: 9pt;' width='75'><center>Outras ****</Center></th>
<th style='font-size: 9pt;' width='75'><center>Total</Center></th>
</tr>
</thead>
<tbody id='tbody' style='color:black;size:5000px'>";
//variave3is para total
//total qtde / MEs
$TotQtdJan ='';
$TotQtdFev ='';
$TotQtdMar ='';
$TotQtdAbr ='';
$TotQtdMai ='';
$TotQtdJun ='';
$TotQtdJul ='';
$TotQtdAgo ='';
$TotQtdSet ='';
$TotQtdOut ='';
$TotQtdNov ='';
$TotQtdDez ='';
$TotQtdCart='';
$TotTotalAnt = '';
//Total valores realizados.
$TotValJan ='';
$TotValFev ='';
$TotValMar ='';
$TotValAbr ='';
$TotValMai ='';
$TotValJun ='';
$TotValJul ='';
$TotValAgo ='';
$TotValSet ='';
$TotValOut ='';
$TotValNov ='';
$TotValDez ='';
$TotValCarteira = '';
$TotValTotAnt = '';
//while com todos os itens encontrador.
$index = 0;
while($registro=mysql_fetch_array($result))
{
$QtdJan ='';
$QtdFev ='';
$QtdMar ='';
$QtdAbr ='';
$QtdMai ='';
$QtdJun ='';
$QtdJul ='';
$QtdAgo ='';
$QtdSet ='';
$QtdOut ='';
$QtdNov ='';
$QtdDez ='';
//valores realizados.
$ValJan ='';
$ValFev ='';
$ValMar ='';
$ValAbr ='';
$ValMai ='';
$ValJun ='';
$ValJul ='';
$ValAgo ='';
$ValSet ='';
$ValOut ='';
$ValNov ='';
$ValDez ='';
$PerSoja = '';
$PerMilho = '';
$PerCana = '';
$PerCitros = '';
$PerCafe = '';
$PerHFF = '';
$PerCereaisInverno = '';
$PerAlgodao = '';
$PerPastagem = '';
$PerSafrinha = '';
$PerOutras = '';
$PerTotalCult = '';
$Descri = $registro['B1_DESC'];
$PrecVend = $registro['pre_produto_preco']; //preço de venda do produto
$sql2 ='';
//seleciona o cliente ou clientes que o RC/Gr pode listar informações, ou cliente especifico se este informado
$sql2 = "SELECT A1_COD,A1_LOJA,A1_NOME,A1_END,A3_NOME,A1_CGC,A1_MUN,A1_EST
FROM clientes
LEft JOIN vendedor ON (A1_VEND=A3_COD)
where ";
$sql2 = $sql2 ." (vendedor.A3_COD='".$represent."' or vendedor.A3_SUPER='".$represent."')" ;
if(($cliente!='')&&($loja !='')){
$sql2 = $sql2 ." and (A1_COD='".$cliente."' and A1_LOJA='".$loja."')" ;
}
$result2 = mysql_query($sql2, $conexao);
$num = mysql_num_rows($result2);
$i = 0;
for($i=0;$i<$num;$i++){
mysql_data_seek($result2,$i);
$row = mysql_fetch_assoc($result2);
$cliente = $row['A1_COD' ];
$loja = $row['A1_LOJA'];
$table .= "<tr>";
$table .= $i . '|' . $num.'-------';
$table .= "</tr>";
$index++;
}
$index++;
mysql_free_result($result2);
//mysql_data_seek($result2, 0) ;//reset result set
};
$table .= "</tbody>
</table>";
}
echo $table;
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
Atualizar Linux Mint 22.2 para 22.3 beta
Jogar games da Battle.net no Linux com Faugus Launcher
Como fazer a Instalação de aplicativos para acesso remoto ao Linux
Assisti Avatar 3: Fogo e Cinzas (4)
Conky, alerta de temperatura alta (11)









