133 lines
3.9 KiB
Plaintext
133 lines
3.9 KiB
Plaintext
Function SVC_Change_Log(Service, Param1, Param2, Param3, Param4, Param5, Param6, Param7)
|
|
|
|
/********************************************************************************************************
|
|
|
|
This program is proprietary and is not to be used by or disclosed to others, nor is it to
|
|
be copied without written permission.
|
|
|
|
Name :
|
|
|
|
Description :
|
|
|
|
Tags : [SRP]
|
|
|
|
Parameters :
|
|
|
|
History (Date, Initials, Notes)
|
|
05/17/10 fjt Initial development
|
|
|
|
********************************************************************************************************/
|
|
|
|
$insert SRP_APP_INSERTS
|
|
$insert SERVICE_INSERT
|
|
$insert NOTIFICATION_EQU
|
|
|
|
Declare subroutine Create_Note
|
|
Declare function SRP_Clean_Array, SRP_Sort_Array
|
|
|
|
Equ Log$ to "WO_MASTER_SCHEDULER.EDT_CHANGE_LOG"
|
|
Equ Crlf$ to Char(13):Char(10)
|
|
|
|
Begin Case
|
|
Case Service _eqc "Compare" ; GoSub Compare
|
|
Case Service _eqc "RemoveAppts" ; GoSub RemoveAppts
|
|
Case Service _eqc "SendNotif" ; GoSub Send_Notif
|
|
End Case
|
|
|
|
Return Ans
|
|
|
|
|
|
!----- SERVICES -----------------------------------------------------------------------------------------
|
|
|
|
|
|
Compare:
|
|
// Compare current to previous record
|
|
If Param3<14> EQ Date() then
|
|
If Param2 NE Param3 then
|
|
Rec = Param2
|
|
GoSub Define_Record
|
|
GoSub Add_To_Array
|
|
end
|
|
end
|
|
return
|
|
|
|
|
|
RemoveAppts:
|
|
// Deletes are automatically added as a change
|
|
Rec = Param2
|
|
If Rec EQ "" then Rec = Xlate("WO_MAST_SCHED", Param1, "", "X")
|
|
Row = Rec<15> :@VM: Param1
|
|
GoSub Add_To_Array
|
|
return
|
|
|
|
|
|
Send_Notif:
|
|
SendTo = ""
|
|
Subject = "Reactor Schedule Change Notice..."
|
|
Array = Get_Property(Log$, "OLE.Array")
|
|
Reactors = Array<1>
|
|
CurDay = Oconv(Date(), "DWA")
|
|
|
|
Swap @VM with Crlf$ in Reactors
|
|
|
|
If Reactors GT "" then
|
|
// This was originally taken from the Click script event in the old scheduler window
|
|
// Modified for use with the new scheduler and change log
|
|
|
|
// Build the message
|
|
MsgToSend = ""
|
|
MsgToSend := "The following reactor(s) have changed on ":Oconv(Date(), "D2/"):" at ":Oconv(Time(), "MT"):":"
|
|
MsgToSend := Crlf$
|
|
MsgToSend := Reactors
|
|
MsgToSend := Crlf$:Crlf$
|
|
MsgToSend := "This has been modified by "
|
|
MsgToSend := Oconv(@USER4, "[XLATE_CONV,LSL_USERS*FIRST_LAST]")
|
|
MsgToSend := " on ":Oconv(Date(), "D2/") :" at ": Oconv(Time(), "MTH" ) : "...See Attachment."
|
|
|
|
// Get the personnel to send the message to
|
|
// Added 09/28/2005 JCH - J.C. Henry & Co., Inc
|
|
|
|
If CurDay EQ "Sunday" or CurDay EQ "Monday" or CurDay EQ "Tuesday" then
|
|
SendTo = Xlate("NOTIFICATION", "MAST_SCHED_BEG", NOTIFICATION_USER_ID$, "X")
|
|
end else
|
|
If CurDay EQ "Thursday" or CurDay EQ "Friday" or CurDay EQ "Saturday" then
|
|
SendTo = Xlate("NOTIFICATION", "MAST_SCHED_END", NOTIFICATION_USER_ID$, "X")
|
|
end else
|
|
// It is Wednesday so send to both cause they alternate
|
|
SendTo = Xlate("NOTIFICATION", "MAST_SCHED_BEG", NOTIFICATION_USER_ID$, 'X')
|
|
SendTo<1,-1> = Xlate("NOTIFICATION", "MAST_SCHED_END", NOTIFICATION_USER_ID$, 'X')
|
|
end
|
|
end
|
|
|
|
// Send the message (original IREPI routine)
|
|
Create_Note(SendTo, "System", Subject, MsgToSend, "WO_MASTER_SCHEDULER", "*CENTER")
|
|
|
|
// Clear the change log
|
|
Set_Property(Log$, "OLE.Array", "")
|
|
Msg(@Window, "", "OK", "", "Send Notifs":@FM:"Notifications have been sent.")
|
|
end else
|
|
Msg(@Window, "", "OK", "", "Send Notifs":@FM:"No changes have been made.")
|
|
end
|
|
return
|
|
|
|
|
|
!----- INTERNAL FUNCTIONS -------------------------------------------------------------------------------
|
|
|
|
|
|
Add_To_Array:
|
|
List = Get_Property(Log$, "OLE.List")
|
|
List<-1> = Row
|
|
Convert @VM to "*" in List
|
|
List = SRP_Clean_Array(List, @FM, "UNIQUE")
|
|
Convert "*" to @VM in List
|
|
List = SRP_Sort_Array(List, "AR1", Yes$)
|
|
Set_Property(Log$, "OLE.List", List)
|
|
return
|
|
|
|
|
|
Define_Record:
|
|
Appt = Param1
|
|
Reactor = Rec<15>
|
|
Row = Reactor :@VM: Appt
|
|
return
|