Wenn Sie ein Jahr auswählen werden sämtliche Monate, Wochen und Tage durch ein Skript berechnet und der Kalender gerendert.
Allerdings ist dieser Vorgangs sehr rechenintensiv und dauert je nach Rechenleistung auch mal eine Minute und länger.
Besonderheiten:
In diesem Beispiel werden die Wochenenden ausgenommen, da man da gewöhnlich nicht arbeitet.
Zeiten bei denen eine Notiz oder ein Termin hinterlegt wurden, werden automatisch durch eine Farbe hervorgehoben.
Des Weiteren wird auch der heutige Tag wird in der Kopfzeile hervorgehoben.
Today I like to show what is possible with XFA forms and FormCalc. This example is an appointment calender.
If you select a year a script starts to calculate all months, week and days in front of rendering the calendar.
But, this progress need thousands of calculations and takes about a minute or longer to finish, depending on the computing power.
Features:
In the example all weekends are excluded because you generally do not work on this days.
Timeslots where a note or appointment has been added are automatically highlighted by a color.
Also, the current date is highlighted in the headline.
Kalender // Calendar
FormCalc-Skript - Berechnung der Kalenderblätter
//
FormCalc script - Calculation of the Calendar Sheets
if (RenderForm.value eq 1) then
var nPages = Page.instanceManager.count
var nStart
var nLength
var nIndex
var nDayNumber
var nDayName
var nWeekDay
var nWeekNumber
var nYear = Year
var nBegin
var nFirstDay
var nLastDay
var nAddDay
var nCheck
for p = 0 upto nPages - 1 step 1 do
nBegin = Concat("1.", p+1, ".", nYear)
nFirstDay = Date2Num(nBegin, "D.M.YYYY")
nAddDay = nFirstDay
for d = 0 upto 31 step 1 do
nAddDay = nAddDay + 1
nCheck = Num2Date(nAddDay, "M")
if (nCheck eq p+1) then
nLastDay = nAddDay
endif
endfor
nLength = Num2Date(nLastDay, "D")
Page[p].Head.Month = Num2Date(Date2Num(nBegin, "D.M.YYYY"), "MMMM")
Page[p].Body._Day.setInstances(nLength)
nStart = Date2Num(nBegin, "D.M.YYYY")
for d = 0 upto nLength - 1 step 1 do
nIndex = Sum(nStart, d)
nDayNumber = Num2Date(nIndex, "DD")
nDayName = Num2Date(nIndex, "EEE")
nWeekDay = Num2Date(nIndex, "E")
nWeekNumber = Num2Date(nIndex, "WW")
if(nWeekDay eq "1" or nWeekDay eq "7") then
Page[p].Body.Day[d].DayName.Text.w = S_S.value
Page[p].Body.Day[d].DayName.Text.border.fill.color.value = "128,128,128"
Page[p].Body.Day[d].Week.Text.w = S_S.value
Page[p].Body.Day[d].Detail[*].Notes.w = S_S.value
Page[p].Body.Day[d].Detail[*].Notes.ui.textEdit.border.fill.color.value = "128,128,128"
Page[p].Body.Day[d].Detail[*].Notes.margin.topInset = "0.0mm"
Page[p].Body.Day[d].Detail[*].Notes.margin.bottomInset = "0.0mm"
Page[p].Body.Day[d].Detail[*].Notes.margin.leftInset = "0.0mm"
Page[p].Body.Day[d].Detail[*].Notes.margin.rightInset = "0.0mm"
Page[p].Body.Day[d].DayName.Text.value.text.value = ""
Page[p].Body.Day[d].Week.Text.value.text.value = ""
else
Page[p].Body.Day[d].DayName.Text.w = M_F.value
Page[p].Body.Day[d].DayName.Text.border.fill.color.value = "255,255,255"
Page[p].Body.Day[d].Week.Text.w = M_F.value
Page[p].Body.Day[d].Detail[*].Notes.w = M_F.value
Page[p].Body.Day[d].Detail[*].Notes.ui.textEdit.border.fill.color.value = "255,255,255"
Page[p].Body.Day[d].Detail[*].Notes.margin.topInset = "0.5mm"
Page[p].Body.Day[d].Detail[*].Notes.margin.bottomInset = "0.5mm"
Page[p].Body.Day[d].Detail[*].Notes.margin.leftInset = "0.5mm"
Page[p].Body.Day[d].Detail[*].Notes.margin.rightInset = "0.5mm"
Page[p].Body.Day[d].DayName.Text.value.text.value = Concat(nDayNumber, ".\u000a", nDayName)
if(nWeekDay == "2") then
Page[p].Body.Day[d].Week.Text.value.text.value = nWeekNumber
else
Page[p].Body.Day[d].Week.Text.value.text.value = ""
endif
endif
endfor
endfor
RenderForm.value = 0
endif
Beispiel-Kalender // Example Calendar
https://acrobat.com/#d=YpV-ajdmwMmAXZHUPL1E-g
Keine Kommentare:
Kommentar veröffentlichen