Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Browse in a screen in DOS - It's been too long !!
Message
From
19/06/2000 17:36:35
Ray Crosier
Creative Consulting Services
North Bennington, Vermont, United States
 
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00381973
Message ID:
00381986
Views:
14
Here is a chuck of code that I used to do this with three files. A master invoice file, transaction file and a cash receipts file. Allows browsing of the master, showing line items from invoice in one browse, and cash receipts to invoice in another window.

PRE

***** BEGINNING OF CODE CHUNK

SELECT cadmst
SET ORDER TO invcust
SET FILTER TO cadmst.signature<>99 .AND. .NOT. DELETED()
GO TOP
IF EOF()
ACTIVATE WINDOW capsmsg
STORE ' ' TO mans
@ 2,10 SAY ' There are no Invoices on file'
@ 4,10 SAY 'Press ENTER to return to previous screen' ;
GET mans PICT 'X'
READ
DEACTIVATE WINDOW capsmsg
STORE .f. TO mok
RETURN
ENDIF
GOTO BOTTOM
SELECT cadtrn
SET ORDER TO invcust
SELECT cadcsh
SET ORDER TO invcust
SELECT cadmst
SET RELATION TO invno+custno INTO cadtrn, invno+custno INTO cadcsh
HIDE WINDOW all
DEFINE WINDOW getsrch ;
FROM 1,0 TO 3,79 IN SCREEN ;
NOCLOSE NOZOOM NOFLOAT NOGROW
ACTIVATE WINDOW getsrch
STORE SPACE(8) TO mvinvnum
@ 0,5 SAY 'Enter the Invoice # to VOID, or press ENTER to browse' ;
GET mvinvnum PICT 'XXXXXXXX'
READ
RELEASE WINDOW getsrch
IF lastkey()=27
STORE .f. TO mok
RETURN
ENDIF
STORE PADL(TRIM(mvinvnum),8,' ') TO mvinvnum
*
* Now, do search loop.
*
SELECT cadmst
GO TOP
IF EOF()
ACTIVATE WINDOW capsmsg
STORE ' ' TO mans
@ 2,10 SAY ' There are no Invoices on file'
@ 4,10 SAY 'Press ENTER to return to previous screen' ;
GET mans PICT 'X'
READ
DEACTIVATE WINDOW capsmsg
STORE .f. TO mok
RETURN
ENDIF
STORE .f. TO mvfound,mok
IF .NOT. EMPTY(mvinvnum)
SET EXACT OFF
SET NEAR ON
SEEK mvinvnum
IF FOUND()
SET EXACT ON
IF cadmst.invno=mvinvnum
STORE .t. TO mvfound,mok
ENDIF
ENDIF
ENDIF
* IF mvfound=.f. here, must browse file
IF .NOT. mvfound
SET NEAR ON
SEEK mvinvnum
DEFINE WINDOW voidbrowse ;
FROM 0,0 TO 10,55 IN SCREEN ;
TITLE 'Select Invoice with arrow keys or PGUP/PGDN keys' ;
FOOTER 'Press Enter key to select, or ESC key to Quit' ;
NOGROW NOFLOAT NOZOOM NOCLOSE
DEFINE WINDOW voiditems ;
FROM 11,0 TO 24,79 IN SCREEN ;
TITLE 'Items on Currently Selected Invoice' ;
NOGROW NOFLOAT NOZOOM NOCLOSE
DEFINE WINDOW voidpmts ;
FROM 0,56 to 10,79 IN SCREEN ;
TITLE 'Payment Info' ;
NOGROW NOFLOAT NOZOOM NOCLOSE
ACTIVATE WINDOW voiditems
SELECT cadtrn
BROWSE FIELDS ;
item :H='Item Number' :15, ;
descrip :H='Description' :27, ;
qtyshp :H=' Qty' :6 :P='9999.9', ;
price :H=' Price' :8 :P='$$999.99', ;
disc :H='Disc %' :6 :P='999.99', ;
extprice :H='Ext Price' :9 :P='$$9999.99' ;
IN WINDOW voiditems NOEDIT NOAPPEND NODELETE NOWAIT
ACTIVATE WINDOW voidpmts
SELECT cadcsh
BROWSE FIELDS ;
artype :H='Code' :4, ;
refno :H='Pmt Type' :8, ;
paidamt :H='Amount' :7 :P='$$99.99' ;
IN WINDOW voidpmts NOEDIT NOAPPEND NODELETE NOWAIT ;
FOR .NOT. DELETED()
ACTIVATE WINDOW voidbrowse
SELECT cadmst
ON KEY LABEL ENTER KEYBOARD CHR(23)
BROWSE FIELDS ;
invno :H='Invoice #' :8, ;
termno :H='Term' :4, ;
custno :H='Cust #' :6, ;
salesmn :H='Sls' :3, ;
invamt :H=' Amount' :8 :P='$$999.99', ;
paidamt :H='Amt Paid' :8 :P='$$999.99', ;
balance :H='Balance' :8 :P='$$999.99' ;
IN WINDOW voidbrowse NOEDIT NOAPPEND NODELETE REST
ON KEY LABEL ENTER
IF LASTKEY()=27
STORE .f. TO mok,mvfound
RETURN
ELSE
* Current record is one to delete
STORE .t. TO mok,mvfound
ENDIF
ENDIF && .not. mvfound
RELEASE WINDOW getsrch,voidbrowse,voidpmts,voiditems
*** END OF CODE CHUNK

/PRE
Previous
Reply
Map
View

Click here to load this message in the networking platform