* try with 12th of the first date's month >>d12=date(year(d1), month(d1), 12) >>*-- if first date is past 12th, use 12th of the second date >>if d12<d1 >> d12=date(year(d2), month(d2), 12) >>endif >>scan for between(d12, d1, d2) >> && do stuff here >>endscan>
BETWEEN(SYS(11,DATE(YEAR(PpBeg),MONTH(PpBeg),12)),SYS(11,PpBeg),SYS(11,PpEnd)) ; OR BETWEEN(SYS(11,DATE(YEAR(PpEnd),MONTH(PpEnd),12)),SYS(11,PpBeg),SYS(11,PpEnd))I was also tempted to make it a one-liner but resisted it for clarity's sake. Payroll report never hinges on a couple of milliseconds more or less. Let's try a two-liner:
d12=date(year(iif(day(d1)<=12, d1, d2)), month(iif(day(d1)<=12, d1, d2)), 12) scan for between(d12, d1, d2) && do stuff here endscan