w_mtrldef_edit_cost_rule.srw 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. $PBExportHeader$w_mtrldef_edit_cost_rule.srw
  2. forward
  3. global type w_mtrldef_edit_cost_rule from w_publ_base
  4. end type
  5. type dw_1 from datawindow within w_mtrldef_edit_cost_rule
  6. end type
  7. type cb_2 from uo_imflatbutton within w_mtrldef_edit_cost_rule
  8. end type
  9. type cb_1 from uo_imflatbutton within w_mtrldef_edit_cost_rule
  10. end type
  11. type st_1 from statictext within w_mtrldef_edit_cost_rule
  12. end type
  13. end forward
  14. global type w_mtrldef_edit_cost_rule from w_publ_base
  15. integer width = 1778
  16. integer height = 1468
  17. string title = "统计设定"
  18. boolean minbox = false
  19. windowtype windowtype = response!
  20. dw_1 dw_1
  21. cb_2 cb_2
  22. cb_1 cb_1
  23. st_1 st_1
  24. end type
  25. global w_mtrldef_edit_cost_rule w_mtrldef_edit_cost_rule
  26. type variables
  27. s_edit_index_tran s_tran //传递参数使用
  28. uo_mtrldef uo_mtrl
  29. end variables
  30. forward prototypes
  31. public function integer wf_save ()
  32. public function integer wf_insertrow ()
  33. end prototypes
  34. public function integer wf_save ();Int rslt = 1
  35. Long li_row
  36. dw_1.AcceptText()
  37. li_row = dw_1.GetRow()
  38. IF li_row <= 0 THEN
  39. MessageBox('提示','记录错误',information!,ok!)
  40. rslt = 0
  41. GOTO ext
  42. END IF
  43. String arg_msg
  44. s_mtrldef_cost s_cost
  45. s_cost.cmpid = dw_1.Object.cmpid[li_row]
  46. s_cost.dscrp = dw_1.Object.dscrp[li_row]
  47. s_cost.mtrltype = dw_1.Object.mtrltype[li_row]
  48. s_cost.emptype = dw_1.Object.emptype[li_row]
  49. s_cost.scformula = dw_1.Object.scformula[li_row]
  50. s_cost.glformula = dw_1.Object.glformula[li_row]
  51. IF uo_mtrl.save_cost(s_cost,arg_msg,TRUE) = 0 THEN
  52. MessageBox('错误',arg_msg,information!,ok!)
  53. rslt = 0
  54. GOTO ext
  55. END IF
  56. ext:
  57. RETURN rslt
  58. end function
  59. public function integer wf_insertrow ();Long ll_row
  60. ll_row = dw_1.InsertRow(0)
  61. dw_1.SetFocus()
  62. dw_1.SetColumn('mtrltype')
  63. RETURN 1
  64. end function
  65. on w_mtrldef_edit_cost_rule.create
  66. int iCurrent
  67. call super::create
  68. this.dw_1=create dw_1
  69. this.cb_2=create cb_2
  70. this.cb_1=create cb_1
  71. this.st_1=create st_1
  72. iCurrent=UpperBound(this.Control)
  73. this.Control[iCurrent+1]=this.dw_1
  74. this.Control[iCurrent+2]=this.cb_2
  75. this.Control[iCurrent+3]=this.cb_1
  76. this.Control[iCurrent+4]=this.st_1
  77. end on
  78. on w_mtrldef_edit_cost_rule.destroy
  79. call super::destroy
  80. destroy(this.dw_1)
  81. destroy(this.cb_2)
  82. destroy(this.cb_1)
  83. destroy(this.st_1)
  84. end on
  85. event open;call super::open;dw_1.SetTransObject(sqlca)
  86. s_tran = Message.PowerObjectParm
  87. uo_mtrl = CREATE uo_mtrldef
  88. uo_mtrl.commit_transaction = sqlca
  89. IF s_tran.b_long = 0 THEN
  90. wf_insertrow()
  91. ELSE
  92. dw_1.Retrieve(s_tran.b_long)
  93. END IF
  94. IF NOT f_power_ind(1374) THEN
  95. dw_1.Enabled = FALSE
  96. END IF
  97. end event
  98. event close;call super::close;destroy uo_mtrl
  99. end event
  100. type cb_func from w_publ_base`cb_func within w_mtrldef_edit_cost_rule
  101. boolean visible = false
  102. integer x = 1056
  103. integer y = 580
  104. boolean enabled = false
  105. end type
  106. type cb_exit from w_publ_base`cb_exit within w_mtrldef_edit_cost_rule
  107. integer x = 1330
  108. integer y = 1228
  109. integer taborder = 30
  110. string text = "取消"
  111. end type
  112. type dw_1 from datawindow within w_mtrldef_edit_cost_rule
  113. event key pbm_dwnkey
  114. event dwnkey pbm_dwnkey
  115. integer x = 55
  116. integer y = 140
  117. integer width = 1641
  118. integer height = 1044
  119. integer taborder = 10
  120. boolean bringtotop = true
  121. string dataobject = "dw_mtrldef_cost_edit"
  122. boolean livescroll = true
  123. borderstyle borderstyle = stylelowered!
  124. end type
  125. event dwnkey;IF Key = KeyDownArrow! THEN RETURN 1
  126. IF Key = keyenter! OR Key = KeyDownArrow! THEN //
  127. keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  128. keybd_event ( 9, 0, 2, 0 ) // 释放tab
  129. RETURN 0
  130. ELSEIF Key = keyuparrow! THEN
  131. keybd_event ( 16, 0, 0 , 0 )
  132. keybd_event ( 9, 0, 0 , 0 )
  133. keybd_event ( 9, 0, 2, 0 )
  134. keybd_event ( 16, 0, 2, 0 )
  135. RETURN 0
  136. END IF
  137. end event
  138. event buttonclicked;
  139. IF dwo.Name = 'b_s' THEN
  140. s_edit_index_tran s_ch_tran //传递参数使用
  141. s_ch_tran.if_retrieve_all = FALSE //是否一次RETRIEVE所有行
  142. s_ch_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式
  143. s_ch_tran.arg_pkid = 0 //目标定位PKID (备用)
  144. OpenWithParm(w_station_edit,s_ch_tran) //调用
  145. s_station S_INSCUST
  146. S_INSCUST = Message.PowerObjectParm //接受返回结构
  147. IF S_INSCUST.stationid > 0 THEN //正常返回值则可以取以下值
  148. dw_1.SetRedraw(FALSE)
  149. dw_1.Object.freight[row] = S_INSCUST.stationname
  150. dw_1.Object.freight_tele[row] = S_INSCUST.tele
  151. dw_1.SetRedraw(TRUE)
  152. END IF
  153. END IF
  154. end event
  155. type cb_2 from uo_imflatbutton within w_mtrldef_edit_cost_rule
  156. integer x = 709
  157. integer y = 1228
  158. integer width = 517
  159. integer height = 96
  160. integer taborder = 40
  161. string text = "保存[C^+S]"
  162. string normalpicname = "save.bmp"
  163. end type
  164. event clicked;call super::clicked;IF NOT f_power_ind(1374) THEN
  165. MessageBox('提示','你没有使用权限!', Information!, OK! )
  166. RETURN
  167. END IF
  168. if wf_save() = 0 then return
  169. close(parent)
  170. end event
  171. type cb_1 from uo_imflatbutton within w_mtrldef_edit_cost_rule
  172. integer x = 110
  173. integer y = 1228
  174. integer width = 517
  175. integer height = 96
  176. integer taborder = 40
  177. string text = "保存&新增[&S]"
  178. string normalpicname = "save.bmp"
  179. end type
  180. event clicked;call super::clicked;IF NOT f_power_ind(1374) THEN
  181. MessageBox('提示','你没有使用权限!', Information!, OK! )
  182. RETURN
  183. END IF
  184. IF wf_save() = 0 THEN RETURN
  185. wf_insertrow()
  186. end event
  187. type st_1 from statictext within w_mtrldef_edit_cost_rule
  188. integer x = 55
  189. integer y = 12
  190. integer width = 1641
  191. integer height = 112
  192. boolean bringtotop = true
  193. integer textsize = -9
  194. integer weight = 400
  195. fontcharset fontcharset = gb2312charset!
  196. fontpitch fontpitch = variable!
  197. string facename = "宋体"
  198. long textcolor = 255
  199. long backcolor = 134217739
  200. string text = "说明:生产/管理费用计算公式含参数: 物料成本、人力成本。例如: (人力成本 + 材料成本) * 0.5"
  201. boolean focusrectangle = false
  202. end type