w_cmpl_modle.srw 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120
  1. $PBExportHeader$w_cmpl_modle.srw
  2. forward
  3. global type w_cmpl_modle from w_publ_base
  4. end type
  5. type dw_pageretr from u_dw_rbtnfilter within w_cmpl_modle
  6. end type
  7. type dw_child from u_dw_rbtnfilter within w_cmpl_modle
  8. end type
  9. type cb_add from uo_imflatbutton within w_cmpl_modle
  10. end type
  11. type cb_edit from uo_imflatbutton within w_cmpl_modle
  12. end type
  13. type cb_delet from uo_imflatbutton within w_cmpl_modle
  14. end type
  15. type cb_retrieve from uo_imflatbutton within w_cmpl_modle
  16. end type
  17. type sle_modlename from singlelineedit within w_cmpl_modle
  18. end type
  19. type cb_addmx from uo_imflatbutton within w_cmpl_modle
  20. end type
  21. type cb_delmx from uo_imflatbutton within w_cmpl_modle
  22. end type
  23. type st_1 from statictext within w_cmpl_modle
  24. end type
  25. type st_2 from statictext within w_cmpl_modle
  26. end type
  27. type sle_usual_query from u_sleedit within w_cmpl_modle
  28. end type
  29. type cb_sort from uo_imflatbutton within w_cmpl_modle
  30. end type
  31. type cb_other from uo_imflatbutton within w_cmpl_modle
  32. end type
  33. type ln_bar from line within w_cmpl_modle
  34. end type
  35. type ln_bar2 from line within w_cmpl_modle
  36. end type
  37. type ln_1 from line within w_cmpl_modle
  38. end type
  39. type ln_2 from line within w_cmpl_modle
  40. end type
  41. type r_bar from rectangle within w_cmpl_modle
  42. end type
  43. end forward
  44. global type w_cmpl_modle from w_publ_base
  45. integer width = 3685
  46. integer height = 2100
  47. string title = "计价模板"
  48. boolean maxbox = true
  49. boolean resizable = true
  50. windowstate windowstate = maximized!
  51. event ue_f8 ( )
  52. event dw_filter ( )
  53. event ue_import_cmpl_modle ( )
  54. event ue_import_bom_modle ( )
  55. dw_pageretr dw_pageretr
  56. dw_child dw_child
  57. cb_add cb_add
  58. cb_edit cb_edit
  59. cb_delet cb_delet
  60. cb_retrieve cb_retrieve
  61. sle_modlename sle_modlename
  62. cb_addmx cb_addmx
  63. cb_delmx cb_delmx
  64. st_1 st_1
  65. st_2 st_2
  66. sle_usual_query sle_usual_query
  67. cb_sort cb_sort
  68. cb_other cb_other
  69. ln_bar ln_bar
  70. ln_bar2 ln_bar2
  71. ln_1 ln_1
  72. ln_2 ln_2
  73. r_bar r_bar
  74. end type
  75. global w_cmpl_modle w_cmpl_modle
  76. type variables
  77. uo_cmpl_modle uo_obj
  78. long ins_child_col = 15
  79. end variables
  80. forward prototypes
  81. public function integer wf_refresh_interface ()
  82. public subroutine wf_retrieve ()
  83. public subroutine wf_settaborder ()
  84. public subroutine wf_addmx ()
  85. public subroutine wf_delmx ()
  86. end prototypes
  87. event ue_f8(); IF NOT IsValid(W_mtrldef_edit) THEN
  88. s_edit_index_tran s_tranf8 //传递参数使用
  89. s_tranf8.if_retrieve_all = FALSE //是否一次RETRIEVE所有行
  90. s_tranf8.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式
  91. s_tranf8.arg_pkid = 0 //目标定位PKID (备用)
  92. s_tranf8.arg_string_code = '' //查询列(物料编码)部分内容,用于初步筛选
  93. s_tranf8.if_select_all = FALSE //多选
  94. s_tranf8.b_long = 2 //选采购
  95. s_tranf8.c_long = -1
  96. s_tranf8.f_long = 2
  97. Long chc = 1,ls_j
  98. IF dw_child.GetRow() > 0 THEN s_tranf8.arg_string_code = Trim(dw_child.Object.mtrlcode[dw_child.GetRow()])
  99. OpenWithParm(W_mtrldef_edit,s_tranf8) //调用
  100. s_mtrldef_array S_INSCUST
  101. S_INSCUST = Message.PowerObjectParm //接受返回结构
  102. if UpperBound(S_INSCUST.mtrlid) > 0 then
  103. if S_INSCUST.mtrlid[1] > 0 then
  104. dw_child.object.mtrlid[dw_child.GetRow()] = S_INSCUST.mtrlid[1]
  105. dw_child.object.mtrlcode[dw_child.GetRow()] = S_INSCUST.mtrlcode[1]
  106. dw_child.object.mtrlname[dw_child.GetRow()] = S_INSCUST.mtrlname[1]
  107. dw_child.object.unit[dw_child.GetRow()] = S_INSCUST.unit[1]
  108. end if
  109. end if
  110. end if
  111. end event
  112. event dw_filter();string obj_expr=''
  113. if trim(sle_usual_query.text)<>'' then
  114. IF POS(trim(sle_usual_query.text),'%')=0 THEN
  115. obj_expr=obj_expr+'( modlename LIKE "%'+trim(sle_usual_query.text)+'%" )'
  116. ELSE
  117. obj_expr=obj_expr+'( modlename LIKE "'+trim(sle_usual_query.text)+'" )'
  118. END IF
  119. end if
  120. dw_pageretr.setfilter(obj_expr)
  121. dw_pageretr.SetRedraw(False)
  122. dw_pageretr.filter()
  123. if dw_pageretr.rowcount()>=1 then
  124. dw_pageretr.scrolltorow(1)
  125. end if
  126. dw_pageretr.trigger event rowfocuschanged(dw_pageretr.GetRow())
  127. dw_pageretr.SetRedraw(TRUE)
  128. end event
  129. event ue_import_cmpl_modle();// 引入计价模板
  130. IF NOT IsValid(w_cmpl_modle_ch) THEN
  131. Open(w_cmpl_modle_ch) //调用
  132. long ls_j, ll_row, ll_col
  133. s_cmpl_modle_ch S_INSCUST
  134. S_INSCUST = Message.PowerObjectParm //接受返回结构
  135. if S_INSCUST.modleid > 0 then
  136. dw_child.reset()
  137. for ls_j = 1 to upperbound(S_INSCUST.printid)
  138. ll_row = dw_child.insertrow(0)
  139. dw_child.object.printid[ll_row] = S_INSCUST.printid[ls_j]
  140. dw_child.object.parmname[ll_row] = S_INSCUST.parmname[ls_j]
  141. dw_child.object.displayname[ll_row] = S_INSCUST.displayname[ls_j]
  142. dw_child.object.defaultvalue[ll_row] = S_INSCUST.defaultvalue[ls_j]
  143. dw_child.object.if_useformula[ll_row] = S_INSCUST.if_useformula[ls_j]
  144. dw_child.object.formula[ll_row] = S_INSCUST.formula[ls_j]
  145. dw_child.object.if_from_mtrl[ll_row] = S_INSCUST.if_from_mtrl[ls_j]
  146. dw_child.object.mtrlid[ll_row] = S_INSCUST.mtrlid[ls_j]
  147. dw_child.object.mtrl_pro[ll_row] = S_INSCUST.mtrl_pro[ls_j]
  148. dw_child.object.if_from_product[ll_row] = S_INSCUST.if_from_product[ls_j]
  149. dw_child.object.product_pro[ll_row] = S_INSCUST.product_pro[ls_j]
  150. dw_child.object.mtrlcode[ll_row] = S_INSCUST.mtrlcode[ls_j]
  151. dw_child.object.mtrlname[ll_row] = S_INSCUST.mtrlname[ls_j]
  152. dw_child.object.unit[ll_row] = S_INSCUST.unit[ls_j]
  153. next
  154. end if
  155. END IF
  156. end event
  157. event ue_import_bom_modle();// 引入BOM模板
  158. IF NOT IsValid(w_bom_modle_ch) THEN
  159. Open(w_bom_modle_ch) //调用
  160. long ls_j, ll_row, ll_col
  161. s_cmpl_modle_ch S_INSCUST
  162. S_INSCUST = Message.PowerObjectParm //接受返回结构
  163. if S_INSCUST.modleid > 0 then
  164. dw_child.reset()
  165. for ls_j = 1 to upperbound(S_INSCUST.printid)
  166. ll_row = dw_child.insertrow(0)
  167. dw_child.object.printid[ll_row] = S_INSCUST.printid[ls_j]
  168. dw_child.object.parmname[ll_row] = S_INSCUST.parmname[ls_j]
  169. dw_child.object.displayname[ll_row] = S_INSCUST.displayname[ls_j]
  170. dw_child.object.defaultvalue[ll_row] = S_INSCUST.defaultvalue[ls_j]
  171. dw_child.object.if_useformula[ll_row] = S_INSCUST.if_useformula[ls_j]
  172. dw_child.object.formula[ll_row] = S_INSCUST.formula[ls_j]
  173. dw_child.object.if_from_mtrl[ll_row] = S_INSCUST.if_from_mtrl[ls_j]
  174. dw_child.object.mtrlid[ll_row] = S_INSCUST.mtrlid[ls_j]
  175. dw_child.object.mtrl_pro[ll_row] = S_INSCUST.mtrl_pro[ls_j]
  176. dw_child.object.if_from_product[ll_row] = S_INSCUST.if_from_product[ls_j]
  177. dw_child.object.product_pro[ll_row] = S_INSCUST.product_pro[ls_j]
  178. dw_child.object.mtrlcode[ll_row] = S_INSCUST.mtrlcode[ls_j]
  179. dw_child.object.mtrlname[ll_row] = S_INSCUST.mtrlname[ls_j]
  180. dw_child.object.unit[ll_row] = S_INSCUST.unit[ls_j]
  181. next
  182. end if
  183. END IF
  184. end event
  185. public function integer wf_refresh_interface ();//wf_refresh_interface
  186. IF dw_edit_mode THEN
  187. sle_modlename.displayOnly = false
  188. cb_addmx.Enabled = true
  189. cb_delmx.Enabled = true
  190. cb_sort.Enabled = true
  191. cb_retrieve.Enabled = FALSE
  192. cb_delet.Enabled = FALSE
  193. // cb_print.Enabled = FALSE
  194. // cb_viewprint.Enabled = FALSE
  195. // cb_auditing.Enabled = FALSE
  196. // cb_auditing_cancel.Enabled = FALSE
  197. dw_pageretr.RBUTTON_FILTER_USE = FALSE //右键查询功能开关
  198. dw_pageretr.titleclick_sort_use = FALSE //单击标题排序功能开关
  199. // dw_child.titleclick_sort_use = TRUE //单击标题排序功能开关
  200. dw_child.RBUTTON_SETPOSITION_USE = FALSE //定位
  201. cb_edit.Enabled = TRUE
  202. cb_add.Enabled = TRUE
  203. // cb_xls.Enabled = FALSE
  204. cb_edit.Text = "放弃&E"
  205. cb_add.Text = "保存&S"
  206. cb_edit.normalpicname = 'Undo.bmp'
  207. cb_add.normalpicname = 'Save.bmp'
  208. ELSE
  209. sle_modlename.displayOnly = true
  210. cb_addmx.Enabled = false
  211. cb_delmx.Enabled = false
  212. cb_sort.Enabled = False
  213. cb_retrieve.Enabled = TRUE
  214. cb_delet.Enabled = TRUE
  215. // cb_print.Enabled = TRUE
  216. // cb_viewprint.Enabled = TRUE
  217. // cb_auditing.Enabled = TRUE
  218. // cb_auditing_cancel.Enabled = TRUE
  219. cb_add.Enabled = TRUE
  220. cb_edit.Enabled = TRUE
  221. // cb_xls.Enabled = TRUE
  222. dw_pageretr.RBUTTON_FILTER_USE = TRUE //右键查询功能开关
  223. dw_pageretr.titleclick_sort_use = TRUE //单击标题排序功能开关
  224. // dw_child.titleclick_sort_use = FALSE //单击标题排序功能开关
  225. dw_child.RBUTTON_SETPOSITION_USE = TRUE //定位
  226. cb_edit.Text = "修改&E"
  227. cb_add.Text = "新建&S"
  228. cb_edit.normalpicname = 'OPEN.bmp'
  229. cb_add.normalpicname = 'new.bmp'
  230. IF dw_pageretr.GetRow() <= 0 THEN
  231. cb_edit.Enabled = FALSE
  232. cb_delet.Enabled = FALSE
  233. // cb_addzy.Enabled = FALSE
  234. // cb_auditing.Enabled = FALSE
  235. END IF
  236. END IF
  237. IF dw_edit_mode THEN
  238. // cb_nextpage.Enabled = FALSE
  239. // cb_retrieveall.Enabled = FALSE
  240. // em_pagerowno.Enabled = FALSE
  241. cb_func.Enabled = FALSE
  242. sle_usual_query.Enabled = FALSE
  243. ELSE
  244. sle_usual_query.Enabled = TRUE
  245. cb_func.Enabled = TRUE
  246. END IF
  247. cb_sort.Enabled = dw_edit_mode
  248. cb_other.Enabled = dw_edit_mode
  249. wf_settaborder()
  250. //wf_lock_child()
  251. //修改uc_taborder
  252. //IF dw_edit_mode THEN
  253. // dw_uc.TriggerEvent("ue_taborder")
  254. //
  255. // IF dw_uc.ins_if_nomodify_uc_taborder THEN
  256. // Long ll_uc_int
  257. // FOR ll_uc_int = 1 TO uc_column_int
  258. // dw_uc.SetTabOrder (ll_uc_int,ll_uc_int*10 )
  259. // NEXT
  260. // END IF
  261. //ELSE
  262. // dw_uc.TriggerEvent("ue_taborder_cancel")
  263. //END IF
  264. cb_edit.of_init_draw()
  265. cb_add.of_init_draw()
  266. cb_edit.of_paint()
  267. cb_add.of_paint()
  268. cb_add.TriggerEvent('ue_textchange')
  269. cb_edit.TriggerEvent('ue_textchange')
  270. //ll_lastrow = 0
  271. THIS.TriggerEvent('refresh_interface')
  272. RETURN 1
  273. end function
  274. public subroutine wf_retrieve ();dw_pageretr.retrieve()
  275. dw_pageretr.trigger event rowfocuschanged(dw_pageretr.GetRow())
  276. end subroutine
  277. public subroutine wf_settaborder ();long i
  278. if dw_edit_mode then
  279. for i = 1 to ins_child_col
  280. dw_child.SetTabOrder(i, i * 10)
  281. next
  282. else
  283. for i = 1 to ins_child_col
  284. dw_child.SetTabOrder(i, 0)
  285. next
  286. end if
  287. end subroutine
  288. public subroutine wf_addmx ();Long ll_row, ll_i, ll_cur, ll_max = 0
  289. IF dw_edit_mode THEN
  290. FOR ll_i = 1 To dw_child.RowCount()
  291. ll_cur = Long(dw_child.Object.parmname[ll_i])
  292. IF ll_cur > ll_max THEN
  293. ll_max = ll_cur
  294. END IF
  295. NEXT
  296. ll_max = ll_max + 1
  297. ll_row = dw_child.InsertRow(0)
  298. dw_child.Object.printid[ll_row] = ll_row
  299. dw_child.ScrollToRow(ll_row)
  300. dw_child.Object.parmname[ll_row] = String(ll_max)
  301. dw_child.SetColumn('parmname')
  302. dw_child.SetFocus()
  303. END IF
  304. end subroutine
  305. public subroutine wf_delmx ();if dw_edit_mode then
  306. if dw_child.GetRow() > 0 then
  307. dw_child.DeleteRow(dw_child.GetRow())
  308. dw_child.setfocus()
  309. end if
  310. end if
  311. end subroutine
  312. on w_cmpl_modle.create
  313. int iCurrent
  314. call super::create
  315. this.dw_pageretr=create dw_pageretr
  316. this.dw_child=create dw_child
  317. this.cb_add=create cb_add
  318. this.cb_edit=create cb_edit
  319. this.cb_delet=create cb_delet
  320. this.cb_retrieve=create cb_retrieve
  321. this.sle_modlename=create sle_modlename
  322. this.cb_addmx=create cb_addmx
  323. this.cb_delmx=create cb_delmx
  324. this.st_1=create st_1
  325. this.st_2=create st_2
  326. this.sle_usual_query=create sle_usual_query
  327. this.cb_sort=create cb_sort
  328. this.cb_other=create cb_other
  329. this.ln_bar=create ln_bar
  330. this.ln_bar2=create ln_bar2
  331. this.ln_1=create ln_1
  332. this.ln_2=create ln_2
  333. this.r_bar=create r_bar
  334. iCurrent=UpperBound(this.Control)
  335. this.Control[iCurrent+1]=this.dw_pageretr
  336. this.Control[iCurrent+2]=this.dw_child
  337. this.Control[iCurrent+3]=this.cb_add
  338. this.Control[iCurrent+4]=this.cb_edit
  339. this.Control[iCurrent+5]=this.cb_delet
  340. this.Control[iCurrent+6]=this.cb_retrieve
  341. this.Control[iCurrent+7]=this.sle_modlename
  342. this.Control[iCurrent+8]=this.cb_addmx
  343. this.Control[iCurrent+9]=this.cb_delmx
  344. this.Control[iCurrent+10]=this.st_1
  345. this.Control[iCurrent+11]=this.st_2
  346. this.Control[iCurrent+12]=this.sle_usual_query
  347. this.Control[iCurrent+13]=this.cb_sort
  348. this.Control[iCurrent+14]=this.cb_other
  349. this.Control[iCurrent+15]=this.ln_bar
  350. this.Control[iCurrent+16]=this.ln_bar2
  351. this.Control[iCurrent+17]=this.ln_1
  352. this.Control[iCurrent+18]=this.ln_2
  353. this.Control[iCurrent+19]=this.r_bar
  354. end on
  355. on w_cmpl_modle.destroy
  356. call super::destroy
  357. destroy(this.dw_pageretr)
  358. destroy(this.dw_child)
  359. destroy(this.cb_add)
  360. destroy(this.cb_edit)
  361. destroy(this.cb_delet)
  362. destroy(this.cb_retrieve)
  363. destroy(this.sle_modlename)
  364. destroy(this.cb_addmx)
  365. destroy(this.cb_delmx)
  366. destroy(this.st_1)
  367. destroy(this.st_2)
  368. destroy(this.sle_usual_query)
  369. destroy(this.cb_sort)
  370. destroy(this.cb_other)
  371. destroy(this.ln_bar)
  372. destroy(this.ln_bar2)
  373. destroy(this.ln_1)
  374. destroy(this.ln_2)
  375. destroy(this.r_bar)
  376. end on
  377. event open;call super::open;uo_obj = create uo_cmpl_modle
  378. dw_pageretr.settransobject(sqlca)
  379. dw_child.settransobject(sqlca)
  380. wf_retrieve()
  381. end event
  382. event close;call super::close;destroy uo_obj
  383. end event
  384. event resize;call super::resize;
  385. if this.width < 3648 then this.width = 3648
  386. if this.Height < 1996 then this.Height = 1996
  387. ln_bar.EndX = THIS.Width
  388. ln_bar2.EndX = THIS.Width
  389. ln_1.EndX = THIS.Width
  390. ln_2.EndX = THIS.Width
  391. r_bar.Width = THIS.Width
  392. dw_child.width = this.width - 1270
  393. dw_pageretr.height = this.height - 450
  394. dw_child.height = dw_pageretr.height - 82
  395. end event
  396. event closequery;call super::closequery;IF dw_edit_mode THEN
  397. IF MessageBox ("IF","将丢失未保存的修改,是否继续?",Question!,YesNo! ) = 2 THEN RETURN 1
  398. END IF
  399. end event
  400. type cb_func from w_publ_base`cb_func within w_cmpl_modle
  401. boolean visible = false
  402. integer x = 1961
  403. end type
  404. type cb_exit from w_publ_base`cb_exit within w_cmpl_modle
  405. integer x = 1440
  406. integer width = 151
  407. integer height = 164
  408. integer picsize = 16
  409. toolbaralignment pic_align = alignattop!
  410. boolean border = false
  411. end type
  412. type dw_pageretr from u_dw_rbtnfilter within w_cmpl_modle
  413. integer y = 300
  414. integer width = 1221
  415. integer height = 1688
  416. integer taborder = 20
  417. boolean bringtotop = true
  418. string dataobject = "dw_cmpl_modle"
  419. boolean hscrollbar = true
  420. boolean vscrollbar = true
  421. boolean rbutton_filter_use = true
  422. boolean rbutton_setposition_use = true
  423. boolean titleclick_sort_use = true
  424. end type
  425. event rowfocuschanged;call super::rowfocuschanged;this.selectrow(0, false)
  426. dw_child.reset()
  427. if currentrow <= 0 then return
  428. this.selectrow(currentrow, true)
  429. long ll_modleid
  430. ll_modleid = this.object.modleid[currentrow]
  431. sle_modlename.text = this.object.modlename[currentrow]
  432. dw_child.retrieve(ll_modleid)
  433. end event
  434. event rowfocuschanging;call super::rowfocuschanging;if dw_edit_mode then return 1
  435. end event
  436. type dw_child from u_dw_rbtnfilter within w_cmpl_modle
  437. integer x = 1234
  438. integer y = 392
  439. integer width = 2414
  440. integer height = 1596
  441. integer taborder = 20
  442. boolean bringtotop = true
  443. string dataobject = "dw_cmpl_modlemx"
  444. boolean hscrollbar = true
  445. boolean vscrollbar = true
  446. end type
  447. event doubleclicked;call super::doubleclicked;if not dw_edit_mode then return
  448. dw_child.accepttext()
  449. if dwo.name = 'formula' then
  450. s_cmpl_parm s_parm
  451. long i
  452. for i = 1 to row - 1
  453. s_parm.parmname[i] = dw_child.object.parmname[i]
  454. s_parm.displayname[i] = dw_child.object.displayname[i]
  455. s_parm.parmvalue[i] = dw_child.object.defaultvalue[i]
  456. next
  457. s_parm.oldformula = dw_child.object.formula[row]
  458. openwithparm(w_cmpl_formula_edit, s_parm)
  459. string ls_ret
  460. ls_ret = message.StringParm
  461. if ls_ret <> 'NULL' then
  462. dw_child.object.formula[row] = ls_ret
  463. end if
  464. end if
  465. if dwo.name = 'mtrlcode' then
  466. // DONE: 选择物料
  467. parent.triggerevent('ue_f8')
  468. end if
  469. end event
  470. event dwnkey;call super::dwnkey;String ls_mtrlcode,ls_mtrlname,ls_unit,ls_mtrlmode,ls_mtrlsectype,ls_zxmtrlmode
  471. String ls_ordercode,ls_relcode,ls_unit_buy
  472. Long ls_mtrlid,ls_sptid,ls_orderid,ls_storageid
  473. Dec ls_planprice,ls_lmbuyprice,ls_price,ls_rebate,ld_rate_buy
  474. Long cnt
  475. Long child_row
  476. Long ls_null
  477. SetNull(ls_null)
  478. String arg_msg = ''
  479. Decimal ls_1stnewcost,ls_1stzqrate,ls_1strate
  480. String ls_sptmtrlname
  481. String ls_1stunit,ls_status,ls_woodcode,ls_pcode
  482. Int li_statusflag,li_woodcodeflag,li_pcodeflag
  483. s_mtrldef_array arg_s_mtrldef
  484. IF dw_edit_mode THEN
  485. IF KeyDown(keydownarrow!) THEN
  486. Long li_row
  487. IF dw_child.GetRow() = dw_child.RowCount() THEN
  488. if dw_child.AcceptText() <> 1 then return 1
  489. wf_addmx()
  490. END IF
  491. ELSE
  492. IF KeyDown(keyenter!) AND NOT KeyDown(keycontrol!) AND NOT KeyDown(keyshift!) THEN
  493. if dw_child.AcceptText() <> 1 then return 1
  494. IF dw_child.GetColumnName() = 'mtrlcode' THEN
  495. child_row = dw_child.GetRow()
  496. ls_mtrlcode = dw_child.Object.mtrlcode[child_row]
  497. ls_storageid = -1
  498. if trim(ls_mtrlcode) = '' then
  499. dw_child.Object.mtrlid[child_row] = 0
  500. dw_child.Object.mtrlcode[child_row] = ''
  501. dw_child.object.mtrlname[child_row] = ''
  502. dw_child.object.unit[child_row] = ''
  503. else
  504. IF f_find_mtrl(ls_mtrlcode,ls_storageid,arg_s_mtrldef) = 0 THEN
  505. PARENT.TriggerEvent('ue_f8')
  506. RETURN 1
  507. ELSE
  508. ls_mtrlid = arg_s_mtrldef.mtrlid[1]
  509. ls_mtrlcode = arg_s_mtrldef.mtrlcode[1]
  510. ls_mtrlname = arg_s_mtrldef.mtrlname[1]
  511. ls_unit = arg_s_mtrldef.unit[1]
  512. END IF
  513. dw_child.Object.mtrlid[child_row] = ls_mtrlid
  514. dw_child.Object.mtrlcode[child_row] = ls_mtrlcode
  515. dw_child.Object.mtrlname[child_row] = ls_mtrlname
  516. dw_child.object.unit[child_row] = ls_unit
  517. end if
  518. IF Key = keyenter! THEN
  519. keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  520. keybd_event ( 9, 0, 2, 0 ) // 释放tab
  521. RETURN 1
  522. END IF
  523. ELSEIF dw_child.GetColumnName( ) = 'product_pro' AND dw_child.GetRow() = dw_child.RowCount() THEN
  524. wf_addmx()
  525. RETURN 1
  526. ELSE
  527. IF Key = keyenter! THEN
  528. keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  529. keybd_event ( 9, 0, 2, 0 ) // 释放tab
  530. RETURN 1
  531. END IF
  532. END IF
  533. END IF
  534. END IF
  535. END IF
  536. // u_mtrldef_mtrlcode
  537. // acprice
  538. // mtrlid
  539. // mtrlname
  540. // plprice
  541. end event
  542. event itemchanged;call super::itemchanged;if dwo.name = 'if_useformula' OR dwo.name = 'if_from_mtrl' OR dwo.name = 'if_from_product' then
  543. if trim(data) = '1' then
  544. if dwo.name <> 'if_useformula' then
  545. this.object.if_useformula[row] = 0
  546. end if
  547. if dwo.name <> 'if_from_mtrl' then
  548. this.object.if_from_mtrl[row] = 0
  549. end if
  550. if dwo.name <> 'if_from_product' then
  551. this.object.if_from_product[row] = 0
  552. end if
  553. end if
  554. end if
  555. if dwo.name = 'parmname' then
  556. if this.object.displayname[row] = this.object.parmname[row] then
  557. this.object.displayname[row] = data
  558. end if
  559. end if
  560. end event
  561. type cb_add from uo_imflatbutton within w_cmpl_modle
  562. integer x = 151
  563. integer width = 192
  564. integer height = 164
  565. integer taborder = 30
  566. boolean bringtotop = true
  567. string text = "新建&S"
  568. string normalpicname = "new.bmp"
  569. integer picsize = 16
  570. toolbaralignment pic_align = alignattop!
  571. boolean border = false
  572. end type
  573. event clicked;call super::clicked;IF Not f_power_ind(2749,sys_msg_pow) THEN
  574. MessageBox(publ_operator,sys_msg_pow)
  575. RETURN
  576. END IF
  577. String ls_msg
  578. Long i
  579. IF Not dw_edit_mode THEN
  580. IF uo_obj.newbegin(ls_msg) <> 1 THEN
  581. MessageBox('错误', ls_msg, stopsign!)
  582. RETURN
  583. END IF
  584. Int li_row
  585. li_row = dw_pageretr.InsertRow (dw_pageretr.GetRow())
  586. dw_pageretr.ScrollToRow(li_row)
  587. dw_pageretr.Trigger Event RowFocusChanged(li_row)
  588. END IF
  589. IF dw_edit_mode THEN
  590. IF dw_child.AcceptText() <> 1 THEN
  591. RETURN
  592. END IF
  593. IF Trim(sle_modlename.Text) = '' THEN
  594. MessageBox('提示', '名称不能为空')
  595. sle_modlename.SetFocus()
  596. RETURN
  597. END IF
  598. FOR i = 1 To dw_child.RowCount()
  599. IF Trim(dw_child.Object.parmname[i]) = '' THEN
  600. MessageBox('提示', '参数名不能为空')
  601. dw_child.ScrollToRow(i)
  602. dw_child.SetColumn('parmname')
  603. dw_child.SetFocus()
  604. RETURN
  605. END IF
  606. IF Trim(dw_child.Object.DisplayName[i]) = '' THEN
  607. MessageBox('提示', '显示名不能为空')
  608. dw_child.ScrollToRow(i)
  609. dw_child.SetColumn('displayname')
  610. dw_child.SetFocus()
  611. RETURN
  612. END IF
  613. IF Pos(dw_child.Object.parmname[i], '[') > 0 THEN
  614. MessageBox('提示', '参数名不能包含字符"["')
  615. dw_child.ScrollToRow(i)
  616. dw_child.SetColumn('parmname')
  617. dw_child.SetFocus()
  618. RETURN
  619. END IF
  620. IF Pos(dw_child.Object.parmname[i], ']') > 0 THEN
  621. MessageBox('提示', '参数名不能包含字符"]"')
  622. dw_child.ScrollToRow(i)
  623. dw_child.SetColumn('parmname')
  624. dw_child.SetFocus()
  625. RETURN
  626. END IF
  627. IF dw_child.Object.if_useformula[i] = 1 And Trim(dw_child.Object.formula[i]) = '' THEN
  628. MessageBox('提示', '请输入公式')
  629. dw_child.ScrollToRow(i)
  630. dw_child.SetColumn('formula')
  631. dw_child.SetFocus()
  632. RETURN
  633. END IF
  634. IF dw_child.Object.if_from_mtrl[i] = 1 And dw_child.Object.mtrlid[i] <= 0 THEN
  635. MessageBox('提示', '请选择相关物料')
  636. dw_child.ScrollToRow(i)
  637. dw_child.SetColumn('mtrlcode')
  638. dw_child.SetFocus()
  639. RETURN
  640. END IF
  641. IF dw_child.Object.if_from_mtrl[i] = 1 And Trim(dw_child.Object.mtrl_pro[i]) = '' THEN
  642. MessageBox('提示', '请选择相关物料属性')
  643. dw_child.ScrollToRow(i)
  644. dw_child.SetColumn('mtrl_pro')
  645. dw_child.SetFocus()
  646. RETURN
  647. END IF
  648. IF dw_child.Object.if_from_product[i] = 1 And Trim(dw_child.Object.product_pro[i]) = '' THEN
  649. MessageBox('提示', '请选择相关产品属性')
  650. dw_child.ScrollToRow(i)
  651. dw_child.SetColumn('product_pro')
  652. dw_child.SetFocus()
  653. RETURN
  654. END IF
  655. NEXT
  656. uo_obj.modlename = Trim(sle_modlename.Text)
  657. s_cmpl_modlemx tmp[]
  658. FOR i = 1 To dw_child.RowCount()
  659. dw_child.Object.printid[i] = i
  660. tmp[i].modleid = dw_child.Object.modleid[i]
  661. tmp[i].printid = dw_child.Object.printid[i]
  662. tmp[i].parmname = dw_child.Object.parmname[i]
  663. tmp[i].DisplayName = dw_child.Object.DisplayName[i]
  664. tmp[i].defaultValue = dw_child.Object.defaultValue[i]
  665. tmp[i].if_useformula = dw_child.Object.if_useformula[i]
  666. tmp[i].formula = dw_child.Object.formula[i]
  667. tmp[i].if_from_mtrl = dw_child.Object.if_from_mtrl[i]
  668. tmp[i].mtrlid = dw_child.Object.mtrlid[i]
  669. tmp[i].mtrl_pro = dw_child.Object.mtrl_pro[i]
  670. tmp[i].if_from_product = dw_child.Object.if_from_product[i]
  671. tmp[i].product_pro = dw_child.Object.product_pro[i]
  672. tmp[i].unit = dw_child.Object.unit[i]
  673. tmp[i].rowtype = dw_child.Object.u_cmpl_modlemx_rowtype[i]
  674. NEXT
  675. uo_obj.mxs = tmp
  676. uo_obj.ModleType = 0
  677. IF uo_obj.savesubmit(ls_msg) <> 1 THEN
  678. MessageBox('错误', ls_msg)
  679. RETURN
  680. END IF
  681. dw_pageretr.Object.modleid[dw_pageretr.GetRow()] = uo_obj.modleid
  682. dw_pageretr.Object.modlename[dw_pageretr.GetRow()] = uo_obj.modlename
  683. dw_pageretr.Object.opemp[dw_pageretr.GetRow()] = uo_obj.opemp
  684. dw_pageretr.Object.opdate[dw_pageretr.GetRow()] = uo_obj.opdate
  685. END IF
  686. dw_edit_mode = Not dw_edit_mode
  687. IF dw_edit_mode THEN
  688. wf_addmx()
  689. END IF
  690. wf_refresh_interface()
  691. end event
  692. type cb_edit from uo_imflatbutton within w_cmpl_modle
  693. integer x = 343
  694. integer width = 192
  695. integer height = 164
  696. integer taborder = 40
  697. boolean bringtotop = true
  698. string text = "修改&E"
  699. string normalpicname = "open.bmp"
  700. integer picsize = 16
  701. toolbaralignment pic_align = alignattop!
  702. boolean border = false
  703. end type
  704. event clicked;call super::clicked;IF NOT f_power_ind(2749,sys_msg_pow) THEN
  705. MessageBox(publ_operator,sys_msg_pow)
  706. RETURN
  707. END IF
  708. String arg_msg = ''
  709. Long uc_row
  710. uc_row = dw_pageretr.GetRow()
  711. IF uc_row <= 0 THEN
  712. MessageBox('系统提示','请选定当前目标单据!')
  713. RETURN
  714. END IF
  715. IF NOT dw_edit_mode THEN
  716. IF uo_obj.updatebegin(dw_pageretr.Object.modleid[uc_row],arg_msg) <>1 THEN
  717. MessageBox('Error!',arg_msg)
  718. RETURN
  719. END IF
  720. END IF
  721. IF dw_edit_mode THEN
  722. IF MessageBox ("IF","是否确定要放弃保存当前单据?",Question!,YesNo! ) = 2 THEN RETURN
  723. END IF
  724. dw_edit_mode = NOT dw_edit_mode
  725. wf_refresh_interface()
  726. IF dw_edit_mode THEN
  727. dw_pageretr.SetFocus()
  728. ELSE
  729. wf_retrieve()
  730. END IF
  731. end event
  732. type cb_delet from uo_imflatbutton within w_cmpl_modle
  733. integer x = 535
  734. integer width = 151
  735. integer height = 164
  736. integer taborder = 50
  737. boolean bringtotop = true
  738. string text = "删除"
  739. string normalpicname = "delete.bmp"
  740. integer picsize = 16
  741. toolbaralignment pic_align = alignattop!
  742. boolean border = false
  743. end type
  744. event clicked;call super::clicked;IF NOT f_power_ind(2749,sys_msg_pow) THEN
  745. MessageBox(publ_operator,sys_msg_pow)
  746. RETURN
  747. END IF
  748. IF dw_edit_mode THEN RETURN
  749. String arg_msg = ''
  750. Long uc_row
  751. uc_row = dw_pageretr.GetRow()
  752. IF uc_row <= 0 THEN
  753. MessageBox('系统提示','请选定当前目标单据!')
  754. RETURN
  755. END IF
  756. IF MessageBox ("IF","是否确定要删除当前单据吗?",Question!,YesNo! ) = 2 THEN RETURN
  757. if uo_obj.del(dw_pageretr.object.modleid[uc_row], arg_msg) <> 1 then
  758. MessageBox('错误', arg_msg)
  759. return
  760. end if
  761. MessageBox(publ_operator,'删除模板'+String(dw_pageretr.Object.modlename[uc_row])+'成功!')
  762. dw_pageretr.DeleteRow(uc_row)
  763. dw_pageretr.trigger event RowFocusChanged(dw_pageretr.GetRow())
  764. end event
  765. type cb_retrieve from uo_imflatbutton within w_cmpl_modle
  766. integer width = 151
  767. integer height = 164
  768. integer taborder = 60
  769. boolean bringtotop = true
  770. string text = "刷新"
  771. string normalpicname = "refresh.bmp"
  772. integer picsize = 16
  773. toolbaralignment pic_align = alignattop!
  774. boolean border = false
  775. end type
  776. event clicked;call super::clicked;wf_retrieve()
  777. end event
  778. type sle_modlename from singlelineedit within w_cmpl_modle
  779. integer x = 1536
  780. integer y = 300
  781. integer width = 1687
  782. integer height = 84
  783. integer taborder = 30
  784. boolean bringtotop = true
  785. integer textsize = -9
  786. integer weight = 400
  787. fontcharset fontcharset = gb2312charset!
  788. fontpitch fontpitch = variable!
  789. string facename = "宋体"
  790. long textcolor = 33554432
  791. boolean displayonly = true
  792. borderstyle borderstyle = stylelowered!
  793. end type
  794. type cb_addmx from uo_imflatbutton within w_cmpl_modle
  795. integer x = 686
  796. integer width = 219
  797. integer height = 164
  798. integer taborder = 30
  799. boolean bringtotop = true
  800. boolean enabled = false
  801. string text = "增明细"
  802. string normalpicname = "mx1.BMP"
  803. integer picsize = 16
  804. toolbaralignment pic_align = alignattop!
  805. boolean border = false
  806. end type
  807. event clicked;call super::clicked;wf_addmx()
  808. end event
  809. type cb_delmx from uo_imflatbutton within w_cmpl_modle
  810. integer x = 905
  811. integer width = 219
  812. integer height = 164
  813. integer taborder = 30
  814. boolean bringtotop = true
  815. boolean enabled = false
  816. string text = "删明细"
  817. string normalpicname = "mx2.BMP"
  818. integer picsize = 16
  819. toolbaralignment pic_align = alignattop!
  820. boolean border = false
  821. end type
  822. event clicked;call super::clicked;wf_delmx()
  823. end event
  824. type st_1 from statictext within w_cmpl_modle
  825. integer x = 50
  826. integer y = 204
  827. integer width = 288
  828. integer height = 48
  829. boolean bringtotop = true
  830. integer textsize = -9
  831. integer weight = 400
  832. fontcharset fontcharset = gb2312charset!
  833. fontpitch fontpitch = variable!
  834. string facename = "宋体"
  835. long textcolor = 33554432
  836. long backcolor = 134217739
  837. string text = "模板名称含"
  838. boolean focusrectangle = false
  839. end type
  840. type st_2 from statictext within w_cmpl_modle
  841. integer x = 1253
  842. integer y = 316
  843. integer width = 261
  844. integer height = 48
  845. boolean bringtotop = true
  846. integer textsize = -9
  847. integer weight = 400
  848. fontcharset fontcharset = gb2312charset!
  849. fontpitch fontpitch = variable!
  850. string facename = "宋体"
  851. long textcolor = 33554432
  852. long backcolor = 134217739
  853. string text = "模板名称:"
  854. boolean focusrectangle = false
  855. end type
  856. type sle_usual_query from u_sleedit within w_cmpl_modle
  857. integer x = 347
  858. integer y = 184
  859. integer height = 92
  860. integer taborder = 20
  861. boolean bringtotop = true
  862. end type
  863. event keyup;call super::keyup;If Key = KeyDownArrow! Then //
  864. dw_pageretr.ScrollNextRow()
  865. End If
  866. If Key = KeyUPArrow! Then //
  867. dw_pageretr.ScrollPriorRow()
  868. End If
  869. end event
  870. event inputchanged;PARENT.POSTEVENT('DW_FILTER')
  871. end event
  872. type cb_sort from uo_imflatbutton within w_cmpl_modle
  873. integer x = 1125
  874. integer width = 151
  875. integer height = 164
  876. integer taborder = 30
  877. boolean bringtotop = true
  878. boolean enabled = false
  879. string text = "重排"
  880. string normalpicname = "p2.BMP"
  881. integer picsize = 16
  882. toolbaralignment pic_align = alignattop!
  883. boolean border = false
  884. end type
  885. event clicked;call super::clicked;if dw_child.accepttext() <> 1 then return
  886. dw_child.SetRedraw(false)
  887. dw_child.Sort()
  888. Long ll_row
  889. FOR ll_row = 1 To dw_child.RowCount()
  890. dw_child.Object.printid[ll_row] = ll_row
  891. NEXT
  892. dw_child.SetRedraw(true)
  893. end event
  894. type cb_other from uo_imflatbutton within w_cmpl_modle
  895. integer x = 1275
  896. integer width = 165
  897. integer height = 164
  898. integer taborder = 40
  899. boolean bringtotop = true
  900. boolean enabled = false
  901. string text = "相关"
  902. string normalpicname = "imexport.BMP"
  903. integer picsize = 16
  904. toolbaralignment pic_align = alignattop!
  905. boolean border = false
  906. end type
  907. event clicked;call super::clicked;
  908. m_Dfc_Control_PopupMenu dmPopupMenu
  909. String menustr
  910. menustr = "Text=引入计价模板~tEvent=ue_import_cmpl_modle"
  911. menustr = menustr + "|" + "Text=引入BOM模板~tEvent=ue_import_BOM_modle"
  912. IF Len(Trim(menustr)) <> 0 THEN
  913. dmPopupMenu = CREATE m_Dfc_Control_PopupMenu
  914. dmPopupMenu.mf_BuildMenu(THIS, menustr)
  915. dmPopupMenu.mf_PopMenu()
  916. DESTROY dmPopupMenu
  917. END IF
  918. end event
  919. type ln_bar from line within w_cmpl_modle
  920. long linecolor = 268435456
  921. integer linethickness = 4
  922. integer beginy = 172
  923. integer endx = 3200
  924. integer endy = 172
  925. end type
  926. type ln_bar2 from line within w_cmpl_modle
  927. long linecolor = 16777215
  928. integer linethickness = 4
  929. integer beginx = 9
  930. integer beginy = 176
  931. integer endx = 3273
  932. integer endy = 176
  933. end type
  934. type ln_1 from line within w_cmpl_modle
  935. long linecolor = 268435456
  936. integer linethickness = 4
  937. integer beginy = 284
  938. integer endx = 3250
  939. integer endy = 284
  940. end type
  941. type ln_2 from line within w_cmpl_modle
  942. long linecolor = 16777215
  943. integer linethickness = 4
  944. integer beginy = 288
  945. integer endx = 3282
  946. integer endy = 288
  947. end type
  948. type r_bar from rectangle within w_cmpl_modle
  949. long linecolor = 16777215
  950. integer linethickness = 4
  951. long fillcolor = 1073741824
  952. integer x = 1650
  953. integer y = 20
  954. integer width = 87
  955. integer height = 68
  956. end type
  957. event constructor;this.fillcolor = 14215660
  958. this.linecolor = 14215660
  959. this.x = -1
  960. this.y = -1
  961. this.height = ln_bar.beginy - 5
  962. end event