home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / hc / schedule.sit / Scheduler / card_7997.txt < prev    next >
Text File  |  1988-02-12  |  6KB  |  194 lines

  1. -- card: 7997 from stack: in
  2. -- bmap block id: 14347
  3. -- flags: 0000
  4. -- background id: 7690
  5. -- name: Talley
  6.  
  7.  
  8. -- part 3 (button)
  9. -- low flags: 00
  10. -- high flags: 8003
  11. -- rect: left=373 top=46 right=68 bottom=473
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Talley
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   put the short date
  23.   global firstofmonth, lastofmonth, StorageArray, Subindex, Index, Name
  24.   global BlankTalleyArray, pointer, wheretotalley
  25.   put 10 into pointer
  26.   put " 0     0     0     0     0     0     0     0" into BlankTalleyArray -- place holders for the talley of 4 shifts per day
  27.   put "" into field TalleyData
  28.   Ask "Which Month Should we Talley" with "February"
  29.   put it into wheretotalley
  30.   Ask "which Year" with "88"
  31.   put "19" before it
  32.   put wheretotalley & it into wheretotalley
  33.   put wheretotalley into field month
  34.  
  35.  
  36.  
  37.   --set lockscreen to true
  38.   go to card wheretotalley of bkgnd "Scheduler"
  39.   put "" into field 38
  40.   SetUpCalendar -- find first and last of month
  41.   put word 2 of line 2 of field "Year" into shifnum -- # shifts per day
  42.  
  43.   repeat with index = firstofmonth to lastofMONTH
  44.     set style of field index to shadow
  45.     repeat with subindex = 1 to shifnum -- or A to ... (up to D for now)
  46.       put the number of words of line subindex of field index into employeenum
  47.       if subindex = 1 then
  48.  
  49.         put 2 into start -- don't start with date (i.e. word 1)
  50.       else
  51.         put 1 into start -- otherwise, start with the first word of the line
  52.       end if
  53.       repeat with employee = start to employeenum
  54.         get word employee of line subindex of field index
  55.         put it into Name
  56.         Put Name
  57.         whichDayOfWeek
  58.  
  59.         StoreIt
  60.         set cursor to 4
  61.  
  62.       end repeat
  63.     end repeat
  64.     set style of field index to transparent
  65.   end repeat
  66.   closebackground
  67.   go back
  68.   TransferData
  69. end mouseup
  70.  
  71. On StoreIt
  72.   set cursor to 4
  73.   Global StorageArray, Name, Index, Subindex, BlankTalleyArray, pointer, step
  74.   -- set lockscreen to true -- don't show our work****
  75.  
  76.   if field 38 contains Name then
  77.     put Offset (name,field 38) into namepointer
  78.     put character (namepointer - 2) of field 38 & char (namepointer - 1) of field 38 into linepointer
  79.     put linepointer - 10 into linepointer
  80.     -- first 2 characters before the name holds the line num
  81.  
  82.  
  83.     -- to the word number in the array, which we can then use for counting
  84.     -- beyond... to place shifts in their spot in the array
  85.     -- namepointer now holds the number of the name in the array
  86.     -- i.e. its the 2nd name or the 4th name etc...
  87.     -- to find which 'word' number it is means you have to add 8 words
  88.     -- for 8 blank shifttalley holders that follow each name etc.
  89.  
  90.     put subindex + step into shiftpointer
  91.  
  92.     get word shiftpointer + 1 of line linepointer of field 38 -- get current talley  for this shift
  93.     put 1 +  it into it -- add 1 to it ***
  94.     put it into word shiftpointer + 1 of line linepointer of field 38-- put it back
  95.  
  96.   else -- uh oh, haven't seen this name, better add it to the list
  97.  
  98.     put pointer + 1 into pointer -- set to 11 the first time (2 digits easier to work with)
  99.     put pointer - 10 into linepointer
  100.     Put 1 into word (subindex + step) of BlankTalleyArray -- its the first
  101.     -- time we've seen this name, set the first shift to 1
  102.  
  103.     put Pointer & Name && BlankTalleyArray into line linepointer┬¼ -- add it to the growing list
  104.     of field 38
  105.  
  106.     put " 0     0     0     0     0     0     0     0" into BlankTalleyArray -- restore it for the -- next joe
  107.   end if
  108. end StoreIt
  109.  
  110. On WhichDayOfWeek
  111.   global step, index
  112.  
  113.   if first char of first word of line 5 of field index = "S" then
  114.     put 4 into step
  115.   else
  116.     put 0 into step
  117.   end if
  118. End WhichDayOfWeek
  119. On TransferData
  120.   global wheretotalley
  121.   set lockscreen to true
  122.   -- go to the calendar background and get the data we've
  123.   go to card wheretotalley of bkgnd "Scheduler"-- collated
  124.   put the number of lines in field 38 into linenums
  125.   repeat with thisline = 1 to linenums
  126.     get line thisline of field 38
  127.     put it into transporter
  128.     put char 3 of word 1 of transporter & char 4 of word 1 of transporter & "    " into word 1 of transporter -- strip the code for the line number
  129.     closebackground
  130.     go to card "Talley"
  131.     set lockscreen to false
  132.     put transporter into line thisline of field "talleydata"
  133.     set lockscreen to true
  134.     closebackground
  135.     go card wheretotalley
  136.   end repeat
  137.   closebackground
  138.   go card "Talley"
  139.   set lockscreen to false
  140. end TransferData
  141.  
  142.  
  143.  
  144. -- part 4 (button)
  145. -- low flags: 00
  146. -- high flags: 8003
  147. -- rect: left=380 top=23 right=45 bottom=466
  148. -- title width / last selected line: 0
  149. -- icon id / first selected line: 0 / 0
  150. -- text alignment: 1
  151. -- font id: 0
  152. -- text size: 12
  153. -- style flags: 0
  154. -- line height: 16
  155. -- part name: Show Menu
  156. ----- HyperTalk script -----
  157. on mouseUp
  158.   show menubar
  159. end mouseUp
  160.  
  161.  
  162.  
  163. -- part 5 (button)
  164. -- low flags: 00
  165. -- high flags: 8003
  166. -- rect: left=361 top=69 right=92 bottom=494
  167. -- title width / last selected line: 0
  168. -- icon id / first selected line: 0 / 0
  169. -- text alignment: 1
  170. -- font id: 0
  171. -- text size: 12
  172. -- style flags: 0
  173. -- line height: 16
  174. -- part name: Scheduler
  175. ----- HyperTalk script -----
  176. on mouseUp
  177.   visual effect barn door close
  178.   GO RECENT CARD OF BKGND "SCHEDULER"
  179. end mouseUp
  180.  
  181.  
  182.  
  183.  
  184. -- part contents for background part 3
  185. ----- text -----
  186. February1988
  187.  
  188. -- part contents for background part 1
  189. ----- text -----
  190. MC      5     5     0     0     1     2     0     0
  191. HS      2     7     0     0     3     2     0     0
  192. CS      4     3     0     0     1     0     0     0
  193. CB      4     4     0     0     2     3     0     0
  194. EW      2     2     0     0     0     1     0     0