>Hi all, I need to control the amount of copies printer for an invoice, but have not figured this out. I have a normal report to print an invoice, the first time I print it It should tell its original, the second time "copy 1" the third "copy 2" etc.
>
>The source of the report is a SQL query that joins master and detail of the invoice, does anyone has done this before. What is the best approach. Note that I need to increment the index on the copy only if printed, this means that if I see the report in preview (screen) it should not affect that counting.
>
>Thanks
>
>Norman
Hi Norman,
Here is a way to find, if the report was sent to the printer, but there is no way to find, if it was really printed, if printer has a spooler. E.g. printer job can be canceled or printer can be turned off, etc.
So, if you like the part of the solution (e.g. the fact, that the report was sent to the printer), it's quite simple:
in the routine, that calls your report define a private (if private would not work, define as public and release after you've done) variable called nCopies. Set it to 1.
In the report footer on Exit put iif(wexists('Printing'),_VFP.SetVar('nCopies',m.nCopies+1),"")
(Or create a separate function with similar functionality)
You can use this variable in your report to print the Copy number.
If it's not broken, fix it until it is.
My Blog