home *** CD-ROM | disk | FTP | other *** search
- // Getex01 - Rework of Gets04.prg to use dictionary
- // in Get:cargo
- //
-
- MEMVAR GetList
-
- #xtranslate GET_NUMBER(<cName>) ;
- => ;
- Ascan(GetList, {|o| Trim(Upper(o:name)) == <cName>})
-
- #xtranslate GET_NUMBER(<cName>, <gl>) ;
- => ;
- Ascan(<gl>, {|o| Trim(Upper(o:name)) == <cName>})
-
-
- FUNCTION Getex01
-
- LOCAL nQty := 0
- LOCAL nDiscount := 0
- LOCAL nAccount := 0
- LOCAL aDict := DictNew()
-
- CLEAR SCREEN
- @ 10, 10 SAY "Enter Quantity" GET nQty ;
- VALID {|oGet| ResetQty(oGet, GetList), .T.}
- @ 11, 25 GET nDiscount WHEN nQty > 10
-
- DictPutPair(aDict, {"Row", 11})
- DictPutPair(aDict, {"Col", 11})
- DictPutPair(aDict, {"Text", "Enter Discount"})
- Atail(Getlist):cargo := aDict
-
- @ 12, 10 SAY " Enter A / C #" GET nAccount
- READ
-
- RETURN NIL
-
-
- FUNCTION ResetQty(oGet, GetList)
-
- LOCAL nDiscGet := GET_NUMBER("NDISCOUNT")
-
- LOCAL oDiscGet := GetList[nDiscGet]
- LOCAL aDict := oDiscget:cargo
-
- IF oGet:varGet() <= 10
- oDiscGet:varPut(0)
- oDiscGet:display()
- @ DictAt(aDict, "Row"), DictAt(aDict, "Col") ;
- SAY Space(Len(DictAt(aDict, "Text")))
- ELSE
- @ DictAt(aDict, "Row"), DictAt(aDict, "Col") ;
- SAY DictAt(aDict, "Text")
- ENDIF
-
- RETURN NIL