Home General

complex purchase order

edited April 2010 in General
I'm a long-time Delphi programmer and have used another report writer for 10
years. A custom application I've developed for a client has fairly complex
requirements for a purchase order report. In the previous report writer, I
could add as many bands to the report as I wanted and specified each band
individually. For example, I could have two detail sections after another,
headers could be on the first page only, or on every page. An so forth.

For a variety of reasons, I've dumped the old report writer for
ReportBuilder and have converted all the reports. Trying to fit this report
into sub-reports and regions with events to turn things on and off in order
to replicate exactly the old functionality is turning out to be very
challenging.

The following are the layout requirements:

* Large header on every page, takes up top 1/3 of page. On the first page,
two memo fields give detailed instructions about the items on the purchase
order. Usually, these memos are fairly small, but can grow to several
paragraphs.

* Details are a mix of "header lines" and normal detail information such as
quantity, part number, description, etc. The details are in a very specific
order and the program allows the entry of either a memo field describing a
section of detail lines to follow -OR- the quantity/part#/etc fields of the
line items. So you might end up with something like this (line numbers
added to show that each line is a separate detail line):
1. Section header describing the following items of Widgets
2. 10 Units Widget 1A, $13.00 $130.00
3. 20 Units Widget 1B, $8.00 $160.00
4. Section header describing the following items of Gizmos
5. 5 Units Gizmo 3H $1.00 $5.00
6. 4 Units Gizmo 3Q $4.00 $16.00

* After the details, a summary showing the total extended amount. Then
comes a very long memo field with many notes to the vendor; this note can
easily be 30 lines long and almost always wraps to the next page.

* Finally, a signature line on the very last page at the very bottom
finishes the report.


Here are the tricks I had to pull to accomplish this:

1. Since I don't see a way to easily show the first page's memos on ONLY the
first page, I used a BeforePrint event on the header band to check the
report's PageNo on SecondPass. This seemed to work, but later problems make
me wonder if it causes side-effects.

2. Since in each detail space, either a "header line" -OR- the line item
details need to print (but not both), I used a BeforePrint event on the
detail band to check the detail line's "line type" and show the appropriate
sub-report containing the field or fields needed for that row. This also
seems to work just fine.

3. The signature line must be on the very bottom of the page, so naturally,
it goes in a Footer band. However, it's only supposed to show up on the
LAST page of the report. There's already a summary section and it's NOT
supposed to be on the bottom of the page (besides, it usually wraps a couple
of pages), so another BeforePrint event was created to hide (on SecondPass)
the Footer band until the last page. I think this is where the problem
might be.


The problems:

1. A somewhat minor issue is that sometimes the last few lines (2 to 6, it
varies) of the notes are repeated on the last page. This is weird and isn't
right, but it's not a show-stopper. However, there seems to be too much
space on the bottom of the page and I've even seen the last two lines of the
notes carry over to another page when they and the signature line could've
easily fit on the current page, thus ending the report one page earlier.
This is probably related to the next one.

2. The major problem that I have to fix is that sometimes detail lines get
repeated on the next page. I've seen as many as 5 lines get repeated! This
could have drastic effects to my client which typically has several thousand
dollars of items on a purchase order.

What could be causing these?


My guess is that it's one of the BeforePrint calculations above. Maybe one
by itself would've worked, but three affecting the layout at print time
might be throwing off internal adjustments.

I created a temporary replacement that put the big memos from the first page
into the Summary band which allowed me to get rid of the first BeforePrint.
Then I let both "headers" and "details" print on every detail line to get
rid of the second BeforePrint. Finally, I allowed the signature to be
printed on every page and got rid of the third BeforePrint.

Now nothing is repeated, but the report is not in the format my client
wants.

Can I get some more ideas? Has anyone heard of this problem before?


Thanks!

--
David Cornelius
Cornelius Concepts

Comments

  • edited April 2010
    Hi David,

    Welcome to the ReportBuilder community!

    From your description, I can see that the event code is most likely causing
    the issue here. Removing some or all of it may solve the problem.

    1. Have you tried placing the first-page-only information inside the Title
    Band? This band by definition will only print on the first page of the
    report.

    2. Instead of using the footer band to display bottom last-page-only
    information, try using the summary band with its AlignToBottom property set
    to True.

    3. For the information currently inside the summary band that is not
    supposed to align to the bottom, you could create a group around the entire
    report. Base the group on an arbitrary label so the group footer prints at
    the bottom of the report replacing the current summary band.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2010
    I had not thought of using a fake group in order to use the group footer.
    That worked very well.

    Thank you so much--that saved the day (and my head!).

    --
    David Cornelius
    Cornelius Concepts

This discussion has been closed.