{-----------------------------------------------------------------------
'
'
procedure for the appointment manager
'
'----------------------------------------------------------------------------------}
{....................................AGENT INFO..............................................}
start_agent_info
AgentName = "APPOINTMENT_MANAGER"
AgentDescr = ""
AgentLanguage = ""
__timer_interval = 0
__is_registered = 1
__delete_on_termination = 0
end_agent_info
{....................................PRODUCTION
CODE..................................................}
{..............................................................................new
appointment}
start_bpm_activity "new appointment"
start_bpm_subactivity "Appointment
elements"
rec = bpm_getrecid()
if (rec = 0)
then
call
OpenForm("ptAppend","APP_E01.FM","WORK.APP",1,"?=APP")
else
expr
= strcat(rec,"=APP")
call
OpenForm("ptEdit","APP_E01.FM","WORK.APP",1,expr)
endif
end_bpm_subactivity
start_bpm_validation
result = 1
rec = bpm_getrecid(1)
{...get the record id of the first activity}
if (rec = 0)
then
call
message("You havent created a new appointment!")
result
= 0
endif
if (rec >
0) then
per_id
= LookUp("APP","APP",rec,"PERSON","")
ther_name
= LookUp("APP","APP",rec,"THERAPIST_NAME","")
app_date
= LookUp("APP","APP",rec,"ADATE","")
app_time
= LookUp("APP","APP",rec,"ATIME","")
if
(per_id = 0) then
call message("You must define a client!")
result = 1
endif
if
(ther_name = "") then
call message("You must define a therapist!")
result = 1
endif
if
(app_date = "") then
call message("You must define a date!")
result = 1
endif
if
(app_date = "") then
call message("You must define a time!")
result = 1
endif
endif
end_bpm_validation
end_bpm_activity
{..................................................................................wait
appointment}
start_bpm_activity "wait appointment"
start_bpm_subactivity "Appointment"
rec =
__params[1]
expr = strcat(rec,"=APP")
call OpenForm("ptEdit","APP_E01.FM","WORK.APP",1,expr)
end_bpm_subactivity
start_bpm_subactivity "Customer"
rec =
__params[2]
expr = strcat(rec,"=PERSON")
call OpenForm("ptEdit","PERSON_E01.FM","WORK.PERSON",1,expr)
end_bpm_subactivity
end_bpm_activity
{..................................................................................escort
to therapist}
start_bpm_activity "escort to therapist"
start_bpm_subactivity "Appointment"
rec =
__params[1]
expr = strcat(rec,"=APP")
call OpenForm("ptEdit","APP_E01.FM","WORK.APP",1,expr)
end_bpm_subactivity
end_bpm_activity
{..................................................................................in
therapy}
start_bpm_activity "in therapy"
start_bpm_subactivity "Appointment"
rec =
__params[1]
expr = strcat(rec,"=APP")
call OpenForm("ptEdit","APP_E01.FM","WORK.APP",1,expr)
end_bpm_subactivity
start_bpm_subactivity "Customer"
rec =
__params[2]
expr = strcat(rec,"=PERSON")
call OpenForm("ptEdit","PERSON_E01.FM","WORK.PERSON",1,expr)
end_bpm_subactivity
end_bpm_activity
{.........................
start_bpm_activity "escort from therapist"
start_bpm_subactivity "Appointment"
rec =
__params[1]
expr = strcat(rec,"=APP")
call OpenForm("ptEdit","APP_E01.FM","WORK.APP",1,expr)
end_bpm_subactivity
end_bpm_activity
{..................................................................................payment
and good bye}
start_bpm_activity "payment and good
bye"
start_bpm_subactivity "Appointment"
rec =
__params[1]
expr = strcat(rec,"=APP")
call OpenForm("ptEdit","APP_E01.FM","WORK.APP",1,expr)
end_bpm_subactivity
start_bpm_subactivity "Customer"
rec =
__params[2]
expr = strcat(rec,"=PERSON")
call OpenForm("ptEdit","PERSON_E01.FM","WORK.PERSON",1,expr)
end_bpm_subactivity
end_bpm_activity
{.....................................CONTROL
CODE......................................................}
{.................................ACTION
CODE................................................
This agent has as job to coordinate (that' why we call it
a coordinator agent) all the job of
a therapy facility.
The customer calls to the facility to make an appointment
with one of the therapists
At the date of the appointment the secretary sees the appointment
with the customer in question
The hostess escorts the customer to the therapist
The therapist is applying the appropriating treatment
After finishing the treatment the hostess escorts the customer
to the secretary
The customer pays and the secretary says good bye to him/her.
The agent follows the events in real time (at the time they
are happen!)
}
start_action
{ press F8 for next step}
call bpm_setprocedureowner(__activation_user)
{.....set the procedure owner}
{(1)....any user can put a new appointment}
callwait bpm_assign_job ( "new appointment" , __activation_user
, "" , 0)
app_id = bpm_getrecid(1,__au_step)
{......get the record id of the appointment}
per_id = LookUp("APP","APP",app_id,"PERSON","")
ther_name = LookUp("APP","APP",app_id,"THERAPIST_NAME","")
app_date = LookUp("APP","APP",app_id,"ADATE","")
app_date_num = DateToNum(app_date)
per_name = LookUp("PERSON","PERSON",per_id,"FULLNAME","")
call bpm_setprocedurecomment(per_name)
{.....set the procedures comment}
{(2)....at date (app_date) the SECRETARY waits the
person to come for the appoinment}
callwait bpm_assign_job ( "wait appointment" , ""
, "SECRETARY" , app_date_num , app_id , per_id )
{(3)....the hostes escorts the person to the therapist}
callwait bpm_assign_job ( "escort to therapist" ,
"" , "HOSTES" , 0 , app_id )
{(4)....the therapist is doing the therapy}
callwait bpm_assign_job ( "in therapy" , ther_name
, "" , 0 , app_id , per_id )
{(5)....the hostes escort the person to the secretary}
callwait bpm_assign_job ( "escort from therapist"
, "" , "HOSTES" , 0 , app_id )
{(6)....the hostes escort the person to the secretary}
callwait bpm_assign_job ( "payment and good bye"
, "" , "SECRETARY" , 0 , app_id , per_id )
{------------------------------------ end of
procedure ---------------------------------------------}
end_action
|