w_money_aging.srw 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. $PBExportHeader$w_money_aging.srw
  2. forward
  3. global type w_money_aging from window
  4. end type
  5. type cb_4 from commandbutton within w_money_aging
  6. end type
  7. type cb_3 from commandbutton within w_money_aging
  8. end type
  9. type cb_2 from commandbutton within w_money_aging
  10. end type
  11. type cb_1 from commandbutton within w_money_aging
  12. end type
  13. type dw_1 from datawindow within w_money_aging
  14. end type
  15. type s_email_cloudmx from structure within w_money_aging
  16. end type
  17. end forward
  18. type s_email_cloudmx from structure
  19. string name
  20. integer days
  21. end type
  22. global type w_money_aging from window
  23. integer width = 1504
  24. integer height = 872
  25. boolean titlebar = true
  26. string title = "账龄分组设置"
  27. boolean controlmenu = true
  28. windowtype windowtype = response!
  29. long backcolor = 67108864
  30. string icon = "AppIcon!"
  31. boolean center = true
  32. cb_4 cb_4
  33. cb_3 cb_3
  34. cb_2 cb_2
  35. cb_1 cb_1
  36. dw_1 dw_1
  37. end type
  38. global w_money_aging w_money_aging
  39. type variables
  40. boolean dw_edit_mode
  41. Long it_MXBT = 0
  42. private:
  43. s_email_cloudmx ss_email_cloudmx[]
  44. s_email_cloudmx sss_email_cloudmx
  45. end variables
  46. forward prototypes
  47. public subroutine wf_lock_child ()
  48. public subroutine wf_face ()
  49. public function integer save (ref string arg_msg)
  50. public function integer acceptmx (string arg_name, integer arg_days, ref string arg_msg)
  51. public subroutine wf_setname ()
  52. end prototypes
  53. public subroutine wf_lock_child ();integer LS_INT
  54. IF dw_edit_mode THEN
  55. FOR LS_INT=3 TO 4
  56. dw_1.SetTabOrder (LS_INT,LS_INT*10 )
  57. dw_1.SetTabOrder (LS_INT,LS_INT*10 )
  58. NEXT
  59. ELSE
  60. FOR LS_INT=3 TO 50
  61. dw_1.SetTabOrder (LS_INT, 0)
  62. dw_1.SetTabOrder (LS_INT, 0)
  63. NEXT
  64. END IF
  65. end subroutine
  66. public subroutine wf_face ();IF dw_edit_mode THEN
  67. cb_2.Text = "保存"
  68. cb_1.Enabled = True
  69. cb_3.Enabled = True
  70. cb_4.Enabled = True
  71. ELSE
  72. cb_2.Text = "修改"
  73. cb_1.Enabled = False
  74. cb_3.Enabled = False
  75. cb_4.Enabled = false
  76. END IF
  77. dw_1.retrieve()
  78. end subroutine
  79. public function integer save (ref string arg_msg);Integer rslt = 1,cnt = 0,i,j,k
  80. DateTime server_dt
  81. Long ll_billid
  82. String ls_sccode
  83. DELETE From u_money_aging;
  84. IF sqlca.SQLCode <> 0 THEN
  85. rslt = 0
  86. arG_MSG = "删除旧有明细操作失败"+"~n"+sqlca.SQLErrText
  87. ROLLBACK Using sqlca;
  88. GOTO ext
  89. END IF
  90. FOR i = 1 To it_mxbt
  91. ll_billid = f_sys_scidentity(0,"u_money_aging","id",arG_MSG,True,id_sqlca) //数据commit事务)
  92. IF ll_billid <= 0 THEN
  93. rslt = 0
  94. GOTO ext
  95. END IF
  96. INSERT INTO u_money_aging
  97. ( id,
  98. name,
  99. days)
  100. VALUES (:ll_billid,
  101. :ss_email_cloudmx[i].name,
  102. :ss_email_cloudmx[i].days
  103. ) Using sqlca;
  104. IF sqlca.SQLCode <> 0 THEN
  105. ll_billid = 0 //还原billID
  106. rslt = 0
  107. arG_MSG = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText
  108. ROLLBACK Using sqlca;
  109. GOTO ext
  110. END IF
  111. NEXT
  112. ext:
  113. //
  114. IF rslt = 0 THEN
  115. it_mxbt = 0
  116. ROLLBACK Using sqlca;
  117. ELSEIF rslt = 1 THEN
  118. COMMIT Using sqlca;
  119. END IF
  120. Return(rslt)
  121. end function
  122. public function integer acceptmx (string arg_name, integer arg_days, ref string arg_msg);Int rslt = 1
  123. Long cnt = 0,LS_i,ls_j
  124. IF IsNull(arg_name) THEN arg_name = ''
  125. IF IsNull(arg_days) THEN arg_days = 0
  126. //IF Trim(arg_name) = '' THEN
  127. // rslt = 0
  128. // arG_MSG = '名称不能为空'
  129. // GOTO ext
  130. //END IF
  131. IF IsNumber(string(arg_days)) =false THEN
  132. rslt = 0
  133. arG_MSG = '天数不为数字'
  134. GOTO ext
  135. END IF
  136. //写入内容
  137. it_mxbt++
  138. ss_email_cloudmx[it_mxbt].name = arg_name
  139. ss_email_cloudmx[it_mxbt].days = arg_days
  140. ext:
  141. IF rslt = 0 THEN
  142. it_mxbt = 0
  143. END IF
  144. Return(rslt)
  145. end function
  146. public subroutine wf_setname ();Integer i,j,sum
  147. dw_1.AcceptText()
  148. FOR i = 1 To dw_1.RowCount()
  149. sum = 0
  150. IF dw_1.Object.days[i] = 0 And i <> dw_1.RowCount() THEN
  151. dw_1.Object.days[i] = 1
  152. END IF
  153. IF dw_1.Object.days[i] >= 10000 THEN dw_1.Object.days[i] = 10000
  154. IF dw_1.Object.days[i] <> 0 THEN
  155. FOR j = 1 To i - 1
  156. sum = sum + dw_1.Object.days[j]
  157. NEXT
  158. dw_1.Object.Name[i] = String(sum +1) + "至" + String(sum +Long(dw_1.Object.days[i])) + "天"
  159. END IF
  160. NEXT
  161. end subroutine
  162. on w_money_aging.create
  163. this.cb_4=create cb_4
  164. this.cb_3=create cb_3
  165. this.cb_2=create cb_2
  166. this.cb_1=create cb_1
  167. this.dw_1=create dw_1
  168. this.Control[]={this.cb_4,&
  169. this.cb_3,&
  170. this.cb_2,&
  171. this.cb_1,&
  172. this.dw_1}
  173. end on
  174. on w_money_aging.destroy
  175. destroy(this.cb_4)
  176. destroy(this.cb_3)
  177. destroy(this.cb_2)
  178. destroy(this.cb_1)
  179. destroy(this.dw_1)
  180. end on
  181. event open;dw_1.SetTransObject(sqlca)
  182. wf_face()
  183. dw_1.retrieve()
  184. end event
  185. type cb_4 from commandbutton within w_money_aging
  186. integer x = 1029
  187. integer y = 132
  188. integer width = 457
  189. integer height = 116
  190. integer taborder = 40
  191. integer textsize = -9
  192. integer weight = 400
  193. fontcharset fontcharset = gb2312charset!
  194. fontpitch fontpitch = variable!
  195. string facename = "宋体"
  196. string text = "放弃"
  197. end type
  198. event clicked;
  199. dw_edit_mode = Not dw_edit_mode
  200. wf_lock_child()
  201. wf_face()
  202. end event
  203. type cb_3 from commandbutton within w_money_aging
  204. integer x = 1033
  205. integer y = 416
  206. integer width = 457
  207. integer height = 116
  208. integer taborder = 40
  209. integer textsize = -9
  210. integer weight = 400
  211. fontcharset fontcharset = gb2312charset!
  212. fontpitch fontpitch = variable!
  213. string facename = "宋体"
  214. string text = "删行"
  215. end type
  216. event clicked;long ll_row,ll_currentrow
  217. ll_row=dw_1.getrow()
  218. if ll_row<=0 then return
  219. dw_1.deleterow(ll_row)
  220. ll_currentrow=dw_1.rowcount()
  221. dw_1.selectrow(0,false)
  222. dw_1.selectrow(ll_currentrow,true)
  223. end event
  224. type cb_2 from commandbutton within w_money_aging
  225. integer x = 1029
  226. integer y = 8
  227. integer width = 457
  228. integer height = 116
  229. integer taborder = 30
  230. integer textsize = -9
  231. integer weight = 400
  232. fontcharset fontcharset = gb2312charset!
  233. fontpitch fontpitch = variable!
  234. string facename = "宋体"
  235. string text = "保存"
  236. end type
  237. event clicked;Integer i
  238. String arg_msg
  239. IF dw_edit_mode THEN
  240. dw_1.AcceptText()
  241. wf_setname()
  242. it_MXBT = 0
  243. FOR i = 1 To dw_1.RowCount()
  244. IF dw_1.Object.days[i] <>0 THEN
  245. IF acceptmx(dw_1.Object.Name[i],&
  246. dw_1.Object.days[i],&
  247. arg_msg) = 0 THEN
  248. MessageBox('Error!',arg_msg)
  249. RETURN
  250. END IF
  251. END IF
  252. NEXT
  253. IF Save(arg_msg) = 0 THEN
  254. MessageBox('Error!',arg_msg)
  255. RETURN
  256. END IF
  257. MessageBox(publ_operator,'保存操作成功!')
  258. END IF
  259. dw_edit_mode = Not dw_edit_mode
  260. wf_lock_child()
  261. wf_face()
  262. end event
  263. type cb_1 from commandbutton within w_money_aging
  264. integer x = 1033
  265. integer y = 296
  266. integer width = 457
  267. integer height = 116
  268. integer taborder = 20
  269. integer textsize = -9
  270. integer weight = 400
  271. fontcharset fontcharset = gb2312charset!
  272. fontpitch fontpitch = variable!
  273. string facename = "宋体"
  274. string text = "增行"
  275. end type
  276. event clicked;integer ll_currentrow
  277. ll_currentrow=dw_1.insertrow(0)
  278. dw_1.selectrow(0,false)
  279. dw_1.selectrow(ll_currentrow,true)
  280. end event
  281. type dw_1 from datawindow within w_money_aging
  282. integer x = 5
  283. integer y = 8
  284. integer width = 1029
  285. integer height = 780
  286. integer taborder = 10
  287. string title = "none"
  288. string dataobject = "dw_money_aging"
  289. boolean hscrollbar = true
  290. boolean vscrollbar = true
  291. boolean hsplitscroll = true
  292. boolean livescroll = true
  293. borderstyle borderstyle = stylelowered!
  294. end type
  295. event clicked;THIS.SelectRow(0,FALSE)
  296. THIS.SelectRow(row,TRUE)
  297. wf_setname()
  298. end event
  299. event itemchanged;wf_setname()
  300. end event