home *** CD-ROM | disk | FTP | other *** search
- /* checkappointments.frx
- * Copyright © 1997 Nils Bandener
- * $VER: checkappointments.frx 6.4 (19.10.97)
- */
-
- scriptname = "Check Appointments"
-
- Options Results
-
- fiasco_port = address()
-
- Signal on Syntax
- Signal on Halt
- Signal on Break_C
- Signal on Failure
-
- LockGUI
-
- /*
- * Get the number of the
- * current day of the week
- */
-
- select
- when date(w) = "Monday" then weekday = 0
- when date(w) = "Tuesday" then weekday = 1
- when date(w) = "Wednesday" then weekday = 2
- when date(w) = "Thursday" then weekday = 3
- when date(w) = "Friday" then weekday = 4
- when date(w) = "Saturday" then weekday = 5
- when date(w) = "Sunday" then weekday = 6
- otherwise weekday = -1
- end
-
- /*
- * Build a formula that is able to search for
- * the appointments that should be announced.
- */
-
- NewSearchInfo 'Formula "announce != -1 && !cancelled && !notshow ? (UseDate ? datediff(currentdate(), date) <= announce && datediff(currentdate(), date) >= 0 : UseDay && announce < 7 ? (day - ' || weekday || ' >= 0 ? day - ' || weekday || ' <= announce : 7 + day - ' || weekday || ' <= announce) : 0 ) : 0" Var "siname"'
-
- /*
- * Search for the appointments and store all
- * matches in a stem variable
- */
-
- Find 'SearchInfo "' || siname || '" Stem searchresult'
-
- string = ""
-
- if searchresult.count = 0 then
- do
- RequestChoice '"No appointments found" "Ok" Title "Appointments"'
- end
- else
- do
- /*
- * Build a string that displays the
- * found appointments
- */
-
- string = "Appointments found:"
-
- do i = 1 to searchresult.count
-
- GetField "record" searchresult.i "stem rd"
-
- if rd.important then
- do
- string = string || "*n_______________________________________*n** "
- end
- else
- do
- string = string || "*n "
- end
-
- if rd.usedate then
- do
- string = string || i || ".: " || rd.date || ", " || rd.time || ": " || rd.short
- end
- else if rd.useday then
- do
- getattr 'field name day labels var daylabels'
-
- d = rd.day
-
- string = string || i || ".: " || daylabels.d || ", " || rd.time || ": " || rd.short
- end
-
- if rd.important then
- do
- string = string || "*n¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯"
- end
- end
-
- /*
- * Display the string
- */
-
- RequestNumber 'title "Appointments" Text "' || string || '*n*nShow an appointment (0 = Do not show)?"'
-
- if rc = 0 then
- do
- if result > 0 & result <= searchresult.count then
- do
- ActiveRecord record searchresult.result
- end
- end
- end
-
-
-
- bail_out:
-
- Interpret Address fiasco_port
-
- UnlockGUI
- ResetStatus
-
- exit
-
- syntax:
- failure:
-
- if show("Ports", fiasco_port) then
- do
- Address Value fiasco_port
-
- RequestChoice '"Error ' || rc || ' in line ' || sigl || ':*n' || errortext(rc) || '" "Cancel" Title "' || scriptname || '"'
- end
- else
- do
- say "Error" rc "in line" sigl ":" errortext(rc)
- say "Enter to continue"
- pull dummy
- end
-
- call bail_out
-
- halt:
- break_c:
-
- if show("Ports", fiasco_port) then
- do
- Address Value fiasco_port
-
- RequestChoice '"Script Abort Requested" "Abort Script" Title "' || scriptname || '"'
- end
- else
- do
- say "*** Break"
- say "Enter to continue"
- pull dummy
- end
-
- call bail_out
-
-
-
-