w_flow_cred.srw 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. $PBExportHeader$w_flow_cred.srw
  2. forward
  3. global type w_flow_cred from w_publ_base
  4. end type
  5. type cb_save from commandbutton within w_flow_cred
  6. end type
  7. type cb_refresh from commandbutton within w_flow_cred
  8. end type
  9. type dw_2 from datawindow within w_flow_cred
  10. end type
  11. type cb_mod from commandbutton within w_flow_cred
  12. end type
  13. type cb_ch from commandbutton within w_flow_cred
  14. end type
  15. type cb_del from commandbutton within w_flow_cred
  16. end type
  17. type dw_1 from u_dw_rbtnfilter within w_flow_cred
  18. end type
  19. type cb_ch_brief from commandbutton within w_flow_cred
  20. end type
  21. type dw_3 from datawindow within w_flow_cred
  22. end type
  23. type cb_write_amt from commandbutton within w_flow_cred
  24. end type
  25. type st_amt from statictext within w_flow_cred
  26. end type
  27. end forward
  28. global type w_flow_cred from w_publ_base
  29. int Width=3269
  30. int Height=2300
  31. WindowType WindowType=response!
  32. boolean TitleBar=true
  33. string Title="现金流量金额分配"
  34. long BackColor=83686901
  35. boolean MinBox=false
  36. cb_save cb_save
  37. cb_refresh cb_refresh
  38. dw_2 dw_2
  39. cb_mod cb_mod
  40. cb_ch cb_ch
  41. cb_del cb_del
  42. dw_1 dw_1
  43. cb_ch_brief cb_ch_brief
  44. dw_3 dw_3
  45. cb_write_amt cb_write_amt
  46. st_amt st_amt
  47. end type
  48. global w_flow_cred w_flow_cred
  49. type variables
  50. s_flow_cred s_flowcred
  51. end variables
  52. forward prototypes
  53. public function integer wf_face ()
  54. end prototypes
  55. public function integer wf_face ();cb_ch.enabled = dw_edit_mode
  56. cb_ch_brief.enabled = dw_edit_mode
  57. cb_write_amt.enabled = dw_edit_mode
  58. cb_save.enabled = dw_edit_mode
  59. cb_del.enabled = dw_edit_mode
  60. cb_refresh.enabled = not dw_edit_mode
  61. if dw_edit_mode then
  62. cb_mod.text = '放弃'
  63. dw_2.settaborder('cw_cashitem_brief',10)
  64. dw_2.settaborder('cw_cashitem_debit',20)
  65. dw_2.settaborder('cw_cashitem_credit',30)
  66. else
  67. cb_mod.text = '修改'
  68. dw_2.settaborder('cw_cashitem_brief',0)
  69. dw_2.settaborder('cw_cashitem_debit',0)
  70. dw_2.settaborder('cw_cashitem_credit',0)
  71. end if
  72. return 1
  73. end function
  74. on w_flow_cred.create
  75. int iCurrent
  76. call super::create
  77. this.cb_save=create cb_save
  78. this.cb_refresh=create cb_refresh
  79. this.dw_2=create dw_2
  80. this.cb_mod=create cb_mod
  81. this.cb_ch=create cb_ch
  82. this.cb_del=create cb_del
  83. this.dw_1=create dw_1
  84. this.cb_ch_brief=create cb_ch_brief
  85. this.dw_3=create dw_3
  86. this.cb_write_amt=create cb_write_amt
  87. this.st_amt=create st_amt
  88. iCurrent=UpperBound(this.Control)
  89. this.Control[iCurrent+1]=this.cb_save
  90. this.Control[iCurrent+2]=this.cb_refresh
  91. this.Control[iCurrent+3]=this.dw_2
  92. this.Control[iCurrent+4]=this.cb_mod
  93. this.Control[iCurrent+5]=this.cb_ch
  94. this.Control[iCurrent+6]=this.cb_del
  95. this.Control[iCurrent+7]=this.dw_1
  96. this.Control[iCurrent+8]=this.cb_ch_brief
  97. this.Control[iCurrent+9]=this.dw_3
  98. this.Control[iCurrent+10]=this.cb_write_amt
  99. this.Control[iCurrent+11]=this.st_amt
  100. end on
  101. on w_flow_cred.destroy
  102. call super::destroy
  103. destroy(this.cb_save)
  104. destroy(this.cb_refresh)
  105. destroy(this.dw_2)
  106. destroy(this.cb_mod)
  107. destroy(this.cb_ch)
  108. destroy(this.cb_del)
  109. destroy(this.dw_1)
  110. destroy(this.cb_ch_brief)
  111. destroy(this.dw_3)
  112. destroy(this.cb_write_amt)
  113. destroy(this.st_amt)
  114. end on
  115. event open;call super::open;wf_face()
  116. s_flowcred = Message.PowerObjectParm
  117. st_amt.text = '金额:'+string(abs(s_flowcred.debit - s_flowcred.credit),'#,#0.00')
  118. dw_1.SetTransObject(sqlca)
  119. dw_2.SetTransObject(sqlca)
  120. cb_refresh.TriggerEvent(Clicked!)
  121. long ll_i,ll_row
  122. for ll_i = 1 to upperbound(s_flowcred.brief)
  123. ll_row = dw_3.insertrow(0)
  124. dw_3.object.brief[ll_row] = s_flowcred.brief[ll_i]
  125. next
  126. end event
  127. type cb_exit from w_publ_base`cb_exit within w_flow_cred
  128. int X=2944
  129. int Y=1376
  130. int Width=224
  131. end type
  132. type cb_save from commandbutton within w_flow_cred
  133. int X=2693
  134. int Y=1376
  135. int Width=247
  136. int Height=96
  137. int TabOrder=20
  138. boolean BringToTop=true
  139. string Text="保存"
  140. int TextSize=-9
  141. int Weight=400
  142. string FaceName="宋体"
  143. FontCharSet FontCharSet=GB2312CharSet!
  144. FontPitch FontPitch=Variable!
  145. end type
  146. event clicked;IF dw_2.RowCount() <= 0 THEN RETURN
  147. Long i
  148. Decimal sum_debit,sum_credit
  149. String c_msg
  150. dw_2.AcceptText()
  151. sum_debit = dw_2.Object.sum_debit[1]
  152. sum_credit = dw_2.Object.sum_credit[1]
  153. IF String(s_flowcred.debit - s_flowcred.credit,'#,##0.00') <> String(sum_debit - sum_credit,'#,##0.00') THEN
  154. c_msg = '凭证中现金流量类科目借方、贷方差额为:'+String(s_flowcred.debit - s_flowcred.credit,'#,##0.00') + '~n'
  155. c_msg = c_msg + '而现金流量金额分配中流入、流出差额为:'+String(sum_debit - sum_credit,'#,##0.00') + '~n'
  156. c_msg = c_msg + '两者不相等,是否继续保存?'
  157. IF MessageBox ( '系统提示', c_msg , Question! , YesNo! ) = 2 THEN RETURN
  158. END IF
  159. Long ls_flowid,ll_printid
  160. string ls_brief
  161. Decimal ls_debit,ls_credit
  162. DELETE FROM cw_cashitem
  163. WHERE accsetid = :s_flowcred.accsetid
  164. AND credid = :s_flowcred.credid;
  165. IF sqlca.SQLCode <> 0 THEN
  166. MessageBox('系统提示','删除凭证原现金流量失败>>'+sqlca.SQLErrText)
  167. ROLLBACK;
  168. RETURN
  169. END IF
  170. FOR i = 1 TO dw_2.RowCount()
  171. ls_flowid = dw_2.Object.cw_flow_flowid[i]
  172. ls_debit = dw_2.Object.cw_cashitem_debit[i]
  173. ls_credit = dw_2.Object.cw_cashitem_credit[i]
  174. ll_printid = dw_2.Object.pid[i]
  175. ls_brief = dw_2.Object.cw_cashitem_brief[i]
  176. IF IsNull(ls_debit) THEN ls_debit = 0
  177. IF IsNull(ls_credit) THEN ls_credit = 0
  178. IF ls_debit <> 0 OR ls_credit <> 0 THEN
  179. INSERT INTO cw_cashitem(accsetid,credid,flowid,debit,credit,brief,printid)
  180. Values(:s_flowcred.accsetid,:s_flowcred.credid,:ls_flowid,:ls_debit,:ls_credit,:ls_brief,:ll_printid);
  181. IF sqlca.SQLCode <> 0 THEN
  182. MessageBox('系统提示','增加凭证现金流量失败>>'+sqlca.SQLErrText)
  183. ROLLBACK;
  184. RETURN
  185. END IF
  186. END IF
  187. NEXT
  188. COMMIT;
  189. MessageBox('系统提示','凭证现金流量保存成功')
  190. dw_edit_mode = FALSE
  191. wf_face()
  192. end event
  193. type cb_refresh from commandbutton within w_flow_cred
  194. int Y=1376
  195. int Width=270
  196. int Height=96
  197. int TabOrder=60
  198. boolean BringToTop=true
  199. string Text="刷新"
  200. int TextSize=-9
  201. int Weight=400
  202. string FaceName="宋体"
  203. FontCharSet FontCharSet=GB2312CharSet!
  204. FontPitch FontPitch=Variable!
  205. end type
  206. event clicked;dw_1.retrieve(s_flowcred.accsetid)
  207. dw_2.retrieve(s_flowcred.accsetid,s_flowcred.credid)
  208. end event
  209. type dw_2 from datawindow within w_flow_cred
  210. int Y=1488
  211. int Width=3173
  212. int Height=644
  213. int TabOrder=100
  214. boolean BringToTop=true
  215. string DataObject="dw_flow_cred_ch"
  216. BorderStyle BorderStyle=StyleLowered!
  217. boolean HScrollBar=true
  218. boolean VScrollBar=true
  219. boolean LiveScroll=true
  220. end type
  221. event rowfocuschanged;IF currentrow <= 0 THEN RETURN
  222. THIS.SelectRow(0,FALSE)
  223. THIS.SelectRow(currentrow,TRUE)
  224. end event
  225. event doubleclicked;cb_del.triggerevent(clicked!)
  226. end event
  227. type cb_mod from commandbutton within w_flow_cred
  228. int X=891
  229. int Y=1376
  230. int Width=247
  231. int Height=96
  232. int TabOrder=70
  233. boolean BringToTop=true
  234. string Text="修改"
  235. int TextSize=-9
  236. int Weight=400
  237. string FaceName="宋体"
  238. FontCharSet FontCharSet=GB2312CharSet!
  239. FontPitch FontPitch=Variable!
  240. end type
  241. event clicked;dw_edit_mode = not dw_edit_mode
  242. wf_face()
  243. end event
  244. type cb_ch from commandbutton within w_flow_cred
  245. int X=270
  246. int Y=1376
  247. int Width=311
  248. int Height=96
  249. int TabOrder=80
  250. boolean BringToTop=true
  251. string Text="↓ 选择"
  252. int TextSize=-9
  253. int Weight=400
  254. string FaceName="宋体"
  255. FontCharSet FontCharSet=GB2312CharSet!
  256. FontPitch FontPitch=Variable!
  257. end type
  258. event clicked;if not dw_edit_mode then return
  259. Long ll_row,ll_row_i
  260. int li_detailfalg
  261. dw_1.AcceptText()
  262. ll_row = dw_1.GetRow()
  263. IF ll_row <= 0 THEN
  264. MessageBox('提示','请选择现金流量项目')
  265. RETURN
  266. END IF
  267. li_detailfalg = dw_1.object.detailfalg[ll_row]
  268. IF li_detailfalg = 0 THEN
  269. MessageBox('提示','一级项目,不能选择')
  270. RETURN
  271. END IF
  272. ll_row_i = dw_2.insertrow(0)
  273. dw_2.object.cw_flow_cashcode[ll_row_i] = dw_1.object.cw_flow_cashcode[ll_row]
  274. dw_2.object.cw_flow_flowname[ll_row_i] = dw_1.object.cw_flow_flowname[ll_row]
  275. dw_2.object.cw_flow_flowid[ll_row_i] = dw_1.object.cw_flow_flowid[ll_row]
  276. dw_2.object.cw_flow_dcflag[ll_row_i] = dw_1.object.cw_flow_dcflag[ll_row]
  277. dw_2.selectrow(0,false)
  278. dw_2.scrolltorow(ll_row_i)
  279. dw_2.selectrow(ll_row_i,true)
  280. dw_2.setfocus()
  281. dw_2.setcolumn('cw_cashitem_brief')
  282. end event
  283. type cb_del from commandbutton within w_flow_cred
  284. int X=581
  285. int Y=1376
  286. int Width=311
  287. int Height=96
  288. int TabOrder=90
  289. boolean BringToTop=true
  290. string Text="↑ 删除"
  291. int TextSize=-9
  292. int Weight=400
  293. string FaceName="宋体"
  294. FontCharSet FontCharSet=GB2312CharSet!
  295. FontPitch FontPitch=Variable!
  296. end type
  297. event clicked;if not dw_edit_mode then return
  298. Long ll_row
  299. dw_2.AcceptText()
  300. ll_row = dw_2.GetRow()
  301. IF ll_row <= 0 THEN
  302. MessageBox('提示','请选择要删除的现金流量项目')
  303. RETURN
  304. END IF
  305. IF MessageBox ("IF","是否确定要删除现金流量项目吗?",Question!,YesNo! ) = 2 THEN RETURN
  306. dw_2.deleterow(ll_row)
  307. end event
  308. type dw_1 from u_dw_rbtnfilter within w_flow_cred
  309. int X=0
  310. int Y=0
  311. int Width=2194
  312. int Height=1360
  313. int TabOrder=30
  314. boolean BringToTop=true
  315. string DataObject="dw_flow_cred"
  316. boolean HScrollBar=true
  317. boolean VScrollBar=true
  318. end type
  319. event rowfocuschanged;IF currentrow <= 0 THEN RETURN
  320. THIS.SelectRow(0,FALSE)
  321. THIS.SelectRow(currentrow,TRUE)
  322. end event
  323. event doubleclicked;cb_ch.triggerevent(clicked!)
  324. end event
  325. event constructor;call super::constructor; titleclick_sort_use=true //单击标题排序功能开关
  326. RBUTTON_FILTER_USE=true //右键查询功能开关
  327. end event
  328. type cb_ch_brief from commandbutton within w_flow_cred
  329. int X=2194
  330. int Y=1376
  331. int Width=357
  332. int Height=96
  333. int TabOrder=40
  334. boolean BringToTop=true
  335. string Text="↓ 选择摘要"
  336. int TextSize=-9
  337. int Weight=400
  338. string FaceName="宋体"
  339. FontCharSet FontCharSet=GB2312CharSet!
  340. FontPitch FontPitch=Variable!
  341. end type
  342. event clicked;if not dw_edit_mode then return
  343. Long ll_row,ll_row_i
  344. dw_3.AcceptText()
  345. dw_2.AcceptText()
  346. ll_row = dw_3.GetRow()
  347. ll_row_i = dw_2.GetRow()
  348. IF ll_row <= 0 THEN
  349. MessageBox('提示','请选择摘要')
  350. RETURN
  351. END IF
  352. IF ll_row_i <= 0 THEN
  353. MessageBox('提示','请选择添加摘要的行')
  354. RETURN
  355. END IF
  356. dw_2.object.cw_cashitem_brief[ll_row_i] = dw_3.object.brief[ll_row]
  357. dw_2.selectrow(0,false)
  358. dw_2.scrolltorow(ll_row_i)
  359. dw_2.selectrow(ll_row_i,true)
  360. dw_2.setfocus()
  361. dw_2.setcolumn('cw_cashitem_brief')
  362. end event
  363. type dw_3 from datawindow within w_flow_cred
  364. int X=2194
  365. int Width=978
  366. int Height=1360
  367. int TabOrder=50
  368. boolean BringToTop=true
  369. string DataObject="dw_flow_cred_brief"
  370. BorderStyle BorderStyle=StyleLowered!
  371. boolean HScrollBar=true
  372. boolean VScrollBar=true
  373. boolean LiveScroll=true
  374. end type
  375. event doubleclicked;cb_ch_brief.triggerevent(clicked!)
  376. end event
  377. event rowfocuschanged;IF currentrow <= 0 THEN RETURN
  378. THIS.SelectRow(0,FALSE)
  379. THIS.SelectRow(currentrow,TRUE)
  380. end event
  381. type cb_write_amt from commandbutton within w_flow_cred
  382. int X=1838
  383. int Y=1376
  384. int Width=357
  385. int Height=96
  386. int TabOrder=30
  387. boolean BringToTop=true
  388. string Text="自动填金额"
  389. int TextSize=-9
  390. int Weight=400
  391. string FaceName="宋体"
  392. FontCharSet FontCharSet=GB2312CharSet!
  393. FontPitch FontPitch=Variable!
  394. end type
  395. event clicked;IF NOT dw_edit_mode THEN RETURN
  396. Long ll_row_i
  397. dw_2.AcceptText()
  398. ll_row_i = dw_2.GetRow()
  399. IF ll_row_i <= 0 THEN
  400. MessageBox('提示','请选择添加摘要的行')
  401. RETURN
  402. END IF
  403. dw_2.SelectRow(0,FALSE)
  404. dw_2.ScrollToRow(ll_row_i)
  405. dw_2.SelectRow(ll_row_i,TRUE)
  406. dw_2.SetFocus()
  407. Decimal ld_amt
  408. ld_amt = s_flowcred.debit - s_flowcred.credit
  409. IF ld_amt > 0 THEN
  410. dw_2.Object.cw_cashitem_debit[ll_row_i] = Abs(ld_amt)
  411. dw_2.SetColumn('cw_cashitem_debit')
  412. ELSE
  413. dw_2.Object.cw_cashitem_credit[ll_row_i] = Abs(ld_amt)
  414. dw_2.SetColumn('cw_cashitem_credit')
  415. END IF
  416. end event
  417. type st_amt from statictext within w_flow_cred
  418. int X=1161
  419. int Y=1400
  420. int Width=585
  421. int Height=52
  422. boolean Enabled=false
  423. boolean BringToTop=true
  424. string Text="none"
  425. boolean FocusRectangle=false
  426. long TextColor=16711680
  427. long BackColor=67108864
  428. int TextSize=-9
  429. int Weight=700
  430. string FaceName="宋体"
  431. FontCharSet FontCharSet=GB2312CharSet!
  432. FontPitch FontPitch=Variable!
  433. end type