if dtMonth = 1 then dtStart := EnCodeDate(dtYear-1, 12, 1) else dtStart := EnCodeDate(dtYear, dtMonth-1, 1);