$PBExportHeader$w_fj_bill_mng_imexport.srw forward global type w_fj_bill_mng_imexport from w_publ_base end type type sle_filename from singlelineedit within w_fj_bill_mng_imexport end type type cb_1 from uo_imflatbutton within w_fj_bill_mng_imexport end type type cb_import from uo_imflatbutton within w_fj_bill_mng_imexport end type type cb_export from uo_imflatbutton within w_fj_bill_mng_imexport end type type sle_filename1 from singlelineedit within w_fj_bill_mng_imexport end type type cb_2 from uo_imflatbutton within w_fj_bill_mng_imexport end type type gb_1 from groupbox within w_fj_bill_mng_imexport end type type gb_2 from groupbox within w_fj_bill_mng_imexport end type end forward global type w_fj_bill_mng_imexport from w_publ_base integer width = 2235 integer height = 760 string title = "导入导出单据附件分类" boolean minbox = false windowtype windowtype = response! long backcolor = 67108864 sle_filename sle_filename cb_1 cb_1 cb_import cb_import cb_export cb_export sle_filename1 sle_filename1 cb_2 cb_2 gb_1 gb_1 gb_2 gb_2 end type global w_fj_bill_mng_imexport w_fj_bill_mng_imexport type variables end variables on w_fj_bill_mng_imexport.create int iCurrent call super::create this.sle_filename=create sle_filename this.cb_1=create cb_1 this.cb_import=create cb_import this.cb_export=create cb_export this.sle_filename1=create sle_filename1 this.cb_2=create cb_2 this.gb_1=create gb_1 this.gb_2=create gb_2 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.sle_filename this.Control[iCurrent+2]=this.cb_1 this.Control[iCurrent+3]=this.cb_import this.Control[iCurrent+4]=this.cb_export this.Control[iCurrent+5]=this.sle_filename1 this.Control[iCurrent+6]=this.cb_2 this.Control[iCurrent+7]=this.gb_1 this.Control[iCurrent+8]=this.gb_2 end on on w_fj_bill_mng_imexport.destroy call super::destroy destroy(this.sle_filename) destroy(this.cb_1) destroy(this.cb_import) destroy(this.cb_export) destroy(this.sle_filename1) destroy(this.cb_2) destroy(this.gb_1) destroy(this.gb_2) end on type cb_func from w_publ_base`cb_func within w_fj_bill_mng_imexport boolean visible = false end type type cb_exit from w_publ_base`cb_exit within w_fj_bill_mng_imexport integer x = 1824 integer y = 552 integer width = 325 end type type sle_filename from singlelineedit within w_fj_bill_mng_imexport integer x = 91 integer y = 116 integer width = 1586 integer height = 92 integer taborder = 30 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type cb_1 from uo_imflatbutton within w_fj_bill_mng_imexport integer x = 1701 integer y = 116 integer width = 114 integer height = 96 integer taborder = 40 boolean bringtotop = true string text = "..." end type event clicked;call super::clicked; integer i string pathname string filename i = getfilesavename("选择文件",pathname,filename,"Dbf","数据文件Dbf,*.Dbf") if i = 1 and trim(pathname) <> "" and trim(filename) <> "" then parent.sle_filename.text = pathname end if return end event type cb_import from uo_imflatbutton within w_fj_bill_mng_imexport integer x = 1815 integer y = 116 integer width = 325 integer height = 96 integer taborder = 40 boolean bringtotop = true string text = "导入" end type event clicked;call super::clicked;Long ll_i IF NOT sys_power_issuper THEN MessageBox('提示','你没有使用权限!',information!,OK!) RETURN END IF datastore ds_field String arg_filename arg_filename = Trim(sle_filename.Text) IF arg_filename = '' THEN MessageBox('提示','请输入文件名称',information!,OK!) RETURN END IF ds_field = CREATE datastore ds_field.DataObject = 'dw_fileclass' ds_field.SetTransObject(sqlca) ds_field.ImportFile(arg_filename) ds_field.AcceptText() IF ds_field.RowCount() <= 0 THEN MessageBox('提示','你导入的单据附件分类文件没有数据',information!,OK!) RETURN END IF DELETE FROM pbcatcol; IF sqlca.SQLCode <> 0 THEN MessageBox('错误','删除原单据附件分类数据失败,'+sqlca.SQLErrText,stopsign!,OK!) RETURN END IF long ClassID string ClassName string Dscrp long billtype FOR ll_i = 1 TO ds_field.RowCount() ClassID = ds_field.Object.ClassID[ll_i] ClassName = ds_field.Object.ClassName[ll_i] Dscrp = ds_field.Object.Dscrp[ll_i] billtype = ds_field.Object.billtype[ll_i] INSERT INTO u_fileclass( ClassID , ClassName , Dscrp, billtype ) VALUES( :ClassID , :ClassName , :Dscrp, :billtype ); IF sqlca.SQLCode <> 0 THEN MessageBox('错误','导入单据附件分类数据失败,'+sqlca.SQLErrText,stopsign!,OK!) RETURN END IF NEXT COMMIT; MessageBox('提示','导入单据附件分类数据成功',information!,OK!) end event type cb_export from uo_imflatbutton within w_fj_bill_mng_imexport integer x = 1815 integer y = 368 integer width = 325 integer height = 96 integer taborder = 40 boolean bringtotop = true string text = "导出" end type event clicked;call super::clicked; string arg_filename,arg_msg blob arg_blob arg_filename = trim(sle_filename1.text) if arg_filename = '' then messagebox('提示','请输入文件名称',information!,OK!) return end if if messagebox("询问","是否确定要将单据附件分类导出成文件",question!,yesno!,1) = 2 then return end if datastore ds_field ds_field = create datastore ds_field.dataobject = 'dw_fileclass' ds_field.settransobject(sqlca) ds_field.retrieve(-1) if fileexists(arg_filename) then if messagebox("询问","指定文件已经存在,是否覆盖该文件?",question!,yesno!,2) = 2 then return end if end if if ds_field.saveas(arg_filename,dBASE3!,false) = 1 then arg_msg = '数据导出成功!' else arg_msg = '数据导出失败,如果该文件已打开请先关闭此文件再试!' end if messagebox('提示',arg_msg,information!,OK!) end event type sle_filename1 from singlelineedit within w_fj_bill_mng_imexport integer x = 91 integer y = 368 integer width = 1586 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! end type type cb_2 from uo_imflatbutton within w_fj_bill_mng_imexport integer x = 1701 integer y = 368 integer width = 114 integer height = 96 integer taborder = 50 boolean bringtotop = true string text = "..." end type event clicked;call super::clicked; integer i string pathname string filename i = getfilesavename("选择文件",pathname,filename,"Dbf","数据文件Dbf,*.Dbf") if i = 1 and trim(pathname) <> "" and trim(filename) <> "" then parent.sle_filename1.text = pathname end if return end event type gb_1 from groupbox within w_fj_bill_mng_imexport integer x = 59 integer y = 48 integer width = 2107 integer height = 216 integer taborder = 10 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 79741120 string text = "导入文件路径" end type type gb_2 from groupbox within w_fj_bill_mng_imexport integer x = 59 integer y = 300 integer width = 2107 integer height = 216 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 79741120 string text = "导出文件路径" end type