Recent

Author Topic: Problem creating a printable invoice.  (Read 3233 times)

oldcoder

  • New Member
  • *
  • Posts: 13
Problem creating a printable invoice.
« on: January 30, 2015, 12:19:23 pm »
I'm trying to rewrite a program using Lazarus, that I wrote years ago in Delphi 4, which I use to run my business.
I am using the FRUserDataset to read in the contents from the Invoice goods data entry form (which is a string grid) directly, because I want to be able to preview the invoice before saving it to the database.
The trouble is that I want to add a page break to the report after every 24 item lines but I don't know how to do that. I am completely new to lazreport.
Any help would be much appreciated.
Thanks.

balazsszekely

  • Guest
Re: Problem creating a printable invoice.
« Reply #1 on: January 30, 2015, 01:44:37 pm »
I seriously doubt that somebody can give you a useful answer without knowing the exact format/layout of your report(bands, master-detail relations, etc).
Lets say you have a simple report with two bands: a Report Title and a Detail band and you want to break the Detail band after every 24 item(record). Declare a global variable(Count). On frReport OnBeginBand event:
Code: [Select]
var
   Count: Integer = 0;
   //...

procedure TForm1.frReportBeginBand(Band: TfrBand);
begin   
   if Band.Typ = btDetailData then
   begin
     Inc(Count);
     if Count = 25 then
     begin
       Count := 0;
       Band.NewPageAfter := True; 
     end
     else
       Band.NewPageAfter := False; 
  end;
end;

oldcoder

  • New Member
  • *
  • Posts: 13
Re: Problem creating a printable invoice.
« Reply #2 on: January 30, 2015, 03:50:10 pm »
Well, doubt no more, GetMem.
You're answer was so useful it solved the problem!
I'm very grateful for your quick and totally effective response.
Thank you.

 

TinyPortal © 2005-2018