FastReport alguma ajuda
Autor: Wesley Ferreira Messias | Publicado: 2014-05-27T10:59:00-07:00

Boas Galera depois de tanta busca, montei este relatório no FastReport, para imprimir um contador
que ZERA com a mudança do mes, e um titulo de MES/ANO para um cabeçalho.


procedure ImgLogoOnBeforePrint(Sender: TfrxComponent);
var
&nbsp; &nbsp;sMes: String; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
begin
&nbsp; &nbsp;{Coloca um LOGO,CAMINHOLOGO e um atributo de uma tabela de filtro}
&nbsp; &nbsp;if (Trim(&lt;frxDBFiltro."CAMINHOLOGO"&gt;) &lt;&gt; '') then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;imgLogo.LoadFromFile(&lt;frxDBFiltro."CAMINHOLOGO"&gt;);


&nbsp; &nbsp;{
&nbsp; &nbsp; &nbsp;O Atributo MES, ele foi colocado com extract do firebird,
&nbsp; &nbsp; &nbsp;assim como o ANO, pela query, eu retorno como Variant, ou seja
&nbsp; &nbsp; &nbsp;a transformação se faz necessária. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;}
&nbsp; &nbsp;if (StrToInt(VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;)) = 1) then
&nbsp; &nbsp; &nbsp; &nbsp;sMes := 'JANEIRO'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp;if (StrToInt(VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;)) = 2) then
&nbsp; &nbsp; &nbsp; &nbsp;sMes := 'FEVEREIRO';
&nbsp; &nbsp;if (StrToInt(VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;)) = 3) then
&nbsp; &nbsp; &nbsp; &nbsp;sMes := 'MARÇO'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp;if (StrToInt(VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;)) = 4) then
&nbsp; &nbsp; &nbsp; &nbsp;sMes := 'ABRIL'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp;if (StrToInt(VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;)) = 5) then
&nbsp; &nbsp; &nbsp; &nbsp;sMes := 'MAIO'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp;if (StrToInt(VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;)) = 6) then
&nbsp; &nbsp; &nbsp; &nbsp;sMes := 'JUNHO';
&nbsp; &nbsp;if (StrToInt(VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;)) = 7) then
&nbsp; &nbsp; &nbsp; &nbsp;sMes := 'JULHO'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp;if (StrToInt(VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;)) = 8) then
&nbsp; &nbsp; &nbsp; &nbsp;sMes := 'AGOSTO'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp;if (StrToInt(VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;)) = 9) then
&nbsp; &nbsp; &nbsp; &nbsp;sMes := 'SETEMBRO';
&nbsp; &nbsp;if (StrToInt(VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;)) = 10) then
&nbsp; &nbsp; &nbsp; &nbsp;sMes := 'OUTUBRO';
&nbsp; &nbsp;if (StrToInt(VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;)) = 11) then
&nbsp; &nbsp; &nbsp; &nbsp;sMes := 'NOVEMBRO';
&nbsp; &nbsp;if (StrToInt(VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;)) = 12) then
&nbsp; &nbsp; &nbsp; &nbsp;sMes := 'DEZEMBRO'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 

&nbsp; &nbsp;Memo2.Text := Lowercase(sMes)+' / '+VarToStr(&lt;frxDBRelatorioDescontos."ANO"&gt;);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
end;

{Este codigo esta escondido,para posterior utilização} &nbsp; &nbsp; 
//procedure frxDBRelatorioFiliadosFIL_CEPRESOnBeforePrint(Sender: TfrxComponent);
//begin
// &nbsp; &nbsp; &nbsp; FormatMaskText('00000\-000;0;_',&lt;frxDBRelatorioFiliados."FIL_CEPRES"&gt;);
//end;

procedure Memo6OnBeforePrint(Sender: TfrxComponent);
var
&nbsp; &nbsp;iContador: Integer;
&nbsp; &nbsp;sMudaMes : String; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
begin
&nbsp; {
&nbsp; &nbsp; esta rotina faz a mudança de contagem de linha de registro
&nbsp; &nbsp; para quando o mes for diferente. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; if (sMudaMes &lt;&gt; VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;) ) then
&nbsp; &nbsp; &nbsp; begin &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sMudaMes := VarToStr(&lt;frxDBRelatorioDescontos."MES"&gt;);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;iContador := 0;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;inc(iContador); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; else &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; begin
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;inc(iContador);
&nbsp; &nbsp; &nbsp; end;

&nbsp; Memo6.Text := IntToStr(iContador);
&nbsp; &nbsp; &nbsp;
end;