PARAMETERS
date1,date2
CREATE CURSOR Cstan(sdate d,edate d,standard N(6,1))
INSERT INTO Cstan(sdate,edate,standard ) Value({^1990.1.1},{^1999.12.31},0.1)
INSERT INTO Cstan(sdate,edate,standard ) Value({^2000.1.1},{^2009.12.31},0.5)
INSERT INTO Cstan(sdate,edate,standard ) Value({^2010.1.1},{^2014.12.31},0.8)
INSERT INTO Cstan(sdate,edate,standard ) Value({^2015.1.1},DATE(),1.2)
IF date2<date1
tmp_date=date1
date1=date2
date2=tmp_date
ENDIF
date1=date1-DAY(date1)+1
&&起始按月初
date2=GOMONTH(date2,1)-DAY(date2)
&&终止按月末
nMoney=0
n=0
DO WHILE .t.
cur_date=GOMONTH(date1,n)
IF cur_date<=date2
SELECT standard FROM cstan
WHERE BETWEEN(cur_date,Sdate,Edate) INTO CURSOR tmp_stan
nMoney=nMoney+standard
USE
n=n+1
ELSE
EXIT
ENDIF
ENDDO
RETURN nMoney