$PBExportHeader$w_subject_import.srw forward global type w_subject_import from window end type type cb_exit from commandbutton within w_subject_import end type type cb_backup from commandbutton within w_subject_import end type type cb_ch from commandbutton within w_subject_import end type type sle_filename from singlelineedit within w_subject_import end type type gb_1 from groupbox within w_subject_import end type end forward global type w_subject_import from window integer x = 814 integer y = 864 integer width = 2231 integer height = 528 boolean titlebar = true string title = "导入会计科目" boolean controlmenu = true boolean minbox = true windowtype windowtype = popup! long backcolor = 134217739 boolean center = true cb_exit cb_exit cb_backup cb_backup cb_ch cb_ch sle_filename sle_filename gb_1 gb_1 end type global w_subject_import w_subject_import type variables BOOLEAN OL_BACKUP=TRUE end variables on w_subject_import.create this.cb_exit=create cb_exit this.cb_backup=create cb_backup this.cb_ch=create cb_ch this.sle_filename=create sle_filename this.gb_1=create gb_1 this.Control[]={this.cb_exit,& this.cb_backup,& this.cb_ch,& this.sle_filename,& this.gb_1} end on on w_subject_import.destroy destroy(this.cb_exit) destroy(this.cb_backup) destroy(this.cb_ch) destroy(this.sle_filename) destroy(this.gb_1) end on event open;IF Message.DoubleParm = 1 THEN OL_BACKUP=FALSE END IF end event type cb_exit from commandbutton within w_subject_import integer x = 1266 integer y = 308 integer width = 311 integer height = 96 integer taborder = 80 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "退出" end type event clicked;close(parent) end event type cb_backup from commandbutton within w_subject_import integer x = 576 integer y = 308 integer width = 311 integer height = 96 integer taborder = 50 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" boolean enabled = false string text = "导入" end type event clicked;IF NOT sys_power_issuper THEN MessageBox('提示','你没有使用权限!',information!,OK!) RETURN END IF String ls_msg datastore ds_tmp ds_tmp = CREATE datastore ds_tmp.DataObject = 'dw_subject_import' ds_tmp.SetTransObject(sqlca) ds_tmp.ImportFile(sle_filename.Text) ds_tmp.AcceptText() IF ds_tmp.RowCount() <= 0 THEN MessageBox('提示','你导入的帐套会计科目文件没有数据',information!,OK!) RETURN END IF DELETE FROM cw_subject; IF sqlca.SQLCode <> 0 THEN ls_msg = sqlca.SQLErrText ROLLBACK; MessageBox('错误','删除原帐套会计科目数据失败,'+ls_msg,stopsign!,OK!) RETURN END IF IF ds_tmp.UPDATE() = -1 THEN ROLLBACK; MessageBox ("错误","保存操作失败!",stopsign!,ok!) RETURN ELSE COMMIT; MessageBox('提示','导入帐套会计科目成功',information!,OK!) RETURN END IF end event type cb_ch from commandbutton within w_subject_import integer x = 1975 integer y = 112 integer width = 137 integer height = 84 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "..." end type event clicked;//new Integer i String Pathname,Filename i = GetFileSaveName("选择备份文件",Pathname,Filename,"Dbf","数据文件Dbf,*.Dbf") IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN cb_backup.Enabled = OL_BACKUP sle_filename.Text = Pathname END IF end event type sle_filename from singlelineedit within w_subject_import event key pbm_keydown integer x = 101 integer y = 112 integer width = 1870 integer height = 92 integer taborder = 10 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type event key;if trim(this.text)="" then cb_backup.enabled=false else cb_backup.enabled=OL_BACKUP end if end event event modified;if trim(this.text)="" then cb_backup.enabled=false else cb_backup.enabled=OL_BACKUP end if end event type gb_1 from groupbox within w_subject_import integer x = 64 integer y = 36 integer width = 2089 integer height = 228 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 string text = "导入文件路径" end type