filepointer=FileOpen( getcurrentdirectory()+&
″\fibank_ufserver.ini″, LineMode!, write!, &
LockReadWrite!, Replace!)
ufservername=″server=″+trim(sle_2.text)
ufsapassword=″password=″+trim(sle_3.text)
ufdatabasename=″databasename=ufdata_″+trim(sle_1.text)+″_″+currentyear
filewrite(filepointer, ufservername)
filewrite(filepointer, ufsapassword)
filewrite(filepointer, ufdatabasename)
fileclose(filepointer)
messagebox(″用友!″,"连接用友数据库服务器成功,+&
并已保存连接参数!")
end if
disconnect using sqlyear;
destroy sqlyear
二 凭证转换窗口的数据窗口设计
本程序有一个主要的数据窗口,用以支持“读取记账凭程序”程序窗口和“记账凭证转换程序”程序窗口的数据窗口对象。该数据窗口设计内容如下:
1.数据窗口名称:dw_pzold;
2.数据源(SQL语句):SELECT fipz.pzdate, fipz.yue, fipz.pztype, fipz.number, fipz.zdy FROM fipz;
3.源代码:
release 9;
datawindow(units=0 timer_interval=1 color=134217752 &
processing=1 HTMLDW=noprint.printername=″″ &
print.documentname=″″ print.orientation=0 print.margin&
.left=110print.margin.right=110 print.margin.top=96 &
print.margin.bottom=96 print.paper.source=0 &
print.paper.size=0 print.canusedefaultprinter=yes &
print.prompt=no print.buttons=no print.preview.buttons=no &
print.cliptext=no print.overrideprintjob=no print.collate=yes&
hidegrayline=no grid.lines=0 )
header(height=92 color=″536870912″ )
summary(height=0 color=″536870912″ )
footer(height=0 color=″536870912″ )
detail(height=104 color=″536870912″ )
table(column=(type=datetime update=yes updatewhereclause=yes &
name=pzdatedbname=″fipz.pzdate″ )
column=(type=char(2) update=yes updatewhereclause=yes &
name=yue dbname=″fipz.yue″ )
column=(type=char(1) update=yes updatewhereclause=yes &
name=pztype dbname=″fipz.pztype″ )
column=(type=char(4) update=yes updatewhereclause=yes &
name=number dbname=″fipz.number″ )
column=(type=char(8) update=yes updatewhereclause=yes &
name=zdy dbname=″fipz.zdy″ )
retrieve=″PBSELECT(VERSION(400) TABLE(NAME=~″fipz~″)&
COLUMN(NAME=~″fipz.pzdate~″) &
COLUMN(NAME=~″fipz.yue~″)&
COLUMN(NAME=~″fipz.pztype~″) &
COLUMN(NAME=~″fipz.number~″)&
COLUMN(( (NAME=~″fipz.zdy~″)) ″ )
text(band=header alignment=″2″ text=″制单员″ border=″0″ &
color=″33554432″ x=″1879″ y=″8″ height=″76″ width=″393″&
html.valueishtml=″0″ name=zdy_t visible=″1″ font.face=″Arial″&
font.height=″-12″ font.weight=″400″font.family=″2″ &
font.pitch=″2″ font.charset=″0″ background.mode=″1″ &
background.color=″536870912″ )
text(band=header alignment=″2″ text=″所属月份″ border=″0″ &
color=″33554432″ x=″535″ y=″8″ height=″76″ width=″379″&
html.valueishtml=″0″ name=yue_t visible=″1″ font.face=″Arial″&
font.height=″-12″ font.weight=″400″font.family=″2″ &
font.pitch=″2″ font.charset=″0″ background.mode=″1″ &
background.color=″536870912″ )
text(band=header alignment=″2″ text=″凭证日期″ border=″0″ &
color=″33554432″ x=″9″ y=″8″ height=″76″ width=″517″ &
html.valueishtml=″0″name=pzdate_t visible=″1″ &
font.face=″Arial″ font.height=″-12″ font.weight=″400″ &
font.family=″2″ font.pitch=″2″ font.charset=″0″ &
background.mode=″1″ background.color=″536870912″ )
text(band=header alignment=″2″ text=″凭证类型″ border=″0″ &
color=″33554432″ x=″923″ y=″8″ height=″76″ width=″489″ &
html.valueishtml=″0″name=pztype_t visible=″1″ &
font.face=″Arial″ font.height=″-12″ font.weight=″400″&
font.family=″2″ font.pitch=″2″ font.charset=″0″ &
background.mode=″1″ background.color=″536870912″ )
text(band=header alignment=″2″ text=″凭证编号″ border=″0″ &
color=″33554432″ x=″1422″ y=″8″ height=″76″ width=″448″ &
html.valueishtml=″0″name=number_t visible=″1″&
font.face=″Arial″ font.height=″-12″ font.weight=″400″&
font.family=″2″ font.pitch=″2″ font.charset=″0″ &
background.mode=″1″ background.color=″536870912″ )
column(band=detail id=5 alignment=″2″ tabsequence=50&
border=″0″ color=″33554432″ x=″1879″ y=″8″ &
height=″88″ width=″393″ format=″[general]″ html.valueishtml=″0″&
name=zdy visible=″1″ edit.limit=8 edit.case=any &
edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes &
edit.imemode=0font.face=″Arial″ font.height=″-12″&
font.weight=″400″ font.family=″2″ font.pitch=″2″ font.charset=″0″&
background.mode=″1″ background.color=″536870912″ )
column(band=detail id=2 alignment=″2″ tabsequence=20 &
border=″0″ color=″33554432″ x=″535″ y=″8″ height=″88″ &
width=″379″ format=″[general]″ html.valueishtml=″0″ name=yue&&
visible=″1″ edit.limit=2 edit.case=any edit.focusrectangle=no &
edit.autoselect=yes edit.autohscroll=yes edit.imemode=0&
font.face=″Arial″ font.height=″-12″ font.weight=″400″&
font.family=″2″ font.pitch=″2″ font.charset=″0″ &
background.mode=″1″ background.color=″536870912″ )
column(band=detail id=1 alignment=″0″ tabsequence=10 &
border=″0″ color=″33554432″ x=″9″ y=″8″ height=″88″ &
width=″517″ format=″[shortdate] [time]″ html.valueishtml=″0″ &
name=pzdate visible=″1″ editmask.mask=″yyyy-mm-dd″ &
editmask.imemode=9 editmask.focusrectangle=no&
font.face=″Arial″ font.height=″-12″ font.weight=″400″&
font.family=″2″ font.pitch=″2″ font.charset=″0″ &
background.mode=″1″ background.color=″536870912″ )
column(band=detail id=3 alignment=″2″ tabsequence=30 &
border=″0″ color=″33554432″ x=″923″ y=″8″ height=″88″ &
width=″489″ format=″[general]~tif( pztype=~″1~″, &
~″记账凭证~″,~″会计凭证~″)″ html.valueishtml=″0″&
name=pztype visible=″1″ edit.limit=1 edit.case=any &
edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes &
edit.imemode=9font.face=″Arial″ font.height=″-12″ &
font.weight=″400″ font.family=″2″ font.pitch=″2″ font.charset=″0″&
background.mode=″1″ background.color=″536870912″ )
column(band=detail id=4 alignment=″2″ tabsequence=40 &
border=″0″ color=″33554432″ x=″1422″ y=″8″ height=″88″ &
width=″448″ format=″[general]″ html.valueishtml=″0″&
name=number visible=″1″ edit.limit=4 edit.case=any &
edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes &
edit.imemode=0font.face=″Arial″ font.height=″-12″ &
font.weight=″400″ font.family=″2″ font.pitch=″2″ font.charset=″0″&
background.mode=″1″ background.color=″536870912″ )
htmltable(border=″1″ )
htmlgen(clientevents=″1″ clientvalidation=″1″ &
clientcomputedfields=″1″ clientformatting=″0″ &
clientscriptable=″0″ generatejavascript=″1″ &
encodeselflinkargs=″1″ netscapelayers=″0″ )
export.xml(headgroups=″1″ includewhitespace=″0″ &
metadatatype=0 savemetadata=0 )
import.xml()
export.pdf(method=0 distill.custompostscript=″0″ xslfop.print=″0″ )
三 “读取记账凭证”和“记账凭证转换”程序设计
本系统主要有两个操作窗口:“读取记账凭证程序”和“记账凭证转换”。前者的运行结果所显示的窗口,其功能是读取所需转换的记账凭证,供用户浏览这些凭证,确定它们是否属于本次转换所针对的正确凭证。
记账凭证转换的运行结果所显示的窗口,其功能是转换指定的记账凭证,生成接口数据文件。接口数据文件由用户在下“保存路径”文本框指定存放路径,在“文件名”文本框指定转换后的接口文件的名称(文件类型限定为文本文件“.txt”)。
限于本书篇幅,只列出上述“记账凭证转换”程序窗口的具体设计:
(一) 对象列表
(二) 主要对象的事件代码
1.窗口对象启动(open)事件的代码设计:主要任务是(1)连接数据库;(2)初始化各数据窗口的数据及一些对象的初始值;(3)根据实现指定的筛选条件过滤记账凭证,并显示在窗口中。为了使源程序更具有可读性,以下程序清单加入了大量的注释语句。这些注释语句由“//”引导,无论在句首还是句中,以“//”引导的部分一直到句尾均为注释内容。这些内容在程序中不被执行,只是用以注释说明,供其他技术人员和读者阅读理解。
uf_connectsqlca()//连接数据库
em_date.text=string(today())//置当天日期为默认日期