×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

it is possible to print, to an specific tray ,based on an specified value from a table.field
2

it is possible to print, to an specific tray ,based on an specified value from a table.field

it is possible to print, to an specific tray ,based on an specified value from a table.field

(OP)
Hi Everyone
i need to print invoices on the same printer, of course this printer has up to 3 trays, one of them have blue paper, there is field named "terms" in the table that, if table.terms ="30 days" i would like this invoices with these value to be printed to the tray with blue color paper and if not will print to the default tray, how in vfp 9.0 can i accomplish it ?
can anyone guide please ?
Thanks so much in advance

RE: it is possible to print, to an specific tray ,based on an specified value from a table.field

The easiest solution is to define more than one "virtual printer" to the same physical printer. IOW install the printer twice, using different names, and with different printer properties. You then simply have different "Set Printer to Name xxxx" clauses, depending on the field you mention.

RE: it is possible to print, to an specific tray ,based on an specified value from a table.field

Alternativel:

1. Create two copies of the report.

2. In each case, in the Report Designer, go to the Page Setup dialoge. Select the target printer.

3. In the same dialogue, click the Page Setup button. In the resulting dialogue, set the Source to the relevant tray. (This will be different for each of the two reports.)

4. In both cases, make sure Printer Environmen is ticked (in the Report menu).

5. Save each report under an appropriate name (e.g. Invoices_White and Invoices_Blue). When you are ready to print the invoices, issue a REPORT FORM command for the appropriate report.

The disadvantage of this method is that, if you later need to change the invoices, you will have to apply the change to both copies.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: it is possible to print, to an specific tray ,based on an specified value from a table.field

I second what Tore says, but that also means you have no chance to change tray within a report, not even per page.

You will have to run single page reports and for each one set the corresponding logical (virtual) printer, but that is possible.

You don't need N DBFs for that, you can run a report FOR NEXT 1, only printing one record. Or you query what belongs into which try into separate DBFs or cursors in advance.

Besides that, I know print stations which have 10 trays and have modes in which pages are sorted into the several trays one after the other and further modes, something you could configure without VFP doing anything specific to get there, that's done by the print station configuration.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: it is possible to print, to an specific tray ,based on an specified value from a table.field

Quote:

The disadvantage of this method is that, if you later need to change the invoices, you will have to apply the change to both copies.

So here is another solution that doesn't have that disadvantage:

1. Create a single copy of the report, as usual.

2. Set the source to the white paper tray, as described above.

3. Make sure Printer Environment is ticked (in the Report menu).

4. Before printing the report, open the report as a DBF and programmatically modify the Expr field, so that DEFAULTSOURCE points to the relevant tray. Then close the DBF and go ahead and print the report.

Step 4 is a little complicated. Rather than my explaining it in detail, have a look at Controlling report settings at run time, which gives an example of the code you need and explains how to get the values for the different paper trays.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: it is possible to print, to an specific tray ,based on an specified value from a table.field

(OP)
Ok, let me clarify something here.

SBT pro 5.0 it is an application done in vfp 5.0, so there are already a report form to print invoices and of course the data that will print in that report form comes from a cursor, the problem is or the question is IF fieldname "TERMS" value='30 DAYS' then i need that invoice to print in a different tray, probably the next invoice to be printed the value of "TERMS' IS EMPTY so then this should go to the default tray most likely white paper tray.
i just saying this to make sure i explained this correctly and the answers are based on what i am saying here, sorry if i explained correctly. so would this change your suggestions ?

i guess i will have to change something in the source code to reroute when TERMS='30 DAYS' to a different printer or if it possible programmatically get the tray number on the same printer when the value is as mentioned

RE: it is possible to print, to an specific tray ,based on an specified value from a table.field

As already said you can't change tray based on data within a running report, you have to do this from the outside.
Unless a printer automatically uses multiple trays you can only pick one tray before starting the report.

So if you print invoices as one report that spans multiple invoices and you want to react when the group = invoice number changes, you cann't switch trays.

You instead need to have printerdefault and printerspecialtray and then print single invoices this way:

CODE

SELECT invoices
SCAN
   If invoice.TERMS='30 DAYS'
      SET PRINTER TO NAME printerspecialtray
   Else
      SET PRINTER TO NAME printerdefault
   Endif
   REPORT FORM yourreport.frx NEXT 1
ENDSCAN 

As preparation, you install the printer twice once named printerdefault and once named printerspecialtray and configure them to the trays. That's something under control of the printer settings, not under control of VFP or VFPs reports and if so, you could only set this up for the whole report, not per page.

That means nothing changes with what I said, I only made more explicit what I meant.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: it is possible to print, to an specific tray ,based on an specified value from a table.field

(OP)
Thanks Olaf and Mike, got it now

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close