home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 16.8 Check for changes
- Author: Joe Booth
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
- #include "INKEY.CH"
-
- function upd_cust(cId_code)
- LOCAL mcust:={}, oldcust:={}, jj, chgd:=.f., ok
- memvar getlist
- use CUSTOMER shared new
- if !neterr()
- set index to cust1,cust2
- endif
- seek cId_code
- if found()
- for jj = 1 to fcount()
- Aadd( mcust,fieldget(jj) )
- next
- oldcust := Aclone(mcust)
- while .T.
- @ 10,10 say "Company name...: " get mcust[1]
- @ 11,10 say "Billing contact: " get mcust[2]
- read
- if lastkey() <> K_ESC
- if rec_lock()
- for jj = 1 to fcount()
- if !(ok := fieldget(jj) == oldcust[jj])
- jj = fcount() + 1
- endif
- next
- if ! ok
- ? "WARNING: Record has been changed already"
- inkey(500)
- for jj = 1 to fcount()
- Aadd(mcust, fieldget(jj))
- next
- unlock
- loop
- endif
- for jj = 1 to fcount()
- fieldput(jj, mcust[jj])
- next
- unlock
- exit
- endif
- endif
- enddo
- endif
- return ok
-
- // end of file CHP1608.PRG
-