主题:用foxpro,编写订房统计程序时,如何把订房起始、结束日期化作订房统计表的记录?
thomasou
[专家分:0] 发布于 2010-07-24 20:26:00
请教各位老师,俺有这样一个问题,譬如,thomasou 从5月21---25日订房,handsome从5月22---24日订房,使用visual foxpro,如何通过编写程序把上述数据化为下面的表格显示呢?谢谢!
5月 21 22 23 24 25
Thomasou 1 1 1 1 1
handsome 1 1 1
回复列表 (共12个回复)
11 楼
thomasou [专家分:0] 发布于 2010-07-28 17:04:00
谢谢10楼高手对俺提出问题的指导,对问题的解决又前进了一步。俺觉得本问题焦点在于对日期开始(21/5)到日期结束(25/5)的过程判断,也就是说,知道从5月21日开始这一天,怎样编程判断出在新表中产生新字段如ms22(5/22)、ms23(5/23)、ms24(5/24)等, 直到5/25结束,然后在这些字段下标上“1”。请继续指点,谢谢。
12 楼
thomasou [专家分:0] 发布于 2010-08-06 17:01:00
受各位高手指导指点的启发,俺用非常非常老土老土的编程办法,处理表一(b01)单月发生的订房问题,以b02表作为过渡表,产生最后b03表,b01表结构是 (ss n(4),xm c(10),rz d(8),ld d(8)),b02表的结构是b02 (ss n(4),xm c(10),rz d(8),ld d(8)ms1 n(1),ms2 n(1).......ms31 n(1))。现把代码呈现,请各位高手指导:
close all
clear
use b03
dele
pack
use b02
dele all
pack
copy stru to b03
close all
use b01
repl all ss with 0
go top
scan
i=1
do while .not. eof( )
skip
repl ss with i+1
i=i+1
enddo
endscan
go top
repl ss with 1
close all
clear
use b01
FOR K=1TO 50(可以根据条目数量调整)
use b02
dele all
pack
append from b01 for ss=K
use b02
FOR i=day(rz)to (day(ld)-1)
repl ms01 with 1 for i=1
repl ms02 with 1 for i=2
repl ms03 with 1 for i=3
repl ms04 with 1 for i=4
repl ms05 with 1 for i=5
repl ms06 with 1 for i=6
repl ms07 with 1 for i=7
repl ms08 with 1 for i=8
repl ms09 with 1 for i=9
repl ms10 with 1 for i=10
repl ms11 with 1 for i=11
repl ms12 with 1 for i=12
repl ms13 with 1 for i=13
repl ms14 with 1 for i=14
repl ms15 with 1 for i=15
repl ms16 with 1 for i=16
repl ms17 with 1 for i=17
repl ms18 with 1 for i=18
repl ms19 with 1 for i=19
repl ms20 with 1 for i=20
repl ms21 with 1 for i=21
repl ms22 with 1 for i=22
repl ms23 with 1 for i=23
repl ms24 with 1 for i=24
repl ms25 with 1 for i=25
repl ms26 with 1 for i=26
repl ms27 with 1 for i=27
repl ms28 with 1 for i=28
repl ms29 with 1 for i=29
repl ms30 with 1 for i=30
repl ms31 with 1 for i=31
endfor
use b03
append from b02
endfor
use b03
brow
我来回复