home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a004 / 4.ddi / TUTORIAL / VIEWINVS.PRG < prev    next >
Encoding:
Text File  |  1988-01-17  |  2.0 KB  |  75 lines

  1. * Viewinvs.prg displays information concerning the specified
  2. * invoice.
  3.  
  4. * Select databases Customer with index Custno and Invoices
  5. SELECT Customer
  6. SET INDEX TO Custno, Lastname, Ziplist
  7. SELECT Invoices
  8.  
  9. * Set up relation between Invoices and Customer
  10. SET RELATION TO Custno INTO Customer
  11.  
  12. * Begin main loop
  13. STORE .T. TO more
  14. DO WHILE more
  15.  
  16.     * Get number of invoice to be displayed
  17.     CLEAR
  18.     @  3,0  SAY CENTER("VIEW INVOICE RECORDS")
  19.     STORE SPACE(5) TO minvoice
  20.     @ 12,5  SAY "Enter invoice number: ";
  21.     GET minvoice PICTURE "!!!!!"
  22.     READ
  23.  
  24.     * Search for entered value
  25.     SEEK minvoice
  26.  
  27.     * If invoice is found, display all pertinent information
  28.     IF FOUND()
  29.     CLEAR
  30.     @  3,0    SAY "Invoice number: " + Invoiceno
  31.     @  5,0    SAY "Ship to:"
  32.     @  5,10 SAY TRIM(Customer->Firstname)+" "+ Customer->Lastname
  33.     @  6,10 SAY Customer->Company
  34.     @  7,10 SAY Customer->Address
  35.     @  8,10 SAY TRIM(Customer->City) + ", " +;
  36.         Customer->State + "  " + Customer->Zip
  37.     IF Customer->Country <> "U.S.A."
  38.         @  9,15 SAY Customer->Country
  39.     ENDIF
  40.     @ 12,5    SAY "Quantity             Part Number"+;
  41.         "                               Price"
  42.     @ 11,0    TO 13,79
  43.     @ 13,0    TO 16,79
  44.     @ 14,5    SAY STR(Quantity,8)
  45.     @ 14,25 SAY Partnum
  46.     @ 14,59 SAY STR(Price)
  47.     @ 18,5    SAY "Ship date: " + DTOC(Shipdate)
  48.     @ 18,39 SAY "Payment due by: " + DTOC(Datedue)
  49.  
  50.     * Use the immediate IF function IIF()
  51.     * to convert Paid value to appropriate message
  52.     @ 19,39 SAY IIF(Paid, "Payment received?  YES",;
  53.         "Payment received?  NO")
  54.  
  55.     * If invoice not found, display message
  56.     ELSE
  57.     @ 14,5    SAY "Invoice not on file"
  58.     ENDIF
  59.  
  60.     * Check whether user wishes to look up additional invoices
  61.     STORE " " TO choice
  62.     @ 22,5  SAY "Look up another invoice? (Y/N): ";
  63.     GET choice PICTURE "Y"
  64.     READ
  65.     IF choice = "N"
  66.     STORE .F. TO more
  67.     ENDIF
  68.  
  69. * End main loop
  70. ENDDO
  71.  
  72. * Reset operating environment and return to Menu.prg
  73. SET RELATION TO
  74. RETURN
  75.