[appointments]
WindowWidth = DisplayWidth : WindowHeight = DisplayHeight
BackgroundColor$ = "green"
statictext #appt.st2, "Monday", 50, 20, 120, 20
statictext #appt.st3, "Tuesday", 280, 20, 120, 20
statictext #appt.st4, "Wednesday", 480, 20, 130, 20
statictext #appt.st5, "Thursday", 680, 20, 130, 20
statictext #appt.st6, "Friday" , 910, 20, 130, 20
statictext #appt.st8, "0800", 198, 60, 40, 20 : statictext #appt.st81, "0800", 825, 60, 40, 20
statictext #appt.st9, "0900", 198, 92, 40, 20 : statictext #appt.st91, "0900", 825, 92, 40, 20
statictext #appt.st10, "1000", 198, 124, 40, 20 : statictext #appt.st101, "1000", 825, 124, 40, 20
statictext #appt.st11, "1100", 198, 156, 40, 20 : statictext #appt.st111, "1100", 825, 156, 40, 20
statictext #appt.st11, "1200", 198, 188, 40, 20 : statictext #appt.st121, "1200", 825, 188, 40, 20
statictext #appt.st01, "0100", 198, 220, 40, 20 : statictext #appt.st011, "0100", 825, 220, 40, 20
statictext #appt.st02, "0200", 198, 252, 40, 20 : statictext #appt.st021, "0200", 825, 252, 40, 20
statictext #appt.st03, "0300", 198, 284, 40, 20 : statictext #appt.st021, "0300", 825, 284, 40, 20
statictext #appt.st04, "0400", 198, 316, 40, 20 : statictext #appt.st021, "0400", 825, 316, 40, 20
listbox #appt.lbMon, mon$(, apptDel, 5,50,190,325
Stylebits #appt.lbMon, _WS_HSCROLL, _WS_VSCROLL, 0, 0
listbox #appt.lbTue, tue$(, apptDel, 230,50,190,325
Stylebits #appt.lbTue, _WS_HSCROLL, _WS_VSCROLL, 0, 0
listbox #appt.lbWed, wed$(, apptDel, 430,50,190,325
Stylebits #appt.lbWed, _WS_HSCROLL, _WS_VSCROLL, 0, 0
listbox #appt.lbThu, thu$(, apptDel, 630,50,190,325
Stylebits #appt.lbThu, _WS_HSCROLL, _WS_VSCROLL, 0, 0
listbox #appt.lbFri, fri$(, apptDel, 855,50,190,325
Stylebits #appt.lbFri, _WS_HSCROLL, _WS_VSCROLL, 0, 0
textbox #appt.tbx,10,85,1035,3 'horizontal 'lines'
textbox #appt.tbx,10,117,1035,3
textbox #appt.tbx,10,149,1035,3
textbox #appt.tbx,10,181,1035,3
textbox #appt.tbx,10,213,1035,3
textbox #appt.tbx,10,245,1035,3
textbox #appt.tbx,10,277,1035,3
textbox #appt.tbx,10,309,1035,3
button #appt.btn1,"<Last Week", [lastWeek], UL,330,440
button #appt.btn2,"Next Week>", [nextWeek], UL,570,440
button #appt.btn2," Enter ", [apptEnter], UL,450,440
open "APPOINTMENTS" for window as #appt
#appt, "trapclose [apptQuit]"
#appt, "font ms_sans_serif 10"
appt.open = 1
#appt.lbMon,"SingleClickSelect patientCall"
#appt.lbTue,"SingleClickSelect patientCall"
#appt.lbWed,"SingleClickSelect patientCall"
#appt.lbThu,"SingleClickSelect patientCall"
#appt.lbFri,"SingleClickSelect patientCall"
if left$(bothName$,8) = "Pat Call" then #appt.btn2,"!hide"
dayNbr = date$("days") ' returns number - days since Jan 1, 1901
dow = (dayNbr mod 7) + 3
if dow > 7 then dow = dow - 7
if dow = 7 then dayNbr = dayNbr - 5
if dow = 6 then dayNbr = dayNbr - 4
if dow = 5 then dayNbr = dayNbr - 3
if dow = 4 then dayNbr = dayNbr - 2
if dow = 3 then dayNbr = dayNbr - 1
if dow = 1 then dayNbr = dayNbr + 1
gosub [getApptFile] ' brings in appointment data for the current week
[apptLoop]
wait
sub patientCall x$
#x$, "selection? patName$"
patFileName$ = "patients\"+patName$ + "\"+patName$+".dat"
files DefaultDir$, patFileName$, info$()
if val(info$(0, 0)) = 0 then
#x$,"selectindex 0"
else
open patFileName$ for input as #pat
line input #pat, patRec$
close #pat
notice "Patient Phone";chr$(13);insert$(word$(patRec$,6,"|"),phTmplt$) ' phone #
end if
end sub 'wait
sub apptDel x$
confirm "Delete this Appointment?"; answer$
if answer$ = "yes" then
#x$, "selection? patNam$"
#x$, "selectionindex? index"
dy$ = right$(x$,3)
adj = 1 - 2*(index mod 2 = 0)
' if index odd adj = 1. if index even adj = -1
select case dy$
case "Mon"
treat$ = mon$(index+adj)
mon$(index) = "-" : mon$(index+adj) = "-"
case "Tue"
treat$ = tue$(index+adj)
tue$(index) = "-" : tue$(index+adj) = "-"
case "Wed"
treat$ = wed$(index+adj)
wed$(index) = "-" : wed$(index+adj) = "-"
case "Thu"
treat$ = thu$(index+adj)
thu$(index) = "-" : thu$(index+adj) = "-"
case "Fri"
treat$ = fri$(index+adj)
fri$(index) = "-" : fri$(index+adj) = "-"
end select
#x$,"Reload"
call apptFileWrite appFileName$ ' rewrite appt file w/o deleted appt
open patFileName$ for input as #pat ' read patient file
line input #pat, patRec$
close #pat
open patFileName$ for output as #pat ' rewrite w/o next visit field
for n = 1 to 16
print #pat, word$(patRec$,n,"|") +"|";
next
print #pat, " |" ' blank next Visit field
close #pat
notice "DELETED";chr$(13);patNam$;" "; treat$
else
#x$,"selectindex 0"
end if
[es]
end sub