Author: <lalong1@charter.net>
Posted: 2009-08-07 14:04:32 Link
Paul,
Any suggestions as to how to print a "continued on next page" string on the
page footer if a group goes to a new page?
Thanks,
Larry
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
Author: Paul McNett
Posted: 2009-08-07 15:20:01 Link
lalong1@charter.net wrote:
> Paul,
> Any suggestions as to how to print a "continued on next page" string on the
> page footer if a group goes to a new page?
The invoice sample prints "continued from last page" in the group
header. You could look at that...
Paul
Author: <lalong1@charter.net>
Posted: 2009-08-10 11:08:20 Link
Paul,
Thanks, but that is not what we need. What you are doing is backward
looking. I need to be forward looking. i.e. on Page 1 say continued on
next page when I know that the current group is not finished. I think that
it could work if the page footer values were evaluated (or re-evaluated)
just before committing the page.
Larry
> -----Original Message-----
> From: dabo-users-bounces@leafe.com
> [mailto:dabo-users-bounces@leafe.com] On Behalf Of Paul McNett
> Sent: Friday, August 07, 2009 3:20 PM
> To: Dabo Users list
> Subject: Re: [dabo-users] Printing conditional string on
> report page footer
>
> lalong1@charter.net wrote:
> > Paul,
> > Any suggestions as to how to print a "continued on next
> page" string
> > on the page footer if a group goes to a new page?
>
> The invoice sample prints "continued from last page" in the
> group header. You could look at that...
>
> Paul
>
>
[excessive quoting removed by server]
Author: Paul McNett
Posted: 2009-08-10 12:51:40 Link
lalong1@charter.net wrote:
> Paul,
>
> Thanks, but that is not what we need. What you are doing is backward
> looking. I need to be forward looking. i.e. on Page 1 say continued on
> next page when I know that the current group is not finished. I think that
> it could work if the page footer values were evaluated (or re-evaluated)
> just before committing the page.
How about:
"continued on next page" if >
self.Cursor[self.RecordNumber+1][<group_expr] ==
self.Cursor[self.RecordNumber][<group_expr>] else ""
Paul
Author: <lalong1@charter.net>
Posted: 2009-08-10 13:12:43 Link
Thanx!
> -----Original Message-----
> From: dabo-users-bounces@leafe.com
> [mailto:dabo-users-bounces@leafe.com] On Behalf Of Paul McNett
> Sent: Monday, August 10, 2009 12:52 PM
> To: Dabo Users list
> Subject: Re: [dabo-users] Printing conditional string on
> report page footer
>
> lalong1@charter.net wrote:
> > Paul,
> >
> > Thanks, but that is not what we need. What you are doing
> is backward
> > looking. I need to be forward looking. i.e. on Page 1 say
> continued
> > on next page when I know that the current group is not finished. I
> > think that it could work if the page footer values were
> evaluated (or
> > re-evaluated) just before committing the page.
>
> How about:
>
> "continued on next page" if >
> self.Cursor[self.RecordNumber+1][<group_expr] ==
> self.Cursor[self.RecordNumber][<group_expr>] else ""
>
> Paul
>
>
[excessive quoting removed by server]
Author: <lalong1@charter.net>
Posted: 2009-08-10 13:50:04 Link
Paul,
Close...but I think it's being evaluated against the first record on the
page vs the last.
For example,
Group 1
a
b
c - page breaks here (so print "continued on next page" in page
footer)
d
Group 2
d
e
f - fits on page so don't print
I think its looking at group1-a & b vs group1-c & d
Larry
> -----Original Message-----
> From: dabo-users-bounces@leafe.com
> [mailto:dabo-users-bounces@leafe.com] On Behalf Of Paul McNett
> Sent: Monday, August 10, 2009 12:52 PM
> To: Dabo Users list
> Subject: Re: [dabo-users] Printing conditional string on
> report page footer
>
> lalong1@charter.net wrote:
> > Paul,
> >
> > Thanks, but that is not what we need. What you are doing
> is backward
> > looking. I need to be forward looking. i.e. on Page 1 say
> continued
> > on next page when I know that the current group is not finished. I
> > think that it could work if the page footer values were
> evaluated (or
> > re-evaluated) just before committing the page.
>
> How about:
>
> "continued on next page" if >
> self.Cursor[self.RecordNumber+1][<group_expr] ==
> self.Cursor[self.RecordNumber][<group_expr>] else ""
>
> Paul
>
>
[excessive quoting removed by server]
Author: Paul McNett
Posted: 2009-08-10 14:21:16 Link
lalong1@charter.net wrote:
> Close...but I think it's being evaluated against the first record on the
> page vs the last.
Page headers and footers print before groups and detail. So you are
right, putting this expr in the page footer wouldn't work. And there's
nothing equivalent to the group's ReprintHeaderOnNewPage for printing
the footer on the old page.
So... an oversight. I think it's logical to change the band printing so
that the page footer prints after the group/detail for the page, however
the detail band relies on knowing the used height of the page footer, so
the page footer will have to have a fixed height.
Or, I could make a group.PrintFooterOnOldPage, which might be
technically better but harder to implement.
If you just need to get this done now, you could put this in the
PageForeground band, because here's the order of band printing on a page:
PageBackground
PageHeader
PageFooter
any continued detail (paragraph) from last page
any group footers not printed yet
any group header(s)
any detail records
any group footers
PageForeground
The trouble with PageForeground is that you need to give it absolute x,y
positions (you need to account for margins yourself). So, if you wanted
"continued on next page" to appear at the bottom of the page just inside
the margins:
<x>self.Report["Page"]["MarginLeft"]</x>
<y>self.Report["Page"]["MarginBottom"]</y>
...and it would overprint anything else that happened to be there.
Paul
Author: <lalong1@charter.net>
Posted: 2009-08-10 15:12:25 Link
Paul,
I modified my version of reportWriter to render the pagefooter in endPage()
vs beginPage() and I can get it to do what I want (see diff below), but
another situation popped up...the deferred printing. Is there a
variable/attribute/property that I can query to tell me that the next page
is going to print the deferred info?
Thanks,
Larry
Index: reportWriter.py
===================================================================
--- reportWriter.py (revision 5306)
+++ reportWriter.py (working copy)
@@ -1797,7 +1797,9 @@
def beginPage():
# Print the static bands that appear below detail in z-order:
self._pageNumber += 1
- for band in ("pageBackground", "pageHeader", "pageFooter"):
+ #LAL - Move pagefooter write to endpage
+ #for band in ("pageBackground", "pageHeader", "pageFooter"):
+ for band in ("pageBackground", "pageHeader"):
printBand(band)
self._brandNewPage = True
@@ -1806,6 +1808,10 @@
x = self.getPt(self.ReportForm["Page"].getProp("MarginLeft"))
self.drawSpanningObjects((x,y))
printBand("pageForeground")
+
+ #LAL
+ printBand("pageFooter")
+
self.Canvas.showPage()
def reprintGroupHeaders(y):
@@ -1861,10 +1867,13 @@
vv = self._groupValues[group["expr"]]
if vv["curVal"] != group.getProp("expr"):
rp = eval(group.get("resetPageNumber", "False"))
- if rp and self._recordNumber == 0:
+ #LAL
+ #if rp and self._recordNumber == 0:
+ #self._pageNumber = 1
+ #elif rp:
+ #self._pageNumber = 0
+ if rp :
self._pageNumber = 1
- elif rp:
- self._pageNumber = 0
vv["curVal"] = group.getProp("expr")
np = eval(group.get("startOnNewPage", "False")) \
and self.RecordNumber > 0
> -----Original Message-----
> From: dabo-users-bounces@leafe.com
> [mailto:dabo-users-bounces@leafe.com] On Behalf Of Paul McNett
> Sent: Monday, August 10, 2009 2:21 PM
> To: Dabo Users list
> Subject: Re: [dabo-users] Printing conditional string on
> report page footer
>
> lalong1@charter.net wrote:
> > Close...but I think it's being evaluated against the first
> record on
> > the page vs the last.
>
> Page headers and footers print before groups and detail. So
> you are right, putting this expr in the page footer wouldn't
> work. And there's nothing equivalent to the group's
> ReprintHeaderOnNewPage for printing the footer on the old page.
>
> So... an oversight. I think it's logical to change the band
> printing so that the page footer prints after the
> group/detail for the page, however the detail band relies on
> knowing the used height of the page footer, so the page
> footer will have to have a fixed height.
>
> Or, I could make a group.PrintFooterOnOldPage, which might be
> technically better but harder to implement.
>
> If you just need to get this done now, you could put this in
> the PageForeground band, because here's the order of band
> printing on a page:
>
> PageBackground
> PageHeader
> PageFooter
> any continued detail (paragraph) from last page any group
> footers not printed yet any group header(s) any detail
> records any group footers PageForeground
>
> The trouble with PageForeground is that you need to give it
> absolute x,y positions (you need to account for margins
> yourself). So, if you wanted "continued on next page" to
> appear at the bottom of the page just inside the margins:
>
> <x>self.Report["Page"]["MarginLeft"]</x>
> <y>self.Report["Page"]["MarginBottom"]</y>
>
> ...and it would overprint anything else that happened to be there.
>
> Paul
>
>
>
[excessive quoting removed by server]
Author: Paul McNett
Posted: 2009-08-10 15:24:59 Link
lalong1@charter.net wrote:
> another situation popped up...the deferred printing. Is there a
> variable/attribute/property that I can query to tell me that the next page
> is going to print the deferred info?
The deferred stuff is basically encapsulated in printBand(), and you can
check to see in there if there's more deferred stuff to print by looking
at the deferred variable. There's no class-level attribute to query.
Paul
Author: <lalong1@charter.net>
Posted: 2009-08-11 00:15:24 Link
Paul,
Below, pls see my requested mod for reportWriter. What I did was move the
evaluation of the pagefooter to the endpage method and allow for tracking of
the deferred output. I had to change the way the pageNumber is being set in
a couple of places to adjust for the move. Your test invoice looks ok, I
think, so hopefully no functional change has occurred, except for the fact
that any references to field values in the page footer have gone from the
first record on the page to the next record after the last one on the page.
Please review my changes and let me know what you think.
The code that I used to print the 'continued' is
"(continued on next page)" if self.RecordNumber<len(self.Cursor) and
(self.Cursor[self.RecordNumber-1]['enrollid']
==self.Cursor[self.RecordNumber]['enrollid'] or self.being_deferred==True)
else ""
which checks for the EOF situation as well.
Thanks,
Larry
Index: reportWriter.py
===================================================================
--- reportWriter.py (revision 5306)
+++ reportWriter.py (working copy)
@@ -865,7 +865,9 @@
More documentation will come.
"""
_clearMemento = True
-
+
+ # LAL - Initialize being_deferred attribute to track if we are
generating a deferred page
+ being_deferred = False
def storeSpanningObject(self, obj, origin=(0,0), group=None):
"""Store the passed spanning object for printing when
the group or
page ends. Pass the group expr to identify group
headers, or None to refer
@@ -1334,6 +1336,8 @@
## rotating, scaling, etc. are cumulative, not
absolute and we don't want
## to start with a canvas in an unknown state.)
c.restoreState()
+ if deferred:
+ pass
return deferred, neededHeight
@@ -1660,7 +1664,7 @@
return maxBandHeight
maxBandHeight = getTotalBandHeight()
-
+
if band in ("groupHeader", "groupFooter",
"detail", "ReportBegin", "ReportEnd"):
extraHeight = 0
if band == "groupHeader":
@@ -1675,7 +1679,11 @@
if y < check or maxBandHeight is
None:
if
self._currentColumn >= columnCount-1:
+ #LAL - Set
being_deferred
+
self.being_deferred=True
endPage()
+ #LAL -
Clear being_deferred
+
self.being_deferred=False
beginPage()
else:
self._currentColumn += 1
@@ -1796,8 +1804,17 @@
def beginPage():
# Print the static bands that appear below
detail in z-order:
+ #for idx, group in enumerate(groups):
+ #vv =
self._groupValues[group["expr"]]
+ #if vv["curVal"] !=
group.getProp("expr"):
+ #rp =
eval(group.get("resetPageNumber", "False"))
+ #if rp:
+
#self._pageNumber = 0
+
self._pageNumber += 1
- for band in ("pageBackground",
"pageHeader", "pageFooter"):
+ #LAL - Move pagefooter write to endpage
+ #for band in ("pageBackground",
"pageHeader", "pageFooter"):
+ for band in ("pageBackground",
"pageHeader"):
printBand(band)
self._brandNewPage = True
@@ -1806,6 +1823,10 @@
x =
self.getPt(self.ReportForm["Page"].getProp("MarginLeft"))
self.drawSpanningObjects((x,y))
printBand("pageForeground")
+
+ #LAL
+ printBand("pageFooter")
+
self.Canvas.showPage()
def reprintGroupHeaders(y):
@@ -1861,20 +1882,30 @@
vv =
self._groupValues[group["expr"]]
if vv["curVal"] !=
group.getProp("expr"):
rp =
eval(group.get("resetPageNumber", "False"))
- if rp and
self._recordNumber == 0:
-
self._pageNumber = 1
- elif rp:
-
self._pageNumber = 0
+
+ #LAL - Change logic
for resetting the page number
+ pgreset=False
+ # Reset page number
if this is not a deferred page
+ if not
self.being_deferred and rp:
+
pgreset=True
+
vv["curVal"] =
group.getProp("expr")
np =
eval(group.get("startOnNewPage", "False")) \
and self.RecordNumber > 0
if np and not
brandNewPage:
endPage()
+
self._pageNumber = 0
+
pgreset=False
beginPage()
y = None
brandNewPage = True ## don't start multiple new pages
+
y =
printBand("groupHeader", y, group)
-
+
+ #LAL - If we still
need to reset the pageNumber
+ if pgreset:
+
self._pageNumber=1
+
# print the detail band:
y = printBand("detail", y)
self._recordNumber += 1
------- End of forwarded message -------
> -----Original Message-----
> From: dabo-users-bounces@leafe.com
> [mailto:dabo-users-bounces@leafe.com] On Behalf Of Paul McNett
> Sent: Monday, August 10, 2009 3:25 PM
> To: Dabo Users list
> Subject: Re: [dabo-users] Printing conditional string on
> report page footer
>
> lalong1@charter.net wrote:
> > another situation popped up...the deferred printing. Is there a
> > variable/attribute/property that I can query to tell me
> that the next
> > page is going to print the deferred info?
>
> The deferred stuff is basically encapsulated in printBand(),
> and you can check to see in there if there's more deferred
> stuff to print by looking at the deferred variable. There's
> no class-level attribute to query.
>
> Paul
>
>
[excessive quoting removed by server]