Trying to determine number of days people stayed in bed and breakfast by quarter. If one person stayed 14 days and there was 2 days in one quarter and 12 in next quarter then the days need to be split up.
The following formula right now will put the days into the proper quarter and shows which of those stays need to be split. Problem is I don't know how to split those days into different quarters.
(First Quarter starts March 1, not Jan 1)
WhilePrintingRecords;
Local NumberVar NumDays := {DAYS_STAYED_VIEW.LENGTH_OF_STAY};
Local NumberVar DayOfMonth := Day({DAYS_STAYED_VIEW.START_DATE});
Local NumberVar TotalOfDays:= DayOfMonth + NumDays;
Local DateVar firstOfMonth := Date(Year({DAYS_STAYED_VIEW.START_DATE}),Month({DAYS_STAYED_VIEW.START_DATE}),1);
Local DateVar lastOfMonth := Date(DateAdd("d",-1,DateAdd("m",1,firstOfMonth)));
Local NumberVar LastDayOfMonth := Day(lastOfMonth);
if Month({DAYS_STAYED_VIEW.START_DATE}) in 4 to 6 then
( if (TotalOfDays > LastDayOfMonth) then
'Another Quarter'
else
' First Quarter')
else if Month({DAYS_STAYED_VIEW.START_DATE}) in 7 to 9 then
( if (TotalOfDays > LastDayOfMonth) then
'Another Quarter2'
else
' Second Quarter')
else if Month({DAYS_STAYED_VIEW.START_DATE}) in 10 to 12 then
( if (TotalOfDays > LastDayOfMonth) then
'Another Quarter3'
else
' Third Quarter')
else if Month({DAYS_STAYED_VIEW.START_DATE}) in 1 to 3 then
( if (TotalOfDays > LastDayOfMonth) then
'Another Quarter4'
else
'Fourth Quarter')
The following formula right now will put the days into the proper quarter and shows which of those stays need to be split. Problem is I don't know how to split those days into different quarters.
(First Quarter starts March 1, not Jan 1)
WhilePrintingRecords;
Local NumberVar NumDays := {DAYS_STAYED_VIEW.LENGTH_OF_STAY};
Local NumberVar DayOfMonth := Day({DAYS_STAYED_VIEW.START_DATE});
Local NumberVar TotalOfDays:= DayOfMonth + NumDays;
Local DateVar firstOfMonth := Date(Year({DAYS_STAYED_VIEW.START_DATE}),Month({DAYS_STAYED_VIEW.START_DATE}),1);
Local DateVar lastOfMonth := Date(DateAdd("d",-1,DateAdd("m",1,firstOfMonth)));
Local NumberVar LastDayOfMonth := Day(lastOfMonth);
if Month({DAYS_STAYED_VIEW.START_DATE}) in 4 to 6 then
( if (TotalOfDays > LastDayOfMonth) then
'Another Quarter'
else
' First Quarter')
else if Month({DAYS_STAYED_VIEW.START_DATE}) in 7 to 9 then
( if (TotalOfDays > LastDayOfMonth) then
'Another Quarter2'
else
' Second Quarter')
else if Month({DAYS_STAYED_VIEW.START_DATE}) in 10 to 12 then
( if (TotalOfDays > LastDayOfMonth) then
'Another Quarter3'
else
' Third Quarter')
else if Month({DAYS_STAYED_VIEW.START_DATE}) in 1 to 3 then
( if (TotalOfDays > LastDayOfMonth) then
'Another Quarter4'
else
'Fourth Quarter')