Simple Weekly Calendar Generation

Submitted by Karthikeyan on
This program is a simple example to handle with date and week days, printing in Foxpro. Construct yourself for your requirement based on this example. This program saves the out put to a text file name cal.txt.

set stat off
set safe off
set talk off
set date brit
set cent on
set alte to cal.txt
set alte on

dt=ctod("01/06/2013") 
mn1=MONTH(DT)
ln=repl('-',80)
lno=0
for i=1 to 365
    mn2=month(dt)
    if mn1=mn2
       ?ln
       ?dt,cdow(dt)
       if cdow(dt)="Sunday"
          ??space(15),"HOLIDAY"
       endif   
       ?
       ?
       lno=lno+4
    endif
    do whil lno=68 or mn1<>mn2
       do whil lno<72
          ?
          lno=lno+1
       enddo   
       if mn1<>mn2
          ?ln
          ?dt,cdow(dt)
          if cdow(dt)="Sunday"
             ??space(15),"HOLIDAY"
          endif   
          ?
          ?
          lno=4
          mn1=mn2
       else
          lno=0
       endif
    enddo
    dt=dt+1
endfor   
?ln
clos all
clea all
modi comm cal.txt

Recommended :
FoxPro e-Book
  1. FoxPro Programming Quick Reference e-Book (New! Revised Edition)