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: [email protected]
> [mailto:[email protected]] 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
>
> [email protected] 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]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message:
http://leafe.com/archives/byMID/!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAafA2fnYuPUOMNFpIYnBEQcKAAAAQAAAA4ekfisHiPEOwSZ4HvJil/[email protected]