书城管理价值链会计发展研究
4865700000032

第32章 价值链会计信息交换系统开发案例(3)

////初始化各数据窗口的数据:

dw_b.settrans( sqlca )//设置机构部门表的数据库连接事务对象

dw_b.retrieve( )//更新并显示机构部门表数据

dw_i.settrans( sqlca ) //设置会计科目表的数据库连接事务对象

dw_i.retrieve( ) //更新并显示会计科目表数据

dw_e.settrans( sqlca ) //设置费用预算类别表的数据库连接事务对象

dw_e.retrieve( ) //更新并显示费用预算类别表数据

dw_p.settrans( sqlca ) //设置往来个人表的数据库连接事务对象

dw_p.retrieve( ) //更新并显示往来个人表数据

dw_pz.settrans( sqlca ) //设置记账凭证表的数据库连接事务对象

dw_pz.retrieve( ) //更新并显示记账凭证表数据

dw_pz0.settransobject( sqlca ) //为凭证目录数据窗口设置记账凭证表的数据库连接事务对象

dw_pz0.setsqlselect(″SELECT distinct fipz.pzdate, fipz.yue, fipz.pztype, fipz.number, fipz.zdy FROM fipz ″) //设置凭证目录数据窗口取数语句

dw_pz0.retrieve( ) //按上述语句更新并显示记账凭证表数据

////初始化各数据窗口的数据结束。

disconnect using sqlca; //断开数据库连接

////设置凭证详细窗口的显示过滤条件

string filterexp=″″ //用于以下保存过滤条件字符串

//开始设置凭证过滤条件:以下以condition_为前缀的都是系统事先定义的全局变量,用以保存

//用户选择的各种查询条件选项

if not( isnull(condition_yue) or condition_yue=″″ ) then //加入凭证编号限制

filterexp=″yue=″+condition_yue+″″

else

filterexp=″ 1=1 ″

end if

if not (isnull(condition_type) or condition_type=″″ ) then &

filterexp=filterexp+″ and pztype="″+condition_type+″″//加入凭证类型限制

if not (isnull(condition_ns) or condition_ns=″″ ) then &

filterexp=filterexp+″ and number 〉=″+condition_ns+″″ //加入起始凭证编号限制

if not (isnull(condition_ne) or condition_ne=″″ ) then &

filterexp=filterexp+″ and number 〈=″+condition_ne+″″ //加入结束凭证编号限制

if not (isnull(condition_bs) or condition_bs=″″ ) then &

filterexp=filterexp+″ and bnumber=″+condition_bs+″″ //加入部门编号限制

if not (isnull(condition_is) or condition_is=″″ ) then &

filterexp=filterexp+″ and inumber 〉=″+condition_is+″″//加入起始科目编号限制

if not (isnull(condition_ie) or condition_ie=″″ ) then &

filterexp=filterexp+″ and inumber 〈=″+condition_ie+″″//加入结束科目编号限制

if not (isnull(condition_es) or condition_es=″″ ) then &

filterexp=filterexp+″ and enumber=″+condition_es+″″ //加入费用预算类别编号限制

if not (isnull(condition_ps) or condition_ps=″″ ) then &

filterexp=filterexp+″ and pnumber=″+condition_ps+″″ //加入个人编号限制

if not (isnull(condition_jmin) or condition_jmin=0 ) then &

filterexp=filterexp+″ and jje 〉=″+string(condition_jmin ) //加入借方最小金额限制

if not (isnull(condition_jmax) or condition_jmax=0 ) then &

filterexp=filterexp+″ and jje 〈=″+string(condition_jmax) //加入借方最大金额限制

if not (isnull(condition_dmin) or condition_dmin=0 ) then &

filterexp=filterexp+″ and dje 〉=″+string(condition_dmin ) //加入贷方最小金额限制

if not (isnull(condition_dmax) or condition_dmax=0 ) then &

filterexp=filterexp+″ and dje 〈=″+string(condition_dmax) //加入贷方最大金额限制

dw_pz0.setfilter(filterexp)

////设置凭证目录窗口的显示过滤条件结束

dw_pz0.filter() //对凭证目录窗口进行过滤处理

dw_pz0.setsort(″yue+pztype+number″) //对凭证目录窗口设置排序条件

dw_pz0.sort() //对凭证目录窗口进行排序处理

dw_pz.setsort(″id″)//对凭证详细窗口设置排序条件

dw_pz.sort() //对凭证详细窗口进行排序处理

string pznumber0, expensecompanyperson

long row0, row1

////判断是否存在有效数据:

if dw_pz0.rowcount() 〉 0 then

pznumber0=dw_pz0.getitemstring(1,″yue″)+&

dw_pz0.getitemstring(1,″pztype″)+dw_pz0.getitemstring(1,″number″)

else

messagebox(″提示!″,″没有符合条件的凭证,请重新给定查询条件!″)

close(this)

open(w_kj1_pzselect)

return

end if

////判断结束。

//设置凭证详细数据窗口过滤条件,仅允许显示当前凭证

dw_pz.setfilter(″left(id,7)="″+pznumber0+″"″)

dw_pz.filter()

////更新窗口当前显示的内容

row0=1

ddlb_1.text=dw_pz.getitemstring(row0,″pztype″)//更新凭证类别显示

em_date.text=string(dw_pz.getitemdatetime(row0,″pzdate″),″yyyy-mm-dd″)//更新凭证时间显示

em_bill.text=string(dw_pz.getitemnumber(row0,″bill″))//更新凭证类别显示

st_number.text=dw_pz.getitemstring(row0,″number″)//更新凭证编号显示

st_user.text=dw_pz.getitemstring(row0,″zdy″)//更新制单员显示

st_shy.text=dw_pz.getitemstring(row0,″shy″)//更新审核员显示

st_jzy.text=dw_pz.getitemstring(row0,″jzy″)//更新记账员显示

pagesum=dw_pz0.rowcount()//提取凭证行数

st_pagesum.text=string(pagesum) //更新凭证行数显示

st_pageno.text=″1″//置当前凭证页面的页码为“1”

//更新凭证页面显示

row0=1

dw_1.reset()//清空凭证页面窗口

do while row0 〈=dw_pz.rowcount() //逐行循环更新

expensecompanyperson=″″

row1=dw_1.insertrow(0)//在页面窗口中插入一个空行

dw_1.setitem(row1,″zy″,dw_pz.getitemstring(row0,″note″))//填入摘要

dw_1.setitem(row1,″zh″,dw_pz.getitemstring(row0,″bnumber″)+&

dw_pz.getitemstring(row0,″inumber″))//填入编号

dw_1.setitem(row1,″zhname″,dw_pz.getitemstring(row0,″bnumber″)+&

dw_pz.getitemstring(row0,″inumber″)+″″+dw_pz.getitemstring+&

(row0,″bname″)″.″+dw_pz.getitemstring(row0,″iname″))//填入帐号

dw_1.setitem(row1,″branch″,dw_pz.getitemstring(row0,″bnumber″))//填入部门代码

dw_1.setitem(row1,″item″,dw_pz.getitemstring(row0,″inumber″))//填入科目代码

dw_1.setitem(row1,″person″,dw_pz.getitemstring(row0,″pnumber″))//填入个人代码

dw_1.setitem(row1,″branchname″,dw_pz.getitemstring(row0,″bname″))//填入部门名称

dw_1.setitem(row1,″itemname″,dw_pz.getitemstring(row0,″iname″))//填入科目名称

dw_1.setitem(row1,″personname″,dw_pz.getitemstring(row0,″pname″))//填入个人姓名

dw_1.setitem(row1,″expensename″,dw_pz.getitemstring(row0,″ename″))//填入费用预算类别

ifnotisnull(dw_pz.getitemstring(row0,″ename″))then&

expensecompanyperson=expensecompanyperson+&

dw_pz.getitemstring(row0,″enumber″)+″.″&

+dw_pz.getitemstring(row0,″ename″)

dw_1.setitem(row1,″expense″,expensecompanyperson)//填入往来单位

dw_1.setitem(row1,″jje″,dw_pz.getitemnumber(row0,″jje″))//填入借方金额

dw_1.setitem(row1,″dje″,dw_pz.getitemnumber(row0,″dje″))//填入贷方单位

row0=row0+1

loop

dw_1.setrow(2)

dw_1.setrow(1)

validrow=dw_1.rowcount()

w_fimain.hide()

tab_1.tabpage_1.em_1.text=condition_yue

tab_1.tabpage_1.em_2.text=condition_ns

tab_1.tabpage_1.em_3.text=condition_ne

//装入已保存的转换文件路径和文件名

long filepointer

string readstring,ufservername,ufsapassword

if fileexists(getcurrentdirectory()+″\fibank_uffile.ini″) then

filepointer=FileOpen( getcurrentdirectory()+″\fibank_uffile.ini″, LineMode!, Read! )

do while fileread(filepointer,readstring) 〈〉-100

if left(readstring,7)=″path=″ then ufservername=trim(mid(readstring,8))

if left(readstring,11)=″filename=″ then ufsapassword=trim(mid(readstring,12))

loop

tab_1.tabpage_1.sle_1.text=ufservername

tab_1.tabpage_1.sle_2.text=ufsapassword

fileclose(filepointer)

end if

2.窗口对象尺寸变化(resize)事件的代码设计:要求当窗口大小变动时,窗口本身及其中的所有可视对象的位置和大小呈合理的随动。

if newwidth 〈 3584then

this.width=3584

end if

if newheight 〈 2123 then

this.height=2123

end if

dw_pz0.width=this.width-tab_1.width-200

dw_1.width=this.width-105

dw_pz0.height=this.height-550-dw_1.height

dw_1.y=dw_pz0.y+dw_pz0.height+220

st_user.y=dw_pz0.y+dw_pz0.height+100

st_shy.y=dw_pz0.y+dw_pz0.height+100

st_jzy.y=dw_pz0.y+dw_pz0.height+100

ddlb_1.y=dw_pz0.y+dw_pz0.height+100