home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / DATABASE / DB3STOCK.ZIP / DB3STOCK.TXT < prev    next >
Encoding:
Text File  |  1986-04-12  |  15.4 KB  |  527 lines

  1. procedure bigboxdt
  2. * -----------------------------------------------------
  3. * BIGBOXDT - draws a large box for major screen display
  4. * -----------------------------------------------------
  5. * define HEADER as a str < 60 chars before entering this routine
  6. SET COLOR TO 7/0
  7. @ 1,0 SAY "╔══════════════════════════════════════════════════════"
  8. @ 1,55 SAY "═══════════════════════╗"
  9. L=2
  10. DO WHILE L<24
  11.    @ L,0 SAY "║"
  12.    @ L,78 SAY "║"
  13.    L=L+1
  14. ENDDO
  15. @ 24,0 SAY "╚══════════════════════════════════════════════════════"
  16. @ 24,55 SAY "═══════════════════════╝"
  17. @ 3, 1 SAY "---------------------------------------"
  18. @ 3,40 SAY "--------------------------------------"
  19. @ 2,3 say date()
  20. @ 2,69 say time()
  21. * H E A D E R  programming set up below
  22. set color to 15/0
  23. @ 2,(80-len(header))/2 say header
  24. set color to 7/0
  25. RETURN
  26.  
  27. procedure boxclear
  28. * ---------------------------------------------------------------
  29. * BOXCLEAR.prg - a routine that clears the screen INSIDE BIGBOXDT
  30. * ---------------------------------------------------------------
  31. * define LN BEFORE coming into this routine
  32. do while ln<24
  33.    @ ln,1 say space(77)
  34.    ln=ln+1
  35. enddo
  36. RETURN
  37.  
  38.  
  39. procedure smallbox
  40. * -----------------------------------------------------------
  41. * SMALLBOX.prg - a routine that draws a smaller box on screen
  42. * -----------------------------------------------------------
  43. @ 4,12 SAY "┌───────────────────────────────────────────────────────┐"
  44. L=5
  45. DO WHILE L<21
  46.    @ L,12 SAY "│"
  47.    @ L,68 SAY "│"
  48.    L=L+1
  49. ENDDO
  50. @21,12 SAY "└───────────────────────────────────────────────────────┘"
  51. RETURN
  52.  
  53. procedure lineboxm
  54. * ------------------------------------------------------------------
  55. * LINEBOXM.prg - draws a single line box in the middle of the screen
  56. * ------------------------------------------------------------------
  57. * define MSG as a str <55 chars before entering this routine
  58. @ 11,12 SAY "┌───────────────────────────────────────────────────────┐"
  59. @ 12,12 SAY "│"
  60. @ 12,68 SAY "│"
  61. @ 13,12 SAY "└───────────────────────────────────────────────────────┘"
  62. set color to 15/0
  63. @12,(80-len(msg))/2 say msg
  64. set color to 7/0
  65. RETURN
  66.  
  67.  
  68. procedure slinboxm
  69. * ------------------------------------------------------------------
  70. * SLINBOXM.prg - draws a single line box in the middle of the screen
  71. * ------------------------------------------------------------------
  72. * define MSG as a str <55 chars before entering this routine
  73. SET COLOR TO 7/0
  74. @ 11,12 SAY "┌───────────────────────────────────────────────────────┐"
  75. @ 12,12 SAY "│"
  76. @ 12,68 SAY "│"
  77. @ 13,12 SAY "└───────────────────────────────────────────────────────┘"
  78. set color to 15/0
  79. @12,(80-len(msg))/2 say msg
  80. set color to 7/0
  81. RETURN
  82.  
  83.  
  84. procedure slinboxt
  85. * ------------------------------------------------------------------
  86. * SLINBOXT.prg - draws a single line box at the top of the screen
  87. * ------------------------------------------------------------------
  88. * define MSG as a str <55 chars before entering this routine
  89. SET COLOR TO 7/0
  90. @  1,12 SAY "┌───────────────────────────────────────────────────────┐"
  91. @  2,12 SAY "│"
  92. @  2,68 SAY "│"
  93. @  3,12 SAY "└───────────────────────────────────────────────────────┘"
  94. set color to 15/0
  95. @ 2,(80-len(msg))/2 say msg
  96. set color to 7/0
  97. RETURN
  98.  
  99. procedure slinboxb
  100. * ------------------------------------------------------------------
  101. * SLINBOXB.prg - draws a single line box at the bottom of the screen
  102. * ------------------------------------------------------------------
  103. * define MSG as a str <55 chars before entering this routine
  104. SET COLOR TO 7/0
  105. @ 22,12 SAY "┌───────────────────────────────────────────────────────┐"
  106. @ 23,12 SAY "│"
  107. @ 23,68 SAY "│"
  108. @ 24,12 SAY "└───────────────────────────────────────────────────────┘"
  109. set color to 15/0
  110. @23,(80-len(msg))/2 say msg
  111. set color to 7/0
  112. RETURN
  113.  
  114.  
  115. procedure dlinboxm
  116. * ------------------------------------------------------------------
  117. * DLINBOXM.prg - draws a double line box at the middle of the screen
  118. * ------------------------------------------------------------------
  119. * define MSG as a str <55 chars before entering this routine
  120. SET COLOR TO 7/0
  121. @ 11,12 SAY "╔═══════════════════════════════════════════════════════╗"
  122. @ 12,12 SAY "║"
  123. @ 12,68 SAY "║"
  124. @ 13,12 SAY "╚═══════════════════════════════════════════════════════╝"
  125. set color to 15/0
  126. @12,(80-len(msg))/2 say msg
  127. set color to 7/0
  128. RETURN
  129.  
  130.  
  131. procedure dlinboxt
  132. * ------------------------------------------------------------------
  133. * DLINBOXT.prg - draws a double line box at the top of the screen
  134. * ------------------------------------------------------------------
  135. * define MSG as a str <55 chars before entering this routine
  136. SET COLOR TO 7/0
  137. @  1,12 SAY "╔═══════════════════════════════════════════════════════╗"
  138. @  2,12 SAY "║"
  139. @  2,68 SAY "║"
  140. @  3,12 SAY "╚═══════════════════════════════════════════════════════╝"
  141. set color to 15/0
  142. @ 2,(80-len(msg))/2 say msg
  143. set color to 7/0
  144. RETURN
  145.  
  146.  
  147. procedure dlinboxb
  148. * ------------------------------------------------------------------
  149. * DLINBOXB.prg - draws a double line box at the bottom of the screen
  150. * ------------------------------------------------------------------
  151. * define MSG as a str <55 chars before entering this routine
  152. SET COLOR TO 7/0
  153. @ 22,12 SAY "╔═══════════════════════════════════════════════════════╗"
  154. @ 23,12 SAY "║"
  155. @ 23,68 SAY "║"
  156. @ 24,12 SAY "╚═══════════════════════════════════════════════════════╝"
  157. set color to 15/0
  158. @23,(80-len(msg))/2 say msg
  159. set color to 7/0
  160. RETURN
  161.  
  162.  
  163. procedure linprm23
  164. * --------------------------------------
  165. * LINPRM23.PRG - GET A PARTICULAR KEY
  166. * --------------------------------------
  167. * define MSG as a str <75 chars before entering this routine
  168. * define TEST as a target string of chars to test FOR
  169. * define TZ as PUBLIC, and then initialize to " " before using this routine
  170. @ 23,1 say space(77)
  171. set color to 15/0
  172. @ 23,(80-len(msg))/2 say msg
  173. set color to 7/0
  174. tz=" "
  175. do while at(tz,test)=0
  176.    tz=" "
  177.    CLEAR GETS
  178.    tkol=((80-len(msg))/2)+len(msg)+2
  179.    if tkol>77
  180.       tkol=77
  181.    endif
  182.    @ 23,tkol get tz picture "!"
  183.    read
  184. enddo
  185. set color to 7/0
  186. @ 23,1 SAY SPACE(77)
  187. RETURN
  188.  
  189. procedure linmsg23
  190. * --------------------------------------
  191. * LINMSG23.PRG - GET ANY KEY TO CONTINUE
  192. * --------------------------------------
  193. * define MSG as a str <75 chars before entering this routine
  194. @ 23,1 say space(77)
  195. set color to 15/0
  196. @ 23,(80-len(msg))/2 say msg
  197. set color to 7/0
  198. zz=" "
  199. tkol=((80-len(msg))/2)+len(msg)+2
  200. if tkol>77
  201.    tkol=77
  202. endif
  203. @ 23,tkol get zz
  204. read
  205. set color to 7/0
  206. @ 23,1 SAY SPACE(77)
  207. RETURN
  208.  
  209.  
  210. procedure prtmsg23
  211. * --------------------------------------------------------------
  212. * PRTMSG23.PRG - prints a message ONLY on line 23; no gets/reads
  213. * --------------------------------------------------------------
  214. * define MSG as a str <75 chars before entering this routine
  215. @23,1 say space(77)
  216. set color to 15/0
  217. @23,(80-len(msg))/2 say msg
  218. set color to 7/0
  219. RETURN
  220.  
  221.  
  222. procedure getfld23
  223. * --------------------------------------
  224. * GETFLD23.PRG - GET A PARTICULAR FIELD
  225. * --------------------------------------
  226. * define KOL as 0 before entering the routine.
  227. * define FEELD as any EMPTY string of any length.
  228. * define MSG as a str <75 chars before entering this routine
  229. * the variable KOL is now the new column position at which to GET the field
  230. msg=msg+"  "+feeld
  231. @ 23,1 say space(77)
  232. set color to 15/0
  233. @ 23,(80-len(msg))/2 say msg
  234. set color to 7/0
  235. kol=col()-len(feeld)
  236. if kol>77
  237.    kol=77
  238. endif
  239. RETURN
  240.  
  241.  
  242.  
  243. procedure prevmo
  244. * ----------------------------------------------------------
  245. * Prevmo.prg -- finds the ACTUAL month of the previous month
  246. * ----------------------------------------------------------
  247. * must define PMONTH as a blank string BEFORE entering this routine
  248. Tmonth=substr(dtoc(date(),1,2)+"/"+substr(dtoc(date(),7,2)
  249. Pmo=ctod(substr(Tmonth,1,2)+"/15/"+substr(Tmonth,4,2))
  250. Pmo=Pmo-30
  251. Pmonth=substr(dtoc(Pmo),1,2)+"/"+substr(dtoc(Pmo),7,2)
  252. RETURN
  253.  
  254. procedure nextmo
  255. * ----------------------------------------------------------
  256. * Nextmo.prg -- finds the ACTUAL month of the next month
  257. * ----------------------------------------------------------
  258. *  must define NMONTH as a blank string BEFORE entering this routine
  259. Tmonth=substr(dtoc(date(),1,2)+"/"+substr(dtoc(date(),7,2)
  260. Nmo=ctod(substr(Tmonth,1,2)+"/15/"+substr(Tmonth,4,2))
  261. Nmo=Nmo+30
  262. Nmonth=substr(dtoc(Nmo),1,2)+"/"+substr(dtoc(Nmo),7,2)
  263. RETURN
  264.  
  265. procedure passwerd
  266. * -------------------------------------------------------------
  267. * PASSWERD.PRG - COMPLETE SECURITY PROGRAM FOR AUTHORIZED USERS
  268. * -------------------------------------------------------------
  269. use SECURITY.dbf
  270. go top
  271. delete all for enterok=space(12)
  272. pack
  273. go top
  274. mastrpass=trim(enterok)
  275. header="Authorized Users Check"
  276. do bigboxdt
  277. ct=1
  278. password=space(12)
  279. nupasswd=space(12)
  280. MSG=" "
  281. do dlinboxm
  282. do while .t.
  283.    @ 12,14 say space(50)
  284.    password=space(12)
  285.    @ 12,23 say "Enter your PASSWORD:  "
  286.    SET console Off
  287.    ACCEPT TO PASSWORD
  288.    SET console ON
  289.    @ 12,14 say space(50)
  290.    @ 12,20 say "Checking authorized users.  Please wait."
  291.    password=upper(password)
  292.    nupass=""
  293.    z=1
  294.    do while z<len(password)+1
  295.       tz=asc(substr(password,z,1))+117
  296.       nupass=nupass+chr(tz)
  297.       z=z+1
  298.    enddo
  299.    go top
  300.    locate for nupass=trim(enterok)
  301.    if eof()
  302.       @ 12,14 say space(50)
  303.       ct=ct+1
  304.       if ct>5
  305.          set color to 15/0
  306.          @ 12,21 say "I think you are an unauthorized user."
  307.          set color to 7/0
  308.          set console off
  309.          set escape off
  310.          do while .t.
  311.             loop
  312.          enddo
  313.        else
  314.          msg="Wrong SECURITY CODE.  Press any key to continue."
  315.          do linmsg23
  316.          loop
  317.       endif
  318.    endif
  319.    if nupass<>mastrpass
  320.       exit
  321.    endif
  322.    * ---------------------------------------
  323.    * PASSWORD ADDITION ROUTINE follows here:
  324.    * ---------------------------------------
  325.    do while .t.
  326.       @ 12,14 say space(50)
  327.       @ 12,21 say "Enter a password to add:  "
  328.       set console OFF
  329.       ACCEPT TO NUPASSWD
  330.       nupasswd=upper(nupasswd)
  331.       set console on
  332.       nupass=""
  333.       nupasswd=trim(nupasswd)
  334.       z=1
  335.       do while z<len(nupasswd)+1
  336.          tz=asc(substr(nupasswd,z,1))+117
  337.          nupass=nupass+chr(tz)
  338.          z=z+1
  339.       enddo
  340.       append blank
  341.       replace enterok with nupass
  342.       msg="Enter another NEW password?  <Y/N>  "
  343.       test="YN"
  344.       do linprm23
  345.       if tz="Y"
  346.          loop
  347.         else
  348.          exit
  349.       endif
  350.    enddo
  351.    * -----------------------------------
  352.    * PASSWORD ADDITION ROUTINE ends here
  353.    * -----------------------------------
  354. enddo
  355. use
  356. set color to 15/0
  357. @ 23,6 say "The System identifies you.  Welcome!  Please wait."
  358. set color to 7/0
  359. RETURN
  360.  
  361.  
  362. * ----------------------------------------------------------------------
  363. * END OF USEABLE DBASE III SUBROUTINES;  TEXT   O N L Y   FOLLOWS BELOW:
  364. * ----------------------------------------------------------------------
  365.  
  366.  
  367. * ---------------------------------
  368. * Displrut.prg
  369. * ---------------------------------
  370. This is actually a text file, not a program.  The dBASE routine below
  371. here is merely an example of a way to set up REPORT DETAIL data to BOTH
  372. SCREEN AND PRINTER with a MINIMUM of programming code/effort!
  373.  
  374.  
  375. You must use the following variables:
  376.  
  377. (AND THEY MUST BE DEFINED and initialized  B E F O R E   invoking the
  378. LINCOUNT.PRG subroutine.  THIS IS EXTREMELY IMPORTANT!)
  379.  
  380.  
  381.       devicetest =  a one-character variable that contains ONLY "S" or "P"
  382.                     Makes sense -- is the device a <s>creen or <p>rinter?
  383.       Ppage      =  Printer page count.  IT MUST BE INITIALIZED TO ZERO (0)
  384.                     before going to LINCOUNT.PRG!
  385.       Spage      =  Screen page count.  IT MUST BE INITIALIZED TO ZERO (0)
  386.                     before going to LINCOUNT.PRG!
  387.       lc         =  The variable that "points" to the current printer
  388.                     or screen line position.  This is a numeric variable.
  389.       overmax    =  a T/F logic variable that points to whether you are
  390.                     "over the max" # of lines allowed
  391.       stopflag   =  a T/F logic variable that is use only in LINCOUNT that
  392.                     determines whether user does NOT want to continue
  393.                     scrolling through page after page of display.
  394.       linemax    =  used by LINCOUNT.prg to determine the proper # of
  395.                     lines to use for screen (21) or printer (56).  This
  396.                     is a numeric variable.
  397.       header1    =  a string which contains the main one-liner heading
  398.                     for this display.  It should be useable for BOTH
  399.                     screen and printer.
  400.  
  401.  
  402. Other Notes:
  403. -----------
  404. Notice that LINCOUNT.PRG does not clear the screen per se; it assumes you
  405. using BOXCLEAR to clear out BIGBOXDT, and you want to preserve those lines!
  406.  
  407.  
  408. * ---------------------------------
  409. * Dummy  D I S P L A Y   PROGRAM
  410. * ---------------------------------
  411. * this program does not run!  It is merely a subroutine from an actual larger
  412. * application, but it is included here for study and later incorporation into
  413. * your own work.  All variables in UPPERCASE signify variables that
  414. * are detail or header variables that were specific to my application;
  415. * they have no other significance in the routine beyond informational purposes.
  416. * Notice, too, that some of the DO <subroutine> calls are to the subroutines
  417. * listed above.
  418. *
  419.  
  420. lc=99
  421. stopflag=.f.
  422. overmax=.f.
  423. do while .not. eof()
  424.    DO LINCOUNT
  425.    *
  426.    *                  SEE LINCOUNT.PRG BELOW!
  427.    *
  428.    if stopflag .and. devicetest="S"
  429.       exit
  430.    endif
  431.    if overmax
  432.       lc=4
  433.       if devicetest="S"
  434.          set color to 15/0
  435.       endif
  436.       @ lc,(80-len(HEADER1))/2 say HEADER1
  437.       if devicetest="S"
  438.          set color to 7/0
  439.       endif
  440.       lc=lc+1
  441.       if devicetest="P"
  442.          @ lc,17 say date()
  443.          @ lc,60 say time()
  444.          lc=lc+2
  445.       endif
  446.       @ lc,5 say "SHORT NAME CLIENT NAME"
  447.       lc=lc+1
  448.       @ lc,5 say "-----------------------------------------------------------------------"
  449.       lc=lc+1
  450.       overmax=.f.
  451.    endif
  452.    if devicetest="S"
  453.       set color to 15/0
  454.    endif
  455.    @ lc, 7 say ALFAPREFIX
  456.    if devicetest="S"
  457.       set color to 7/0
  458.    endif
  459.    @ lc,17 say NAME
  460.    *
  461.    *
  462.    * -----------------------------------
  463.    * CONTINUE WITH DETAIL REPORT DISPLAY
  464.    * -----------------------------------
  465.    *
  466.    *
  467.    lc=lc+1
  468.    skip
  469. enddo
  470. firstloop=.T.
  471. if devicetest="S" .and. .not. stopflag
  472.    msg="Press any key to continue."
  473.    do linmsg23
  474. endif
  475. if devicetest="P"
  476.    eject
  477.    set device to screen
  478. endif
  479.  
  480.  
  481. * -------------------------
  482. * L I N C O U N T . P R G
  483. * -------------------------
  484.  
  485. If devicetest="P" .and. lc>linemax
  486.    overmax=.t.
  487.    Ppage=Ppage+1
  488.    if Ppage>1
  489.       eject
  490.       @ 2,70 say "Page "+str(Ppage,3,0)
  491.    endif
  492. endif
  493.  
  494. If devicetest="S" .and. lc>linemax
  495.    overmax=.t.
  496.    Spage=Spage+1
  497.    if Spage<2
  498.       lc=4
  499.       do while lc<24
  500.          @ lc,1 say space(77)
  501.          lc=lc+1
  502.       enddo
  503.    endif
  504.    if Spage>1
  505.       test="CS"
  506.       msg="<C>ontinue with the display or <S>top the display?"
  507.       do linprm23
  508.       if tz="S"
  509.          stopflag=.t.
  510.          RETURN
  511.       endif
  512.       lc=4
  513.       do while lc<24
  514.          @ lc,1 say space(77)
  515.          lc=lc+1
  516.       enddo
  517.       set color to 15/0
  518.       @ 4,69 say "Page "+str(Spage,3,0)
  519.       set color to 7/0
  520.       lc=5
  521.    endif
  522. endif
  523. RETURN
  524.  
  525.  
  526.  
  527.