By: Cícero Raupp Rolim
Date: 2004-08-18
Time: 15:38
|
headergrp and event (onsection)
I'am have found one error when I use a headergrp and event arguments. The First record after a group title, return incorrect result...
Sorry for my english...
Thank's
Code:
<?
$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate('rel_listagem_inadimplentes.htm') ;
$TBS->MergeBlock('bloco',$Conn,$query);
$TBS->Show() ;
function ebloc($BlockName,&$CurrRec,&$DetailSrc,$RecNum){
global $Cub,$Juros,$Multa;
$CurrRec['valor'] = $CurrRec['valor_titulo'];
$CurrRec['valor_titulo'] = $CurrRec['valor_titulo'] * $Cub;
$Diferenca = (date_mysql_2_timestamp($CurrRec['data_vencimento']) - date_mktime())/86400;
$ValorTemp = $CurrRec['valor_titulo'];
for ($j=1;$j<abs($Diferenca);$j++)
$ValorTemp+= ($ValorTemp * $Juros) / 100;
$CurrRec['juros'] = $ValorTemp - $CurrRec['valor_titulo'];
$ValorTemp = $CurrRec['valor_titulo'] + $CurrRec['juros'];
$ValorTemp+= ($ValorTemp * $Multa) / 100;
$CurrRec['multa'] = $ValorTemp - $CurrRec['valor_titulo'];
$CurrRec['saldo'] = $CurrRec['valor_titulo'] + $CurrRec['juros'] + $CurrRec['multa'];
}
?>
Template:
<tr>
<td><div align="center"><strong>Parcela</strong></div></td>
<td><div align="center"><strong>Emissão</strong></div></td>
<td><div align="center"><strong>Vcto</strong></div></td>
<td><div align="center"><strong>Valor</strong></div></td>
<td><div align="center"><strong>Multa</strong></div></td>
<td><div align="center"><strong>Juros</strong></div></td>
<td><div align="center"><strong>Saldo Atual</strong></div></td>
</tr>
<tr bgcolor="#CCCCCC">
<td><strong>Cliente:</strong></td>
<td colspan="6">[bloco.nome;headergrp=nome;block=tr]</td>
</tr>
<tr>
<td><div align="center">[bloco.codigo_parcela;block=tr;onsection=ebloc;htmlconv=no]</div></td>
<td><div align="center">[bloco.data_emissao;frm='dd/mm/yyyy']</div></td>
<td><div align="center">[bloco.data_vencimento;frm='dd/mm/yyyy']</div></td>
<td><div align="right">[bloco.valor;frm=0,00]</div></td>
<td><div align="right">[bloco.multa;htmlconv=no;frm=0.000,00]</div></td>
<td><div align="right">[bloco.juros;htmlconv=no;frm=0.000,00]</div></td>
<td><div align="right">[bloco.saldo;htmlconv=no;frm=0.000,00]</div></td>
</tr>
|