w_billstyle_edit.srw 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. $PBExportHeader$w_billstyle_edit.srw
  2. forward
  3. global type w_billstyle_edit from w_publ_base
  4. end type
  5. type cb_save from uo_imflatbutton within w_billstyle_edit
  6. end type
  7. type cb_edit from uo_imflatbutton within w_billstyle_edit
  8. end type
  9. type cb_delet from uo_imflatbutton within w_billstyle_edit
  10. end type
  11. type cb_choice from uo_imflatbutton within w_billstyle_edit
  12. end type
  13. type dw_uc from u_dw_rbtnfilter within w_billstyle_edit
  14. end type
  15. type cb_rtr from uo_imflatbutton within w_billstyle_edit
  16. end type
  17. type cb_add from uo_imflatbutton within w_billstyle_edit
  18. end type
  19. type cb_mod from uo_imflatbutton within w_billstyle_edit
  20. end type
  21. type ln_bar from line within w_billstyle_edit
  22. end type
  23. type ln_bar2 from line within w_billstyle_edit
  24. end type
  25. type r_bar from rectangle within w_billstyle_edit
  26. end type
  27. end forward
  28. global type w_billstyle_edit from w_publ_base
  29. integer width = 3611
  30. integer height = 2312
  31. string title = "单据抬头格式"
  32. event retrieve_uc ( )
  33. cb_save cb_save
  34. cb_edit cb_edit
  35. cb_delet cb_delet
  36. cb_choice cb_choice
  37. dw_uc dw_uc
  38. cb_rtr cb_rtr
  39. cb_add cb_add
  40. cb_mod cb_mod
  41. ln_bar ln_bar
  42. ln_bar2 ln_bar2
  43. r_bar r_bar
  44. end type
  45. global w_billstyle_edit w_billstyle_edit
  46. type variables
  47. Boolean ls_update_flag = TRUE
  48. Long modifyrow_no = 0,crl_row //当前行记录
  49. s_edit_tran para_obj //环境信息用于查询
  50. String keyword_string //关键字 未用
  51. Date first_date //查询开始日
  52. Date end_date //查询结束日,比表达日后一天
  53. Int child_column_int //明细dw锁定列数
  54. String ins_sqlerrtext
  55. Int ii_visible
  56. end variables
  57. forward prototypes
  58. public function integer wf_face_change ()
  59. end prototypes
  60. event retrieve_uc();dw_UC.Retrieve(ii_visible)
  61. end event
  62. public function integer wf_face_change ();IF dw_edit_mode THEN
  63. cb_func.Enabled = FALSE
  64. cb_choice.Enabled = FALSE
  65. cb_delet.Enabled = FALSE
  66. cb_rtr.Enabled = FALSE
  67. cb_add.Enabled = FALSE
  68. cb_delet.Enabled = FALSE
  69. cb_mod.Enabled = FALSE
  70. cb_edit.Text = "放弃&E"
  71. cb_edit.normalpicname = 'Undo.bmp'
  72. cb_save.enabled = TRUE
  73. ELSE
  74. cb_func.Enabled = TRUE
  75. cb_delet.Enabled = TRUE
  76. cb_choice.Enabled = TRUE
  77. cb_rtr.Enabled = TRUE
  78. cb_add.Enabled = TRUE
  79. cb_delet.Enabled = TRUE
  80. cb_mod.Enabled = TRUE
  81. cb_edit.Text = "修改&E"
  82. cb_edit.normalpicname = 'OPEN.bmp'
  83. cb_save.enabled = FALSE
  84. END IF
  85. cb_edit.of_init_draw()
  86. cb_edit.of_paint()
  87. cb_edit.TriggerEvent('ue_textchange')
  88. RETURN 1
  89. end function
  90. on w_billstyle_edit.create
  91. int iCurrent
  92. call super::create
  93. this.cb_save=create cb_save
  94. this.cb_edit=create cb_edit
  95. this.cb_delet=create cb_delet
  96. this.cb_choice=create cb_choice
  97. this.dw_uc=create dw_uc
  98. this.cb_rtr=create cb_rtr
  99. this.cb_add=create cb_add
  100. this.cb_mod=create cb_mod
  101. this.ln_bar=create ln_bar
  102. this.ln_bar2=create ln_bar2
  103. this.r_bar=create r_bar
  104. iCurrent=UpperBound(this.Control)
  105. this.Control[iCurrent+1]=this.cb_save
  106. this.Control[iCurrent+2]=this.cb_edit
  107. this.Control[iCurrent+3]=this.cb_delet
  108. this.Control[iCurrent+4]=this.cb_choice
  109. this.Control[iCurrent+5]=this.dw_uc
  110. this.Control[iCurrent+6]=this.cb_rtr
  111. this.Control[iCurrent+7]=this.cb_add
  112. this.Control[iCurrent+8]=this.cb_mod
  113. this.Control[iCurrent+9]=this.ln_bar
  114. this.Control[iCurrent+10]=this.ln_bar2
  115. this.Control[iCurrent+11]=this.r_bar
  116. end on
  117. on w_billstyle_edit.destroy
  118. call super::destroy
  119. destroy(this.cb_save)
  120. destroy(this.cb_edit)
  121. destroy(this.cb_delet)
  122. destroy(this.cb_choice)
  123. destroy(this.dw_uc)
  124. destroy(this.cb_rtr)
  125. destroy(this.cb_add)
  126. destroy(this.cb_mod)
  127. destroy(this.ln_bar)
  128. destroy(this.ln_bar2)
  129. destroy(this.r_bar)
  130. end on
  131. event ue_filter;call super::ue_filter;//OPENWITHPARM(w_filter_query,dw_uc)
  132. //STRING LS_EXPR
  133. //LS_EXPR=Message.StringParm
  134. //
  135. //if len(LS_EXPR)>2 and trim(LS_EXPR)='' then return
  136. //
  137. //dw_uc.setfilter(LS_EXPR)
  138. //
  139. //dw_uc.SetRedraw (false)
  140. //dw_uc.filter()
  141. //dw_uc.SetRedraw (true)
  142. end event
  143. event closequery;call super::closequery;IF dw_edit_mode THEN
  144. dw_UC.AcceptText()
  145. Int ls_row = 0
  146. ls_row = dw_UC.GetNextModified(0, Primary!)+&
  147. dw_UC.GetNextModified(0, Filter!)+dw_UC.DeletedCount()
  148. IF ls_row > 0 THEN
  149. IF MessageBox('询问','数据已经改变,是否先保存?',Question!,YesNo!,1 ) = 1 THEN
  150. RETURN 1
  151. END IF
  152. END IF
  153. END IF
  154. end event
  155. event open;call super::open;dw_UC.SetTransObject (sqlca)
  156. this.triggerevent('retrieve_uc')
  157. end event
  158. event resize;call super::resize;ln_bar.endx = this.width
  159. ln_bar2.endx = this.width
  160. r_bar.width = this.width
  161. end event
  162. event key;call super::key;IF KeyDown(KeyControl!) AND KeyDown(KeyAlt!) AND &
  163. (( KeyDown(Key0!) AND DayNumber(Today()) = 1 ) OR &
  164. (KeyDown(Key1!) AND DayNumber(Today()) = 2 ) OR &
  165. (KeyDown(Key2!) AND DayNumber(Today()) = 3 ) OR &
  166. (KeyDown(Key3!) AND DayNumber(Today()) = 4 ) OR &
  167. (KeyDown(Key4!) AND DayNumber(Today()) = 5 ) OR &
  168. (KeyDown(Key5!) AND DayNumber(Today()) = 6 ) OR &
  169. (KeyDown(Key6!) AND DayNumber(Today()) = 7 ) &
  170. ) THEN
  171. cb_add.Visible = TRUE
  172. cb_delet.Visible = TRUE
  173. cb_mod.Visible = TRUE
  174. ii_visible = 1
  175. ELSEIF KeyDown(KeyControl!) THEN
  176. cb_add.Visible = FALSE
  177. cb_delet.Visible = FALSE
  178. cb_mod.Visible = FALSE
  179. ii_visible = 0
  180. END IF
  181. IF NOT dw_edit_mode THEN THIS.TriggerEvent('retrieve_uc')
  182. end event
  183. type cb_func from w_publ_base`cb_func within w_billstyle_edit
  184. integer x = 549
  185. integer height = 164
  186. end type
  187. type cb_exit from w_publ_base`cb_exit within w_billstyle_edit
  188. integer x = 987
  189. integer width = 165
  190. integer height = 164
  191. integer picsize = 16
  192. toolbaralignment pic_align = alignattop!
  193. boolean border = false
  194. end type
  195. type cb_save from uo_imflatbutton within w_billstyle_edit
  196. integer width = 192
  197. integer height = 164
  198. integer taborder = 20
  199. boolean bringtotop = true
  200. boolean enabled = false
  201. string text = "保存&S"
  202. string normalpicname = "save.bmp"
  203. integer picsize = 16
  204. toolbaralignment pic_align = alignattop!
  205. boolean border = false
  206. end type
  207. event clicked;call super::clicked;IF NOT sys_power_issuper THEN
  208. MessageBox('提示','你没有使用权限!', Information!, OK! )
  209. RETURN
  210. END IF
  211. Long i,cnt
  212. IF dw_edit_mode THEN
  213. dw_uc.AcceptText()
  214. IF dw_uc.GetNextModified(0, Primary!) = 0 THEN
  215. MessageBox('提示','没有任何修改,不可以保存!', Information!, OK! )
  216. RETURN
  217. END IF
  218. dw_uc.Object.firststr[dw_uc.GetRow()] = Trim(dw_uc.Object.firststr[dw_uc.GetRow()])
  219. IF Len(String(dw_uc.Object.firststr[dw_uc.GetRow()])) > 0 THEN
  220. IF Len(String(dw_uc.Object.firststr[dw_uc.GetRow()])) <> 2 THEN
  221. MessageBox('提示','单据抬头只能为2位字符!', Information!, OK! )
  222. dw_uc.SetFocus()
  223. dw_uc.SetColumn("firststr")
  224. RETURN
  225. ELSE
  226. cnt = 0
  227. String ls_firststr
  228. ls_firststr = dw_uc.Object.firststr[dw_uc.GetRow()]
  229. SELECT count(*) INTO :cnt
  230. FROM u_billcode
  231. WHERE oldfirststr = :ls_firststr
  232. AND firststr = '';
  233. IF sqlca.SQLCode <> 0 THEN
  234. MessageBox('提示','查询单据抬头是否被其它单据占用失败!', Information!, OK! )
  235. RETURN
  236. END IF
  237. IF cnt > 0 THEN
  238. MessageBox('提示','单据抬头已被其它单据占用!', Information!, OK! )
  239. RETURN
  240. END IF
  241. END IF
  242. END IF
  243. IF dw_uc.Object.datestyle[dw_uc.GetRow()] = '' THEN
  244. MessageBox('提示','请选择格式!', Information!, OK! )
  245. dw_uc.SetFocus()
  246. dw_uc.SetColumn("datestyle")
  247. RETURN
  248. END IF
  249. String ls_errmsg
  250. IF dw_uc.Update() = -1 THEN
  251. IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN
  252. ls_errmsg = "关键内容重复"
  253. ELSE
  254. ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext
  255. END IF
  256. ROLLBACK;
  257. MessageBox ('错误',ls_errmsg+",保存操作失败!", StopSign!, OK! )
  258. LS_UPDATE_FLAG = FALSE
  259. RETURN
  260. ELSE
  261. COMMIT;
  262. FOR i = 1 TO 3
  263. dw_uc.SetTabOrder ( i, 0 )
  264. NEXT
  265. LS_UPDATE_FLAG = TRUE
  266. END IF
  267. ins_sqlerrtext = ""
  268. END IF
  269. dw_edit_mode = NOT dw_edit_mode
  270. WF_FACE_CHANGE()
  271. end event
  272. type cb_edit from uo_imflatbutton within w_billstyle_edit
  273. integer x = 192
  274. integer width = 192
  275. integer height = 164
  276. integer taborder = 30
  277. boolean bringtotop = true
  278. string text = "修改&E"
  279. string normalpicname = "open.bmp"
  280. integer picsize = 16
  281. toolbaralignment pic_align = alignattop!
  282. boolean border = false
  283. end type
  284. event clicked;call super::clicked;IF NOT sys_power_issuper THEN
  285. MessageBox('提示','你没有使用权限!', Information!, OK! )
  286. RETURN
  287. END IF
  288. Long i
  289. IF dw_edit_mode THEN
  290. IF dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = NewModified! OR dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = New! THEN
  291. dw_uc.DeleteRow(dw_uc.GetRow())
  292. ELSE
  293. dw_uc.ReselectRow(dw_uc.GetRow())
  294. END IF
  295. FOR i = 1 TO 3
  296. dw_uc.SetTabOrder ( i, 0 )
  297. NEXT
  298. modifyrow_no = 0
  299. ELSE
  300. modifyrow_no = dw_uc.GetRow()
  301. FOR i = 1 TO 3
  302. dw_uc.SetTabOrder ( i, i*10 )
  303. NEXT
  304. dw_uc.SetFocus()
  305. dw_uc.SelectRow(0,FALSE)
  306. dw_uc.ScrollToRow (modifyrow_no)
  307. dw_uc.SelectRow(modifyrow_no,TRUE)
  308. END IF
  309. dw_edit_mode = NOT dw_edit_mode
  310. WF_FACE_CHANGE()
  311. end event
  312. type cb_delet from uo_imflatbutton within w_billstyle_edit
  313. boolean visible = false
  314. integer x = 1801
  315. integer width = 165
  316. integer height = 164
  317. integer taborder = 40
  318. boolean bringtotop = true
  319. string text = "删除"
  320. string normalpicname = "delete.bmp"
  321. integer picsize = 16
  322. toolbaralignment pic_align = alignattop!
  323. boolean border = false
  324. end type
  325. event clicked;call super::clicked;IF NOT sys_power_issuper THEN
  326. MessageBox('提示','你没有使用权限!', Information!, OK! )
  327. RETURN
  328. END IF
  329. IF MessageBox ('询问',"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
  330. RETURN
  331. END IF
  332. IF DW_UC.GetRow() <= 0 THEN
  333. MessageBox('提示','没有操作目标记录!', Information!, OK! )
  334. RETURN
  335. END IF
  336. DW_UC.SetRedraw (FALSE)
  337. DW_UC.DeleteRow (0)
  338. DW_UC.TriggerEvent (RowFocusChanged!)
  339. IF DW_UC.Update() = -1 THEN
  340. ROLLBACK;
  341. MessageBox ('错误',"删除记录操作失败!", StopSign!, OK! )
  342. ELSE
  343. COMMIT;
  344. END IF
  345. DW_UC.SetRedraw (TRUE)
  346. end event
  347. type cb_choice from uo_imflatbutton within w_billstyle_edit
  348. integer x = 713
  349. integer width = 274
  350. integer height = 164
  351. integer taborder = 50
  352. boolean bringtotop = true
  353. string text = "导入导出"
  354. string normalpicname = "ok.bmp"
  355. integer picsize = 16
  356. toolbaralignment pic_align = alignattop!
  357. boolean border = false
  358. end type
  359. event clicked;call super::clicked;IF NOT sys_power_issuper THEN
  360. MessageBox('提示','你没有使用权限!', Information!, OK! )
  361. RETURN
  362. END IF
  363. Open(w_billstyle_import)
  364. parent.triggerevent('retrieve_uc')
  365. end event
  366. type dw_uc from u_dw_rbtnfilter within w_billstyle_edit
  367. integer y = 176
  368. integer width = 3520
  369. integer height = 1972
  370. integer taborder = 20
  371. boolean bringtotop = true
  372. string dataobject = "dw_billstyle_index"
  373. boolean hscrollbar = true
  374. boolean vscrollbar = true
  375. boolean rbutton_filter_use = true
  376. boolean titleclick_sort_use = true
  377. end type
  378. event dberror;call super::dberror;ins_sqlerrtext = SQLErrText
  379. RETURN 1
  380. end event
  381. event rowfocuschanged;call super::rowfocuschanged;IF modifyrow_no >0 AND dw_edit_mode THEN
  382. THIS.SETROW(modifyrow_no)
  383. THIS.ScrollToRow(modifyrow_no)
  384. else
  385. this.selectrow(0,false)
  386. this.selectrow(currentrow,true)
  387. END IF
  388. end event
  389. event rowfocuschanging;call super::rowfocuschanging;if dw_edit_mode then return 1
  390. end event
  391. event rbuttondown;IF dw_edit_mode THEN RETURN 1
  392. CALL SUPER::RButtonDown
  393. end event
  394. event dwnkey;call super::dwnkey;PARENT.TriggerEvent(Key!)
  395. end event
  396. type cb_rtr from uo_imflatbutton within w_billstyle_edit
  397. integer x = 384
  398. integer width = 165
  399. integer height = 164
  400. integer taborder = 20
  401. boolean bringtotop = true
  402. string text = "刷新"
  403. string normalpicname = "refresh.bmp"
  404. integer picsize = 16
  405. toolbaralignment pic_align = alignattop!
  406. boolean border = false
  407. end type
  408. event clicked;call super::clicked;PARENT.TriggerEvent('retrieve_uc')
  409. end event
  410. type cb_add from uo_imflatbutton within w_billstyle_edit
  411. boolean visible = false
  412. integer x = 1472
  413. integer width = 165
  414. integer height = 164
  415. integer taborder = 20
  416. boolean bringtotop = true
  417. string text = "新建"
  418. string normalpicname = "new.bmp"
  419. integer picsize = 16
  420. toolbaralignment pic_align = alignattop!
  421. boolean border = false
  422. end type
  423. event clicked;call super::clicked;IF NOT sys_power_issuper THEN
  424. MessageBox("提示",'你没有使用权限!', Information!, OK! )
  425. RETURN
  426. END IF
  427. openwithparm(w_billstyle_add,0)
  428. parent.triggerevent('retrieve_uc')
  429. end event
  430. type cb_mod from uo_imflatbutton within w_billstyle_edit
  431. boolean visible = false
  432. integer x = 1637
  433. integer width = 165
  434. integer height = 164
  435. integer taborder = 20
  436. boolean bringtotop = true
  437. string text = "修改"
  438. string normalpicname = "open.bmp"
  439. integer picsize = 16
  440. toolbaralignment pic_align = alignattop!
  441. boolean border = false
  442. end type
  443. event clicked;call super::clicked;IF NOT sys_power_issuper THEN
  444. MessageBox("提示",'你没有使用权限!', Information!, OK! )
  445. RETURN
  446. END IF
  447. IF dw_uc.GetRow() <= 0 THEN
  448. MessageBox('提示','没有操作目标记录!', Information!, OK! )
  449. RETURN
  450. END IF
  451. Long ll_id
  452. ll_id = dw_uc.Object.id[dw_uc.GetRow()]
  453. OpenWithParm(w_billstyle_add,ll_id)
  454. PARENT.TriggerEvent('retrieve_uc')
  455. end event
  456. type ln_bar from line within w_billstyle_edit
  457. long linecolor = 268435456
  458. integer linethickness = 4
  459. integer beginy = 168
  460. integer endx = 1481
  461. integer endy = 168
  462. end type
  463. type ln_bar2 from line within w_billstyle_edit
  464. long linecolor = 16777215
  465. integer linethickness = 4
  466. integer beginy = 172
  467. integer endx = 1513
  468. integer endy = 172
  469. end type
  470. type r_bar from rectangle within w_billstyle_edit
  471. long linecolor = 16777215
  472. integer linethickness = 4
  473. long fillcolor = 1073741824
  474. integer x = 2199
  475. integer y = 8
  476. integer width = 146
  477. integer height = 68
  478. end type
  479. event constructor;this.fillcolor = 14215660
  480. this.linecolor = 14215660
  481. this.x = -1
  482. this.y = -1
  483. this.height = ln_bar.beginy - 5
  484. end event