w_itemdef.srw 15 KB

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