home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 16 / CD_ASCQ_16_0994.iso / news / 4611 / fw16d.ins / SAMPLES / TECH.PRG < prev    next >
Text File  |  1994-06-11  |  23KB  |  600 lines

  1. /*┌─ Program ────────────────────────────────────────────────────────────────┐
  2.   │  Application: WinDesk Desktop Organizer!                                 │
  3.   │    File Name: WINDESK.PRG                                                │
  4.   │       Author: John H. Stolte, Sr.  & Jon Kilburn                         │
  5.   │ Date created: 11-28-93                                                   │
  6.   │    Mod. Date: 06-03-94                                                   │
  7.   │ Time created: 06:32:40pm                                                 │
  8.   │    Copyright: Released into the Public Domain                            │
  9.   └──────────────────────────────────────────────────────────────────────────┘*/
  10. #include "FIVEWIN.CH"
  11. #INCLUDE "Tech.ch"
  12.  
  13. STATIC oWnd
  14. STATIC aContact := { "Compuserve" , "Phone" , "FAX" , "BBS" }
  15. STATIC aAssign  := { "Antonio Linares" ,  "Jon Kilburn" , "John Stolte", "Mark Lussier" }
  16. STATIC oName,oSource,oType,oDateIn,oDateOut,oAssigned,oComplete,oProblem,oSolution,oContact,oWhere,oNotes,oFilter
  17. STATIC cName,cSource,cType,dDateIn,dDateOut,cAssigned,lComplete,mProblem,mSolution,cContact,cWhere,mNotes,lFilter := .f.
  18. static adding := .f.
  19.  
  20.  
  21. FUNCTION Main()
  22. /*
  23. ┌─────────────────────────────────────────────────────────────────────────────┐
  24. │                                                                             │
  25. │ Function   : Main()--> NIL                                                  │▒
  26. │ Programmer : John H. Stolte                                                 │▒
  27. │ Date       : November 28, 1993                                              │▒
  28. │ Modified   : April 17, 1994 -- Jon Kilburn (Dr. Jon)                        │▒
  29. │ Purpose    : Main procedure for the Windesk program.  Note.. This is just   │▒
  30. │              the same as you would handle it in DOS.  The windows objects   │▒
  31. │              handle there events transparently to the Clipper program.      │▒
  32. │ Parameters : None                                                           │▒
  33. │ Returns    : NIL                                                            │▒
  34. │ Libraries  : FiveWin                                                        │▒
  35. │ DataBases  : None                                                           │▒
  36. │                                                                             │▒
  37. └─────────────────────────────────────────────────────────────────────────────┘▒
  38.   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  39. */
  40. LOCAL          ;
  41.       oBrush,  ;
  42.       oBar,    ;
  43.       hBorland
  44.  
  45.    /*
  46.        Important! Since the program uses Borland custom controls the borland
  47.        DLL must be loaded by the program.
  48.    */
  49.    hBorland := loadlibrary("BWCC.DLL")
  50.  
  51.    SET DELETED ON
  52.    SET 3DLOOK ON
  53.  
  54.    /*
  55.       This command sets our resources to the windesk DLL. What this means
  56.       is that any dialogs we load using the DEFINE DIALOG .. RESOURCE
  57.       command will be automatically read in from the Windesk DLL.  Pretty
  58.       cool huh?
  59.    */
  60.    SET RESOURCES TO "TECH.DLL"
  61.  
  62.    //─────────── Set the background wallpaper to a "Bricks" style ────────────//
  63.    DEFINE BRUSH oBrush STYLE BRICKS
  64.  
  65.    /*
  66.       Defines the main program window.  Assigns it a caption (or Title) using
  67.       the TITLE option.  Then sets the background (wallpaper) of the window
  68.       to the "Bricks".  Finally it attaches a menu to the window.
  69.    */
  70.    DEFINE WINDOW oWnd FROM 1, 5 TO 20, 75 ;
  71.       TITLE "FiveWin Tech Support System"   ;
  72.       BRUSH oBrush                        ;
  73.       MENU  BuildMenu()
  74.  
  75.   @ 10, 25 BITMAP FILENAME "..\bitmaps\clipLogo.bmp" OF oWnd // logo
  76.  
  77.    //──────────── Window message bar added to display the text ───────────────//
  78.    SET MESSAGE OF oWnd TO "FiveWin Tech Support System"
  79.  
  80.    //─────── Display the window now that we have initialized everything ──────//
  81.    ACTIVATE WINDOW oWnd MAXIMIZED ;
  82.      ON INIT Support()  //JHS this causes weird stuff to happen!
  83.  
  84.    //─────────────────────────── Close the resources ─────────────────────────//
  85.    SET RESOURCES TO
  86.    SET 3DLOOK OFF
  87.  
  88.    freelibrary(hBorland)
  89.  
  90. RETURN nil
  91.  
  92.  
  93.  
  94. STATIC FUNCTION BuildMenu()
  95. /*
  96. ┌─────────────────────────────────────────────────────────────────────────────┐
  97. │                                                                             │
  98. │ Function   : BuildMenu()--> oMenu                                           │▒
  99. │ Programmer : John H. Stolte & Jon Kilburn                                   │▒
  100. │ Date       : November 28, 1993                                              │▒
  101. │ Modified   : April 17, 1994                                                 │▒
  102. │ Purpose    : Umm....Build the main menu (Don't you just hate those          │▒
  103. │              Rotten confusing function names...                             │▒
  104. │ Parameters : None                                                           │▒
  105. │ Returns    : NIL                                                            │▒
  106. │ Libraries  : None                                                           │▒
  107. │ DataBases  : None                                                           │▒
  108. │                                                                             │▒
  109. └─────────────────────────────────────────────────────────────────────────────┘▒
  110.   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  111. */
  112. LOCAL          ;
  113.       oMenu
  114.  
  115.    //───── Create the top level menu bar object and attach all sub menus ─────//
  116.    MENU oMenu
  117.  
  118.    MENUITEM "&Support"
  119.    MENU
  120.  
  121.       MENUITEM "&Support"                          ;
  122.          MESSAGE "Add/Edit Data in The Database"    ;
  123.          ACTION Support()
  124.  
  125.       MENUITEM "&Calculator"                       ;
  126.          MESSAGE "Popup Calculator"                ;
  127.          ACTION Winexec("calc")
  128.  
  129.       MENUITEM "Calen&dar"                         ;
  130.          MESSAGE "Popup Calendar"                  ;
  131.          ACTION Winexec("Calendar")
  132.  
  133.       MENUITEM "&NotePad"                          ;
  134.          MESSAGE "Popup Note Pad"                  ;
  135.          ACTION Winexec("NotePad")
  136.  
  137.       MENUITEM "&Write"                            ;
  138.          MESSAGE "Write - WordProcessor"           ;
  139.          ACTION Winexec("Write")
  140.  
  141.       MENUITEM "&Browser"                          ;
  142.          MESSAGE "Generic Database Browser"        ;
  143.          ACTION BrowseFile()
  144.  
  145.       SEPARATOR
  146.  
  147.       MENUITEM "&Close..."                         ;
  148.          MESSAGE "Exit this Program"               ;
  149.          ACTION oWnd:end()
  150.    ENDMENU
  151.  
  152.    MENUITEM "&About"
  153.    MENU
  154.    MENUITEM "&About" ;
  155.          MESSAGE "About FiveWIn Tech SUpport" ;
  156.          ACTION About()
  157.    ENDMENU
  158.  
  159.    ENDMENU
  160.  
  161. RETURN oMenu
  162.  
  163.  
  164. STATIC FUNCTION About()
  165. /*
  166. ┌─────────────────────────────────────────────────────────────────────────────┐
  167. │                                                                             │
  168. │ Function   : About()--> NIL                                                 │▒
  169. │ Programmer : John H. Stolte & Jon Kilburn                                   │▒
  170. │ Date       : November 28, 1993                                              │▒
  171. │ Modified   : April 18, 1994                                                 │▒
  172. │ Purpose    : Another confusing function designed to do nothing more than    │▒
  173. │              thoroughly confuse the user and any programmers who might be   │▒
  174. │              looking at this code.  As you can tell we use cryptic names    │▒
  175. │              and _NEVER_ comment our code....                               │▒
  176. │ Parameters : None                                                           │▒
  177. │ Returns    : NIL                                                            │▒
  178. │ Libraries  : FiveWin                                                        │▒
  179. │ DataBases  : None                                                           │▒
  180. │                                                                             │▒
  181. └─────────────────────────────────────────────────────────────────────────────┘▒
  182.   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  183. */
  184. LOCAL          ;
  185.       oDlg
  186.  
  187.    DEFINE DIALOG oDlg RESOURCE "About"
  188.  
  189.    REDEFINE SAY ID 10 OF oDlg
  190.    REDEFINE SAY ID 20 OF oDlg
  191.    REDEFINE SAY ID 30 OF oDlg
  192.    REDEFINE SAY ID 40 OF oDlg
  193.  
  194.    ACTIVATE DIALOG oDlg CENTERED
  195.  
  196. RETURN nil
  197.  
  198.  
  199.  
  200.  
  201.  
  202. STATIC FUNCTION BrowseFile()
  203. /*
  204. ┌─────────────────────────────────────────────────────────────────────────────┐
  205. │                                                                             │
  206. │ Function   : BrowseFile()--> NIL                                            │▒
  207. │ Programmer : Jon Kilburn                                                    │▒
  208. │ Date       : April 18, 1994                                                 │▒
  209. │ Modified   :                                                                │▒
  210. │ Purpose    : Generic Browser for any database file....Please pay attention  │▒
  211. │              Now boys and girls cause I'm only gonna do this as many times  │▒
  212. │              as you want...I'll build the dialog, browse and buttons for    │▒
  213. │              For you...                                                     │▒
  214. │ Parameters : None                                                           │▒
  215. │ Returns    : NIL                                                            │▒
  216. │ Libraries  : None                                                           │▒
  217. │ DataBases  : None                                                           │▒
  218. │                                                                             │▒
  219. └─────────────────────────────────────────────────────────────────────────────┘▒
  220.   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  221. */
  222. LOCAL            ;
  223.       oDlg,      ;
  224.       oLbx,      ;
  225.       cFile,     ;
  226.       nSel,      ;
  227.       btnNew,    ;
  228.       btnModify, ;
  229.       btnDelete, ;
  230.       btnSearch, ;
  231.       btnList,   ;
  232.       btnEnd
  233.  
  234.    nSel  := select()
  235.  
  236.    cFile := cGetFile("*.dbf", "Open a database")
  237.    IF ! empty(cFile) .and. cfile <> "*.dbf"
  238.       USE (cFile) ALIAS FILE1 SHARED NEW
  239.       SELECT FILE1
  240.  
  241.       IF neterr()
  242.          MsgAlert("File is currently locked by another user!", "File Error")
  243.          RETURN nil
  244.       ENDIF
  245.  
  246.       DEFINE DIALOG oDlg FROM 3, 3 TO 26, 79 TITLE cFile
  247.       @ 0, 1 SAY "Fields" OF oDlg
  248.       @ 1, 1 LISTBOX oLbx FIELDS ;
  249.          SIZE 284, 137  OF oDlg
  250.  
  251.       /*
  252.          Please take note..I only created one button to call the delete
  253.          function as an example.  You may add and define more of buttons
  254.          if you wish.
  255.       */
  256.    @ 13,  1 BUTTON btnNew    PROMPT "&New"    OF oDlg SIZE 40, 12 ;
  257.           Action(msgStop("Add Your Own ADD Function"))
  258.  
  259.    @ 13,  8 BUTTON btnModify PROMPT "&Modify" OF oDlg SIZE 40, 12 ;
  260.           Action(msgStop("Add Your Own EDIT Function"))
  261.  
  262.    @ 13, 15 BUTTON btnDelete PROMPT "&Delete" OF oDlg SIZE 40, 12 ;
  263.          ACTION (FILE1->(DeleteOne()), oLbx:setfocus(.T.))
  264.  
  265.  
  266.    @ 13, 22 BUTTON btnSearch PROMPT "&Search" OF oDlg SIZE 40, 12 ;
  267.           Action(msgStop("Add Your Own SEARCH Function"))
  268.  
  269.    @ 13, 29 BUTTON btnList   PROMPT "&Print"  OF oDlg SIZE 40, 12 ;
  270.           Action(msgStop("Add Your Own PRINT Function"))
  271.  
  272.    @ 13, 36 BUTTON btnEnd    PROMPT "&Exit"   OF oDlg SIZE 40, 12 ;
  273.          ACTION (oDlg:end(), FILE1->(dbclosearea()))
  274.  
  275.       ACTIVATE DIALOG oDlg CENTERED
  276.    ENDIF
  277.  
  278.    if nSel <> 0
  279.       select(nSel)
  280.    endif
  281.  
  282. RETURN nil
  283.  
  284. STATIC FUNCTION DeleteOne()
  285. /*┌─ Function ───────────────────────────────────────────────────────────────┐
  286.   │     Function: DeleteOne()                                                │
  287.   │  Description: A Yes/No Messagebox with a 3d Look To Prompt the user for  │
  288.   │               Delete/Recall of a Record                                  │
  289.   ├──────────────────────────────────────────────────────────────────────────┤
  290.   │    Arguments: None                                                       │
  291.   │ Return Value: Nil                                                        │
  292.   │     See Also:                                                            │
  293.   └──────────────────────────────────────────────────────────────────────────┘*/
  294.  
  295.    IF ! deleted()
  296.       IF MsgYesNo("Delete this Record?", "Delete")
  297.          rlock()
  298.          dbdelete()
  299.          dbunlock()
  300.       ENDIF
  301.    ELSE
  302.       IF MsgYesNo("Recall this Record?", "Recall")
  303.          rlock()
  304.          dbrecall()
  305.          dbunlock()
  306.       ENDIF
  307.    ENDIF
  308.  
  309. RETURN nil
  310.  
  311.  
  312.  
  313. STATIC FUNCTION Exit()
  314. /*
  315. ┌─────────────────────────────────────────────────────────────────────────────┐
  316. │                                                                             │
  317. │ Function   : Exit()--> NIL                                                  │▒
  318. │ Programmer : John H. Stolte                                                 │▒
  319. │ Date       : February 22, 1994                                              │▒
  320. │ Modified   : April 18, 1994 -- Dr. Jon                                      │▒
  321. │ Purpose    : Make sure the user wishes to exit the windesk program...       │▒
  322. │ Parameters : None                                                           │▒
  323. │ Returns    : NIL                                                            │▒
  324. │ Libraries  : FiveWin                                                        │▒
  325. │ DataBases  : None                                                           │▒
  326. │                                                                             │▒
  327. └─────────────────────────────────────────────────────────────────────────────┘▒
  328.   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  329. */
  330. LOCAL       ;
  331.       oDlg
  332.  
  333.    DEFINE DIALOG oDlg RESOURCE "Exit"
  334.  
  335.    REDEFINE SAY ID 10 OF oDlg
  336.    REDEFINE BITMAP ID 110 OF oDlg RESOURCE "Question"
  337.  
  338.    REDEFINE BUTTON ID IDYES OF oDlg       ;
  339.       ACTION (oDlg:end(), oWnd:end())
  340.    REDEFINE BUTTON ID IDNO OF oDlg        ;
  341.       ACTION oDlg:end()
  342.  
  343.    ACTIVATE DIALOG oDlg CENTERED
  344.  
  345. RETURN nil
  346.  
  347. //=============================
  348. function support
  349.  
  350. LOCAL aStru_
  351.  
  352.    IF ! file("tech.DBF")
  353.       aStru_ := {                            ;
  354.                   {"Name",    "C", 30, 0},   ;
  355.                   {"Source",  "C", 30, 0},   ;
  356.                   {"Type",    "C", 30, 0},   ;
  357.                   {"DateIn",  "D",  8, 0},   ;
  358.                   {"DateOut", "D",  8, 0},   ;
  359.                   {"Assigned","C",  20, 0},   ;
  360.                   {"Complete","L",  1, 0},   ;
  361.                   {"Problem", "M", 10, 0},   ;
  362.                   {"Solution","M", 10, 0},   ;
  363.                   {"Notes",   "M", 10, 0},   ;
  364.                   {"Contact", "C", 30, 0},   ;
  365.                   {"Where",   "C", 30, 0}     }
  366.  
  367.       dbcreate("TECH", aStru_)
  368.    ENDIF
  369.       IF ! file("TECH" + indexext())
  370.          USE TECH NEW EXCLUSIVE
  371.          INDEX ON upper(TECH->Name) TO TECH
  372.       ENDIF
  373.       CLOSE ALL
  374.    USE TECH NEW SHARED
  375.    SET INDEX TO TECH
  376.  
  377. cName     :=  tech->name
  378. cSource   :=  tech->source
  379. cType     :=  tech->type
  380. dDateIn   :=  tech->datein
  381. dDateOut  :=  tech->dateout
  382. cAssigned :=  tech->assigned
  383. lComplete :=  tech->complete
  384. mProblem  :=  tech->problem
  385. mSolution :=  tech->solution
  386. mNotes    :=  tech->notes
  387. cContact  :=  tech->contact
  388. cWhere    :=  tech->where
  389.  
  390.    DEFINE DIALOG oDlg RESOURCE "TECHSUPP"
  391.  
  392.    //────────────────── Handle the gets (Edit) controls ──────────────────────//
  393.    REDEFINE GET  oNAME      VAR  cName        ID ID_NAME OF oDlg   PICTURE "@!" VALID !empty(cname)
  394.    REDEFINE GET  oSOURCE    VAR  cSOURCE    ID ID_SOURCE   OF oDlg PICTURE "@!"
  395.    REDEFINE GET  oTYPE      VAR  cTYPE      ID ID_TYPE     OF oDlg PICTURE "@!"
  396.    REDEFINE GET  oDATEIN    VAR  dDATEIN    ID ID_DATEIN   OF oDlg
  397.    REDEFINE GET  oDATEOUT   VAR  dDATEOUT   ID ID_DATEOUT  OF oDlg
  398.    REDEFINE GET  oPROBLEM   VAR  mPROBLEM   MEMO ID ID_PROBLEM  OF oDlg
  399.    REDEFINE GET  oSOLUTION  VAR  mSOLUTION  MEMO ID ID_SOLUTION OF oDlg
  400.    REDEFINE GET  oNotes     VAR  mNotes     MEMO ID ID_NOTES    OF oDlg
  401.    REDEFINE GET  oWHERE     VAR  cWHERE     ID ID_WHERE    OF oDlg PICTURE "@!"
  402.  
  403.  
  404.  
  405.    //─────────────────── Handle the combobox for states ──────────────────────//
  406.    REDEFINE COMBOBOX oContact VAR cContact   ITEMS aContact ID ID_CONTACT  OF oDlg
  407.    REDEFINE COMBOBOX oAssigned VAR cAssigned ITEMS aAssign  ID ID_ASSIGNED OF oDlg
  408.  
  409.    //─────────────────── Handle the checkbox for active ──────────────────────//
  410.    REDEFINE CHECKBOX oComplete VAR lComplete ID ID_COMPLETE OF oDlg ;
  411.    ON CLICK fixdate()
  412.    REDEFINE CHECKBOX oFilter VAR lFilter ID ID_FILT OF oDlg
  413.  
  414.    //─────────────────── Handle the Scroll Bar for Next Previous ──────────────────────//
  415.    REDEFINE SCROLLBAR HORIZONTAL ID ID_NEXT OF oDlg RANGE 1, RecCount() ;
  416.       ON DOWN ( DbSkip(),;
  417.                 If( EoF(), DbGoBottom(),),;
  418.                 freshen() );
  419.       ON UP   ( DbSkip( -1 ), ;
  420.                 freshen() )
  421.  
  422.    REDEFINE BUTTON ID ID_ADD OF oDlg                                      ;
  423.    ACTION Addone()
  424.  
  425.    REDEFINE BUTTON ID ID_SAVE OF oDlg                                      ;
  426.    ACTION saveone()
  427.  
  428.    REDEFINE BUTTON ID ID_DELETE OF oDlg                                      ;
  429.    ACTION Delone()
  430.  
  431.    REDEFINE BUTTON ID ID_SEARCH OF oDlg                                      ;
  432.    ACTION ( SearchOne(), freshen() )
  433.  
  434.    REDEFINE BUTTON ID ID_ABORT OF oDlg                                      ;
  435.    ACTION ( If( MsgYesNo( "Quit this Database ?", "Select" ),oDlg:End(),) )
  436.  
  437.    REDEFINE BUTTON ID ID_ALL OF oDlg                                      ;
  438.    ACTION turnon("ALL")
  439.  
  440.  
  441.    REDEFINE BUTTON ID ID_OPEN OF oDlg                                      ;
  442.    ACTION turnon("OPEN")
  443.  
  444.    REDEFINE BUTTON ID ID_CLOSED OF oDlg                                      ;
  445.    ACTION turnon("CLOSED")
  446.  
  447.    REDEFINE BUTTON ID ID_PRINT OF oDlg                                      ;
  448.    ACTION WinExec("g:\caret\caret.exe")
  449.  
  450.    ACTIVATE DIALOG oDLG CENTERED NOWAIT
  451.    close data
  452. return nil
  453.  
  454. FUNCTION FIXDATE
  455.    iif(lcomplete,dDateOut := date(),dDateout := ctod("  /  /  "))
  456.    oDateOut:Refresh()
  457. RETURN NIL
  458.  
  459. FUNCTION ADDONE
  460. adding := .t.
  461. cName     :=  space(30)         ; oName:refresh()
  462. cSource   :=  space(30)         ; oSource:refresh()
  463. cType     :=  space(30)         ; oType:refresh()
  464. dDateIn   :=  ctod("  /  /  ")  ; oDateIn:refresh()
  465. dDateOut  :=  ctod("  /  /  ")  ; oDateOut:refresh()
  466. cAssigned :=  space(20)         ; oAssigned:refresh()
  467. lComplete :=  .f.               ; oComplete:refresh()
  468. mProblem  :=  space(512)        ; oProblem:refresh()
  469. mSolution :=  space(512)        ; oSolution:refresh()
  470. mNotes    :=  space(512)        ; oNotes:refresh()
  471. cContact  :=  space(30)         ; oContact:refresh()
  472. cWhere    :=  space(30)         ; oWhere:refresh()
  473. return nil
  474.  
  475. STATIC FUNCTION SearchOne()
  476. LOCAL oDlg, oBmp, cSearch, nRec
  477.  
  478.    nRec    := TECH->(recno())
  479.    cSearch := space(30)
  480.  
  481.    DEFINE DIALOG oDlg FROM 5,5 TO 11, 38 TITLE "Search"
  482.  
  483.    @ 0.2, 5 SAY "Search for Name.." OF oDlg
  484.    @ 1.2, 5 GET cSearch OF oDlg PICTURE "@!"
  485.  
  486.    //──────────── Check to see if the spyglass BMP is in the current directory
  487.    IF file("GLASS.BMP")
  488.       @ 0.5, 1 BITMAP oBmp FILE "GLASS.BMP" SIZE 20,20 NO BORDER OF oDlg
  489.    ENDIF
  490.  
  491.    //────────────────────────── Define the Action Associated to the OK Button
  492.    @ 2.7, 3 BUTTON "&Ok"  OF oDlg SIZE 44,12                                 ;
  493.    ACTION  (TECH->(dbseek(cSearch,.t.)),                                         ;
  494.              IF(TECH->(eof()), MsgInfo("Name Not Found!", "Search Failed"),),  ;
  495.              oDlg:end())
  496.  
  497.  
  498.    //────────────────────── Define the Action Associated to the Cancel Button
  499.    @ 2.7, 11 BUTTON "&Cancel" OF oDlg SIZE 44, 12 ACTION oDlg:end()
  500.  
  501.    ACTIVATE DIALOG oDlg CENTERED
  502.  
  503.    IF TECH->(eof())
  504.       TECH->(dbgoto(nRec))
  505.       freshen()
  506.    ENDIF
  507.  
  508. RETURN nil
  509.  
  510.  
  511.    function saveone
  512. If MsgYesNo( "Save This Record ?", "Select" )
  513.    if adding
  514.       dbappend()
  515.       adding := .f.
  516.    endif
  517.    dbrlock(recno())
  518.    tech->name     := cName
  519.    tech->source   := cSource
  520.    tech->type     := cType
  521.    tech->datein   := dDateIn
  522.    tech->dateout  := dDateOut
  523.    tech->assigned := cAssigned
  524.    tech->complete := lComplete
  525.    tech->problem  := mProblem
  526.    tech->solution := mSolution
  527.    tech->notes    := mNotes
  528.    tech->contact  := cContact
  529.    tech->where    := cWhere
  530.    dbunlock(recno())
  531. ENDIF
  532.    return nil
  533.  
  534. FUNCTION DELONE
  535. If MsgYesNo( "Are you SURE you Want to Delete This Record ?", "Select" )
  536.    dbrlock(recno())
  537.    dbdelete()
  538.    dbunlock(recno())
  539.    if ! bof()
  540.       dbskip(+1)
  541.    else
  542.       dbskip(-1)
  543.    endif
  544.    freshen()
  545. ENDIF
  546. return nil
  547.  
  548. Function turnon(what)
  549. local counter := 0
  550.    DO CASE
  551.    CASE WHAT = "ALL"
  552.       dbClearFilter()
  553.       lFilter := .f.
  554.       oFilter:refresh()
  555.       freshen()
  556.    CASE WHAT = "OPEN"
  557.       DBSETFILTER( {|| lComplete == .f.}, "lComplete == .f." )
  558.       lFilter := .t.
  559.       oFilter:refresh()
  560.       freshen()
  561.       count to counter
  562.       if counter == 0
  563.         MsgStop("No Records Match That Filter")
  564.         dbClearFilter()
  565.         lFilter := .f.
  566.         oFilter:refresh()
  567.       freshen()
  568.       endif
  569.    CASE WHAT = "CLOSED"
  570.       DBSETFILTER( {|| lComplete == .t.}, "lComplete == .t." )
  571.       lFilter := .t.
  572.       oFilter:refresh()
  573.       freshen()
  574.       count to counter
  575.       if counter == 0
  576.         MsgStop("No Records Match That Filter")
  577.         dbClearFilter()
  578.         lFilter := .f.
  579.         oFilter:refresh()
  580.       freshen()
  581.       endif
  582.  
  583. ENDCASE
  584.    return NIL
  585.  
  586. STATIC FUNCTION Freshen
  587.    cName     :=  tech->name     ; oName:refresh()
  588.    cSource   :=  tech->source   ; oSource:refresh()
  589.    cType     :=  tech->type     ; oType:refresh()
  590.    dDateIn   :=  tech->datein   ; oDateIn:refresh()
  591.    dDateOut  :=  tech->dateout  ; oDateOut:refresh()
  592.    cAssigned :=  tech->assigned ; oAssigned:refresh()
  593.    lComplete :=  tech->complete ; oComplete:refresh()
  594.    mProblem  :=  tech->problem  ; oProblem:refresh()
  595.    mSolution :=  tech->solution ; oSolution:refresh()
  596.    mNotes    :=  tech->notes    ; oNotes:refresh()
  597.    cContact  :=  tech->contact  ; oContact:refresh()
  598.    cWhere    :=  tech->where    ; oWhere:refresh()
  599. return nil
  600.