Local NumberVar daysAbsent:= {@Excused Absence Q1} + {@Unexcused Absence Q1};
Local DateVar startTerm := date ("08/21/2009");
Local DateVar endTerm := date ("10/23/2009");
Local DateVar Array holidays := MakeArray(date ("09/07/2009"));
Local DateVar startDate;
Local DateVar endDate;
Local DateVar minDate;
Local DateVar maxDate;
Local NumberVar dayCount;
Local NumberVar counter := 0;
minDate := date(minimum({StsAttndDayDtl_1.StsAttndDayDtl_1_Date}));
maxDate := date(maximum({StsAttndDayDtl_1.StsAttndDayDtl_1_Date}));
if minDate = maxDate then
(
Select (minDate)
Case Is < startTerm: startDate := startTerm
Case Is > startTerm:
if minDate < endTerm then
startDate := minDate else
startDate := date(dateAdd("d", +1, endTerm))
Default: startDate := minDate;
) else
if minDate = startTerm to endTerm then
startDate := minDate else
if maxDate = startTerm to endTerm then
startDate := maxDate else
startDate := startTerm;
startDate := date(dateAdd("d", -1, startDate));
if isNull({StsAttndDayDtl_2.StsAttndDayDtl_2_Date}) = FALSE then
(
minDate := date(minimum({StsAttndDayDtl_2.StsAttndDayDtl_2_Date}));
maxDate := date(maximum({StsAttndDayDtl_2.StsAttndDayDtl_2_Date}));
if minDate = maxDate then
(
if minDate < startTerm then
endDate := endTerm else
Select (minDate)
Case Is < endTerm:
if minDate > startTerm then
endDate := date(dateAdd("d", -1, minDate)) else
endDate := endTerm
Case Is > endTerm: endDate := endTerm
Default: endDate := date(dateAdd("d", -1, minDate));
) else
if minDate = startTerm to endTerm then
endDate := date(dateAdd("d", -1, minDate)) else
if maxDate = startTerm to endTerm then
endDate := date(dateAdd("d", -1, maxDate)) else
if minDate < startTerm and
maxDate < startTerm then
endDate := startTerm else
endDate := endTerm;
) else
endDate := endTerm;
dayCount := Datediff("d", startDate, endDate) - DateDiff("ww", startDate, endDate, crSaturday) - DateDiff("ww", startDate, endDate, crSunday) - daysAbsent;
While UBound(holidays) <> counter do
(counter := counter + 1;
if Not (dayofweek(holidays[counter]) in [1,7]) and
holidays[counter] in date(dateAdd("d", +1, startDate)) to endDate then
dayCount := dayCount -1

;
dayCount;
All formulas work in the subreport until this one is added.