w_iteminput_mod.srw 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. $PBExportHeader$w_iteminput_mod.srw
  2. forward
  3. global type w_iteminput_mod from w_publ_base
  4. end type
  5. type dw_1 from datawindow within w_iteminput_mod
  6. end type
  7. type cb_2 from uo_imflatbutton within w_iteminput_mod
  8. end type
  9. type cb_1 from uo_imflatbutton within w_iteminput_mod
  10. end type
  11. type gb_1 from groupbox within w_iteminput_mod
  12. end type
  13. end forward
  14. global type w_iteminput_mod from w_publ_base
  15. integer width = 2423
  16. integer height = 1412
  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. gb_1 gb_1
  24. end type
  25. global w_iteminput_mod w_iteminput_mod
  26. type variables
  27. s_edit_index_tran s_tran
  28. uo_iteminput uo_item
  29. long ll_scid
  30. end variables
  31. forward prototypes
  32. public function integer wf_save ()
  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. Long arg_itemid
  44. Long arg_dateint
  45. DateTime arg_outdate
  46. String arg_dscrp
  47. Decimal arg_outamt
  48. Long arg_accountsid
  49. String arg_msg
  50. Long arg_banktypeid
  51. String arg_billcode
  52. Long arg_rapmoneyid
  53. Long arg_moneyid
  54. Long arg_scid
  55. String arg_relcode
  56. arg_itemid = dw_1.Object.u_iteminput_itemid[li_row]
  57. arg_dateint = dw_1.Object.u_iteminput_dateint[li_row]
  58. arg_outdate = dw_1.Object.u_iteminput_outdate[li_row]
  59. arg_dscrp = dw_1.Object.u_iteminput_dscrp[li_row]
  60. arg_outamt = dw_1.Object.u_iteminput_outamt[li_row]
  61. arg_accountsid = dw_1.Object.u_iteminput_accountsid[li_row]
  62. arg_banktypeid = dw_1.Object.u_iteminput_banktypeid[li_row]
  63. arg_billcode = dw_1.Object.u_iteminput_billcode[li_row]
  64. arg_moneyid = dw_1.Object.u_iteminput_moneyid[li_row]
  65. arg_relcode = dw_1.Object.u_iteminput_relcode[li_row]
  66. arg_scid = dw_1.Object.u_iteminput_scid[li_row]
  67. IF arg_dateint = 0 THEN//新增
  68. s_iteminput s_input
  69. s_input.itemid = arg_itemid
  70. s_input.dateint = arg_dateint
  71. s_input.outdate = arg_outdate
  72. s_input.dscrp = arg_dscrp
  73. s_input.outamt = arg_outamt
  74. s_input.accountsid = arg_accountsid
  75. s_input.banktypeid = arg_banktypeid
  76. s_input.billcode = arg_billcode
  77. s_input.relcode = arg_relcode
  78. s_input.buildtype = 0
  79. s_input.opemp = publ_operator
  80. s_input.relrep = ''
  81. s_input.scid = arg_scid
  82. s_input.moneyid = arg_moneyid
  83. IF uo_item.add_iteminput(s_input,arg_msg,False) = 0 THEN
  84. MessageBox('错误',arg_msg,stopsign!,ok!)
  85. rslt = 0
  86. GOTO ext
  87. END IF
  88. // IF uo_item.add_iteminput(arg_scid,arg_itemid,arg_dateint,arg_outdate,arg_dscrp,arg_outamt,arg_accountsid,arg_msg,TRUE,arg_banktypeid,0,arg_billcode,arg_moneyid,arg_relcode) = 0 THEN
  89. // MessageBox('错误',arg_msg,stopsign!,ok!)
  90. // rslt = 0
  91. // GOTO ext
  92. // END IF
  93. ELSE//修改
  94. arg_rapmoneyid = dw_1.Object.u_iteminput_rapmoneyid[li_row]
  95. IF uo_item.mod_iteminput(arg_itemid,arg_dateint,arg_rapmoneyid,arg_outdate,arg_dscrp,arg_outamt,arg_accountsid,arg_banktypeid,arg_msg,TRUE,arg_billcode,arg_relcode) = 0 THEN
  96. MessageBox('错误',arg_msg,stopsign!,ok!)
  97. rslt = 0
  98. GOTO ext
  99. END IF
  100. END IF
  101. ext:
  102. RETURN rslt
  103. end function
  104. on w_iteminput_mod.create
  105. int iCurrent
  106. call super::create
  107. this.dw_1=create dw_1
  108. this.cb_2=create cb_2
  109. this.cb_1=create cb_1
  110. this.gb_1=create gb_1
  111. iCurrent=UpperBound(this.Control)
  112. this.Control[iCurrent+1]=this.dw_1
  113. this.Control[iCurrent+2]=this.cb_2
  114. this.Control[iCurrent+3]=this.cb_1
  115. this.Control[iCurrent+4]=this.gb_1
  116. end on
  117. on w_iteminput_mod.destroy
  118. call super::destroy
  119. destroy(this.dw_1)
  120. destroy(this.cb_2)
  121. destroy(this.cb_1)
  122. destroy(this.gb_1)
  123. end on
  124. event open;call super::open;dw_1.SetTransObject(sqlca)
  125. s_tran = Message.PowerObjectParm
  126. uo_item = CREATE uo_iteminput
  127. Int li_opentype
  128. Long li_itemid,li_dateint
  129. String ls_dscrp
  130. li_opentype = s_tran.b_long
  131. li_itemid = s_tran.c_long
  132. li_dateint = s_tran.d_long
  133. ls_dscrp = s_tran.b_string
  134. ll_scid = s_tran.e_long
  135. datawindowchild childdw
  136. dw_1.SetTransObject (sqlca)
  137. dw_1.GetChild("u_iteminput_accountsid",childdw)
  138. childdw.SetTransObject (sqlca)
  139. IF childdw.Retrieve(sys_user_account) = 0 THEN
  140. childdw.InsertRow(0)
  141. END IF
  142. IF li_opentype = 1 THEN
  143. dw_1.InsertRow(0)
  144. IF ls_dscrp <> '' THEN
  145. dw_1.Object.u_iteminput_dscrp[dw_1.GetRow()] = ls_dscrp
  146. END IF
  147. ELSE
  148. dw_1.Retrieve(li_itemid,li_dateint)
  149. END IF
  150. dw_1.Object.u_iteminput_scid[dw_1.GetRow()] = ll_scid
  151. end event
  152. event close;call super::close;destroy uo_item
  153. end event
  154. type cb_func from w_publ_base`cb_func within w_iteminput_mod
  155. boolean visible = false
  156. integer x = 873
  157. integer y = 1084
  158. end type
  159. type cb_exit from w_publ_base`cb_exit within w_iteminput_mod
  160. integer x = 2039
  161. integer y = 1180
  162. integer taborder = 30
  163. string text = "取消"
  164. end type
  165. type dw_1 from datawindow within w_iteminput_mod
  166. event key pbm_dwnkey
  167. event dwnkey pbm_dwnkey
  168. integer x = 14
  169. integer y = 52
  170. integer width = 2341
  171. integer height = 1108
  172. integer taborder = 10
  173. boolean bringtotop = true
  174. string dataobject = "dw_iteminput_edit"
  175. boolean livescroll = true
  176. borderstyle borderstyle = stylelowered!
  177. end type
  178. event dwnkey;if key = KeyDownArrow! then return 1
  179. string ls_itemcode
  180. string ls_itemname
  181. string ls_itemtype
  182. int li_itemflag
  183. long ll_itemid,li_row
  184. dw_1.accepttext()
  185. li_row=dw_1.getrow()
  186. if dw_1.getcolumnname ( )='u_itemdef_itemcode' and key = keyenter! then
  187. ls_itemcode=trim(dw_1.object.u_itemdef_itemcode[li_row])
  188. select itemid,itemname,itemflag,itemtype into :ll_itemid,:ls_itemname,:li_itemflag,:ls_itemtype from u_itemdef where itemcode=:ls_itemcode;
  189. dw_1.setredraw(false)
  190. if sqlca.sqlcode<>0 then
  191. dw_1.triggerevent(doubleclicked!)
  192. return 0
  193. else
  194. dw_1.object.u_iteminput_itemid[li_row]=ll_itemid
  195. dw_1.object.u_itemdef_itemname[li_row]=ls_itemname
  196. dw_1.object.u_itemdef_itemtype[li_row]=ls_itemtype
  197. dw_1.object.u_itemdef_itemflag[li_row]=li_itemflag
  198. end if
  199. dw_1.setredraw(true)
  200. dw_1.setcolumn("u_iteminput_outamt")
  201. return 0
  202. else
  203. if key = keyenter! or key = keydownarrow! then //
  204. keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  205. keybd_event ( 9, 0, 2, 0 ) // 释放tab
  206. return 0
  207. elseif key = keyuparrow! then
  208. keybd_event ( 16, 0, 0 , 0 )
  209. keybd_event ( 9, 0, 0 , 0 )
  210. keybd_event ( 9, 0, 2, 0 )
  211. keybd_event ( 16, 0, 2, 0 )
  212. return 0
  213. end if
  214. end if
  215. end event
  216. event doubleclicked;string ls_itemcode
  217. long li_row
  218. dw_1.accepttext()
  219. li_row=dw_1.getrow()
  220. ls_itemcode=trim(dw_1.object.u_itemdef_itemcode[li_row])
  221. if not isvalid(w_itemdef_response) then
  222. s_edit_index_tran s_ch_tran //传递参数使用
  223. s_ch_tran.if_retrieve_all=local_retrieve_all //是否一次retrieve所有行
  224. s_ch_tran.work_mode=1 //0-单纯编辑模式 1-选择\编辑模式
  225. s_ch_tran.arg_pkid=0 //目标定位pkid (备用)
  226. s_ch_tran.arg_string_code=ls_itemcode //查询列(物料编码)部分内容,用于初步筛选
  227. openwithparm(w_itemdef_response,s_ch_tran) //调用
  228. s_itemdef s_inscust
  229. s_inscust=message.powerobjectparm //接受返回结构
  230. if s_inscust.itemid > 0 then //正常返回值则可以取以下值
  231. dw_1.setredraw(false)
  232. dw_1.object.u_iteminput_itemid[li_row]=s_inscust.itemid
  233. dw_1.object.u_itemdef_itemcode[li_row]=s_inscust.itemcode
  234. dw_1.object.u_itemdef_itemname[li_row]=s_inscust.itemname
  235. dw_1.object.u_itemdef_itemtype[li_row]=s_inscust.itemtype
  236. dw_1.object.u_itemdef_itemflag[li_row]=s_inscust.itemflag
  237. dw_1.setcolumn("u_iteminput_outamt")
  238. dw_1.setredraw(true)
  239. end if
  240. end if
  241. end event
  242. event rbuttondown;Long ll_row,ll_column
  243. ll_row = THIS.GetRow()
  244. ll_column = THIS.GetColumn()
  245. IF ll_row <= 0 THEN RETURN
  246. IF ll_column <= 0 THEN RETURN
  247. IF Left( THIS.Describe( dwo.Name+ ".coltype"),4) = 'date' THEN
  248. s_calender_arg s_calender
  249. s_calender.PointerX = THIS.PointerX()
  250. s_calender.PointerY = THIS.PointerY()
  251. s_calender.X = THIS.X + PARENT.X
  252. s_calender.Y = THIS.Y + PARENT.Y
  253. OpenWithParm(w_calendar,s_calender)
  254. THIS.SetItem(ll_row,ll_column,id_date_selected)
  255. end if
  256. end event
  257. type cb_2 from uo_imflatbutton within w_iteminput_mod
  258. integer x = 1714
  259. integer y = 1180
  260. integer width = 329
  261. integer height = 96
  262. integer taborder = 40
  263. string text = "保存[C^+S]"
  264. end type
  265. event clicked;call super::clicked;if wf_save() = 0 then return
  266. close(parent)
  267. end event
  268. type cb_1 from uo_imflatbutton within w_iteminput_mod
  269. integer x = 1312
  270. integer y = 1180
  271. integer width = 407
  272. integer height = 96
  273. integer taborder = 40
  274. string text = "保存&新增[&S]"
  275. end type
  276. event clicked;call super::clicked;if wf_save() = 0 then return
  277. dw_1.reset()
  278. dw_1.insertrow(0)
  279. dw_1.Object.u_iteminput_scid[dw_1.GetRow()] = ll_scid
  280. dw_1.setfocus()
  281. dw_1.setcolumn('u_iteminput_outdate')
  282. end event
  283. type gb_1 from groupbox within w_iteminput_mod
  284. integer width = 2373
  285. integer height = 1300
  286. integer taborder = 30
  287. integer textsize = -9
  288. integer weight = 400
  289. fontcharset fontcharset = gb2312charset!
  290. fontpitch fontpitch = variable!
  291. string facename = "宋体"
  292. long textcolor = 33554432
  293. long backcolor = 134217739
  294. string text = "资料录入"
  295. end type