123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461 |
- $PBExportHeader$w_billstyle_import.srw
- forward
- global type w_billstyle_import from window
- end type
- type sle_filename_in from singlelineedit within w_billstyle_import
- end type
- type cb_1 from commandbutton within w_billstyle_import
- end type
- type cb_exit from commandbutton within w_billstyle_import
- end type
- type cb_import from commandbutton within w_billstyle_import
- end type
- type cb_ch from commandbutton within w_billstyle_import
- end type
- type sle_filename_out from singlelineedit within w_billstyle_import
- end type
- type cb_export from commandbutton within w_billstyle_import
- end type
- type gb_1 from groupbox within w_billstyle_import
- end type
- type gb_2 from groupbox within w_billstyle_import
- end type
- end forward
- global type w_billstyle_import from window
- integer x = 814
- integer y = 864
- integer width = 2304
- integer height = 900
- boolean titlebar = true
- string title = "单据抬头导入导出"
- boolean controlmenu = true
- windowtype windowtype = response!
- long backcolor = 134217739
- sle_filename_in sle_filename_in
- cb_1 cb_1
- cb_exit cb_exit
- cb_import cb_import
- cb_ch cb_ch
- sle_filename_out sle_filename_out
- cb_export cb_export
- gb_1 gb_1
- gb_2 gb_2
- end type
- global w_billstyle_import w_billstyle_import
- type variables
- BOOLEAN OL_BACKUP=TRUE
- end variables
- on w_billstyle_import.create
- this.sle_filename_in=create sle_filename_in
- this.cb_1=create cb_1
- this.cb_exit=create cb_exit
- this.cb_import=create cb_import
- this.cb_ch=create cb_ch
- this.sle_filename_out=create sle_filename_out
- this.cb_export=create cb_export
- this.gb_1=create gb_1
- this.gb_2=create gb_2
- this.Control[]={this.sle_filename_in,&
- this.cb_1,&
- this.cb_exit,&
- this.cb_import,&
- this.cb_ch,&
- this.sle_filename_out,&
- this.cb_export,&
- this.gb_1,&
- this.gb_2}
- end on
- on w_billstyle_import.destroy
- destroy(this.sle_filename_in)
- destroy(this.cb_1)
- destroy(this.cb_exit)
- destroy(this.cb_import)
- destroy(this.cb_ch)
- destroy(this.sle_filename_out)
- destroy(this.cb_export)
- destroy(this.gb_1)
- destroy(this.gb_2)
- end on
- event open;IF Message.DoubleParm = 1 THEN
- OL_BACKUP=FALSE
- END IF
- end event
- type sle_filename_in from singlelineedit within w_billstyle_import
- event key pbm_keydown
- integer x = 133
- integer y = 428
- integer width = 1586
- integer height = 92
- integer taborder = 40
- 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_import.enabled=false
- else
- cb_import.enabled=OL_BACKUP
- end if
- end event
- event modified;if trim(this.text)="" then
- cb_import.enabled=false
- else
- cb_import.enabled=OL_BACKUP
- end if
- end event
- type cb_1 from commandbutton within w_billstyle_import
- integer x = 1719
- integer y = 428
- integer width = 114
- integer height = 92
- 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_import.enabled=OL_BACKUP
- sle_filename_in.text=pathname
- END IF
- end event
- type cb_exit from commandbutton within w_billstyle_import
- integer x = 1838
- integer y = 668
- integer width = 320
- 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_import from commandbutton within w_billstyle_import
- integer x = 1838
- integer y = 428
- integer width = 320
- 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
- datastore ds_setting
- ds_setting = CREATE datastore
- ds_setting.DataObject = 'ds_billstyle_import'
- ds_setting.SetTransObject(sqlca)
- ds_setting.ImportFile(sle_filename_in.Text)
- ds_setting.AcceptText()
- IF ds_setting.RowCount() <= 0 THEN
- MessageBox('提示','你导入的系统单据抬头文件没有数据', Information!, OK! )
- RETURN
- END IF
- Long ll_id_arr[]
- String ls_firststr_arr[]
- String ls_datestyle_arr[]
- String ls_dscrp_arr[]
- Long ll_cnt = 1
- DECLARE cur_billcode CURSOR FOR
- SELECT u_billcode.id,
- u_billcode.firststr,
- u_billcode.datestyle,
- u_billcode.dscrp
- FROM u_billcode
- Where u_billcode.firststr <> ''
- or u_billcode.datestyle <> 'yymmdd';
- OPEN cur_billcode;
- FETCH cur_billcode INTO :ll_id_arr[ll_cnt],
- :ls_firststr_arr[ll_cnt],
- :ls_datestyle_arr[ll_cnt],
- :ls_dscrp_arr[ll_cnt];
-
- DO WHILE sqlca.SQLCode = 0
- ll_cnt++
- FETCH cur_billcode INTO :ll_id_arr[ll_cnt],
- :ls_firststr_arr[ll_cnt],
- :ls_datestyle_arr[ll_cnt],
- :ls_dscrp_arr[ll_cnt];
- LOOP
- CLOSE cur_billcode;
- ll_cnt = ll_cnt - 1
- DELETE FROM u_billcode;
- IF sqlca.SQLCode <> 0 THEN
- MessageBox('错误','删除原系统单据抬头数据失败,'+sqlca.SQLErrText, StopSign!, OK! )
- RETURN
- END IF
- Long ll_i
- Long ll_id
- String ls_firststr
- String ls_datestyle
- String ls_dscrp
- String ls_oldfirststr
- String ls_billstyle
- String ls_win1
- String ls_win2
- String ls_tablename
- String ls_codename
- String ls_module
- FOR ll_i = 1 TO ds_setting.RowCount()
- ll_id = ds_setting.Object.id[ll_i]
- ls_firststr = ds_setting.Object.firststr[ll_i]
- ls_datestyle = ds_setting.Object.datestyle[ll_i]
- ls_dscrp = ds_setting.Object.dscrp[ll_i]
- ls_oldfirststr = ds_setting.Object.oldfirststr[ll_i]
- ls_billstyle = ds_setting.Object.billstyle[ll_i]
- ls_win1 = ds_setting.Object.win1[ll_i]
- ls_win2 = ds_setting.Object.win2[ll_i]
- ls_tablename = ds_setting.Object.tablename[ll_i]
- ls_codename = ds_setting.Object.codename[ll_i]
- ls_module = ds_setting.Object.module[ll_i]
-
- INSERT INTO
- u_billcode(id,
- firststr,
- datestyle,
- dscrp,
- oldfirststr,
- billstyle,
- win1,
- win2,
- tablename,
- codename,
- module)
- VALUES(:ll_id,
- :ls_firststr,
- :ls_datestyle,
- :ls_dscrp,
- :ls_oldfirststr,
- :ls_billstyle,
- :ls_win1,
- :ls_win2,
- :ls_tablename,
- :ls_codename,
- :ls_module);
- IF sqlca.SQLCode <> 0 THEN
- MessageBox('错误','新增系统单据抬头数据失败,'+sqlca.SQLErrText, StopSign!, OK! )
- ROLLBACK;
- RETURN
- END IF
- NEXT
- FOR ll_i = 1 TO ll_cnt
- UPDATE u_billcode
- SET firststr = :ls_firststr_arr[ll_i],
- datestyle = :ls_datestyle_arr[ll_i],
- dscrp = :ls_dscrp_arr[ll_i]
- Where id = :ll_id_arr[ll_i];
- IF sqlca.SQLCode <> 0 THEN
- MessageBox('错误','更新改变系统单据抬头数据失败,'+sqlca.SQLErrText, StopSign!, OK! )
- ROLLBACK;
- RETURN
- END IF
- NEXT
- COMMIT;
- MessageBox('提示','导入系统功能数据成功', Information!, OK! )
- end event
- type cb_ch from commandbutton within w_billstyle_import
- integer x = 1719
- integer y = 128
- integer width = 114
- integer height = 92
- 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_export.enabled=OL_BACKUP
- sle_filename_out.text=pathname
- END IF
- end event
- type sle_filename_out from singlelineedit within w_billstyle_import
- event key pbm_keydown
- integer x = 133
- integer y = 128
- integer width = 1586
- 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_export.enabled=false
- else
- cb_export.enabled=OL_BACKUP
- end if
- end event
- event modified;if trim(this.text)="" then
- cb_export.enabled=false
- else
- cb_export.enabled=OL_BACKUP
- end if
- end event
- type cb_export from commandbutton within w_billstyle_import
- integer x = 1838
- integer y = 128
- integer width = 320
- integer height = 96
- integer taborder = 30
- 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 arg_filename,arg_msg
- blob arg_blob
- arg_filename = trim(sle_filename_out.text)
- if arg_filename = '' then
- messagebox('提示','请输入文件名称', Information!, OK! )
- return
- end if
- if messagebox("询问","是否确定要将单据抬头导出成文件",question!,yesno!,1) = 2 then
- return
- end if
- datastore ds_setting
- ds_setting = create datastore
- ds_setting.dataobject = 'ds_billstyle_import'
- ds_setting.settransobject(sqlca)
- ds_setting.retrieve( )
- if fileexists(arg_filename) then
- if messagebox("询问","指定文件已经存在,是否覆盖该文件?",question!,yesno!,2) = 2 then
- return
- end if
- end if
- if ds_setting.saveas(arg_filename,dbase2!,false) = 1 then
- arg_msg = '数据导出成功!'
- else
- arg_msg = '数据导出失败,如果该文件已打开请先关闭此文件再试!'
- end if
- messagebox('提示',arg_msg, Information!, OK! )
- end event
- type gb_1 from groupbox within w_billstyle_import
- integer x = 73
- integer y = 48
- integer width = 2149
- integer height = 216
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 134217739
- string text = "导出文件路径"
- end type
- type gb_2 from groupbox within w_billstyle_import
- integer x = 73
- integer y = 348
- integer width = 2149
- 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 = 134217739
- string text = "导入文件路径"
- end type
|