You are on page 1of 8

DimuserMailDbAsNotesDatabase

DimSessAsNotesSession
DimUsrNameAsnotesname'
'gettheusernameDimParent_Rdoc
AsNotesDocumentDimResponse_Rdoc
AsNotesDocument
DimExcludeFromView(1)AsString

SubClick(SourceAsButton)
DimstartupDateAsNotesDateTime
DimendDateAsNotesDateTime
DimAllDtTime()Asnotesdatetime
DimtempDtAsNotesDateTime

DimiAsInteger
DimNo_of_weekAsInteger
DimsubjtAsString
Dimpop_StrAsString

'==================================
===============================
'settingupofimportantvariable
No_of_week=10'Reminderwill
workforthisnumberofweeks
subjt="Reminder"
pop_Str="Don'tforgetto
fillupyourtimesheetSupportOffice"
'==================================
===============================
'==================================
===============================
'Settingglobalobjects&variables
SetSess=Newnotessession
SetuserMailDb=sess.currentdatabase
SetUsrName=

NewNotesName(sess.UserName)
ExcludeFromView(0)="D"
ExcludeFromView(1)="S"
'==================================
===============================
'validation
CallDeletePreviousActive

'==================================
===================================
==========
'Setsthestartupdateasthecurrent
fridayat10:00AM&enddateto20weeksafter
that
currDay=Weekday(Now)
SetstartupDate=NewNotesDateTime(Now)
Startupdate.AdjustDay(6currDay)'6isforfriday
SetstartupDate=NewNotesDateTime
(Cstr(startupDate.DateOnly)+""+Cstr("10:00
AM"))
SettempDt=NewNotesDateTime
(Cstr(startupDate.DateOnly)+""
+Cstr(StartupDate.TimeOnly))
SetendDate=NewNotesDateTime
(Cstr(startupDate.DateOnly)+""
+Cstr(StartupDate.TimeOnly))
CallendDate.AdjustDay(((No_of_week1)*7))
'===================================
===================================
===========
'===================================
===================================
===========
'Calculatestheallthedatetimes
atagapof7daysi.e.eachfriday

whichfallsbetweenstart&enddate
i=0
While(endDate.timedifference
(tempDt)>=0)'Cdat(tempDt.DateOnly)<=
Cdat(endDate.DateOnly)
RedimPreserveAllDtTime(i)
AsNotesDateTime
SetAllDtTime(i)=NewNotesDateTime
(Cstr(TempDt.DateOnly)+""+Cstr(TempDt.TimeOnly))
CallTempDt.AdjustDay(7)
i=i+1
Wend
CallTempDt.AdjustDay(7)
SetendDate=NewNotesDateTime
(Cstr(TempDt.DateOnly)+""+Cstr(TempDt.TimeOnly))
'==================================
====================================
=================

'passinstartdatetime,enddate
timeofthereminderappointment,
subject,popupstring,nameofuser,andsession.
'Createstheparentnoteofthereminder
CallCreateParentNote
(startupDate,endDate,pop_Str,subjt,AllDtTime)
'Createstheresponsenoteofthereminder
CallcreateResponseNote
(startupDate,endDate,pop_Str,subjt,AllDtTime)
Msgbox"TimesheetReminder
addedtoyourcalendar",64,"Add
TimeSheetReminder"+userMailDb.Title

EndSub
SubCreateParentNote(dateTimeAsnotesDateTime,
EndDtAsNotesDateTime,popUpStrAsString,
subjectStrAs
String,AllDateTimeAsVariant)

'passinstartdatetime,enddatetimeofthe
reminder,subject,
popupstring,nameofuser,andsession.

'createreminderdoc

SetParent_Rdoc=userMailDb.CreateDocument
WithParent_Rdoc
.ReplaceItemValue"TimeSheetReminder","1"
'Addedforsearching
.ReplaceItemValue"$Alarm",1
.ReplaceItemValue"$AlarmDescription",popUpStr
.ReplaceItemValue"$AlarmMemoOptions",""
.ReplaceItemValue"$AlarmOffset",1
'popup1minutebeforethetimespecified..
.ReplaceItemValue"$AlarmSound","tada"
.ReplaceItemValue"$AlarmUnit","M"
.Replaceitemvalue"$AltPrincipal",
Cstr(UsrName.Canonical)
.Replaceitemvalue"$CSFlags","c"
.Replaceitemvalue"$CSVersion","2"
.Replaceitemvalue"$NoPurge",Enddt
.Replaceitemvalue"$PublicAccess","1"
.Alarms="1"
.AltChair=UsrName.Canonical
.AppointmentType="4"'4forreminder
.ApptUNID=Cstr(Parent_Rdoc.UniversalID)
.Chair=Cstr(UsrName.Canonical)
.EndDate=dateTime.DateOnly'Asperoutputthis
isstartupdateonly
.EndDateTime=dateTime.lsLocaltime'Asperoutput,
thisstartupdatetimei.e.firstentryinparent
note
.EndTime=dateTime.TimeOnly
.ExcludeFromView=ExcludeFromView'"D;S"'keeps
itemsoutofthedraftview.
.Form="Appointment"

.Replaceitemvalue"From",UsrName.Canonical
.MeetingType="1"
.OrgRepeat="1"
.OrgTable="C0"
.Principal=Cstr(UsrName.Canonical)
.RepeatCustom=AllDateTime'shouldbeallthe
dateswithouttimes
.RepeatDates=AllDateTime'Allthedatetimes
.RepeatEndDates=AllDateTime'Allthedatetimes
.RepeatFor=5
.RepeatForUnit=""
.RepeatFromEnd=""
.RepeatHow="F"
.RepeatInstanceDates=AllDateTime
.RepeatInterval="1"
.Repeats="1"
.RepeatStartDate=dateTime.lsLocaltime
.RepeatUnit="C"
.RepeatUntil=EndDt.lsLocaltime
.RepeatWeekends="D"
.SchedulerSwitcher="1"
.SequenceNum=1
.StartDate=dateTime.lsLocaltime
.StartTime=dateTime.TimeOnly
.STARTDATETIME=dateTime.lsLocaltime
.Subject=subjectStr
.tmpAdditionalInviteeButton="1"
.tmpAdditionalRoomsButton="1"
.tmpAppointmentType="Reminder"
.tmpAppointmentType_1="Reminder"
.tmpChair=Usrname.Canonical
.tmpEventLabel="Reminder"
.tmpOwnerHW="0"
.tmpParticipantHW="1"
.tmpRW="1"
.tmpShowTZ="0"
.txtNum="5"
.UpdateSeq=1

.WebDateTimeInit="1"
.ReplaceItemValue"_viewIcon",10
.ComputeWithFormTrue,False

.SaveTrue,False
'.PutInFolder("$Alarms")
EndWith
'*************************************************
**************************************************
**************************************************
**************************************************
**

EndSub
SubcreateResponseNote(dateTime
AsnotesDateTime,EndDtAsNotesDateTime,
popUpStrAsString,subjectStrAsString,
AllDateTimeAsVariant)'passinstartdate
time,enddatetimeofthereminder,subject,
popupstring,nameofuser,andsession.

SetResponse_Rdoc=
userMailDb.CreateDocument
CallResponse_Rdoc.MakeResponse
(Parent_Rdoc)'makingresponsedocument
WithResponse_Rdoc
.ReplaceItemValue"TimeSheetReminder","1"
'Addedforsearching
.ReplaceItemValue"$Alarm",1
.ReplaceItemValue"$AlarmDescription",popUpStr
.ReplaceItemValue"$AlarmMemoOptions",""
.ReplaceItemValue"$AlarmOffset",1
'popup1minutebeforethetimespecified..
.ReplaceItemValue"$AlarmSound","tada"
.ReplaceItemValue"$AlarmUnit","M"
.Replaceitemvalue

"$AltPrincipal",Cstr(UsrName.Canonical)
.Replaceitemvalue"$CSFlags","i"
.Replaceitemvalue"$CSVersion","2"
.Replaceitemvalue"$NoPurge",Enddt
.Replaceitemvalue"$PublicAccess","1"
.Replaceitemvalue"$RefOptions","1"
'.Replaceitemvalue"$Ref",'itgets
automaticallycreated.
.Alarms="1"
.AltChair=UsrName.Canonical
.AppointmentType="4"'4forreminder
.ApptUNID=Cstr(Parent_Rdoc.UniversalID)
'universalidoftheparentdocument
.CalendarDateTime=AllDateTime
'Allthedatetimes
.Chair=Cstr(UsrName.Canonical)
.EndDate=dateTime.DateOnly
'Asperoutputthisisstartupdateonly
.EndDateTime=AllDateTime
'Asperoutputinresponsedocument,
thisisallthedatetime
.EndTime=dateTime.TimeOnly
.ExcludeFromView=ExcludeFromView
'keepsitemsoutofthedraftview.
.Form="Appointment"
.Replaceitemvalue"From",UsrName.Canonical
.MeetingType="1"
.OrgRepeat="1"
.OrgTable="C0"
.Principal=Cstr(UsrName.Canonical)
.RepeatInstanceDates=AllDateTime
'alldatetime
.Repeats="1"
.SchedulerSwitcher="1"
.SequenceNum=1
.StartDate=dateTime.lsLocaltime
.StartTime=dateTime.TimeOnly
.STARTDATETIME=AllDateTime

'alldatetime
.Subject=subjectStr
.txtNum="5"
.UpdateSeq=1
.WebDateTimeInit="1"
.ReplaceItemValue"_viewIcon",10
.ComputeWithFormTrue,False
.SaveTrue,False
.PutInFolder("$Alarms")
EndWith
'******************************************
********************************************
*********************************************
**********************************************
************************

EndSub
SubDeletePreviousActive
DimSrchStrAsString
DimdoccollAsNotesDocumentCollection
DimdocAsNotesDocument
DimAppViewAsNotesView
SrchStr={TimeSheetReminder="1"}
SetAppView=userMaildb.GetView("($ApptUNID)")
Setdoccoll=usermaildb.Search(SrchStr,Nothing,1)
Calldoccoll.RemoveAll(True)

EndSubc

You might also like