Thanks.
GeneB
Code: Select all
FUNCTION NewQuantity()
local cItem, nOldQty, nNewQty, bSayQty, oFrame, getlist:={}
cItem    := SPACE(20)
nOldQty  := 0
nNewQty  := 0
@ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_RAISEDBOX ;
   OBJECT oFrame ;
   SIZE 70,15
   @  2,2 DCSAY "Item" GET cItem   ;              // enter inventory item
      PICTURE "@!"                 ;
      PARENT oFrame                ;
      GETID 'GetItem'              ;
      VALID {|| nOldQty:=GetOldQty(cItem)                         ;
              , DC_GetRefresh(getlist)                            ;
              , DC_SetAppFocus(DC_GetObject(getlist,'GetNewQty')) ;
              , .T. }
   bSayQty := {|| "Old Quantity" + STR(nOldQty,5,0) }  // show existing qty
   @ 4,2 DCSAY bSayQty  ;
      PARENT oFrame
   @ 6,2 DCSAY "New Quantity" GET nNewQty  ;          // get new quantity
      PICTURE "99999"                      ;
      PARENT oFrame                        ;
      GETID 'GetNewQty'                    ;
      VALID {|| DC_SetAppFocus(DC_GetObject(getlist,'YesButton')) ;
              , .T. }
   @ 9, 2 DCPUSHBUTTON     ;                // write new quantity to file
           CAPTION "Yes"   ;
           PARENT oFrame   ;
           SIZE 13,1.5     ;
           ID 'YesButton'  ;
           ACTION {|| UpdateQty(cItem,nNewQty)  ;
                    , cItem := SPACE(20)        ;
                    , nOldQty := 0              ;
                    , nNewQty := 0              ;
                    , DC_GetRefresh(getlist)    ;
                    , DC_SetAppFocus(DC_GetObject(getlist,'GetItem')) }
   @ 9,22 DCPUSHBUTTON  ;                       // no write, clear gets
           CAPTION "No"   ;
           PARENT oFrame  ;
           SIZE 13,1.5    ;
           ACTION {|| cItem := SPACE(20)        ;
                    , nOldQty := 0              ;
                    , nNewQty := 0              ;
                    , DC_GetRefresh(getlist)    ;
                    , DC_SetAppFocus(DC_GetObject(getlist,'GetItem')) }
   @ 9,42 DCPUSHBUTTON   ;                     // exit this routine
           CAPTION "Exit" ;
           PARENT oFrame  ;
           SIZE 13,1.5    ;
           ACTION {|| DC_ReadguiEvent(DCGUI_EXIT_OK,Getlist) ;
                    , DC_GetRefresh(getlist) }
DCREAD GUI FIT MODAL
RETURN NIL   //////////////////////////////////////////////////////////////
STATIC FUNCTION GetOldQty(cItem)
// locate item in dbf file and return quantity
RETURN 99
STATIC FUNCTION UpdateQty(cItem,nNewQty)
// update dbf with new quantity
RETURN NIL

