把foxpro代码转为delphi代码
wait wind "正在汇总,请稍候..." timeout 0.5
sele men_time
yyear=year(thisform.text1.value)
mmonth=month(thisform.text1.value)
index on person_no tag person_no for year(date)=yyear and month(date)=mmonth and !empt(allt(name))
dddate=thisform.text1.value-day(thisform.text1.value)+1
SET RELATION TO allt(str(year(ddate))) INTO Weekend ADDITIVE
SET RELATION TO class INTO Class ADDITIVE
**************************************************************************************
do case
case month(dddate)=1 or month(dddate)=3 or month(dddate)=5 or month(dddate)=7 or month(dddate)=8;
or month(dddate)=10 or month(dddate)=12
dday=31
case month(dddate)=4 or month(dddate)=6 or month(dddate)=9 or month(dddate)=11
dday=30
case month(dddate)=2
if year(dddate)/4=int(year(dddate)/4)
dday=29
else
dday=28
endif
endcase
repl all day with 0
for i=1 to dday
hol=seek(dddate,"hols")
if hol
l=iif(len(allt(str(i)))=1,"0"+allt(str(i)),allt(str(i)))
repl all day with day+1 for date_in<dddate
else
l=iif(len(allt(str(i)))=1,"0"+allt(str(i)),allt(str(i)))
repl all day with day+1 for d&l>0
endif
dddate=dddate+1
endfor
*************************************************************************************************
dddate=thisform.text1.value-day(thisform.text1.value)+1
l=allt(str(month(dddate)))
repl all wday with 0,p1 with 0,p2 with 0,p3 with 0,p4 with 0,t1 with 0,t2 with 0,t3 with 0,;
t4 with 0,t01 with 0,time with 0,tprice with 0,jt with 0
repl all wday with weekend.m&l-(dday-day) for (weekend.m&l-(dday-day))>0
for i=1 to dday
repl all check with .f.
l=iif(len(allt(str(i)))=1,"0"+allt(str(i)),allt(str(i)))
hol=seek(dddate,"hols")
if hol
if hols.again=1
a=2
else if hols.again=0
a=3
endif
repl all p4 with p4+8*class.modulus for date_in<dddate and d&l=0
repl all p4 with p4+(d&l*(a-1)+8)*class.modulus for date_in<dddate and d&l>0 and d&l<=8
repl all p4 with p4+a*d&l*class.modulus for date_in<dddate and d&l>8
repl all p4 with p4+8*tclass for date_in<dddate and d&l<=0 and class=0
repl all p4 with p4+(d&l*(a-1)+8)*tclass for date_in<dddate and d&l>0 and d&l<=8 and class=0
repl all p4 with p4+a*d&l*tclass for date_in<dddate and d&l>8 and class=0
repl all t4 with t4+d&l for date_in<dddate and day>0
else
if cdow(dddate)="Saturday" or cdow(dddate)="Sunday"
repl all t3 with t3+iif(d&l>10,10,d&l),t1 with t1+iif(d&l>10,d&l-10,0),wday with (wday-1),check with .t. for wday>0 and d&l<>0
repl all t1 with t1+d&l for d&l<=8 and !(check)
repl all t1 with t1+8,t2 with t2+(d&l-8) for d&l>8 and d&l<=10 and !(check)
repl all t1 with t1+(d&l-2),t2 with t2+2 for d&l>10 and !(check)
else
repl all t1 with t1+d&l for d&l<=8 and jprice<=0
repl all t1 with t1+8,t2 with t2+(d&l-8) for d&l>8 and d&l<=10
repl all t1 with t1+(d&l-2),t2 with t2+2 for d&l>10
endif
repl all t01 with t01+(d&l-10) for d&l>10
endif
repl all time with time+d&l
dddate=dddate+1
endfor
repl all t1 with t1-t01
repl all t1 with time-t2-t3-t4-t01 for jtime=0
repl all p1 with t1*class.modulus,p2 with t2*class.modulus*1.5,p3 with t3*class.modulus*2,;
p01 with t01*class.modulus for jtime<=0
repl all jtime with 0 for jprice<=0
repl all ttime with time-jtime for (time-jtime)>0
repl all ttime with 0 for (time-jtime)<=0
repl all p4 with p4-t4*class.modulus for jtime>0 and date_in<=dddate
repl all p4 with 0 for time=0
repl all tprice with ttime*class.tmod for jtime>0
repl all p1 with tprice for jtime>0 and left(person_no,3)<>"301" and left(person_no,5)<>"50202"
repl all p1 with t1*tclass p2 with t2*tclass, p3 with t3*tclass,p01 with t01*tclass for class=0
repl all tprice with p1+p2+p3+p01+p4 for jtime<=0
repl all p01 with 0 for jtime>0
repl all t1 with time-t2-t3-t4-t01 for jprice>0
repl all Tprice with Tprice+p4 for jtime>0
repl all jt with 1.4*time-tprice-jprice for 1.4*time-tprice-jprice>0
*********************************************************************************************
repl all slry with round(tprice+jprice+hsjt+jt+blgz,0)
repl all price with round(slry+bfkf+tcf-flf-htf-bwfk-czfk-qtfk-fkjj-fkczjj-kjjj-shqjj-qtjj-shbx-kcf,0)
*********************************************************************************************
repl all m100 with int(price/100) for price>0
repl all m50 with int((price-m100*100)/50) for price>0
repl all m20 with int((price-m100*100-m50*50)/20) for price>0
repl all m10 with int((price-m100*100-m50*50-m20*20)/10) for price>0
repl all m5 with int((price-m100*100-m50*50-m20*20-m10*10)/5) for price>0
repl all m2 with int((price-m100*100-m50*50-m20*20-m10*10-m5*5)/2) for price>0
repl all m1 with int((price-m100*100-m50*50-m20*20-m10*10-m5*5-m2*2)) for price>0
set rela to
wait wind "汇总结束..."
index on person_no tag person_no