home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP16.EXE / CHP1608.PRG < prev    next >
Encoding:
Text File  |  1991-04-30  |  1.4 KB  |  58 lines

  1. /*
  2.    Listing 16.8  Check for changes
  3.    Author: Joe Booth
  4.    Excerpted from "Clipper 5: A Developer's Guide"
  5.    Copyright (c) 1991 M&T Books
  6.                       501 Galveston Drive
  7.                       Redwood City, CA 94063-4728
  8.                       (415) 366-3600
  9. */
  10.  
  11. #include "INKEY.CH"
  12.  
  13. function upd_cust(cId_code)
  14. LOCAL mcust:={}, oldcust:={}, jj, chgd:=.f., ok
  15. memvar getlist
  16. use CUSTOMER shared new
  17. if !neterr()
  18.    set index to cust1,cust2
  19. endif
  20. seek cId_code
  21. if found()
  22.    for jj = 1 to fcount()
  23.       Aadd( mcust,fieldget(jj) )
  24.    next
  25.    oldcust := Aclone(mcust)
  26.    while .T.
  27.       @ 10,10 say "Company name...: " get mcust[1]
  28.       @ 11,10 say "Billing contact: " get mcust[2]
  29.       read
  30.       if lastkey() <> K_ESC
  31.          if rec_lock()
  32.             for jj = 1 to fcount()
  33.                if !(ok := fieldget(jj) == oldcust[jj])
  34.                   jj = fcount() + 1
  35.                endif
  36.             next
  37.             if ! ok
  38.                ? "WARNING: Record has been changed already"
  39.                inkey(500)
  40.                for jj = 1 to fcount()
  41.                   Aadd(mcust, fieldget(jj))
  42.                next
  43.                unlock
  44.                loop
  45.             endif
  46.             for jj = 1 to fcount()
  47.                fieldput(jj, mcust[jj])
  48.             next
  49.             unlock
  50.             exit
  51.          endif
  52.       endif
  53.    enddo
  54. endif
  55. return ok
  56.  
  57. // end of file CHP1608.PRG
  58.