w_musttake_mod.srw 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. $PBExportHeader$w_musttake_mod.srw
  2. forward
  3. global type w_musttake_mod from w_publ_base
  4. end type
  5. type dw_1 from datawindow within w_musttake_mod
  6. end type
  7. type cb_2 from uo_imflatbutton within w_musttake_mod
  8. end type
  9. type cb_1 from uo_imflatbutton within w_musttake_mod
  10. end type
  11. end forward
  12. global type w_musttake_mod from w_publ_base
  13. integer y = 388
  14. integer width = 2560
  15. integer height = 1120
  16. string title = "应收帐录入"
  17. boolean minbox = false
  18. windowtype windowtype = response!
  19. dw_1 dw_1
  20. cb_2 cb_2
  21. cb_1 cb_1
  22. end type
  23. global w_musttake_mod w_musttake_mod
  24. type variables
  25. s_edit_index_tran s_tran
  26. uo_musttake uo_take
  27. long li_cusid,li_scid,ll_moneyid
  28. string ls_billcode
  29. decimal ld_takeamt
  30. end variables
  31. forward prototypes
  32. public function integer wf_save ()
  33. public function integer wf_insertrow ()
  34. end prototypes
  35. public function integer wf_save ();Int rslt = 1
  36. Long li_row
  37. dw_1.AcceptText()
  38. li_row = dw_1.GetRow()
  39. IF li_row <= 0 THEN
  40. MessageBox('提示','记录错误',information!,ok!)
  41. rslt = 0
  42. GOTO ext
  43. END IF
  44. String arg_msg
  45. DateTime arg_takedate
  46. Decimal arg_oriamt
  47. Decimal arg_msttakeamt
  48. Decimal arg_takeamt
  49. String arg_inrep
  50. Long arg_banktypeid
  51. String arg_billcode
  52. Long arg_cusid
  53. Long arg_scid
  54. String arg_takeabout
  55. DateTime arg_viewdate
  56. Long arg_accountsid
  57. Long arg_itemid
  58. String arg_relcode
  59. arg_scid = dw_1.Object.scid[li_row]
  60. arg_cusid = dw_1.Object.cusid[li_row]
  61. arg_takedate = dw_1.Object.takedate[li_row]
  62. arg_oriamt = dw_1.Object.oriamt[li_row]
  63. arg_msttakeamt = dw_1.Object.msttakeamt[li_row]
  64. arg_takeamt = dw_1.Object.takeamt[li_row]
  65. arg_inrep = dw_1.Object.inrep[li_row]
  66. arg_banktypeid = dw_1.Object.banktypeid[li_row]
  67. arg_billcode = dw_1.Object.billcode[li_row]
  68. arg_takeabout = dw_1.Object.dscrp[li_row]
  69. arg_viewdate = dw_1.Object.viewdate[li_row]
  70. arg_accountsid = dw_1.Object.accountsid[li_row]
  71. arg_itemid = dw_1.Object.itemid[li_row]
  72. arg_relcode = dw_1.Object.relcode[li_row]
  73. //IF arg_cusid = 0 THEN
  74. // MessageBox('提示','请选择当前客户!',information!,ok!)
  75. // rslt = 0
  76. // GOTO ext
  77. //END IF
  78. IF sys_option_msttake_takeamt_secaudit = 1 AND &
  79. dw_1.Object.takeamt[li_row] <> 0 THEN
  80. MessageBox('系统提示','系统选项使用了[070]客户收款单使用二级审核,只能使用客户收款单增加收款,请检查!')
  81. rslt = 0
  82. GOTO ext
  83. END IF
  84. IF uo_take.add_takerec(arg_scid,arg_cusid,arg_takedate,arg_inrep,&
  85. arg_oriamt,arg_msttakeamt,arg_takeamt,&
  86. arg_takeabout,arg_billcode,arg_banktypeid,0,publ_operator,&
  87. 0,0,arg_msg,TRUE,arg_viewdate,arg_accountsid,arg_itemid,ll_moneyid,arg_relcode) = 0 THEN
  88. MessageBox("错误",arg_msg,stopsign!,ok!)
  89. rslt = 0
  90. GOTO ext
  91. END IF
  92. f_SetProfileString(sys_empid, dw_1.DataObject, "dft_itemid", String(dw_1.Object.itemid[li_row]))
  93. f_SetProfileString(sys_empid, dw_1.DataObject, "dft_billcode", String(dw_1.Object.billcode[li_row]))
  94. f_SetProfileString(sys_empid, dw_1.DataObject, "dft_banktypeid", String(dw_1.Object.banktypeid[li_row]))
  95. ext:
  96. RETURN rslt
  97. end function
  98. public function integer wf_insertrow ();long li_newrow
  99. dw_1.setredraw(false)
  100. li_newrow = dw_1.insertrow(0)
  101. dw_1.object.cusid[li_newrow] = li_cusid
  102. dw_1.object.moneyid[li_newrow] = ll_moneyid
  103. dw_1.object.scid[li_newrow] = li_scid
  104. dw_1.object.billcode[li_newrow] = ls_billcode
  105. dw_1.object.takeamt[li_newrow] = ld_takeamt
  106. dw_1.object.oriamt[li_newrow] = 0 - ld_takeamt
  107. if ls_billcode = '' then// 新建时插入上次输入,收款时插入单号
  108. dw_1.Object.billcode[li_newrow] = f_profilestring(sys_empid, dw_1.DataObject, "dft_billcode", String(0))
  109. end if
  110. dw_1.Object.itemid[li_newrow] = Long(f_profilestring(sys_empid, dw_1.DataObject, "dft_itemid", String(0)))
  111. dw_1.Object.banktypeid[li_newrow] = Long(f_profilestring(sys_empid, dw_1.DataObject, "dft_banktypeid", String(0)))
  112. dw_1.Object.inrep[li_newrow] = publ_operator
  113. dw_1.setfocus()
  114. dw_1.setcolumn('billcode')
  115. dw_1.setredraw(true)
  116. return 1
  117. end function
  118. on w_musttake_mod.create
  119. int iCurrent
  120. call super::create
  121. this.dw_1=create dw_1
  122. this.cb_2=create cb_2
  123. this.cb_1=create cb_1
  124. iCurrent=UpperBound(this.Control)
  125. this.Control[iCurrent+1]=this.dw_1
  126. this.Control[iCurrent+2]=this.cb_2
  127. this.Control[iCurrent+3]=this.cb_1
  128. end on
  129. on w_musttake_mod.destroy
  130. call super::destroy
  131. destroy(this.dw_1)
  132. destroy(this.cb_2)
  133. destroy(this.cb_1)
  134. end on
  135. event open;call super::open;dw_1.settransobject(sqlca)
  136. s_tran=message.powerobjectparm
  137. li_cusid = s_tran.b_long
  138. li_scid = s_tran.c_long
  139. ls_billcode = s_tran.b_string
  140. ld_takeamt = s_tran.b_decimal
  141. ll_moneyid= s_tran.d_long
  142. datawindowchild childdw
  143. dw_1.SetTransObject (sqlca)
  144. dw_1.GetChild("accountsid",childdw)
  145. childdw.SetTransObject (sqlca)
  146. IF childdw.Retrieve(sys_user_account) = 0 THEN
  147. childdw.InsertRow(0)
  148. END IF
  149. wf_insertrow()
  150. uo_take = create uo_musttake
  151. end event
  152. event close;call super::close;destroy uo_take
  153. end event
  154. type cb_func from w_publ_base`cb_func within w_musttake_mod
  155. boolean visible = false
  156. integer x = 2355
  157. integer y = 13
  158. end type
  159. type cb_exit from w_publ_base`cb_exit within w_musttake_mod
  160. integer x = 2231
  161. integer y = 899
  162. integer taborder = 30
  163. string text = "取消"
  164. end type
  165. type dw_1 from datawindow within w_musttake_mod
  166. event key pbm_dwnkey
  167. event dwnkey pbm_dwnkey
  168. integer width = 2538
  169. integer height = 848
  170. integer taborder = 10
  171. boolean bringtotop = true
  172. string dataobject = "dw_msttake_mod"
  173. boolean livescroll = true
  174. borderstyle borderstyle = stylelowered!
  175. end type
  176. event dwnkey;if key = keydownarrow! then return 1
  177. if key = keyenter! or key = keydownarrow! then //
  178. keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  179. keybd_event ( 9, 0, 2, 0 ) // 释放tab
  180. return 0
  181. elseif key = keyuparrow! then
  182. keybd_event ( 16, 0, 0 , 0 )
  183. keybd_event ( 9, 0, 0 , 0 )
  184. keybd_event ( 9, 0, 2, 0 )
  185. keybd_event ( 16, 0, 2, 0 )
  186. return 0
  187. end if
  188. end event
  189. event rbuttondown;Long ll_row,ll_column
  190. ll_row = THIS.GetRow()
  191. ll_column = THIS.GetColumn()
  192. IF ll_row <= 0 THEN RETURN
  193. IF ll_column <= 0 THEN RETURN
  194. IF Left( THIS.Describe( dwo.Name+ ".coltype"),4) = 'date' THEN
  195. s_calender_arg s_calender
  196. s_calender.PointerX = THIS.PointerX()
  197. s_calender.PointerY = THIS.PointerY()
  198. s_calender.X = THIS.X + PARENT.X
  199. s_calender.Y = THIS.Y + PARENT.Y
  200. OpenWithParm(w_calendar,s_calender)
  201. THIS.SetItem(ll_row,ll_column,id_date_selected)
  202. end if
  203. end event
  204. type cb_2 from uo_imflatbutton within w_musttake_mod
  205. integer x = 1905
  206. integer y = 899
  207. integer width = 329
  208. integer height = 96
  209. integer taborder = 40
  210. string text = "保存[C^+S]"
  211. end type
  212. event clicked;call super::clicked;if wf_save() = 0 then return
  213. close(parent)
  214. end event
  215. type cb_1 from uo_imflatbutton within w_musttake_mod
  216. integer x = 1503
  217. integer y = 899
  218. integer width = 406
  219. integer height = 96
  220. integer taborder = 40
  221. string text = "保存&新增[&S]"
  222. end type
  223. event clicked;call super::clicked;if wf_save() = 0 then return
  224. long li_newrow
  225. dw_1.reset()
  226. wf_insertrow()
  227. end event