w_itemdef_ch.srw 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. $PBExportHeader$w_itemdef_ch.srw
  2. forward
  3. global type w_itemdef_ch from w_publ_edit_index
  4. end type
  5. type cbx_1 from checkbox within w_itemdef_ch
  6. end type
  7. end forward
  8. global type w_itemdef_ch from w_publ_edit_index
  9. integer width = 2519
  10. integer height = 1616
  11. string title = "收支项目"
  12. cbx_1 cbx_1
  13. end type
  14. global w_itemdef_ch w_itemdef_ch
  15. type variables
  16. s_itemdef INS_RT_STRU
  17. string oldcode,oldname,newcode,newname
  18. int inuse=1
  19. end variables
  20. on w_itemdef_ch.create
  21. int iCurrent
  22. call super::create
  23. this.cbx_1=create cbx_1
  24. iCurrent=UpperBound(this.Control)
  25. this.Control[iCurrent+1]=this.cbx_1
  26. end on
  27. on w_itemdef_ch.destroy
  28. call super::destroy
  29. destroy(this.cbx_1)
  30. end on
  31. event close;call super::close;CLOSEWITHRETURN(THIS,INS_RT_STRU)
  32. //<INS_RT_STRU> 窗体级子定义结构变量,用于返回
  33. end event
  34. event open;call super::open;INS_RT_STRU.itemid=0
  35. end event
  36. event retrieve_uc;boolean cb_firstpage_enabled,cb_nextpage_enabled,cb_retrieveall_enabled
  37. boolean cb_priorpage_enabled,cb_func_enabled,cb_retrieve_enabled
  38. cb_firstpage_enabled=cb_firstpage.enabled
  39. cb_nextpage_enabled=cb_nextpage.enabled
  40. cb_retrieveall_enabled=cb_retrieveall.enabled
  41. cb_priorpage_enabled=cb_priorpage.enabled
  42. cb_func_enabled=cb_func.enabled
  43. cb_retrieve_enabled=cb_retrieve.enabled
  44. cb_firstpage.enabled=false
  45. cb_nextpage.enabled=false
  46. cb_retrieveall.enabled=false
  47. cb_priorpage.enabled=false
  48. cb_func.enabled=false
  49. cb_retrieve.enabled=false
  50. IF not cbx_1.checked THEN
  51. inuse = -1
  52. ELSE
  53. inuse = 1
  54. END IF
  55. dw_UC.setredraw(false)
  56. dw_index.ShareDataOff()
  57. SetPointer(HourGlass!)
  58. dw_UC.retrieve(inuse)
  59. SetPointer(Arrow!)
  60. dw_uc.sharedata(dw_index)
  61. dw_UC.setredraw(true)
  62. if dw_index.rowcount()>=1 then
  63. dw_index.selectrow(0,false)
  64. dw_index.selectrow(1,true)
  65. end if
  66. cb_firstpage.enabled=cb_firstpage_enabled
  67. cb_nextpage.enabled=cb_nextpage_enabled
  68. cb_retrieveall.enabled=cb_retrieveall_enabled
  69. cb_priorpage.enabled=cb_priorpage_enabled
  70. cb_func.enabled=cb_func_enabled
  71. cb_retrieve.enabled=cb_retrieve_enabled
  72. end event
  73. event ue_usual_query_filt;call super::ue_usual_query_filt;if dw_edit_mode or keydown(keyf4!) or keydown(keyf5!) then return
  74. string obj_expr=''
  75. if trim(sle_usual_query.text)<>'' then
  76. IF POS(trim(sle_usual_query.text),'%')=0 THEN
  77. obj_expr=obj_expr+'( itemcode LIKE "%'+trim(sle_usual_query.text)+'%" )'
  78. ELSE
  79. obj_expr=obj_expr+'( itemcode LIKE "'+trim(sle_usual_query.text)+'" )'
  80. END IF
  81. end if
  82. dw_UC.setfilter(obj_expr)
  83. dw_UC.SetRedraw(False)
  84. dw_INDEX.SetRedraw(False)
  85. dw_UC.filter()
  86. if dw_index.rowcount()>=1 then
  87. dw_index.selectrow(0,false)
  88. dw_index.selectrow(1,true)
  89. end if
  90. dw_UC.SetRedraw(TRUE)
  91. dw_INDEX.SetRedraw(TRUE)
  92. end event
  93. event ue_usual_query_retr;call super::ue_usual_query_retr;if dw_edit_mode or keydown(keyf4!) or keydown(keyf5!) then return
  94. string ls_querystrpart=''
  95. ls_newselect=lower(ori_oldselect)
  96. if trim(sle_usual_query.text)<>'' then
  97. if pos(trim(sle_usual_query.text),'%')=0 then
  98. ls_querystrpart="(itemcode like '%"+trim(sle_usual_query.text)+"%')"
  99. else
  100. ls_querystrpart="(itemcode like '"+trim(sle_usual_query.text)+"')"
  101. end if
  102. if Pos(ls_newselect," where ") <> 0 then
  103. ls_newselect=ls_newselect+" AND ("+ls_querystrpart+')'
  104. else
  105. ls_newselect=ls_newselect+" where ("+ls_querystrpart+')'
  106. end if
  107. end if
  108. wf_retrieveuc(dw_uc,ls_newselect,1)
  109. this.triggerevent('retrieve_uc') //注意必须有此句
  110. end event
  111. type cb_func from w_publ_edit_index`cb_func within w_itemdef_ch
  112. end type
  113. type cb_exit from w_publ_edit_index`cb_exit within w_itemdef_ch
  114. integer x = 1179
  115. end type
  116. type sle_usual_query from w_publ_edit_index`sle_usual_query within w_itemdef_ch
  117. end type
  118. type cb_nextpage from w_publ_edit_index`cb_nextpage within w_itemdef_ch
  119. integer x = 928
  120. integer y = 1600
  121. end type
  122. type cb_priorpage from w_publ_edit_index`cb_priorpage within w_itemdef_ch
  123. integer x = 782
  124. integer y = 1600
  125. end type
  126. type cb_firstpage from w_publ_edit_index`cb_firstpage within w_itemdef_ch
  127. integer x = 635
  128. integer y = 1600
  129. end type
  130. type cb_retrieveall from w_publ_edit_index`cb_retrieveall within w_itemdef_ch
  131. integer x = 489
  132. integer y = 1600
  133. end type
  134. type em_pagerowno from w_publ_edit_index`em_pagerowno within w_itemdef_ch
  135. integer x = 192
  136. integer y = 1600
  137. end type
  138. type st_pagerowno from w_publ_edit_index`st_pagerowno within w_itemdef_ch
  139. integer x = 18
  140. integer y = 1620
  141. end type
  142. type st_1 from w_publ_edit_index`st_1 within w_itemdef_ch
  143. string text = "编号含"
  144. end type
  145. type cb_add from w_publ_edit_index`cb_add within w_itemdef_ch
  146. end type
  147. event cb_add::clicked;IF NOT f_power_ind(139) THEN
  148. MessageBox('提示','你没有使用权限!',information!,ok!)
  149. RETURN
  150. END IF
  151. Long ll_sptid = 0
  152. String errmsg = ''
  153. Long ll_cnt
  154. Long ll_itemid,ll_dfttype
  155. String ls_dfttypename
  156. IF dw_edit_mode THEN
  157. dw_uc.AcceptText()
  158. IF dw_uc.GetNextModified(0, Primary!) = 0 THEN
  159. MessageBox('提示','没有任何修改,不可以保存!',information!,ok!)
  160. RETURN
  161. END IF
  162. dw_uc.Object.itemcode[dw_uc.GetRow()] = Trim(dw_uc.Object.itemcode[dw_uc.GetRow()])
  163. dw_uc.Object.itemname[dw_uc.GetRow()] = Trim(dw_uc.Object.itemname[dw_uc.GetRow()])
  164. dw_uc.Object.dscrp[dw_uc.GetRow()] = Trim(dw_uc.Object.dscrp[dw_uc.GetRow()])
  165. IF dw_uc.Object.itemcode[dw_uc.GetRow()] = '' THEN
  166. MessageBox('提示','请输入项目编号!',information!,ok!)
  167. dw_uc.SetFocus()
  168. dw_uc.SetColumn("itemcode")
  169. RETURN
  170. END IF
  171. IF dw_uc.Object.itemname[dw_uc.GetRow()] = '' THEN
  172. MessageBox('提示','请输入项目名称!',information!,ok!)
  173. dw_uc.SetFocus()
  174. dw_uc.SetColumn("itemname")
  175. RETURN
  176. END IF
  177. //检查默认项目是否已存在
  178. ll_itemid = dw_uc.Object.itemid[dw_uc.GetRow()]
  179. ll_dfttype = dw_uc.Object.dfttype[dw_uc.GetRow()]
  180. IF ll_dfttype <> 0 THEN
  181. ll_cnt = 0
  182. SELECT count(*) INTO :ll_cnt
  183. FROM u_itemdef
  184. WHERE dfttype = :ll_dfttype
  185. AND itemid <> :ll_itemid;
  186. IF sqlca.SQLCode <> 0 THEN
  187. MessageBox('错误','查询默认项目是否已存在失败',stopsign!,ok!)
  188. RETURN
  189. END IF
  190. IF ll_cnt > 0 THEN
  191. CHOOSE CASE ll_dfttype
  192. CASE 1
  193. ls_dfttypename = '默认销售收款'
  194. CASE 2
  195. ls_dfttypename = '默认采购外协付款'
  196. CASE 3
  197. ls_dfttypename = '默认销售优惠'
  198. CASE 4
  199. ls_dfttypename = '默认销售退货'
  200. CASE 5
  201. ls_dfttypename = '默认采购外协退货'
  202. END CHOOSE
  203. MessageBox('提示','已存在'+ls_dfttypename+'的项目,不能重复建立!',information!,ok!)
  204. dw_uc.SetFocus()
  205. dw_uc.SetColumn("dfttype")
  206. RETURN
  207. END IF
  208. CHOOSE CASE ll_dfttype
  209. CASE 1
  210. IF dw_uc.Object.itemflag[dw_uc.GetRow()] = -1 THEN
  211. MessageBox('提示','默认销售收款项目方向只能设为收入!',information!,ok!)
  212. RETURN
  213. END IF
  214. CASE 2
  215. IF dw_uc.Object.itemflag[dw_uc.GetRow()] = 1 THEN
  216. MessageBox('提示','默认采购外协付款方向只能设为支出!',information!,ok!)
  217. RETURN
  218. END IF
  219. CASE 3
  220. IF dw_uc.Object.itemflag[dw_uc.GetRow()] = -1 THEN
  221. MessageBox('提示','默认销售优惠项目方向只能设为收入!',information!,ok!)
  222. RETURN
  223. END IF
  224. CASE 4
  225. IF dw_uc.Object.itemflag[dw_uc.GetRow()] = 1 THEN
  226. MessageBox('提示','默认销售退货项目方向只能设为支出!',information!,ok!)
  227. RETURN
  228. END IF
  229. CASE 5
  230. IF dw_uc.Object.itemflag[dw_uc.GetRow()] = -1 THEN
  231. MessageBox('提示','默认采购外协退货项目方向只能设为收入!',information!,ok!)
  232. RETURN
  233. END IF
  234. END CHOOSE
  235. END IF
  236. //////////////////////////////////////////////////
  237. IF dw_uc.Object.itemid[dw_uc.GetRow()] = 0 THEN
  238. ll_sptid = f_sys_scidentity(0,"u_itemdef","itemid",errmsg,FALSE,sqlca)
  239. IF ll_sptid <= 0 THEN
  240. MessageBox("错误",errmsg,stopsign!,ok!)
  241. RETURN
  242. ELSE
  243. dw_uc.Object.itemid[dw_uc.GetRow()] = ll_sptid
  244. END IF
  245. ELSE
  246. newcode = dw_uc.Object.itemcode[dw_uc.GetRow()]
  247. newname = dw_uc.Object.itemname[dw_uc.GetRow()]
  248. String arg_msg
  249. f_setsysoplog('定义资料','项目修改,原:'+oldcode+','+oldname+'->新:'+newcode+','+newname,arg_msg,FALSE)
  250. END IF
  251. /////////////////////////////
  252. END IF
  253. CALL SUPER::Clicked
  254. IF dw_edit_mode THEN
  255. dw_uc.SetColumn('itemcode')
  256. END IF
  257. end event
  258. type cb_edit from w_publ_edit_index`cb_edit within w_itemdef_ch
  259. end type
  260. event cb_edit::clicked;if not f_power_ind(139) then
  261. messagebox('提示','你没有使用权限!',information!,ok!)
  262. return
  263. end if
  264. CALL SUPER::CLICKED
  265. if dw_edit_mode then
  266. oldcode=DW_UC.OBJECT.itemcode[DW_UC.GETROW()]
  267. oldname=DW_UC.OBJECT.itemname[DW_UC.GETROW()]
  268. else
  269. oldcode=''
  270. oldname=''
  271. end if
  272. end event
  273. type cb_delet from w_publ_edit_index`cb_delet within w_itemdef_ch
  274. end type
  275. event cb_delet::clicked;IF NOT f_power_ind(139) THEN
  276. MessageBox('提示','你没有使用权限!',information!,ok!)
  277. RETURN
  278. END IF
  279. Long LS_id
  280. Long LS_LONG = 0,cnt=0
  281. String ls_code,arg_msg
  282. IF DW_UC.GetRow() <= 0 THEN
  283. MessageBox('提示','没有操作目标记录!',information!,ok!)
  284. RETURN
  285. END IF
  286. LS_id = DW_UC.Object.itemid[DW_UC.GetRow()]
  287. ls_code = DW_UC.Object.itemcode[DW_UC.GetRow()]
  288. select count(*) into :cnt from u_iteminput where itemid=:ls_id;
  289. if sqlca.sqlcode<>0 then
  290. messagebox('错误','查询历史数据失败!>>'+sqlca.sqlerrtext,stopsign!,ok!)
  291. return
  292. end if
  293. if cnt>0 then
  294. Messagebox('提示','该项目已在其它支出中使用!不能删除!',information!,ok!)
  295. return
  296. end if
  297. cnt=0
  298. select count(*) into :cnt from u_Bmstpay where itemid=:ls_id;
  299. if sqlca.sqlcode<>0 then
  300. messagebox('错误','查询历史数据失败!>>'+sqlca.sqlerrtext,stopsign!,ok!)
  301. return
  302. end if
  303. if cnt>0 then
  304. Messagebox('提示','该项目已在应付帐中使用!不能删除!',information!,ok!)
  305. return
  306. end if
  307. cnt=0
  308. select count(*) into :cnt from u_Bmstpaymx where itemid=:ls_id;
  309. if sqlca.sqlcode<>0 then
  310. messagebox('错误','查询历史数据失败!>>'+sqlca.sqlerrtext,stopsign!,ok!)
  311. return
  312. end if
  313. if cnt>0 then
  314. Messagebox('提示','该项目已在应付帐中使用!不能删除!',information!,ok!)
  315. return
  316. end if
  317. cnt=0
  318. select count(*) into :cnt from u_Bmsttake where itemid=:ls_id;
  319. if sqlca.sqlcode<>0 then
  320. messagebox('错误','查询历史数据失败!>>'+sqlca.sqlerrtext,stopsign!,ok!)
  321. return
  322. end if
  323. if cnt>0 then
  324. Messagebox('提示','该项目已在应收帐中使用!不能删除!',information!,ok!)
  325. return
  326. end if
  327. cnt=0
  328. select count(*) into :cnt from u_Bmsttakemx where itemid=:ls_id;
  329. if sqlca.sqlcode<>0 then
  330. messagebox('错误','查询历史数据失败!>>'+sqlca.sqlerrtext,stopsign!,ok!)
  331. return
  332. end if
  333. if cnt>0 then
  334. Messagebox('提示','该项目已在应收帐中使用!不能删除!')
  335. return
  336. end if
  337. IF MessageBox ("询问","是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
  338. RETURN
  339. END IF
  340. DW_UC.SetRedraw (FALSE)
  341. DW_UC.DeleteRow (0)
  342. DW_UC.TriggerEvent (RowFocusChanged!)
  343. IF DW_UC.UPDATE() = -1 THEN
  344. ROLLBACK;
  345. MessageBox ("错误","删除记录操作失败!",stopsign!,OK!)
  346. ELSE
  347. COMMIT;
  348. f_setsysoplog('定义资料','支出项目定义资料删除,ID:'+String(LS_id)+',code:'+ls_code,arg_msg,TRUE)
  349. END IF
  350. DW_UC.SetRedraw (TRUE)
  351. WF_INDEX_UC()
  352. end event
  353. type cb_choice from w_publ_edit_index`cb_choice within w_itemdef_ch
  354. integer x = 1029
  355. end type
  356. event cb_choice::clicked;call super::clicked;LONG LS_ROW
  357. LS_ROW=dw_uc.getrow()
  358. if LS_ROW<=0 then
  359. messagebox('提示','请先选择目标行!',information!,ok!)
  360. return
  361. end if
  362. INS_RT_STRU.itemid=dw_INDEX.OBJECT.itemid[LS_ROW]
  363. INS_RT_STRU.itemcode=dw_INDEX.OBJECT.itemcode[LS_ROW]
  364. INS_RT_STRU.itemname=dw_INDEX.OBJECT.itemname[LS_ROW]
  365. INS_RT_STRU.itemtype=dw_INDEX.OBJECT.itemtype[LS_ROW]
  366. INS_RT_STRU.itemflag=dw_INDEX.OBJECT.itemflag[LS_ROW]
  367. INS_RT_STRU.itemsectype=dw_INDEX.OBJECT.itemsectYpe[LS_ROW]
  368. CLOSE(PARENT)
  369. end event
  370. type cb_cancel from w_publ_edit_index`cb_cancel within w_itemdef_ch
  371. end type
  372. type cbx_mlselect from w_publ_edit_index`cbx_mlselect within w_itemdef_ch
  373. integer x = 1669
  374. integer y = 212
  375. end type
  376. type cbx_allselect from w_publ_edit_index`cbx_allselect within w_itemdef_ch
  377. integer x = 1906
  378. integer y = 216
  379. integer width = 206
  380. end type
  381. type cb_mode_itfchg_b from w_publ_edit_index`cb_mode_itfchg_b within w_itemdef_ch
  382. end type
  383. type cb_mode_itfchg from w_publ_edit_index`cb_mode_itfchg within w_itemdef_ch
  384. integer x = 1330
  385. end type
  386. type gb_1 from w_publ_edit_index`gb_1 within w_itemdef_ch
  387. integer x = 37
  388. integer y = 1596
  389. end type
  390. type dw_uc from w_publ_edit_index`dw_uc within w_itemdef_ch
  391. integer x = 1202
  392. integer width = 1262
  393. integer height = 1208
  394. string dataobject = "dw_itemdef_edit"
  395. end type
  396. type cb_retrieve from w_publ_edit_index`cb_retrieve within w_itemdef_ch
  397. end type
  398. type cb_print from w_publ_edit_index`cb_print within w_itemdef_ch
  399. end type
  400. event cb_print::clicked;call super::clicked;S_print_MSG LS_PRMSG
  401. LS_PRMSG.obj_dwNAME='dw_rp_item_index'
  402. LS_PRMSG.SHARE_DW=DW_UC
  403. LS_PRMSG.TAG_TEXT='项目资料表'
  404. LS_PRMSG.SETUP_FLAG=0
  405. LS_PRMSG.PAGECH_FLAG=1
  406. Openwithparm(w_publ_preview,LS_PRMSG)
  407. end event
  408. type ln_bar from w_publ_edit_index`ln_bar within w_itemdef_ch
  409. end type
  410. type ln_bar2 from w_publ_edit_index`ln_bar2 within w_itemdef_ch
  411. end type
  412. type r_bar from w_publ_edit_index`r_bar within w_itemdef_ch
  413. end type
  414. type ln_1 from w_publ_edit_index`ln_1 within w_itemdef_ch
  415. end type
  416. type ln_2 from w_publ_edit_index`ln_2 within w_itemdef_ch
  417. end type
  418. type dw_index from w_publ_edit_index`dw_index within w_itemdef_ch
  419. integer width = 1202
  420. integer height = 1208
  421. string dataobject = "dw_itemdef_index"
  422. end type
  423. type cb_help from w_publ_edit_index`cb_help within w_itemdef_ch
  424. end type
  425. type cbx_1 from checkbox within w_itemdef_ch
  426. integer x = 919
  427. integer y = 212
  428. integer width = 402
  429. integer height = 60
  430. boolean bringtotop = true
  431. integer textsize = -9
  432. integer weight = 400
  433. fontcharset fontcharset = gb2312charset!
  434. fontpitch fontpitch = variable!
  435. string facename = "宋体"
  436. long textcolor = 33554432
  437. long backcolor = 134217739
  438. string text = "只显示有效"
  439. end type
  440. event clicked;int ll_ifuse
  441. if this.checked then
  442. ll_ifuse = 1
  443. else
  444. ll_ifuse = -1
  445. end if
  446. f_SetProfileString (sys_empid,dw_uc.DATAOBJECT, "if_user",string(ll_ifuse) )
  447. parent.triggerevent('retrieve_uc')
  448. end event
  449. event constructor;Int ll_ifuse
  450. ll_ifuse = Long(f_ProfileString (sys_empid,dw_uc.DataObject, "if_user",'-1'))
  451. IF ll_ifuse = 1 THEN
  452. THIS.Checked = TRUE
  453. ELSE
  454. THIS.Checked = FALSE
  455. END IF
  456. end event