home *** CD-ROM | disk | FTP | other *** search
- **
- ** PROGRAM TITLE : HFORM
- **
- ** WRITTEN BY : Paul Long
- **
- ** WRITTEN FOR : Copyright (C) 1992 All rights reserved. XL Systems, Inc.
- **
- ** PROGRAM INTENT: Functions for converting forms data to GHOST data
- ** and adds it to a DBF.
- **
- ** NOTE: This file uses a hybrid approach It uses "traditional,"
- ** non-OOP programming, but organizing the code along OOP
- ** lines, e.g., one source file per "class."
- **
- #include "inkey.ch"
-
- memvar cLastName, cFirstName, cMiddleInitial, cAcctNo, cExamNo, cPIC, cSSN, ;
- dDOB, adDOS
-
- static nFormEntries, lFormFound
-
-
- *******************************************************
- *
- * FormNew
- *
- *******************************************************
- * Construct Form object mainly by constructing DOSFile object.
- *
- function FormNew(cFileName)
-
- // Initialize variables to a known state
- public cLastName := "", cFirstName := "", cMiddleInitial := "", ;
- cAcctNo := "", cExamNo := "", cPIC := "", cSSN := "", ;
- dDOB := ctod(" / / "), adDOS := {}
- nFormEntries := 0
- FormFound(.t.)
-
- return DOSFileNew(cFileName)
-
-
- *******************************************************
- *
- * FormDestruct
- *
- *******************************************************
- * Destruct form object by destructing input file
- *
- function FormDestruct(nHandle)
-
- DOSFileDestruct(nHandle)
-
- return nil
-
-
- *******************************************************
- *
- * FormAdd2DBF
- *
- *******************************************************
- * Convert forms data to GHOST data and add to DBF
- *
- function FormAdd2DBF(nHandle, cDBF)
-
- if file(cDBF + ".dbf") // Make sure output .DBF exists
- use (cDBF) exclusive new
- if neterr()
- ?? "*** ERROR *** " + cDBF + ".dbf cannot be opened"
- else
- do while FormSkip(nHandle) // Read each form
- // Write data for this form
- FormWrite(cDBF)
- ?? ++nFormEntries, cLastName, chr(K_RETURN) // Tell user progess
- enddo
- (cDBF)->(dbclosearea())
- endif
- else
- ?? "*** ERROR *** " + cDBF + ".dbf file is missing"
- endif
-
- return nil
-
-
- *******************************************************
- *
- * FormEntries
- *
- *******************************************************
- * Return number of entries in last-converted form
- *
- function FormEntries
-
- return nFormEntries
-
-
- *******************************************************
- *
- * FormWrite
- *
- *******************************************************
- * Write service information from the current form.
- *
- function FormWrite(cDBF)
-
- // Add n records to DBF
- aeval(adDOS, { | dDOS | ;
- (cDBF)->(dbappend()), ;
- (cDBF)->acctno := cAcctNo, ;
- (cDBF)->examno := cExamNo, ;
- (cDBF)->svcdate := dDOS, ;
- (cDBF)->ssn := cSSN, ;
- (cDBF)->pic := cPIC, ;
- (cDBF)->firstname := cFirstName, ;
- (cDBF)->midinitial := cMiddleInitial, ;
- (cDBF)->lastname := cLastName, ;
- (cDBF)->birthdate := dDOB ;
- })
-
- return nil
-
-
- *******************************************************
- *
- * FormFound
- *
- *******************************************************
- * Return whether last search succeeded.
- *
- function FormFound(lWhetherFound)
-
- if lWhetherFound != nil
- lFormFound := lWhetherFound
- endif
-
- return lFormFound
-