Recent

Author Topic: Lazreport : How Print at the bottom of the last page  (Read 12276 times)

tintinux

  • Sr. Member
  • ****
  • Posts: 378
    • Gestinux
Lazreport : How Print at the bottom of the last page
« on: April 20, 2011, 10:26:33 am »
Hi

Is it possible to print a summary at the bottom of a report, only on the last page when there are several pages. This is usually what is expected in an invoice, for example.

A ReportSummary is printed after the last detail line.
A Page footer is printed on each page.
I do not see any band type or option to print once at the report bottom.

Thanks for your help.
Tintinux
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

zeljko

  • Hero Member
  • *****
  • Posts: 1905
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Lazreport : How Print at the bottom of the last page
« Reply #1 on: April 20, 2011, 04:11:56 pm »
Hi

Is it possible to print a summary at the bottom of a report, only on the last page when there are several pages. This is usually what is expected in an invoice, for example.

A ReportSummary is printed after the last detail line.
A Page footer is printed on each page.
I do not see any band type or option to print once at the report bottom.

Thanks for your help.
Tintinux

You can use MasterDataFooter (or whatever name it is) for that

tintinux

  • Sr. Member
  • ****
  • Posts: 378
    • Gestinux
Re: Lazreport : How Print at the bottom of the last page
« Reply #2 on: April 20, 2011, 07:23:22 pm »
I have tried with a MasterFooter band, but it is printed right after the last MasterData, same as ReportSummary.

I want to print in the bottom of the page, even when there is not many MasterData lines.

Regards
Tintinux
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

denver

  • Jr. Member
  • **
  • Posts: 67
Re: Lazreport : How Print at the bottom of the last page
« Reply #3 on: April 20, 2011, 10:00:39 pm »
Basically, I will use the code only ( without the visual designer ) to create reports. so you can get full control of the report.
Lazreport allow you to create report from code only.

zeljko

  • Hero Member
  • *****
  • Posts: 1905
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Lazreport : How Print at the bottom of the last page
« Reply #4 on: April 21, 2011, 09:04:56 am »
I have tried with a MasterFooter band, but it is printed right after the last MasterData, same as ReportSummary.

I want to print in the bottom of the page, even when there is not many MasterData lines.

Ah, ok, you can do that on PageFooter, since there's should be variable which says that it's last page, so then just make visible memos with your results.Basically (in OnBeforePrint or PageFooter) you can say
if [PAGE] = [TOTALPAGES] then
begin
   Memo1WithResult.Visible := True;
   Memo2WithResult.Visible := True;
end;

I'm not sure if names of variables are correct, look at LazReport source, also take a look if FINALPASS variable exists.
I'm using FastReports and such vars exists there. Also if you use TOTALPAGES then you should enable "DoublePass" on your report (in designer).


tintinux

  • Sr. Member
  • ****
  • Posts: 378
    • Gestinux
Re: Lazreport : How Print at the bottom of the last page
« Reply #5 on: April 21, 2011, 01:36:24 pm »
Hi

Thanks for the help, it is a little better now.

But when the PageFooter is not printed, the data lines are not printed in the freed space, and a blank space remains on the bottom of the first pages.

I have tried, without success, with OnBeginPage. Any idea to use the entire sheet of paper ?

However, all this is a bit tricky, and make the report description more dependent on the code. I definitely don't want to generate the report by code, to allow users to change the layout with the designing tool.

Better would be, IMHO,  an option in ReportSummary to print at the bottom, like we can find in many other report generators.

If someone is interested the code I used is :

Code: [Select]
procedure TForm.ReportBeginBand(Band: TfrBand);

var
  CurrentPage, TotalPages : Variant ;

begin
  if (Band.Typ = btPageFooter) and Report.FinalPass then
  begin
    Report.GetVariableValue('PAGE#', CurrentPage );
    Report.GetVariableValue('TOTALPAGES', TotalPages );
    Band.Visible := (CurrentPage = TotalPages) ;
  end;
end;

Regards,
Tintinux
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

 

TinyPortal © 2005-2018