Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Still problems with too many copies for report
Message
 
To
09/11/2007 14:34:01
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01268095
Message ID:
01268106
Views:
12
>Hi,
>
>My users can select a report and specifiy the number of copies - long reports run from the server so they input the number of copies on a print dialog form and my app then passes it off to a server app that loops the required number of times to print the report e.g.
>
>FOR lnAtCopy = 1 TO .inNumCopies
>
>REPORT FORM ... etc.
>
>ENDFOR
>
>Starting with VFP9, they don't always get the correct number of copies - sometimes not enough and then sometimes the printer keeps going and going until it runs out of paper.
>
>I have turned on the printer option "keep printed documents" to capture the spooler file but I cannot decifer it (it is not PCL I found out - it seems to be "Enhanced Meta File"?) so all I have is the size of the file to look at - and it does not seem larger than normal (and therefore I do not thing VFP is looping too many times). I have tried all kinds of settings (using HP PCL5 instead of 6, HP PS (postscript), bypassing the spooler (causes crashes on large reports then) with no luck.
>
>Anyone else seen instances when the number of copies if off? I *have* to use VFP9 style of reporting as I have to use a report listener (for other reasons).
>
>Note that the users do not want to run the reports from their workstations as it ties up their machines for too long.
>
>Thanks,
>Albert Gostick

Why just not use PROMPT and let the user choose how many copies they have to print?
In your way you create as many Print Jobs as the value of .inNumCopies is. Let the printer driver choose how to optimize the output.
If you want to keep your way then do this (AFTER the print dialog):
*** Print dialog goes here
*** and after ALL testing for a valid input from the user:
lnCopies = .inNumCopies
lcReport = FULLPATH([TheNameOfTheReport.FRX])
lcTempReport = SYS(2015)
COPY FILE (FORCEEXT(lcReport,"*")) TO (FORCEEXT(lcTempReport,"*"))
SELECT 0
USE (lcTempReport+[.FRX]) ALIAS MyReport
GO TOP
IF [COPIES] $ UPPER(Expr)
   lcExpr     = LEFT(Expr,AT([COPIES],UPPER(Expr))-1)
   lcExprRest = SUBSTR(Expr,LEN(lcExpr)+1)
   lcExprRest = SUBSTR(lcExprRest,AT(CHR(13)+CHR(10),lcExprRest))
   lcExpr     = lcExpr + [COPIES=]+TRANSFORM(lnCopies)+lcExprRest
ELSE
   lcExpr     = Expr + CHR(13)+CHR(10)+[COPIES=]+TRANSFORM(lnCopies)
ENDIF
REPLACE Expr WITH lcExpr IN MyReport
USE IN MyReport
REPORT FORM MyReport ....
ERASE (FORCEEXT(lcTempReport,"*"))
(not tested, just be sure my calculations are right)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform