w_publ_preview_billformatset.srw 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. $PBExportHeader$w_publ_preview_billformatset.srw
  2. forward
  3. global type w_publ_preview_billformatset from w_publ_base
  4. end type
  5. type cb_open from uo_imflatbutton within w_publ_preview_billformatset
  6. end type
  7. type cb_1 from uo_imflatbutton within w_publ_preview_billformatset
  8. end type
  9. type cb_def from uo_imflatbutton within w_publ_preview_billformatset
  10. end type
  11. type cb_del from uo_imflatbutton within w_publ_preview_billformatset
  12. end type
  13. type dw_formatlist from datawindow within w_publ_preview_billformatset
  14. end type
  15. type sle_name from singlelineedit within w_publ_preview_billformatset
  16. end type
  17. type st_1 from statictext within w_publ_preview_billformatset
  18. end type
  19. type gb_1 from groupbox within w_publ_preview_billformatset
  20. end type
  21. end forward
  22. global type w_publ_preview_billformatset from w_publ_base
  23. integer width = 1755
  24. integer height = 1156
  25. string title = "单据格式"
  26. boolean minbox = false
  27. windowtype windowtype = response!
  28. cb_open cb_open
  29. cb_1 cb_1
  30. cb_def cb_def
  31. cb_del cb_del
  32. dw_formatlist dw_formatlist
  33. sle_name sle_name
  34. st_1 st_1
  35. gb_1 gb_1
  36. end type
  37. global w_publ_preview_billformatset w_publ_preview_billformatset
  38. type variables
  39. s_preview_billformatset_tran s_billformat
  40. long defpos=0
  41. boolean editmode=false,editname=false
  42. end variables
  43. forward prototypes
  44. public subroutine wf_addformat (dropdownlistbox ddlb, string dwname)
  45. public function integer wf_checkname (ref string arg_msg)
  46. public subroutine wf_facechange ()
  47. public subroutine wf_finddef ()
  48. public function integer wf_readsubdwpos_blob (string dwname, string dname, blob dwpos)
  49. public subroutine wf_setmode (datawindow dw, integer mode)
  50. end prototypes
  51. public subroutine wf_addformat (dropdownlistbox ddlb, string dwname);string formatname
  52. int defflag
  53. int ls_defpos=0
  54. Declare getbillformat cursor for
  55. select dname,default_flag from sys_dwnSyntax where dwname=:dwname ;
  56. open getbillformat;
  57. Do While sqlca.sqlcode=0
  58. Fetch getbillformat into :formatname,:defflag;
  59. if sqlca.sqlcode<>0 then exit;
  60. ddlb.additem(formatname)
  61. ls_defpos++
  62. if defflag=1 then
  63. defpos=ls_defpos
  64. end if
  65. loop
  66. Close getbillformat;
  67. end subroutine
  68. public function integer wf_checkname (ref string arg_msg);long findrow
  69. if trim(dw_formatlist.object.dname[dw_formatlist.getrow()])='' then
  70. arg_msg='格式名不能空!'
  71. return 0
  72. end if
  73. findrow=dw_formatlist.find("dwname='"+trim(dw_formatlist.object.dname[dw_formatlist.getrow()])+"'",1,dw_formatlist.rowcount())
  74. messagebox('',findrow)
  75. if findrow>0 then
  76. arg_msg='格式名称重复!'
  77. return 0
  78. end if
  79. return 1
  80. end function
  81. public subroutine wf_facechange ();cb_open.enabled= not editmode
  82. cb_del.enabled= not editmode
  83. cb_def.enabled= not editmode
  84. cb_def.enabled= not editmode
  85. end subroutine
  86. public subroutine wf_finddef ();long findrow,currow
  87. if dw_formatlist.rowcount()=1 then
  88. dw_formatlist.selectrow(0,false)
  89. dw_formatlist.selectrow(1,true)
  90. dw_formatlist.SETROW(1)
  91. dw_formatlist.ScrollToRow (1)
  92. dw_formatlist.object.default_flag[1]=1
  93. return
  94. end if
  95. findrow=dw_formatlist.find("dname='"+s_billformat.dname+"'",2,dw_formatlist.rowcount())
  96. if findrow=0 then
  97. dw_formatlist.selectrow(0,false)
  98. dw_formatlist.selectrow(1,true)
  99. dw_formatlist.SETROW(1)
  100. dw_formatlist.ScrollToRow (1)
  101. dw_formatlist.object.default_flag[1]=1
  102. else
  103. findrow=dw_formatlist.find("default_flag=1",1,dw_formatlist.rowcount())
  104. if findrow>0 then
  105. dw_formatlist.object.default_flag[findrow]=1
  106. currow=findrow
  107. else
  108. dw_formatlist.object.default_flag[1]=1
  109. currow=1
  110. end if
  111. dw_formatlist.selectrow(0,false)
  112. dw_formatlist.selectrow(currow,true)
  113. dw_formatlist.SETROW(currow)
  114. dw_formatlist.ScrollToRow (currow)
  115. end if
  116. sle_name.text=s_billformat.dname
  117. end subroutine
  118. public function integer wf_readsubdwpos_blob (string dwname, string dname, blob dwpos);blob subdwpos
  119. select subdwSyntaxB into :subdwpos from sys_dwnSyntax where dwname=:dwname and dname=:dname;
  120. if sqlca.sqlcode=-1 then
  121. Messagebox('系统信息','读取明细格式失败!'+sqlca.sqlerrtext)
  122. return 0
  123. end if
  124. return 1
  125. end function
  126. public subroutine wf_setmode (datawindow dw, integer mode);dw.SetTabOrder('dname',mode*10)
  127. //dw.SetTabOrder('default_flag',mode*20)
  128. end subroutine
  129. on w_publ_preview_billformatset.create
  130. int iCurrent
  131. call super::create
  132. this.cb_open=create cb_open
  133. this.cb_1=create cb_1
  134. this.cb_def=create cb_def
  135. this.cb_del=create cb_del
  136. this.dw_formatlist=create dw_formatlist
  137. this.sle_name=create sle_name
  138. this.st_1=create st_1
  139. this.gb_1=create gb_1
  140. iCurrent=UpperBound(this.Control)
  141. this.Control[iCurrent+1]=this.cb_open
  142. this.Control[iCurrent+2]=this.cb_1
  143. this.Control[iCurrent+3]=this.cb_def
  144. this.Control[iCurrent+4]=this.cb_del
  145. this.Control[iCurrent+5]=this.dw_formatlist
  146. this.Control[iCurrent+6]=this.sle_name
  147. this.Control[iCurrent+7]=this.st_1
  148. this.Control[iCurrent+8]=this.gb_1
  149. end on
  150. on w_publ_preview_billformatset.destroy
  151. call super::destroy
  152. destroy(this.cb_open)
  153. destroy(this.cb_1)
  154. destroy(this.cb_def)
  155. destroy(this.cb_del)
  156. destroy(this.dw_formatlist)
  157. destroy(this.sle_name)
  158. destroy(this.st_1)
  159. destroy(this.gb_1)
  160. end on
  161. event open;call super::open;Long currow,findrow
  162. s_billformat = Message.PowerObjectParm
  163. dw_formatlist.SetTransObject(sqlca)
  164. dw_formatlist.Retrieve(s_billformat.dwname)
  165. currow = dw_formatlist.InsertRow(1)
  166. dw_formatlist.Object.dwname[currow] = '标准格式'
  167. dw_formatlist.Object.dname[currow] = '标准格式'
  168. wf_finddef()
  169. sle_name.SetFocus()
  170. sle_name.SelectText(1, Len(sle_name.Text))
  171. end event
  172. event close;call super::close;closewithreturn(this,s_billformat)
  173. end event
  174. type cb_func from w_publ_base`cb_func within w_publ_preview_billformatset
  175. boolean visible = false
  176. integer x = 1207
  177. integer y = 912
  178. integer width = 146
  179. integer height = 92
  180. boolean enabled = false
  181. end type
  182. type cb_exit from w_publ_base`cb_exit within w_publ_preview_billformatset
  183. integer x = 1390
  184. integer y = 912
  185. integer width = 274
  186. integer height = 92
  187. end type
  188. type cb_open from uo_imflatbutton within w_publ_preview_billformatset
  189. integer x = 23
  190. integer y = 912
  191. integer width = 274
  192. integer height = 92
  193. integer taborder = 50
  194. string text = "打开格式"
  195. end type
  196. event clicked;call super::clicked;if dw_formatlist.getrow()<=0 then
  197. messagebox('系统提示','没有可打开的格式!')
  198. return
  199. end if
  200. s_billformat.dname=dw_formatlist.object.dname[dw_formatlist.getrow()]
  201. cb_exit.triggerevent(clicked!)
  202. end event
  203. type cb_1 from uo_imflatbutton within w_publ_preview_billformatset
  204. integer x = 325
  205. integer y = 912
  206. integer width = 274
  207. integer height = 92
  208. integer taborder = 50
  209. string text = "保存格式"
  210. end type
  211. event clicked;call super::clicked;long findrow,currow,defflag,updaterow
  212. string dwname,dname,errmsg
  213. if trim(sle_name.text) = '' then
  214. messagebox('系统信息','格式名不能为空!')
  215. return
  216. end if
  217. findrow = dw_formatlist.find("dname='"+trim(sle_name.text)+"'",1,dw_formatlist.rowcount())
  218. if findrow = 0 then
  219. dwname = s_billformat.dwname
  220. dname = sle_name.text
  221. defflag = 0
  222. insert into sys_dwnsyntax (dwname,dname,default_flag) values (:dwname,:dname,:defflag);
  223. if sqlca.sqlcode = -1 then
  224. errmsg = sqlca.sqlerrtext
  225. rollback;
  226. messagebox('系统提示','保存格式名称出错!'+errmsg)
  227. return
  228. end if
  229. commit;
  230. else
  231. if dw_formatlist.getrow() = 1 then
  232. messagebox('系统信息','不能保存到标准格式!')
  233. return
  234. end if
  235. if messagebox ("全部","是否确定要覆盖当前单式吗?",question!,yesno! ) = 2 then return
  236. dwname = dw_formatlist.object.dwname[dw_formatlist.getrow()]
  237. dname = dw_formatlist.object.dname[dw_formatlist.getrow()]
  238. end if
  239. updateblob sys_dwnsyntax set dwsyntaxb = :s_billformat.dwsyntaxb where dwname = :dwname and dname = :dname;
  240. if sqlca.sqlcode = -1 then
  241. messagebox('系统提示','保存单据格式失败!原因:'+sqlca.sqlerrtext)
  242. rollback;
  243. return
  244. else
  245. commit;
  246. end if
  247. //messagebox('sb',len(s_billformat.subdwsyntaxb))
  248. if len(s_billformat.subdwsyntaxb) > 0 then
  249. updateblob sys_dwnsyntax set subdwsyntaxb = :s_billformat.subdwsyntaxb where dwname = :dwname and dname = :dname;
  250. if sqlca.sqlcode = -1 then
  251. messagebox('系统提示','保存单据格式失败!原因:'+sqlca.sqlerrtext)
  252. rollback;
  253. return
  254. else
  255. commit;
  256. end if
  257. end if
  258. messagebox('系统信息','保存格式成功!')
  259. dw_formatlist.retrieve(s_billformat.dwname)
  260. currow = dw_formatlist.insertrow(1)
  261. dw_formatlist.object.dwname[currow] = '标准格式'
  262. dw_formatlist.object.dname[currow] = '标准格式'
  263. // cb_exit.triggerevent(clicked!)
  264. end event
  265. type cb_def from uo_imflatbutton within w_publ_preview_billformatset
  266. integer x = 910
  267. integer y = 912
  268. integer width = 274
  269. integer height = 92
  270. integer taborder = 50
  271. string text = "设为默认"
  272. end type
  273. event clicked;call super::clicked;IF dw_formatlist.GetRow() <= 0 THEN
  274. MessageBox('系统提示','请选择格式!')
  275. END IF
  276. Long i,currow,rslt = 1
  277. String dwname,dname
  278. dw_formatlist.SetRedraw(FALSE)
  279. FOR i = 1 TO dw_formatlist.RowCount()
  280. dw_formatlist.Object.default_flag[i] = 0
  281. NEXT
  282. dw_formatlist.Object.default_flag[dw_formatlist.GetRow()] = 1
  283. dw_formatlist.SetRedraw(TRUE)
  284. IF dw_formatlist.GetRow() = 1 THEN
  285. dwname = s_billformat.dwname
  286. ELSE
  287. dwname = dw_formatlist.Object.dwname[dw_formatlist.GetRow()]
  288. END IF
  289. dname = dw_formatlist.Object.dname[dw_formatlist.GetRow()]
  290. UPDATE sys_dwnSyntax Set default_flag = 0 Where dwname = :dwname;
  291. IF sqlca.SQLCode <> 0 THEN
  292. MessageBox('系统提示','设置默认值失败'+sqlca.SQLErrText)
  293. ROLLBACK;
  294. rslt = 0
  295. END IF
  296. IF dw_formatlist.GetRow() > 1 THEN
  297. UPDATE sys_dwnSyntax Set default_flag = 1 Where dwname = :dwname AND dname = :dname;
  298. IF sqlca.SQLCode = -1 THEN
  299. MessageBox('系统提示','设置默认值失败'+sqlca.SQLErrText)
  300. ROLLBACK;
  301. rslt = 0
  302. END IF
  303. END IF
  304. IF rslt = 1 THEN
  305. MessageBox('系统提示','设置默认值成功!')
  306. COMMIT;
  307. END IF
  308. end event
  309. type cb_del from uo_imflatbutton within w_publ_preview_billformatset
  310. integer x = 594
  311. integer y = 912
  312. integer width = 274
  313. integer height = 92
  314. integer taborder = 50
  315. string text = "删除格式"
  316. end type
  317. event clicked;call super::clicked;String dwname,dname
  318. IF dw_formatlist.GetRow() = 1 OR Trim(sle_name.Text) = '标准格式' THEN
  319. MessageBox('系统提示','该格式为标准格式,不能删除!')
  320. RETURN
  321. END IF
  322. If (dw_formatlist.RowCount() = 0) Or (dw_formatlist.GetRow() <= 0) THEN
  323. MessageBox('系统提示','没有可删除的格式!')
  324. RETURN
  325. END IF
  326. IF MessageBox ("全部","是否确定要删除当前单式吗?",Question!,YesNo! ) = 2 THEN RETURN
  327. dwname = dw_formatlist.Object.dwname[dw_formatlist.GetRow()]
  328. dname = dw_formatlist.Object.dname[dw_formatlist.GetRow()]
  329. DELETE FROM sys_dwnSyntax Where dwname = :dwname AND dname = :dname;
  330. IF sqlca.SQLCode <> 0 THEN
  331. MessageBox('系统提示','删除格式失败!')
  332. ROLLBACK;
  333. RETURN
  334. END IF
  335. COMMIT;
  336. dw_formatlist.DeleteRow(dw_formatlist.GetRow())
  337. MessageBox('系统提示','删除格式成功!')
  338. end event
  339. type dw_formatlist from datawindow within w_publ_preview_billformatset
  340. integer x = 32
  341. integer y = 176
  342. integer width = 1641
  343. integer height = 668
  344. integer taborder = 20
  345. string dataobject = "dw_publ_preview_formatlist"
  346. boolean hscrollbar = true
  347. boolean vscrollbar = true
  348. boolean livescroll = true
  349. borderstyle borderstyle = stylelowered!
  350. end type
  351. event doubleclicked;IF row > 0 THEN
  352. cb_open.TriggerEvent(Clicked!)
  353. END IF
  354. end event
  355. event rowfocuschanged;IF editmode THEN RETURN
  356. IF this.getrow() <= 0 THEN RETURN
  357. THIS.SelectRow(0,FALSE)
  358. THIS.SelectRow(this.getrow(),TRUE)
  359. dw_formatlist.SetRow(this.getrow())
  360. dw_formatlist.ScrollToRow (this.getrow())
  361. sle_name.Text = dw_formatlist.Object.dname[this.getrow()]
  362. end event
  363. type sle_name from singlelineedit within w_publ_preview_billformatset
  364. integer x = 242
  365. integer y = 68
  366. integer width = 1417
  367. integer height = 84
  368. integer taborder = 10
  369. integer textsize = -9
  370. integer weight = 400
  371. fontcharset fontcharset = gb2312charset!
  372. fontpitch fontpitch = variable!
  373. string facename = "宋体"
  374. long textcolor = 33554432
  375. boolean autohscroll = false
  376. borderstyle borderstyle = stylelowered!
  377. boolean hideselection = false
  378. end type
  379. type st_1 from statictext within w_publ_preview_billformatset
  380. integer x = 55
  381. integer y = 80
  382. integer width = 174
  383. integer height = 60
  384. integer textsize = -9
  385. integer weight = 400
  386. fontcharset fontcharset = gb2312charset!
  387. fontpitch fontpitch = variable!
  388. string facename = "宋体"
  389. long textcolor = 33554432
  390. long backcolor = 67108864
  391. boolean enabled = false
  392. string text = "格式名"
  393. boolean focusrectangle = false
  394. end type
  395. type gb_1 from groupbox within w_publ_preview_billformatset
  396. integer width = 1719
  397. integer height = 864
  398. integer taborder = 10
  399. integer textsize = -9
  400. integer weight = 400
  401. fontcharset fontcharset = gb2312charset!
  402. fontpitch fontpitch = variable!
  403. string facename = "宋体"
  404. long textcolor = 33554432
  405. long backcolor = 67108864
  406. string text = "格式设置"
  407. end type