Simple Invoice

Hi.

I'm trying to print a universal government form. You may think of it as an invoice.

My "invoice" is very simple:

1. header band with fixed information.
2. DetailData band with up to 25 rows from detailData source x.
3. DetailData band with up to 5 rows from detailData source y.
4. Page footer with summary information.

1 and 4 are working as expected.

The problem is that in order to show 25 rows on the detaildata band regardless if there are less than 25 detail data records, I am having to detached the data source from the band. After band is detached from a data source, I only get empty line numbers 1 thru 25 with no data. If I attach the data source back to the detaildata band, then it will only show as many rows as detail records are found on the data source, thus shrinking the detail area when less than 25 and moving up other bands below. If more than 25 detail records, then it pushes the other bands to the next page. I need each segment to be at a fixed positon on the page.

Please find attached my .fr3 file as it might help explain what I'm trying to do.

Thank you,



Reinaldo.

Comments

  • edited 6:59AM
    I am not a FR expert, but I don't think it can do fixed regions, which is what it sounds like you need. I know how to accomplish using the SQL results. It can be accomplished using data groups. Join with a sequence of numbers, zero based, and divide by 25 to get the group number. That's the number you will group by in FR. So, row 0 will be group 0, row 24 will be 0, row 25 will be 1, and so forth. With the group numbers and FR groups defined, you can force a page break on group numbers and use group headers and footers to add additional detail.

    How this all happens depends on your database. What are you using?
  • edited 6:59AM
    kamiller42 wrote: »
    How this all happens depends on your database. What are you using?

    I'm using Sybase ADS. But the detail data comes to FR as a userdataset as it is already stored on an array. Your post has help me figure out an idea, that I think will work. I could just fill the array with empty lines up to 25 if necessary.

    Not only do I need the detail line to be of fixed height, I also need to print alternating gray bars on that space. Sort of what's called a "pijama effect". The pijama effect I got to work ok. But since it only prints as many lines are the data source has rows, the rest of the space is not filled with the alternating gray bars.

    The idea of filling the array with empty lines is not pleasant. But I suppose that it will work.

    BTW - I could not find fr3 samples of invoices anywhere. Can someone point to them?

    Thank you,



    Reinaldo.
  • edited 6:59AM
    By user dataset, do you mean in memory clientdataset fed by an array? That makes things easier. You can fill the dataset with whatever you want, e.g. add filler rows as necessary.

    I don't have any sample invoices. But, I have had a need to accomplish something similar using another report system. It was accomplished using report design concepts basic to all report systems, specifically detail bands and grouping.
  • edited 6:59AM
    Have a look at the topic from March this year [topic="7796"]Print fixed number of rows at one page[/topic]
    I attached 3 examples (PDF files) to show how it can be done.
    I mean - no matter of how many rows I get from ADOQuery I can print no more 7 lines (rows) per each page.

    And if you find those examples interesting then you may follow my solution included in FR file below.

    Mick
  • edited 6:59AM
    Mick;

    Thank you for helping. Unfortunately I can't download from any of the links. Would you please email them as attachment? I'd love to look at them.


    reinaldo dot crespo at gmail dot com

    thank you very much,



    Reinaldo.
  • edited 6:59AM
    Have you received my e-mail?

    Mick
  • edited 6:59AM
    Mick.pl wrote: »
    Have you received my e-mail?

    Mick
    Mick;

    I'm sorry I never responded. Yes I did. I studied your solution to finally come up with a similar one. Thank you very much.

    Basically, what I did is to detach the detail band from the data source and assign a fixed number of rows to the detail data band. Then with code, I skipped an internal counter. Something like this:
    var
    dSet:TfrxDataSet;
      
    //----------------------------------------------------------------------
    Procedure Page1OnBeforePrint( Sender:TfrxComponent );
    begin
       dSet.first;                        
    end;
    
    //----------------------------------------------------------------------                                                                                                                                                  
    procedure MemoOnBeforePrint( Sender: TfrxComponent );
    begin
      
      TfrxMemoView(Sender).Visible := not dSet.eof;
        
    end;
    
    //----------------------------------------------------------------------                                                                                                                                                  
    procedure ItemsOnAfterPrint( Sender: TfrxComponent );
    begin
      
      dSet.next;
        
    end;
    
    Begin
       dSet := Report.GetDataSet( 'Detail' )                                                                                        
    End.
    

    In the code above, I used memoOnBeforePrint for before print event of all memos on the detail band. The detail band itself executes ItemsOnAfterPrint on the after print event. This idea worked really nice.

    Again, thank you for your help.


    Reinaldo.
  • edited 6:59AM
    Hello Dear,

    I am also in the same situation.

    I Need to print 15 rows in Detail Band. But some times there are 2-3 records in database then it shrinks everything up and does not look good.

    Please suggest me what to do, i could not understand from your conversation how you solved your problem.

    here is attached my report file.
    Thanks,

    Balbir
    LPO.fr3 19.4K
  • gpigpi
    edited 6:59AM
    See attach
  • edited 6:59AM
    gpi wrote: »
    See attach

    Thank you dear GPI, you saved me and gave me this valueable solution. I was looking for this since long.

    Thanks Alot Alot for your help.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.