Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining Two Report Into One PrintJob - Second Attempt

Status
Not open for further replies.

edbytes

Programmer
Aug 29, 2001
27
0
0
US
I posted this message last week but it seems to have disappeared from the board. I got a response notification in my email but the link comes up dead. I'm hoping the same member or others may have a solution.

Here we go:


Continuation on an old problem but i'm going to try this another way.


Using vfp 8.0, w2k and an hplj9000dns I want to combine two reports and print them as one print job so that they will be stapled by the printer(obviously, this printer has the ability to do so).

So this is what I am doing:

I have two files; file1 and file2. File1 contains the data that Report1 will print and File2 contains the data that Report2 will print. Report1 prints on color stock from tray3 on the printer and report2 prints on letterhead from tray4. I currently print both reports to a file, combine and print as a single job however the printer still seperates them, prints report1 ejects(there is only one page in report1) and then prints report2 and staples if there is more than one page.



SELECT file1
REPORT FORM Report1.frx NEXT 1 TO FILE "c:\tempfiles\myReport.prn" NOCONSOLE

SELECT file2
GOTO file1.posrec
REPORT FORM Report2.frx NEXT report1.tot_prc2 TO FILE "c:\tempfiles\report2.prn" NOCONSOLE

&& Copy report1 temp file to a new file.
STRTOFILE(FILETOSTR("c:\tempfiles\report1.prn"),"c:\tempfiles\myReport.prn",0)

&& add report2 from temp file file already containing report1.
STRTOFILE(FILETOSTR("c:\tempfiles\report2.prn"),"c:\tempfiles\myReport.prn",1)

&& Print report to lpt5. lpt5 is currently set to hplj9000dns printer.
GOTO report1.posrec
APPEND MEMO myMemo FROM c:\tempfiles\BatchVoucher.prn
COPY MEMO myMemo TO lpt5




This used to work but all of a sudden it stopped without having made any changes to the program code and I don't beleive I changed any printer settings. I'm pretty much the only person who uses this printer.

Anyone have any experience or any ideas on how to accomplish what I want.
 
Hi edbytes,

Why are you copying myMemo to lpt5 instead of myReport.prn?

Regards,

Mike
 
It's the same thing pretty much. I'm copying the myReport.prn to a memo field in the file, which will be archived in case something goes goofy with the printer, I can just print whichever group of reports I would need again rather than re-running the entire process. Copying either myMemo or myReport accomplish the same thing just happens to be the way I coded it. I haven't found any differences in using this coding.
 
I see report1.prn and report2.prn going to myReport.prn, but I see BatchVoucher.prn going to the myMemo field and the printer.

No need for GOTO report1.posrec, append is going to move the record pointer to the last record.

Regards,

Mike
 
BatchVoucher.prn should be myReport.prn, I missed that while editing. Need to use the GOTO due to two different files. The one where the pointer is being moved contains more records than just what's being printed at this point.
 
Try REPORT FORM Report1.frx NEXT 1 TO FILE "c:\tempfiles\myReport.prn" NOCONSOLE NOPAGEEJECT or NORESET

Regards,

Mike
 
Try adding NOPAGEEJECT or NORESET to:
Code:
REPORT FORM Report1.frx NEXT 1 TO FILE "c:\tempfiles\myReport.prn" NOCONSOLE

Regards,

Mike
 
Thanks mspratt, that does keep the job together but the reports are printing from the same tray which is now another issue since they are supposed to print from seperate trays.
 
In the printer manual, find the code to change trays. Should be an escape sequence. When you are combining the files insert the sequence between them.

Regards,

Mike
 
they are supposed to print from seperate trays

The best and most simple means of getting the printer to switch between Trays is as already suggested, use the Printer Command Language and send the appropriate code string.

But if that is not possible, you can install the print driver in a manner that is unique to each separate tray.

Example:
hplj9000 - Tray 1 && Driver #1
hplj9000 - Tray 2 && Driver #2

These would need to be installed in each workstation that is going to run this particular utility within your application.

Then:
Code:
< Save original Window Default Printer >
< Set Windows Default Printer & Foxpro Printer To Driver #1 >
SELECT file1
REPORT FORM Report1.frx NEXT 1 TO FILE "c:\tempfiles\myReport.prn" NOCONSOLE

< Set Windows Default Printer & Foxpro Printer To Driver #2 >
SELECT file2
GOTO file1.posrec
REPORT FORM Report2.frx NEXT report1.tot_prc2 TO FILE "c:\tempfiles\report2.prn" NOCONSOLE

< Return To Original Windows Default Printer >

I am having to do this to programatically go between an Image (TIFF) "Printer" and the usual Windows Default Printer and it works fine.

I also do this for going between Tray 1 & Tray 2 of another HP Laser printer for another utility.

Good Luck,
JRB-Bldr
 
Thanks to all for the help. Here's where I am. I've got it working from within foxpro however when I recreate my app, it all prints on the same stock as report1. For some reason, when using the NOPAGEEJECT option the tray selected for the report doesn't get released. Anyone else have any ideas.

I will post how I got as far as I did once I can get the app working properly.

thanks again.
 
Is the printer PCL 5 compliant?

Final.prn = STRTOFILE(FILETOSTR(report1.prn) ;
+ CHR(27) + "&l4H" + FILETOSTR(report2.prn))

The 4 in &l4H is to select the alternate paper source.

Regards,

Mike
 
You may also need to manually eject.

Final.prn = STRTOFILE(FILETOSTR(report1.prn) ;
+ CHR(12) + CHR(27) + "&l4H" + FILETOSTR(report2.prn))

Regards,

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top