Standard Nav supports When you work with the various documents for sales and purchases (orders, quotes, invoices, credit memos, and so on), you can print different reports. For example, you print a sales invoice when you click the Posting button on an invoice in a sales application area and select Post and Print.
Just check the Tables 77- Report Selections
78 - Printer Selection
chekc the Form 64 - Printer Selections
But you can´t select more than one printer for one report here???
The question was to select the printer by a filter.
For Example Sales Invoice, it should work like:
If Salesperson.Code := 1 THEN "Use Printer HP 12345"
If Salesperson.Code := 2 THEN "Use Printer Kyocera 3456"
...
So its needed to print on different printers depending whats in a field in the concerning table. And I don´t whant to make several copies of the report to do this. Is there any idea how to do this???
But what is, if you print more then one invoice in a batch (like filter 'Invoice0001..Invoice0022')?
So, invoice 1 should print out on Printer1, Invoice 2 on printer 4 and so on. Depending on the Salesperson in the Rec. So, thats not so easy possible. Because NAV gets the printer for this report before any trigger in the report is fired.
Question: What is the reason why do you need this?
Its for use in our warehouse. Its for printing picklists automatic to different printers (or printer trays) depending what shipping company is used in the sales header.
In the properties you can only choose between the paper source, not the destination tray.
If nothing is possible like this i will make 3 copies of the report and put everything in the printer selection table.
the only workaround i can think of is creating 3 reports all the same w/diff #'s.
you can set the default printer in the properties of the report.
on your print button c/al code
if shipping agent = aaa then runmodal report 50000
if shipping agent = bbb then runmodal report 50001
if shipping agent = ccc then runmodal report 50002
*not actual useable code - it just a quick idea
you know what I mean? :-k
Yes, thanks. I know. This is how we do today. I was just wondering if theres a more practical solution, because I need 4 copies of the report to run this.
I had a similar need just for having Sales Orders automatically print to specific printers at each Location. There are various Locations around the US all within our network that we wanted to print to based off the location.
Years ago we used a modification on the Report Selections by adding a Location Code field, and then adding some code in the Document-Print codeunit to use this during the PrintSalesHeader function.
The downside, was using Printer Selections, we could only have 1 per Report ID, so we needed to maintain a plethora of reports which was not fun when they were identical.
The newer solution, we added a field "Default Sales Printer" to the Location table
Then in Document-Print if that user doesn't already have a printer setup for them in Report Selections we add one for that Report Selection, and that User and insert it into the Report Selections table and commit it. Then after the report is run, delete it.
Its for use in our warehouse. Its for printing picklists automatic to different printers (or printer trays) depending what shipping company is used in the sales header.
In the properties you can only choose between the paper source, not the destination tray.
If nothing is possible like this i will make 3 copies of the report and put everything in the printer selection table.
Not the solution your are looking for, but you could have different people assigned to print the pick tickets. Or set up different terminals to print each type. So, John filters and prints all picklist and his prints all go to his defualt printer. or someone goes to the terminal/comouter for a specific shipper and again filters and prints the pick tickets to the default printer for that terminal/computer. the cost of this solution is the hardware and user license. but there is no programing needed, and if you upgade later, no need to carry over custom programming.
This can be solved with user training and no new hardware or licences. but training the user. to select the appropriate printer and filter and print the reports as needed.
I successfully print to different printers within one report but I do this by first writing my output to a text file and then using the SHELL command to copy this text file to the appropriate networked printer:
TempString := 'ts2 z01 file.txt'; //these values vary based on printer selected
SHELL(BatchFile, TempString);
BatchFile is a text constant set to 'D:\Tag\sendtags.bat'
and the sendtags.bat file contains this command line: lpr.exe -S %1 -P %2 %3
The report is set to processing only so the user is never prompted to select a Navision printer.
I have 14 Zebra tag printers located throughout the company's four sites. The user simply selects which printer they want to print to on the form and the report (run modally from the form) takes care of the rest. This works well because the output of the report does not have to be formatted for appearance...it's simply a stream of text commands sent to the printer.
For formatted text that is presentation quality, it's a bit more difficult (but not impossible).
Comments
Standard Nav supports When you work with the various documents for sales and purchases (orders, quotes, invoices, credit memos, and so on), you can print different reports. For example, you print a sales invoice when you click the Posting button on an invoice in a sales application area and select Post and Print.
Just check the Tables 77- Report Selections
78 - Printer Selection
chekc the Form 64 - Printer Selections
just use this concept to get what you need.
But you can´t select more than one printer for one report here???
The question was to select the printer by a filter.
For Example Sales Invoice, it should work like:
If Salesperson.Code := 1 THEN "Use Printer HP 12345"
If Salesperson.Code := 2 THEN "Use Printer Kyocera 3456"
...
So its needed to print on different printers depending whats in a field in the concerning table. And I don´t whant to make several copies of the report to do this. Is there any idea how to do this???
But what is, if you print more then one invoice in a batch (like filter 'Invoice0001..Invoice0022')?
So, invoice 1 should print out on Printer1, Invoice 2 on printer 4 and so on. Depending on the Salesperson in the Rec. So, thats not so easy possible. Because NAV gets the printer for this report before any trigger in the report is fired.
Question: What is the reason why do you need this?
Its for use in our warehouse. Its for printing picklists automatic to different printers (or printer trays) depending what shipping company is used in the sales header.
In the properties you can only choose between the paper source, not the destination tray.
If nothing is possible like this i will make 3 copies of the report and put everything in the printer selection table.
you can set the default printer in the properties of the report.
on your print button c/al code
if shipping agent = aaa then runmodal report 50000
if shipping agent = bbb then runmodal report 50001
if shipping agent = ccc then runmodal report 50002
*not actual useable code - it just a quick idea
you know what I mean? :-k
http://www.BiloBeauty.com
http://www.autismspeaks.org
Years ago we used a modification on the Report Selections by adding a Location Code field, and then adding some code in the Document-Print codeunit to use this during the PrintSalesHeader function.
The downside, was using Printer Selections, we could only have 1 per Report ID, so we needed to maintain a plethora of reports which was not fun when they were identical.
The newer solution, we added a field "Default Sales Printer" to the Location table
Then in Document-Print if that user doesn't already have a printer setup for them in Report Selections we add one for that Report Selection, and that User and insert it into the Report Selections table and commit it. Then after the report is run, delete it.
I didn't think of it until I was responding to this post:
viewtopic.php?f=23&t=29388
But it works beautifully... You could do the same but on the Shipping Agent table.
"Profanity is the one language all programmers know best."
This can be solved with user training and no new hardware or licences. but training the user. to select the appropriate printer and filter and print the reports as needed.
TempString := 'ts2 z01 file.txt'; //these values vary based on printer selected
SHELL(BatchFile, TempString);
BatchFile is a text constant set to 'D:\Tag\sendtags.bat'
and the sendtags.bat file contains this command line: lpr.exe -S %1 -P %2 %3
The report is set to processing only so the user is never prompted to select a Navision printer.
I have 14 Zebra tag printers located throughout the company's four sites. The user simply selects which printer they want to print to on the form and the report (run modally from the form) takes care of the rest. This works well because the output of the report does not have to be formatted for appearance...it's simply a stream of text commands sent to the printer.
For formatted text that is presentation quality, it's a bit more difficult (but not impossible).