$PBExportHeader$w_accset_info.srw forward global type w_accset_info from w_publ_base end type type tab_accsetinfo from tab within w_accset_info end type type tabpage_1 from userobject within tab_accsetinfo end type type dw_1 from datawindow within tabpage_1 end type type tabpage_1 from userobject within tab_accsetinfo dw_1 dw_1 end type type tabpage_2 from userobject within tab_accsetinfo end type type dw_2 from datawindow within tabpage_2 end type type dw_credenceword_index from datawindow within tabpage_2 end type type cb_4 from uo_imflatbutton within tabpage_2 end type type cb_5 from uo_imflatbutton within tabpage_2 end type type tabpage_2 from userobject within tab_accsetinfo dw_2 dw_2 dw_credenceword_index dw_credenceword_index cb_4 cb_4 cb_5 cb_5 end type type tabpage_3 from userobject within tab_accsetinfo end type type em_1 from editmask within tabpage_3 end type type st_2 from statictext within tabpage_3 end type type dw_3 from datawindow within tabpage_3 end type type cb_2 from uo_imflatbutton within tabpage_3 end type type cb_7 from uo_imflatbutton within tabpage_3 end type type tabpage_3 from userobject within tab_accsetinfo em_1 em_1 st_2 st_2 dw_3 dw_3 cb_2 cb_2 cb_7 cb_7 end type type tabpage_4 from userobject within tab_accsetinfo end type type dw_4 from datawindow within tabpage_4 end type type tabpage_4 from userobject within tab_accsetinfo dw_4 dw_4 end type type tab_accsetinfo from tab within w_accset_info tabpage_1 tabpage_1 tabpage_2 tabpage_2 tabpage_3 tabpage_3 tabpage_4 tabpage_4 end type type cb_1 from uo_imflatbutton within w_accset_info end type end forward global type w_accset_info from w_publ_base integer width = 2167 integer height = 1344 string title = "帐套选项" boolean minbox = false long backcolor = 80269524 tab_accsetinfo tab_accsetinfo cb_1 cb_1 end type global w_accset_info w_accset_info type variables datawindow dw1,dw2,dw3,dw4 uo_accset uo_newaccset s_subject_array ins_s_subject datastore ds_initsubject end variables forward prototypes public function integer wf_import_subject (ref string arg_msg) public function integer wf_get_subject (long arg_cropid, ref string arg_msg) end prototypes public function integer wf_import_subject (ref string arg_msg);String ls_filename ds_initsubject = CREATE datastore ds_initsubject.DataObject = "d_subjectdata_import" ds_initsubject.SetTransObject(sqlca) ls_filename = sys_cur_path +'initdata.dbf' IF NOT FileExists ( ls_filename ) THEN arg_msg = '初始化科目失败,没有找到科目文件' RETURN 0 END IF IF ds_initsubject.ImportFile ( ls_filename ) <= 0 THEN arg_msg = '初始化科目失败,导入科目数据失败或文件中没有相应企业的科目' RETURN 0 END IF RETURN 1 end function public function integer wf_get_subject (long arg_cropid, ref string arg_msg);Long rslt = 1,itmxt = 0,i ds_initsubject.SetFilter('croptypeid = '+ String(arg_cropid)) ds_initsubject.Filter( ) IF ds_initsubject.RowCount() > 0 THEN FOR i = 1 To ds_initsubject.RowCount() itmxt++ ins_s_subject.croptypeid[itmxt] = ds_initsubject.Object.croptypeid[i] ins_s_subject.subid[itmxt] = ds_initsubject.Object.subid[i] ins_s_subject.Name[itmxt] = ds_initsubject.Object.Name[i] ins_s_subject.dcflag[itmxt] = ds_initsubject.Object.dcflag[i] ins_s_subject.detailflag[itmxt] = ds_initsubject.Object.detailflag[i] ins_s_subject.hswb[itmxt] = ds_initsubject.Object.hswb[i] ins_s_subject.moneyid[itmxt] = ds_initsubject.Object.moneyid[i] ins_s_subject.hsqty[itmxt] = ds_initsubject.Object.hsqty[i] ins_s_subject.unit[itmxt] = ds_initsubject.Object.unit[i] ins_s_subject.hsdept[itmxt] = ds_initsubject.Object.hsdept[i] ins_s_subject.hsemp[itmxt] = ds_initsubject.Object.hsemp[i] ins_s_subject.hsitem[itmxt] = ds_initsubject.Object.hsitem[i] ins_s_subject.hstrader[itmxt] = ds_initsubject.Object.hstrader[i] ins_s_subject.attrflag[itmxt] = ds_initsubject.Object.attrflag[i] ins_s_subject.specialcode[itmxt] = ds_initsubject.Object.specialcode[i] ins_s_subject.relevantid[itmxt] = ds_initsubject.Object.relevantid[i] IF IsNull(ds_initsubject.Object.relevantid[i]) THEN MessageBox("","") END IF NEXT END IF RETURN rslt end function on w_accset_info.create int iCurrent call super::create this.tab_accsetinfo=create tab_accsetinfo this.cb_1=create cb_1 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.tab_accsetinfo this.Control[iCurrent+2]=this.cb_1 end on on w_accset_info.destroy call super::destroy destroy(this.tab_accsetinfo) destroy(this.cb_1) end on event open;call super::open;Long cnt = 0 String arg_msg uo_newaccset = CREATE uo_accset IF wf_import_subject(arg_msg) = 0 THEN MessageBox(publ_operator, arg_msg) Close(This) END IF SELECT count(*) INTO :cnt From cw_accset; IF sqlca.SQLCode <> 0 THEN cnt = 0 END IF IF cnt = 0 THEN INSERT INTO cw_accset (accsetid,accsetname,step1,step2,step3,step4,step5,step6,ifnewsubid) VALUES (11,'000',4,3,3,3,3,2,1); IF sqlca.SQLCode <> 0 THEN arg_msg = sqlca.SQLErrText ROLLBACK; MessageBox('提示','建立帐套失败,原因:'+arg_msg) ELSE //取科目 IF wf_get_subject(0,arg_msg) = 0 THEN MessageBox(publ_operator,arg_msg) RETURN END IF uo_newaccset.accsetid = 11 IF uo_newaccset.subject_arrray(ins_s_subject,arg_msg,False) = 0 THEN MessageBox(publ_operator,arg_msg) RETURN END IF COMMIT; END IF END IF dw1 = tab_accsetinfo.tabpage_1.dw_1 dw2 = tab_accsetinfo.tabpage_2.dw_2 dw3 = tab_accsetinfo.tabpage_3.dw_3 dw4 = tab_accsetinfo.tabpage_4.dw_4 dw1.SetTransObject(sqlca) dw2.SetTransObject(sqlca) dw3.SetTransObject(sqlca) dw4.SetTransObject(sqlca) tab_accsetinfo.tabpage_2.dw_credenceword_index.SetTransObject(sqlca) dw1.Retrieve(sys_accsetid) dw2.Retrieve(sys_accsetid) tab_accsetinfo.tabpage_3.cb_2.TriggerEvent(Clicked!) //retrieve dw3) Int li_ifstart IF sys_accsetbegin THEN li_ifstart = 1 ELSE li_ifstart = 0 END IF dw4.Retrieve(sys_accsetid,li_ifstart) tab_accsetinfo.tabpage_2.dw_credenceword_index.Retrieve(sys_accsetid) end event event close;call super::close;Destroy uo_accset end event type cb_func from w_publ_base`cb_func within w_accset_info boolean visible = false integer x = 1783 integer y = 1184 boolean enabled = false end type type cb_exit from w_publ_base`cb_exit within w_accset_info integer x = 1120 integer y = 1116 end type type tab_accsetinfo from tab within w_accset_info integer x = 46 integer y = 24 integer width = 2043 integer height = 1068 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 80269524 boolean raggedright = true integer selectedtab = 1 tabpage_1 tabpage_1 tabpage_2 tabpage_2 tabpage_3 tabpage_3 tabpage_4 tabpage_4 end type on tab_accsetinfo.create this.tabpage_1=create tabpage_1 this.tabpage_2=create tabpage_2 this.tabpage_3=create tabpage_3 this.tabpage_4=create tabpage_4 this.Control[]={this.tabpage_1,& this.tabpage_2,& this.tabpage_3,& this.tabpage_4} end on on tab_accsetinfo.destroy destroy(this.tabpage_1) destroy(this.tabpage_2) destroy(this.tabpage_3) destroy(this.tabpage_4) end on type tabpage_1 from userobject within tab_accsetinfo integer x = 18 integer y = 112 integer width = 2007 integer height = 940 long backcolor = 80269524 string text = "企业信息" long tabtextcolor = 33554432 long tabbackcolor = 80269524 string picturename = "Custom092!" long picturemaskcolor = 553648127 dw_1 dw_1 end type on tabpage_1.create this.dw_1=create dw_1 this.Control[]={this.dw_1} end on on tabpage_1.destroy destroy(this.dw_1) end on type dw_1 from datawindow within tabpage_1 integer x = 87 integer y = 40 integer width = 1824 integer height = 876 integer taborder = 30 boolean bringtotop = true string dataobject = "dw_accset_info" boolean border = false boolean livescroll = true end type type tabpage_2 from userobject within tab_accsetinfo integer x = 18 integer y = 112 integer width = 2007 integer height = 940 long backcolor = 80269524 string text = "帐套参数" long tabtextcolor = 33554432 long tabbackcolor = 80269524 string picturename = "EditFuncDeclare!" long picturemaskcolor = 553648127 dw_2 dw_2 dw_credenceword_index dw_credenceword_index cb_4 cb_4 cb_5 cb_5 end type on tabpage_2.create this.dw_2=create dw_2 this.dw_credenceword_index=create dw_credenceword_index this.cb_4=create cb_4 this.cb_5=create cb_5 this.Control[]={this.dw_2,& this.dw_credenceword_index,& this.cb_4,& this.cb_5} end on on tabpage_2.destroy destroy(this.dw_2) destroy(this.dw_credenceword_index) destroy(this.cb_4) destroy(this.cb_5) end on type dw_2 from datawindow within tabpage_2 integer x = 32 integer y = 88 integer width = 1065 integer height = 780 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_accset_info2" boolean border = false boolean livescroll = true end type type dw_credenceword_index from datawindow within tabpage_2 integer x = 1134 integer y = 88 integer width = 594 integer height = 780 integer taborder = 40 boolean bringtotop = true string dataobject = "dw_credenceword_index" boolean livescroll = true borderstyle borderstyle = stylelowered! end type type cb_4 from uo_imflatbutton within tabpage_2 integer x = 1737 integer y = 124 integer width = 233 integer height = 96 integer taborder = 40 boolean bringtotop = true string text = "增加" end type event clicked;long li_row li_row=dw_credenceword_index.insertrow(0) dw_credenceword_index.object.accsetid[li_row]=sys_accsetid end event type cb_5 from uo_imflatbutton within tabpage_2 integer x = 1737 integer y = 224 integer width = 233 integer height = 96 integer taborder = 40 boolean bringtotop = true string text = "删除" end type event clicked;long li_row li_row=dw_credenceword_index.getrow() if li_row=0 then messagebox(publ_operator,'没有可删除凭证字') return end if dw_credenceword_index.deleterow(li_row) end event type tabpage_3 from userobject within tab_accsetinfo integer x = 18 integer y = 112 integer width = 2007 integer height = 940 long backcolor = 80269524 string text = "会计月历" long tabtextcolor = 33554432 long tabbackcolor = 80269524 string picturename = "Custom023!" long picturemaskcolor = 553648127 em_1 em_1 st_2 st_2 dw_3 dw_3 cb_2 cb_2 cb_7 cb_7 end type on tabpage_3.create this.em_1=create em_1 this.st_2=create st_2 this.dw_3=create dw_3 this.cb_2=create cb_2 this.cb_7=create cb_7 this.Control[]={this.em_1,& this.st_2,& this.dw_3,& this.cb_2,& this.cb_7} end on on tabpage_3.destroy destroy(this.em_1) destroy(this.st_2) destroy(this.dw_3) destroy(this.cb_2) destroy(this.cb_7) end on type em_1 from editmask within tabpage_3 integer x = 366 integer y = 48 integer width = 370 integer height = 92 integer taborder = 40 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! string mask = "####" boolean spin = true end type event constructor;IF sys_accsetbegin THEN This.Text = Left(String(sys_curyearmon),4) ELSE IF sys_startyearmon = 0 THEN This.Text = String(Today(),'yyyy') ELSE This.Text = Left(String(sys_startyearmon),4) END IF END IF end event event modified;cb_2.triggerevent(clicked!) end event type st_2 from statictext within tabpage_3 integer x = 82 integer y = 68 integer width = 283 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 boolean enabled = false string text = "会计年度:" alignment alignment = right! boolean focusrectangle = false end type type dw_3 from datawindow within tabpage_3 integer x = 841 integer y = 12 integer width = 1015 integer height = 916 integer taborder = 30 boolean bringtotop = true string dataobject = "dw_accset_info3" boolean livescroll = true borderstyle borderstyle = stylelowered! end type type cb_2 from uo_imflatbutton within tabpage_3 integer x = 741 integer y = 48 integer width = 91 integer height = 92 integer taborder = 50 boolean bringtotop = true string text = ".." end type event clicked;dw_3.retrieve(sys_accsetid,long(em_1.text)) end event type cb_7 from uo_imflatbutton within tabpage_3 integer x = 430 integer y = 156 integer width = 384 integer height = 92 integer taborder = 50 boolean bringtotop = true string text = "重新生成月历" end type event clicked;Long next_y,ll_cnt_next_y s_calendar s_calendar_array[] String arg_msg IF MessageBox (publ_operator,"是否确定要重置月历?(选择确定后先删除原月历,再重新生成新的月历)",Question!,YesNo! ) = 2 THEN RETURN END IF next_y = Long(Left(em_1.Text,4)) DELETE FROM cw_calendar Where accsetid = :sys_accsetid; IF sqlca.SQLCode <> 0 THEN arg_msg = sqlca.SQLErrText ROLLBACK; MessageBox('提示','删除原月历失败,'+arg_msg) RETURN END IF f_init_calendar_array(next_y,s_calendar_array[]) Long k FOR k = 1 TO UpperBound(s_calendar_array) INSERT INTO cw_calendar(accsetid,cmonth,sdate,edate) Values(:sys_accsetid,:s_calendar_array[k].cmonth,:s_calendar_array[k].sdate,:s_calendar_array[k].edate); IF sqlca.SQLCode <> 0 THEN arg_msg = String(s_calendar_array[k].cmonth)+',加入新月历失败,'+sqlca.SQLErrText ROLLBACK; MessageBox('提示',arg_msg) RETURN END IF NEXT COMMIT; MessageBox('提示','操作完成') //日志 String ls_code ls_code = publ_operator f_setsysoplog('重置月历','重置月历,用户:'+ls_code,arg_msg,TRUE) //-- cb_2.TriggerEvent(Clicked!) end event type tabpage_4 from userobject within tab_accsetinfo integer x = 18 integer y = 112 integer width = 2007 integer height = 940 long backcolor = 80269524 string text = "凭证选项" long tabtextcolor = 33554432 long tabbackcolor = 80269524 string picturename = "Start!" long picturemaskcolor = 553648127 dw_4 dw_4 end type on tabpage_4.create this.dw_4=create dw_4 this.Control[]={this.dw_4} end on on tabpage_4.destroy destroy(this.dw_4) end on type dw_4 from datawindow within tabpage_4 integer x = 233 integer y = 104 integer width = 1330 integer height = 736 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_accset_info4" boolean border = false boolean livescroll = true end type type cb_1 from uo_imflatbutton within w_accset_info integer x = 617 integer y = 1116 integer width = 311 integer height = 96 integer taborder = 30 boolean bringtotop = true string normalpicname = "ok.bmp" end type event clicked;String ls_errmsg dw1.AcceptText() IF dw1.UPDATE() = -1 THEN ls_errmsg = "因为网络或其他原因>"+sqlca.SQLErrText ROLLBACK; MessageBox (publ_operator,ls_errmsg+",保存企业信息操作失败!",Exclamation!,OK!) RETURN END IF dw2.AcceptText() IF dw2.UPDATE() = -1 THEN ls_errmsg = "因为网络或其他原因>"+sqlca.SQLErrText ROLLBACK; MessageBox (publ_operator,ls_errmsg+",保存帐套代号信息操作失败!",Exclamation!,OK!) RETURN END IF tab_accsetinfo.tabpage_2.dw_credenceword_index.AcceptText() IF tab_accsetinfo.tabpage_2.dw_credenceword_index.UPDATE() = -1 THEN ls_errmsg = "因为网络或其他原因>"+sqlca.SQLErrText ROLLBACK; MessageBox (publ_operator,ls_errmsg+",保存帐套参数操作失败!",Exclamation!,OK!) RETURN END IF dw3.AcceptText() IF dw3.UPDATE() = -1 THEN ls_errmsg = "因为网络或其他原因>"+sqlca.SQLErrText ROLLBACK; MessageBox (publ_operator,ls_errmsg+",保存会计月历操作失败!",Exclamation!,OK!) RETURN END IF dw4.AcceptText() IF dw4.UPDATE() = -1 THEN ls_errmsg = "因为网络或其他原因>"+sqlca.SQLErrText ROLLBACK; MessageBox (publ_operator,ls_errmsg+",保存凭证选项操作失败!",Exclamation!,OK!) RETURN END IF IF NOT sys_accsetbegin THEN s_calendar l_s_calendar[] Long arg_year String arg_msg arg_year = dw4.Object.startyear[1] f_init_calendar_array(arg_year,l_s_calendar[]) DELETE FROM cw_calendar Where accsetid = :sys_accsetid; IF sqlca.SQLCode <> 0 THEN ls_errmsg = "因为网络或其他原因>"+sqlca.SQLErrText ROLLBACK; MessageBox (publ_operator,ls_errmsg+",删除原日历操作失败!",Exclamation!,OK!) RETURN END IF uo_accset uo_newaccset uo_newaccset = CREATE uo_accset uo_newaccset.accsetid = sys_accsetid IF uo_newaccset.new_calendar(l_s_calendar[],arg_msg,FALSE) = 0 THEN MessageBox(publ_operator,arg_msg) RETURN END IF DESTROY uo_newaccset END IF COMMIT; MessageBox(publ_operator,'帐套选项保存成功,系统将退出,请重新进入系统') HALT end event