(Source Code) Foxpro - Calendar Printing based on Month/Year entered

Foxpro/VFP Source Codes

 Foxpro - Calendar Printing based on Month/Year entered * foxpro program to print calendar * input month and year and calendar will be shown set date brit set cent on clear decl a(5,7) input "Enter month " to mn input "Enter year" to yr if mn > 12 or mn < 1 then  ?"invalid month"  return endif store 0 to a store 0 to r,c,mndays dt = ctod("01/" +str(mn,2)+"/"+str(yr,4)) do calcdays r=1 ?dt c=dow(dt) for r = 1 to 6  for j = c to 7   rowno = iif(r<6,r,1)   a(rowno,j) = day(dt)   if day(dt)>=mndays then    exit loop   endif   dt = dt + 1  endfor  if day(dt)>=mndays then   exit loop  endif c=1 endfor clear ? ?cmonth(dt) + str(year(dt),5) ?"*********************" ?"S" at 7 ??"M" at 12 ??"T" at 17 ??"W" at 21 ??"Th" at 27 ??"F" at 32 ??"SA" at 37 ? colm=0 for r = 1 to 5  for c = 1 to 7   if a(r,c) <> 0 then    ?? str(a(r,c),5) at colm + c*5   endif  endfor  ? endfor proc calcdays ************** do case  case mn =1 or mn= 3 or mn= 5 or mn= 7 or mn= 8 or mn= 10 or mn= 12   mndays = 31  case mn= 4 or mn= 6 or mn= 9 or mn=11   mndays = 30  case mn = 2   if mod(yr,4) = 0 and not mod(yr,100)<> 0 then    mndays = 29   else    if mod(yr,4)=0 and mod(yr,100) = 0 and mod(yr,400) = 0 then     mndays = 29    else     mndays = 28    endif   endif endcase