×
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

Previewing an invoice as it is developed.

Previewing an invoice as it is developed.

Previewing an invoice as it is developed.

(OP)
A form lets the user enters the details of a sales invoice : Header information such as customer account, reference, delivery address; and Line details (Qty, product, price, description &c) - these are entered into a grid.

When all the details have been entered, the invoice can be output (to printer, pdf or screen) using the REPORT FORM command.

Is it possible to show an image of the invoice as it developed – perhaps on the RHS of the screen? This feature is required because some of the detail lines may invoke formatting of the lines which cannot easily be shown on the grid being used for data entry.

This can be achieved up to a point by letting the user invoke the REPORT FORM . . . PREVIEW WINDOW. But in order to let the user continue entering data into the grid, he has to press Esc, whereupon the preview window closes, and focus returns to the data entry grid.

Is there a way of keeping a report preview up on the screen, and letting it be refreshed with some command as each new line on the grid is entered or altered.

Thank you

RE: Previewing an invoice as it is developed.

Andrew, the reason that you have to press ESC to let the user return to the grid is that the report preview window is, by default, modal. To make it modeless, add the NOWAIT keyword. That will allow the user to carry on entering data while the preview is visible.

However, doing that on its own won't refresh the preview. You will have to re-generate the report each time the user finishes entering an invoice line. In other words, re-issue your REPORT FORM ... NO WAIT, probably in the grid's AfterRowColChange (and perhaps its LostFocus).

The whole thing might work better if the preview window is docked to the right of the screen - but you might need to experiment a bit to get that right.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Previewing an invoice as it is developed.

(OP)
Thanks Mike. The NOWAIT does the trick.

In the matter of positioning the form preview, I just check whether the form that I am running is on the left or right of the screen, and then position the window for the report on the other side.

The final lines of code which displays the form are broadly :

CODE -->

PUBLIC oRepForm
WITH Thisform
   lMidPoint = INT(.Left + .width/2)
   oRepForm = CREATEOBJECT("Form")
   WITH oRepForm
      .WindowState = 0   && This puts the form into windowed state.
      .height = _screen.Height - 85
      IF lmidpoint < (_screen.Width / 2)
         .left = INT(_screen.width * .5)
         .width = _screen.Width - .left
        ELSE
         .left =  1
         .width = (_screen.Width * .5)
         ENDIF
      ENDWITH
   SELECT tDetail
   REPORT FORM Salinv1 PREVIEW WINDOW (oRepForm.Name) NOWAIT
   ENDWITH 

If I subsequently wish to re-display the preview - maybe some of the invoice lines have altered – and the preview is still on the screen, I find that executing the the above code again does not refresh the report. The existing image on screen seems to take precedence. Only if I click on the ‘Close’ button of the preview (so that it vanishes) am I subsequently able to re-execute the above code to see the revised state of the invoice.

Have tried various instructions to make the preview vanish - e.g. oRepForm.Release() – but this is not effective.

RE: Previewing an invoice as it is developed.

Hmm. You're right. I've just run your code and am seeing the same behaviour. However, the following should work:

First, SET REPORT BEHAVIOR 90. This will give you a slightly different preview window, but it should basically work the same.

Then, when you are ready to close the window, do CLEAR WINDOW orepForm. I'm not exactly sure why, but that should close the form. You should then be able to repeat your CREATEOBJECT() and REPORT FORM. Bear in mind that after you do the CLEAR WINDOW, the public variable will no longer exist, so be sure to re-define it. (Or better still, use a form property rather than a public variable.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Previewing an invoice as it is developed.

When a report shows its preview in a form you give it, closing the preview form ends the report without printing. Restarting the report should be possible, but recreation of a public variable has a buggy behaviour, IIRC and since the report has a reference to the report form it's becoming a "zombie", an object, that doesn't release unless you actually end the report. either with the exit toolbar button or the print toolbar button of the report or closing the preview. I don't know, if you'd see the new report behind the already existing.

You're using .WindowState = 0. A Form you create with CREATEOBJECT should be shown using either the SHOWmethod or setting .visible =.t., not this way.

Bye, Olaf.

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

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