home *** CD-ROM | disk | FTP | other *** search
- * ┌─────────────────────────────────────────────────────────────────────┐ *
- * │ INVOICEP.PRG: INVOICE PRINT │ *
- * │ Copyright (c) 1989 Tech III, Inc. All rights reserved. │ *
- * │ Tech III of San Pedro, California (213) 547-2191. │ *
- * │ "The bridge connecting people and technology."(tm) │ *
- * └─────────────────────────────────────────────────────────────────────┘ *
- @ 00,00 SAY WINTITLE(PROMPT())
-
- SELECT lines
- SET ORDER TO lns_inv
- SELECT invoice
- IF EOF() .OR. BOF()
- GO TOP
- ENDIF
- STORE RECNO() TO curr_rec
- STORE SET('MEMOWIDTH') TO memocols
- SET ORDER TO inv_inv
- SET RELATION TO invoice INTO lines
- IF EOF() .OR. BOF()
- GO TOP
- ELSE
- SKIP 0
- ENDIF
-
- * INITIALIZE VARIABLES
- PUBLIC taxamt
- STORE 0 TO taxamt
- STORE .t. TO _box, printing
- STORE invoice TO startno, endno
-
- * DEFINITIONS
- ON ESCAPE STORE .f. TO printing
- ON PAGE AT LINE 56 DO prn_foot
-
- * USER INPUT: SELECT INVOICE RANGE TO PRINT
-
- @ 02,02 SAY 'Begin printing with invoice number: ' GET startno PICTURE '99999'
- @ 04,02 SAY 'Stop printing after invoice number: ' GET endno PICTURE '99999' ;
- RANGE startno,
- READ
-
- IF .NOT. YESNO("System is ready to print.")
- STORE .f. TO printing
- ELSE
- IF .NOT. READY2PR()
- STORE .f. TO printing
- ENDIF
- ENDIF
-
- IF .NOT. printing
- DO standby WITH 'You have canceled the report.'
- ELSE
- SEEK startno
-
- * START PRINTING
- ACTIVATE WINDOW pticker
- SET CONSOLE OFF
- SET PRINT ON
- PRINTJOB
- SCAN REST WHILE printing .AND. invoice <= endno
- STORE invoice TO this_one
- STORE 1 TO pagenum
- STORE INVSUB() TO invtot
- STORE invoice->taxrate TO mtaxrate
- STORE 0 TO taxamt
- DO prn_head
- SELECT lines
- SCAN REST WHILE invoice = this_one
- DO prn_items
- ENDSCAN
- STORE PROW() TO start_line
- DO WHILE PROW() >= start_line
- ?
- ENDDO
- SELECT invoice
- ENDSCAN
- SET PRINTER OFF
- SET CONSOLE ON
- DEACTIVATE WINDOW pticker
- DO standby WITH 'Your print request has been completed.'
- ENDPRINTJOB
- ENDIF
-
- * Housekeeping
- SET RELATION TO
- ON ESCAPE
- ON PAGE
- SELECT invoice
- GOTO curr_rec
- RETURN
-
- * HEADINGS
- PROCEDURE prn_head
- STORE 0 TO _plineno, _pcolno
- DEFINE BOX FROM 00 TO 79 HEIGHT 52 AT LINE 5 SINGLE
- ?
- ?
- STORE " INVOICE # " + LTRIM(STR(invoice->invoice,10)) TO invno_str
- ? invno_str AT (79 - LEN(invno_str)) STYLE 'B'
- ?
- ?
- ?
- ? PTICKER() + "B ┌ ┐ S ┌ ┐" AT 01
- ? PTICKER() + "I H" AT 01
- ?? LEFT(invoice->contact,32) AT 04
- ?? LEFT(invoice->s_contact,32) AT 44
- ? PTICKER() + "L I" AT 01
- ?? LEFT(invoice->company,32) AT 04
- ?? LEFT(invoice->s_company,32) AT 44
- ? PTICKER() + "L P" AT 01
- ?? LEFT(invoice->address1,32) AT 04
- ?? LEFT(invoice->s_address1,32) AT 44
- ? LEFT(invoice->city,20) AT 04
- ?? invoice->state AT 25
- ?? invoice->zip AT 28
- ?? LEFT(invoice->s_city,22) AT 44
- ?? invoice->s_state AT 66
- ?? invoice->s_zip AT 69
- ? PTICKER() + "T T " AT 01
- ? PTICKER() + "O └ ┘ O └ ┘" AT 01
- ? PTICKER() + '├' AT 00
- ?? "──────────┬──────────────────┬───────┬────────────┬───────────────────────────" AT 01
- ?? '┤' AT 79
- ? PTICKER() + "Date │ P.O # │ Slsmn │ Ship via │" AT 03
- ? PTICKER() + '├' AT 00
- ?? "──────────┼──────────────────┼───────┼────────────┼───────────────────────────" AT 01
- ?? '┤' AT 79
- ? PTICKER() + "│ │ │ │" AT 11
- ?? invoice->inv_date AT 02
- ?? invoice->po AT 13
- ?? invoice->soldby AT 33
- ?? invoice->shipvia AT 40
- ? PTICKER() + '└' AT 00
- ?? "──────────┴──────────────────┴───────┴────────────┴───────────────────────────" AT 01
- ?? '┘' AT 79
- ? PTICKER() + '┌' AT 00
- ?? "────────┬─────────────────────────────────────────┬─────┬─────────┬───────────" AT 01
- ?? '┐' AT 79
- ? PTICKER() + "Item # │ Description │ Qty │ Price │ Extension" AT 02
- ? PTICKER() + '├' AT 00
- ?? "────────┴─────────────────────────────────────────┴─────┴─────────┴───────────" AT 01
- ?? '┤' AT 79
- RETURN
-
- * LINE ITEMS
- PROCEDURE prn_items
- ? PTICKER() + lines->item AT 2
- ?? IIF(taxable,'*',' ') AT 9
- ?? LEFT(lines->descript,37) AT 11
- ?? lines->quantity PICTURE '9999999' AT 50
- ?? lines->price PICTURE '999,999.99' AT 57
- ?? lines->quantity*lines->price PICTURE '9999,999.99' AT 68
- IF taxable
- STORE taxamt+((mtaxrate*(quantity*price))*.01) TO taxamt
- ENDIF
- RETURN
-
- * FOOTERS
- PROCEDURE prn_foot
- * PRINT PAGE NUMBER IF MORE PAGES TO GO, OR IF THIS IS LAST PAGE OF MULTI-
- * PAGE INVOICE
- ? PTICKER()
- ? PTICKER()
- IF invoice = this_one .OR. pagenum > 1
- ?? 'PAGE ' + STR(pagenum,3) AT 35
- ENDIF
- * PRINT A HEADER (AND CONTINUE) IF MORE PAGES TO GO
- IF invoice = this_one
- EJECT
- STORE pagenum + 1 TO pagenum
- DO prn_head
- ELSE
- * PRINT TOTAL IF THIS IS THE LAST PAGE
- ? 'INVOICE TOTAL: $ ' + TRANSFORM(invtot, '99,999,999.99') AT 40
- ? 'TAX AMOUNT(*): $ ' + TRANSFORM(taxamt, '99,999,999.99') AT 40
- ? 'GROSS TOTAL : $ ' + TRANSFORM(invtot+taxamt,'99,999,999.99') AT 40
- EJECT
- STORE 1 TO pagenum
- ENDIF
-
- RETURN
-
- FUNCTION getfirst
- SET NEAR ON
- SEEK startno
- IF FOUND()
- STORE .t. TO returnval
- ELSE
- DO standby WITH "That invoice isn't on file."
- IF .NOT. BOF()
- SKIP -1
- ENDIF
- IF EOF()
- GO TOP
- ENDIF
- STORE invoice TO startno
- STORE .f. TO returnval
- ENDIF
- SET NEAR OFF
- RETURN returnval
-
- FUNCTION getlast
- SET NEAR ON
- SEEK endno
- IF FOUND()
- STORE .t. TO returnval
- ELSE
- DO standby WITH "That invoice isn't on file."
- IF .NOT. BOF()
- SKIP -1
- ENDIF
- IF EOF()
- GO TOP
- ENDIF
- STORE invoice TO endno
- STORE .f. TO returnval
- ENDIF
- SET NEAR OFF
- RETURN returnval
-
- * EOF
-