w_mtrldef_edit_price_pz.srw 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. $PBExportHeader$w_mtrldef_edit_price_pz.srw
  2. forward
  3. global type w_mtrldef_edit_price_pz from w_publ_easyq
  4. end type
  5. type cb_save from uo_imflatbutton within w_mtrldef_edit_price_pz
  6. end type
  7. type ddlb_1 from dropdownlistbox within w_mtrldef_edit_price_pz
  8. end type
  9. type dw_his from u_dw_rbtnfilter within w_mtrldef_edit_price_pz
  10. end type
  11. type tv_1 from uo_tv_mtrltype within w_mtrldef_edit_price_pz
  12. end type
  13. type cb_edit from uo_imflatbutton within w_mtrldef_edit_price_pz
  14. end type
  15. end forward
  16. global type w_mtrldef_edit_price_pz from w_publ_easyq
  17. string title = "产品及物料(按配置)计划价设定"
  18. cb_save cb_save
  19. ddlb_1 ddlb_1
  20. dw_his dw_his
  21. tv_1 tv_1
  22. cb_edit cb_edit
  23. end type
  24. global w_mtrldef_edit_price_pz w_mtrldef_edit_price_pz
  25. type variables
  26. string ls_handtype
  27. long cur_isuse = -1
  28. end variables
  29. forward prototypes
  30. public function integer wf_face ()
  31. end prototypes
  32. public function integer wf_face ();cb_1.Enabled = NOT dw_edit_mode
  33. cb_save.Enabled = dw_edit_mode
  34. cb_func.Enabled = NOT dw_edit_mode
  35. cb_psetup.Enabled = NOT dw_edit_mode
  36. cb_2.Enabled = NOT dw_edit_mode
  37. cbx_yl.Enabled = NOT dw_edit_mode
  38. ddlb_1.Enabled = NOT dw_edit_mode
  39. IF dw_edit_mode THEN
  40. dw_1.SetTabOrder('planprice',10)
  41. cb_edit.Text = '放弃'
  42. cb_edit.normalpicname = 'Undo.bmp'
  43. ELSE
  44. dw_1.SetTabOrder('planprice',0)
  45. cb_edit.Text = '修改'
  46. cb_edit.normalpicname = 'OPEN.bmp'
  47. END IF
  48. cb_edit.of_init_draw()
  49. cb_edit.of_paint()
  50. cb_edit.TriggerEvent('ue_textchange')
  51. RETURN 1
  52. end function
  53. on w_mtrldef_edit_price_pz.create
  54. int iCurrent
  55. call super::create
  56. this.cb_save=create cb_save
  57. this.ddlb_1=create ddlb_1
  58. this.dw_his=create dw_his
  59. this.tv_1=create tv_1
  60. this.cb_edit=create cb_edit
  61. iCurrent=UpperBound(this.Control)
  62. this.Control[iCurrent+1]=this.cb_save
  63. this.Control[iCurrent+2]=this.ddlb_1
  64. this.Control[iCurrent+3]=this.dw_his
  65. this.Control[iCurrent+4]=this.tv_1
  66. this.Control[iCurrent+5]=this.cb_edit
  67. end on
  68. on w_mtrldef_edit_price_pz.destroy
  69. call super::destroy
  70. destroy(this.cb_save)
  71. destroy(this.ddlb_1)
  72. destroy(this.dw_his)
  73. destroy(this.tv_1)
  74. destroy(this.cb_edit)
  75. end on
  76. event resize;call super::resize;
  77. tv_1.height = dw_1.height - dw_his.height - 10
  78. dw_his.y = tv_1.y + tv_1.height
  79. end event
  80. event ue_before_open;call super::ue_before_open;if_ue_sentdataout = TRUE
  81. dw_his.SetTransObject (sqlca)
  82. IF sys_option_planprice_directinput = 1 THEN
  83. dw_1.Modify('planprice.Protect = 0')
  84. ELSE
  85. dw_1.Modify('planprice.Protect = 1')
  86. END IF
  87. end event
  88. type cb_func from w_publ_easyq`cb_func within w_mtrldef_edit_price_pz
  89. end type
  90. event cb_func::clicked;m_Dfc_Control_PopupMenu dmPopupMenu
  91. string menustr
  92. if if_ue_retr then
  93. menustr="Text=查询~tEvent=ue_retr"
  94. end if
  95. if if_ue_filter then
  96. if len(trim(menustr))=0 then
  97. menustr="Text=高级筛选~tEvent=ue_filter"
  98. else
  99. menustr=menustr + "|" + "Text=高级筛选~tEvent=ue_filter"
  100. end if
  101. end if
  102. if if_ue_sort then
  103. if len(trim(menustr))=0 then
  104. menustr="Text=排序~tEvent=ue_sort"
  105. else
  106. menustr=menustr + "|" + "Text=排序~tEvent=ue_sort"
  107. end if
  108. end if
  109. if menustr<>"" and if_ue_sentdataout then menustr=menustr + "|" + "Text=-"
  110. if if_ue_sentdataout then
  111. if len(trim(menustr))=0 then
  112. menustr="Text=数据发送~tEvent=ue_sentdataout"
  113. else
  114. menustr=menustr + "|" + "Text=数据发送~tEvent=ue_sentdataout"
  115. end if
  116. end if
  117. if len(trim(menustr))<>0 then
  118. dmPopupMenu = Create m_Dfc_Control_PopupMenu
  119. dmPopupMenu.mf_BuildMenu(This, menustr)
  120. dmPopupMenu.mf_PopMenu()
  121. Destroy dmPopupMenu
  122. end if
  123. end event
  124. type cb_exit from w_publ_easyq`cb_exit within w_mtrldef_edit_price_pz
  125. integer x = 1161
  126. end type
  127. type cb_2 from w_publ_easyq`cb_2 within w_mtrldef_edit_price_pz
  128. integer x = 859
  129. integer taborder = 100
  130. boolean bringtotop = true
  131. end type
  132. type cb_psetup from w_publ_easyq`cb_psetup within w_mtrldef_edit_price_pz
  133. integer x = 603
  134. boolean bringtotop = true
  135. end type
  136. type cb_1 from w_publ_easyq`cb_1 within w_mtrldef_edit_price_pz
  137. boolean bringtotop = true
  138. end type
  139. event cb_1::clicked;call super::clicked;dw_1.Retrieve(cur_isuse,ls_handtype)
  140. end event
  141. type st_3 from w_publ_easyq`st_3 within w_mtrldef_edit_price_pz
  142. boolean visible = false
  143. integer x = 823
  144. integer y = 368
  145. end type
  146. type st_4 from w_publ_easyq`st_4 within w_mtrldef_edit_price_pz
  147. boolean visible = false
  148. integer x = 1170
  149. integer y = 508
  150. end type
  151. type em_1 from w_publ_easyq`em_1 within w_mtrldef_edit_price_pz
  152. boolean visible = false
  153. integer x = 736
  154. integer y = 436
  155. integer taborder = 110
  156. end type
  157. type em_2 from w_publ_easyq`em_2 within w_mtrldef_edit_price_pz
  158. boolean visible = false
  159. integer x = 1253
  160. integer y = 428
  161. integer taborder = 140
  162. end type
  163. type ddlb_yl from w_publ_easyq`ddlb_yl within w_mtrldef_edit_price_pz
  164. integer x = 1600
  165. integer y = 36
  166. end type
  167. type cbx_yl from w_publ_easyq`cbx_yl within w_mtrldef_edit_price_pz
  168. integer x = 1390
  169. integer y = 40
  170. end type
  171. type dw_1 from w_publ_easyq`dw_1 within w_mtrldef_edit_price_pz
  172. integer x = 1152
  173. integer y = 300
  174. integer width = 1495
  175. integer height = 1436
  176. string dataobject = "dw_mtrldef_edit_price_pz"
  177. end type
  178. event dw_1::rowfocuschanged;IF currentrow <= 0 THEN RETURN
  179. This.SelectRow(0,False)
  180. This.SelectRow(currentrow,True)
  181. end event
  182. event dw_1::clicked;call super::clicked;IF row <= 0 THEN RETURN
  183. This.SelectRow(0,False)
  184. This.SetRow(row)
  185. This.SelectRow(row,True)
  186. end event
  187. event dw_1::doubleclicked;call super::doubleclicked;IF row = 0 THEN RETURN
  188. Long ll_mtrlid
  189. String ls_status
  190. String ls_woodcode
  191. String ls_pcode
  192. ll_mtrlid = dw_1.Object.mtrlid[row]
  193. ls_status = dw_1.Object.status[row]
  194. ls_woodcode = dw_1.Object.woodcode[row]
  195. ls_pcode = dw_1.Object.pcode[row]
  196. dw_his.SetRedraw(FALSE)
  197. dw_his.Retrieve(ll_mtrlid,ls_status,ls_woodcode,ls_pcode)
  198. dw_his.SetRedraw(TRUE)
  199. end event
  200. type sle_mtrl from w_publ_easyq`sle_mtrl within w_mtrldef_edit_price_pz
  201. end type
  202. type sle_cust from w_publ_easyq`sle_cust within w_mtrldef_edit_price_pz
  203. end type
  204. type st_mtrl from w_publ_easyq`st_mtrl within w_mtrldef_edit_price_pz
  205. end type
  206. type st_cust from w_publ_easyq`st_cust within w_mtrldef_edit_price_pz
  207. end type
  208. type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_mtrldef_edit_price_pz
  209. end type
  210. type pb_em1 from w_publ_easyq`pb_em1 within w_mtrldef_edit_price_pz
  211. boolean visible = false
  212. end type
  213. type pb_em2 from w_publ_easyq`pb_em2 within w_mtrldef_edit_price_pz
  214. boolean visible = false
  215. end type
  216. type pb_2 from w_publ_easyq`pb_2 within w_mtrldef_edit_price_pz
  217. boolean visible = false
  218. end type
  219. type cb_help from w_publ_easyq`cb_help within w_mtrldef_edit_price_pz
  220. integer x = 1010
  221. end type
  222. type cb_copyself from w_publ_easyq`cb_copyself within w_mtrldef_edit_price_pz
  223. boolean visible = false
  224. end type
  225. type gb_1 from w_publ_easyq`gb_1 within w_mtrldef_edit_price_pz
  226. end type
  227. type ln_bar from w_publ_easyq`ln_bar within w_mtrldef_edit_price_pz
  228. end type
  229. type ln_bar2 from w_publ_easyq`ln_bar2 within w_mtrldef_edit_price_pz
  230. end type
  231. type r_bar from w_publ_easyq`r_bar within w_mtrldef_edit_price_pz
  232. end type
  233. type ln_1 from w_publ_easyq`ln_1 within w_mtrldef_edit_price_pz
  234. end type
  235. type ln_2 from w_publ_easyq`ln_2 within w_mtrldef_edit_price_pz
  236. end type
  237. type ln_3 from w_publ_easyq`ln_3 within w_mtrldef_edit_price_pz
  238. end type
  239. type ln_4 from w_publ_easyq`ln_4 within w_mtrldef_edit_price_pz
  240. end type
  241. type cb_save from uo_imflatbutton within w_mtrldef_edit_price_pz
  242. integer x = 302
  243. integer width = 151
  244. integer height = 164
  245. integer taborder = 20
  246. boolean bringtotop = true
  247. boolean enabled = false
  248. string text = "保存"
  249. string normalpicname = "save.bmp"
  250. integer picsize = 16
  251. toolbaralignment pic_align = alignattop!
  252. boolean border = false
  253. end type
  254. event clicked;call super::clicked;IF NOT f_power_ind(723) THEN
  255. MessageBox('提示',sys_msg_pow, Information!, OK! )
  256. RETURN
  257. END IF
  258. int rslt = 1
  259. Long i
  260. dw_1.AcceptText()
  261. Decimal ld_planprice
  262. Decimal last_planprice
  263. Long mtrlid,ll_printid
  264. String ls_status
  265. String ls_woodcode
  266. String ls_pcode
  267. string ls_msg
  268. FOR i = 1 TO dw_1.RowCount()
  269. last_planprice = dw_1.Object.planprice.Original[i]
  270. ld_planprice = dw_1.Object.planprice[i]
  271. ls_status = dw_1.Object.status[i]
  272. ls_woodcode = dw_1.Object.woodcode[i]
  273. ls_pcode = dw_1.Object.pcode[i]
  274. ll_printid = i
  275. IF last_planprice <> ld_planprice THEN
  276. mtrlid = dw_1.Object.mtrlid[i]
  277. INSERT INTO u_planprice_his (
  278. billid,
  279. mtrlid,
  280. lastprice,
  281. planprice,
  282. relcode,
  283. reason,
  284. changedtime,
  285. changedemp,
  286. printid,
  287. status,
  288. woodcode,
  289. pcode)
  290. VALUES(
  291. 0,
  292. :mtrlid,
  293. :last_planprice,
  294. :ld_planprice,
  295. '',
  296. '产品计划价设定',
  297. getdate(),
  298. :publ_operator,
  299. :ll_printid,
  300. :ls_status,
  301. :ls_woodcode,
  302. :ls_pcode);
  303. IF SQLca.SQLCode <> 0 THEN
  304. ls_msg = sqlca.sqlerrtext
  305. rslt = 0
  306. ROLLBACK;
  307. MessageBox('提示','插入计划价变更历史表失败!'+ls_msg, Information!, OK! )
  308. GOTO ext
  309. END IF
  310. END IF
  311. NEXT
  312. IF dw_1.Update() = 1 THEN
  313. COMMIT;
  314. MessageBox('提示','保存成功!', Information!, OK! )
  315. ELSE
  316. rslt = 0
  317. ROLLBACK;
  318. MessageBox('提示','保存失败', Information!, OK! )
  319. END IF
  320. ext:
  321. IF rslt = 0 THEN
  322. RETURN
  323. ELSE
  324. dw_edit_mode = Not dw_edit_mode
  325. wf_face()
  326. RETURN
  327. END IF
  328. end event
  329. type ddlb_1 from dropdownlistbox within w_mtrldef_edit_price_pz
  330. integer y = 192
  331. integer width = 325
  332. integer height = 452
  333. integer taborder = 100
  334. boolean bringtotop = true
  335. integer textsize = -9
  336. integer weight = 400
  337. fontcharset fontcharset = gb2312charset!
  338. fontpitch fontpitch = variable!
  339. string facename = "宋体"
  340. long textcolor = 33554432
  341. string text = "[全部]"
  342. string item[] = {"[全部]","有效"}
  343. borderstyle borderstyle = stylelowered!
  344. end type
  345. event selectionchanged;IF This.Text = '[全部]' THEN
  346. cur_isuse = -1
  347. ELSEIF This.Text = '有效' THEN
  348. cur_isuse = 1
  349. END IF
  350. cb_1.TriggerEvent(Clicked!)
  351. end event
  352. type dw_his from u_dw_rbtnfilter within w_mtrldef_edit_price_pz
  353. integer y = 840
  354. integer width = 1152
  355. integer height = 892
  356. integer taborder = 20
  357. boolean bringtotop = true
  358. string dataobject = "dw_planprice_his_pz"
  359. boolean controlmenu = true
  360. boolean minbox = true
  361. boolean maxbox = true
  362. boolean hscrollbar = true
  363. boolean vscrollbar = true
  364. end type
  365. event clicked;call super::clicked;IF row <=0 THEN RETURN
  366. this.selectrow(0,false)
  367. this.selectrow(row,true)
  368. end event
  369. type tv_1 from uo_tv_mtrltype within w_mtrldef_edit_price_pz
  370. integer y = 300
  371. integer width = 1152
  372. integer height = 540
  373. integer taborder = 90
  374. boolean bringtotop = true
  375. integer textsize = -9
  376. fontcharset fontcharset = gb2312charset!
  377. fontfamily fontfamily = anyfont!
  378. string facename = "宋体"
  379. end type
  380. event selectionchanged;call super::selectionchanged;ls_handtype = THIS.uo_cur_info.handtype
  381. cb_1.TriggerEvent(CLICKED!)
  382. end event
  383. type cb_edit from uo_imflatbutton within w_mtrldef_edit_price_pz
  384. integer x = 453
  385. integer width = 151
  386. integer height = 164
  387. integer taborder = 40
  388. boolean bringtotop = true
  389. string text = "修改"
  390. string normalpicname = "open.bmp"
  391. integer picsize = 16
  392. toolbaralignment pic_align = alignattop!
  393. boolean border = false
  394. end type
  395. event clicked;call super::clicked;IF NOT f_power_ind(723) THEN
  396. MessageBox('提示',sys_msg_pow, Information!, OK! )
  397. RETURN
  398. END IF
  399. IF dw_edit_mode THEN
  400. IF MessageBox('提示','是否要确定放弃保存资料', question!, YesNo!, 2) = 2 THEN
  401. RETURN
  402. END IF
  403. END IF
  404. dw_edit_mode = NOT dw_edit_mode
  405. wf_face()
  406. IF NOT dw_edit_mode THEN
  407. cb_1.TriggerEvent(Clicked!)
  408. END IF
  409. end event