中国人民银行XX分行科目日计表

年  月  日
科目代码	科目名称	        发  生  额	         余    额
		   借   方	   贷  方	  借  方	  贷   方
  ……	……	    ……	   ……	   ……	   ……
 合  计	……	    ……	   ……	   ……	   ……
          会计           复核            制表
打印时涉及到两个表,总帐表和总帐信息表,其数据结构如下:
总帐表名zzb                     总帐信息表zzxxb
字段名 类型    说      明        字段名   类型    说      明
rq     char(8)   日期              kmdm   char(4)   科目代码
kmdm  char(4)   科目代码          kmmc   char(4)   科目名称
jffse   n(16.2)   借方发生额
dffse  n(16.2)   贷方发生额
jfye   n(16.2)   借方余额
dfye   n(16.2)   贷方余额
用foxbase2.1编写的打印程序如下:
bt="中国人民银行XX分行日计表"
workdate=”19980601”
use zzb
copy to temp for rq=workdate
close databases
sele 2
use zzxxb
sele 1
use temp
set console off
set device to print
@ prow()+1,1 say space(34)+bt
@ prow()+1,1 say space(34)+replicate("━",len(bt))
@ prow()+1,1 say space(40)+ substr (workdate,1,4)+"年"+ substr (workdate,5,2)+"月"+ substr (workdate,7,2)+"日"
@ prow()+1,1 say "┌────┬────────────┬───────────────┬───────────────┐"
@ prow()+1,1 say "│        │                        │?  发       生        额     │      余              额      │"
@ prow()+1,1 say "│科目代码│    科  目  名  称      ├───────┬───────┼───────┬───────┤"
@ prow()+1,1 say "│        │                        │   借     方  │  贷      方  │  借     方   │ 贷      方   │"
@ prow()+1,1 say "├────┼────────────┼───────┼───────┼───────┼───────┤"
do while .not.eof()
   a1=a->kmdm
   sele 2
   find a1
   a2=b->kmmc
   sele 1
   if jffse <>0.00 then
     	a3=str(jffse,14,2)
		a3=space(14 - len(a3))+a3
	else
		a3=space(14)
	end if
	if dffse <>0.00 then
		a4=str(dffse,14,2)
		a4=space(14 - len(a4))+a4
	else
		a4=space(14)
	end if
	if jfye <>0.00 then
		a5=str(jfye,14,2)
		a5=space(14 - len(a5))+a5
	else
		a5=space(14)
	end if
	if dfye <>0.00 then
		a6=str(dfye ,14,2)
		a6=space(14 - len(a6))+a6
	else
		a6=space(14)
	end if
	@ prow()+1,1 say "│"+a1+"│"+a2+"│"+a3+"│"+a4+"│"+a5+"│"+a6+"│"
	@ prow()+1,1 say "├────┼────────────┼───────┼───────┼───────┼───────┤"
    skip
enddo
sum jffse,dffse,jfye,dfye to b3,b4,b5,b6
if b3<>0.00 then
    	a3=str(b3,14,2)
	a3=space(14 - len(a3))+a3
else
	a3=space(14)
end if
if b4<>0.00 then
   a4=str(b4,14,2)
   a4=space(14 - len(a4))+a4
else
   a4=space(14)
end if
if b5<>0.00 then
   a5=str(b5,14,2)
   a5=space(14 - len(a5))+a5
else
   a5=space(14)
end if
if b6<>0.00 then
   a6=str(b6 ,14,2)
   a6=space(14 - len(a6))+a6
else
  a6=space(14)
end if
@ prow()+1,1 say "│"+space(4)+"│合     计│"+a3+"│"+a4+"│"+a5+"│"+a6+"│"
@ prow()+1,1 say "└────┴────────────┴───────┴───────┴───────┴───────┘"
@ prow()+1,1 say "         会计:           复核:                    制表:"
set print off
set console on
delete file temp.dbf
close databases
用PowerBuilder5.0编写的打印脚本如下:
string bt,a1,a2,a3,a4,a5,a6,workdate=”19980601”
dec b3,b4,b5,b6,jffse,dffse,jfye,dfye
long prt
declare cur_kmrjb cursor for
	select kmdm,jffse,dffse,jfye,dfye from zzb where rq=:workdate;
prt=printopen()
bt="中国人民银行XX分行日计表"
print(prt,1,space(34)+bt)
print(prt,1,space(34)+fill("━",len(bt)))
print(prt,1,space(40)+mid(workdate,1,4)+"年"+mid(workdate,5,2)+"月"+mid(workdate,7,2)+"日")
print(prt,1,"┌────┬────────────┬───────────────┬───────────────┐")
print(prt,1,"│        │                        │?  发       生        额     │      余              额      │")
print(prt,1,"│科目代码│    科  目  名  称      ├───────┬───────┼───────┬───────┤")
print(prt,1,"│        │                        │   借     方  │  贷      方  │  借     方   │ 贷      方   │")
print(prt,1,"├────┼────────────┼───────┼───────┼───────┼───────┤")
open cur_kmrjb;
do 
  	fetch cur_kmrjb into :a1, :jffse,:dffse,:jfye,:dfye;
	sqlflag=sqlca.sqlcode;
	if sqlflag<>0 then	exit
	select kmmc into :a2 from zzxxb where kmdm=:a1;
	if jffse <>0.00 then
     	a3=string(jffse,'###,###.00')
		a3=space(14 - len(a3))+a3
	else
		a3=space(14)
	end if
	if dffse <>0.00 then
		a4= string(dffse,'###,###.00')
		a4=space(14 - len(a4))+a4
	else
		a4=space(14)
	end if
	if jfye <>0.00 then
		a5=string(jfye,'###,###.00')
		a5=space(14 - len(a5))+a5
	else
		a5=space(14)
	end if
	if dfye <>0.00 then
		a6=string(dfye ,'###,###.00')
		a6=space(14 - len(a6))+a6
	else
		a6=space(14)
	end if
	print(prt,1,"│"+a1+"│"+a2+"│"+a3+"│"+a4+"│"+a5+"│"+a6+"│")
	print(prt,1,"├────┼────────────┼───────┼───────┼───────┼───────┤")
next	
close cur_kmrjb;
select sum(jffse),sum(dffse),sum(jfye),sum(dfye) into :b3,:b4,:b5,:b6
	from zzb where rq=:workdate;
if b3<>0.00 then
    	a3= string(b3,'###,###.00')
	a3=space(14 - len(a3))+a3
else
	a3=space(14)
end if
if b4<>0.00 then
   a4= string(b4,'###,###.00')
   a4=space(14 - len(a4))+a4
else
   a4=space(14)
end if
if b5<>0.00 then
   a5= string(b5,'###,###.00')
   a5=space(14 - len(a5))+a5
else
   a5=space(14)
end if
if b6<>0.00 then
   a6= string(b6,'###,###.00')
   a6=space(14 - len(a6))+a6
else
  a6=space(14)
end if
print(prt,1,"│"+space(4)+"│合     计│"+a3+"│"+a4+"│"+a5+"│"+a6+"│")
print(prt,1,"└────┴────────────┴───────┴───────┴───────┴───────┘")
print(prt,1,"          会计:            复核:                        制表:")
printclose(prt)