w_rapmoney.srw 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. $PBExportHeader$w_rapmoney.srw
  2. forward
  3. global type w_rapmoney from w_publ_easyq
  4. end type
  5. type ddlb_rap from dropdownlistbox within w_rapmoney
  6. end type
  7. type cb_add from uo_imflatbutton within w_rapmoney
  8. end type
  9. type cb_mod from uo_imflatbutton within w_rapmoney
  10. end type
  11. type cb_del from uo_imflatbutton within w_rapmoney
  12. end type
  13. type cb_3 from uo_imflatbutton within w_rapmoney
  14. end type
  15. type cbx_use from checkbox within w_rapmoney
  16. end type
  17. end forward
  18. global type w_rapmoney from w_publ_easyq
  19. integer x = 270
  20. integer y = 136
  21. string title = "出纳帐"
  22. ddlb_rap ddlb_rap
  23. cb_add cb_add
  24. cb_mod cb_mod
  25. cb_del cb_del
  26. cb_3 cb_3
  27. cbx_use cbx_use
  28. end type
  29. global w_rapmoney w_rapmoney
  30. type variables
  31. Long ins_accountid = 0
  32. String ins_accountname = ''
  33. long cur_scid_arr[]
  34. end variables
  35. forward prototypes
  36. public subroutine wf_init_rap ()
  37. end prototypes
  38. public subroutine wf_init_rap ();Long ls_accountid[]
  39. String ls_accountname[]
  40. Long ll_ifuse[],i = 1,j,cnt
  41. ddlb_rap.SetRedraw(False)
  42. ddlb_rap.Reset()
  43. DECLARE account_cur CURSOR FOR
  44. SELECT u_accounts.accountsid,
  45. u_accounts.accountsname,
  46. u_accounts.ifuse
  47. FROM u_accounts
  48. Order By u_accounts.accountsname Asc ;
  49. OPEN account_cur;
  50. FETCH account_cur Into :ls_accountid[i],:ls_accountname[i],:ll_ifuse[i];
  51. DO WHILE sqlca.SQLCode = 0
  52. i++
  53. // IF cbx_use.Checked THEN
  54. // IF ll_ifuse = 1 THEN
  55. // ddlb_rap.AddItem(ls_accountname+'['+String(ls_accountid)+']')
  56. // END IF
  57. // ELSE
  58. // ddlb_rap.AddItem(ls_accountname+'['+String(ls_accountid)+']')
  59. // END IF
  60. FETCH account_cur Into :ls_accountid[i],:ls_accountname[i],:ll_ifuse[i];
  61. LOOP
  62. //ddlb_rap.Text = ins_accountname+'['+String(ins_accountid)+']'
  63. CLOSE account_cur;
  64. FOR i = 1 To UpperBound(sys_user_account)
  65. FOR j = 1 To UpperBound(ls_accountid)
  66. IF sys_user_account[i] = ls_accountid[j] THEN
  67. IF cbx_use.Checked THEN
  68. IF ll_ifuse[j] = 1 THEN
  69. ddlb_rap.AddItem(ls_accountname[j]+'['+String(ls_accountid[j])+']')
  70. cnt ++
  71. IF cnt = 1 THEN
  72. ddlb_rap.Text = ls_accountname[j]+'['+String(ls_accountid[j])+']'
  73. ins_accountid = ls_accountid[j]
  74. END IF
  75. END IF
  76. ELSE
  77. ddlb_rap.AddItem(ls_accountname[j]+'['+String(ls_accountid[j])+']')
  78. cnt ++
  79. IF cnt = 1 THEN
  80. ddlb_rap.Text = ls_accountname[j]+'['+String(ls_accountid[j])+']'
  81. ins_accountid = ls_accountid[j]
  82. END IF
  83. END IF
  84. END IF
  85. NEXT
  86. NEXT
  87. ddlb_rap.SetRedraw(True)
  88. end subroutine
  89. on w_rapmoney.create
  90. int iCurrent
  91. call super::create
  92. this.ddlb_rap=create ddlb_rap
  93. this.cb_add=create cb_add
  94. this.cb_mod=create cb_mod
  95. this.cb_del=create cb_del
  96. this.cb_3=create cb_3
  97. this.cbx_use=create cbx_use
  98. iCurrent=UpperBound(this.Control)
  99. this.Control[iCurrent+1]=this.ddlb_rap
  100. this.Control[iCurrent+2]=this.cb_add
  101. this.Control[iCurrent+3]=this.cb_mod
  102. this.Control[iCurrent+4]=this.cb_del
  103. this.Control[iCurrent+5]=this.cb_3
  104. this.Control[iCurrent+6]=this.cbx_use
  105. end on
  106. on w_rapmoney.destroy
  107. call super::destroy
  108. destroy(this.ddlb_rap)
  109. destroy(this.cb_add)
  110. destroy(this.cb_mod)
  111. destroy(this.cb_del)
  112. destroy(this.cb_3)
  113. destroy(this.cbx_use)
  114. end on
  115. event open;call super::open;//菜单打开
  116. if_ue_retr=true
  117. if_ue_filter=true
  118. if_ue_sort=true
  119. if_ue_sentdataout=true
  120. wf_init_rap()
  121. IF cbx_loginretr.Checked THEN
  122. cb_1.TriggerEvent(Clicked!)
  123. END IF
  124. end event
  125. event key;call super::key;if keydown(keyf1!) then this.triggerevent("ue_help")
  126. end event
  127. type cb_func from w_publ_easyq`cb_func within w_rapmoney
  128. end type
  129. type cb_exit from w_publ_easyq`cb_exit within w_rapmoney
  130. integer x = 1613
  131. end type
  132. type cb_2 from w_publ_easyq`cb_2 within w_rapmoney
  133. integer x = 1273
  134. integer width = 194
  135. string text = "打印&P"
  136. end type
  137. type cb_psetup from w_publ_easyq`cb_psetup within w_rapmoney
  138. integer x = 1017
  139. end type
  140. type cb_1 from w_publ_easyq`cb_1 within w_rapmoney
  141. end type
  142. event cb_1::clicked;DateTime firstdate,enddate
  143. firstdate = DateTime(Date(em_1.Text),Time(0))
  144. enddate = DateTime(Date(em_2.Text),Time('23:59:59'))
  145. IF ins_accountid <= 0 THEN RETURN
  146. SELECT
  147. u_accounts.accountsname into :ins_accountname
  148. FROM u_accounts
  149. where u_accounts.accountsid = :ins_accountid;
  150. UPDATE u_parm_pay
  151. Set firstdate = :firstdate,
  152. enddate = :enddate Where id = 3;
  153. IF sqlca.SQLCode = 0 THEN
  154. IF sqlca.SQLNRows = 0 THEN
  155. INSERT INTO u_parm_pay (firstdate,enddate,id) Values (:firstdate,:enddate,3);
  156. IF sqlca.SQLCode <> 0 THEN
  157. ROLLBACK;
  158. MessageBox('错误','数据库操作失败!I',stopsign!,ok!)
  159. RETURN
  160. END IF
  161. END IF
  162. ELSE
  163. ROLLBACK;
  164. MessageBox('错误','数据库操作失败!U',stopsign!,ok!)
  165. RETURN
  166. END IF
  167. COMMIT;
  168. dw_1.Retrieve(ins_accountid,firstdate,enddate,ins_accountname)
  169. end event
  170. type st_3 from w_publ_easyq`st_3 within w_rapmoney
  171. integer x = 1898
  172. integer y = 218
  173. end type
  174. type st_4 from w_publ_easyq`st_4 within w_rapmoney
  175. integer x = 2611
  176. integer y = 218
  177. end type
  178. type em_1 from w_publ_easyq`em_1 within w_rapmoney
  179. integer x = 2099
  180. integer y = 202
  181. end type
  182. type em_2 from w_publ_easyq`em_2 within w_rapmoney
  183. integer x = 2714
  184. integer y = 202
  185. end type
  186. type ddlb_yl from w_publ_easyq`ddlb_yl within w_rapmoney
  187. integer x = 2026
  188. integer y = 13
  189. end type
  190. type cbx_yl from w_publ_easyq`cbx_yl within w_rapmoney
  191. integer x = 1807
  192. integer y = 13
  193. end type
  194. event cbx_yl::clicked;call super::clicked;if this.checked then
  195. dw_1.selectrow(0,false)
  196. end if
  197. end event
  198. type dw_1 from w_publ_easyq`dw_1 within w_rapmoney
  199. integer y = 314
  200. integer height = 1024
  201. string dataobject = "dw_rapmoney"
  202. end type
  203. event dw_1::rowfocuschanged;call super::rowfocuschanged;IF currentrow <=0 THEN RETURN
  204. this.selectrow(0,false)
  205. this.selectrow(currentrow,true)
  206. end event
  207. event dw_1::dwnkey;call super::dwnkey;parent.triggerevent("key")
  208. end event
  209. type sle_mtrl from w_publ_easyq`sle_mtrl within w_rapmoney
  210. end type
  211. type sle_cust from w_publ_easyq`sle_cust within w_rapmoney
  212. end type
  213. type st_mtrl from w_publ_easyq`st_mtrl within w_rapmoney
  214. end type
  215. type st_cust from w_publ_easyq`st_cust within w_rapmoney
  216. end type
  217. type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_rapmoney
  218. boolean visible = true
  219. integer x = 1807
  220. integer y = 93
  221. end type
  222. type pb_em1 from w_publ_easyq`pb_em1 within w_rapmoney
  223. integer x = 2520
  224. integer y = 195
  225. end type
  226. type pb_em2 from w_publ_easyq`pb_em2 within w_rapmoney
  227. integer x = 3131
  228. end type
  229. type pb_2 from w_publ_easyq`pb_2 within w_rapmoney
  230. integer x = 3233
  231. end type
  232. type cb_help from w_publ_easyq`cb_help within w_rapmoney
  233. integer x = 1463
  234. end type
  235. event cb_help::clicked;call super::clicked;parent.triggerevent("ue_help")
  236. end event
  237. type cb_copyself from w_publ_easyq`cb_copyself within w_rapmoney
  238. boolean visible = false
  239. integer x = 655
  240. integer y = 1603
  241. end type
  242. type gb_1 from w_publ_easyq`gb_1 within w_rapmoney
  243. end type
  244. type ln_bar from w_publ_easyq`ln_bar within w_rapmoney
  245. end type
  246. type ln_bar2 from w_publ_easyq`ln_bar2 within w_rapmoney
  247. end type
  248. type r_bar from w_publ_easyq`r_bar within w_rapmoney
  249. end type
  250. type ln_1 from w_publ_easyq`ln_1 within w_rapmoney
  251. end type
  252. type ln_2 from w_publ_easyq`ln_2 within w_rapmoney
  253. end type
  254. type ln_3 from w_publ_easyq`ln_3 within w_rapmoney
  255. end type
  256. type ln_4 from w_publ_easyq`ln_4 within w_rapmoney
  257. end type
  258. type ddlb_rap from dropdownlistbox within w_rapmoney
  259. integer x = 4
  260. integer y = 202
  261. integer width = 1847
  262. integer height = 1661
  263. integer taborder = 80
  264. boolean bringtotop = true
  265. integer textsize = -9
  266. integer weight = 400
  267. fontcharset fontcharset = gb2312charset!
  268. fontpitch fontpitch = variable!
  269. string facename = "宋体"
  270. long textcolor = 33554432
  271. boolean autohscroll = true
  272. boolean hscrollbar = true
  273. boolean vscrollbar = true
  274. borderstyle borderstyle = stylelowered!
  275. end type
  276. event selectionchanged;ins_accountname=left(ddlb_rap.text,pos(ddlb_rap.text,'[',1) - 1 )
  277. ins_accountid=long(mid(ddlb_rap.text,pos(ddlb_rap.text,'[',1) + 1 ,pos(ddlb_rap.text,']',1) - pos(ddlb_rap.text,'[',1) - 1))
  278. cb_1.TriggerEvent(clicked!)
  279. end event
  280. event constructor;//Long ls_accountid = 0,i
  281. //String ls_accountname = ''
  282. //long cnt
  283. //DECLARE account_cur CURSOR FOR
  284. // SELECT u_accounts.accountsid,
  285. // u_accounts.accountsname
  286. // FROM u_accounts
  287. // Order By u_accounts.accountsname Asc ;
  288. //
  289. //OPEN account_cur;
  290. //FETCH account_cur Into :ls_accountid,:ls_accountname;
  291. //ins_accountid = ls_accountid
  292. //ins_accountname = ls_accountname
  293. //
  294. //DO WHILE sqlca.SQLCode = 0
  295. // FOR i = 1 To UpperBound(sys_user_account)
  296. // IF ls_accountid = sys_user_account[i] THEN
  297. // ddlb_rap.AddItem(ls_accountname+'['+String(ls_accountid)+']')
  298. // cnt ++
  299. // if cnt = 1 then ddlb_rap.Text = ins_accountname+'['+String(ins_accountid)+']'
  300. // END IF
  301. // NEXT
  302. //
  303. // FETCH account_cur Into :ls_accountid,:ls_accountname;
  304. //LOOP
  305. //
  306. //
  307. //
  308. //CLOSE account_cur;
  309. //
  310. end event
  311. type cb_add from uo_imflatbutton within w_rapmoney
  312. integer x = 304
  313. integer width = 194
  314. integer height = 163
  315. integer taborder = 20
  316. boolean bringtotop = true
  317. string text = "新增&S"
  318. string normalpicname = "new.bmp"
  319. integer picsize = 16
  320. toolbaralignment pic_align = alignattop!
  321. boolean border = false
  322. end type
  323. event clicked;call super::clicked;if not f_power_ind(142) then
  324. messagebox('提示','你没有使用权限!',information!,ok!)
  325. return
  326. end if
  327. s_edit_index_tran s_tran
  328. s_tran.b_long = 1 //新建
  329. s_tran.c_long = ins_accountid
  330. s_tran.d_long = 0
  331. openwithparm(w_rapmoney_mod,s_tran)
  332. cb_1.triggerevent(clicked!)
  333. end event
  334. type cb_mod from uo_imflatbutton within w_rapmoney
  335. integer x = 494
  336. integer width = 194
  337. integer height = 163
  338. integer taborder = 30
  339. boolean bringtotop = true
  340. string text = "修改&E"
  341. string normalpicname = "open.bmp"
  342. integer picsize = 16
  343. toolbaralignment pic_align = alignattop!
  344. boolean border = false
  345. end type
  346. event clicked;call super::clicked;IF NOT f_power_ind(142) THEN
  347. MessageBox('提示','你没有使用权限!',information!,ok!)
  348. RETURN
  349. END IF
  350. Long li_row
  351. li_row = dw_1.GetRow()
  352. IF li_row <= 0 THEN
  353. MessageBox('提示','请选择要修改的记录',information!,ok!)
  354. RETURN
  355. END IF
  356. IF dw_1.Object.dscrp[li_row] = "期初余额" then
  357. MessageBox('提示','期初余额,不能修改',information!,ok!)
  358. RETURN
  359. end if
  360. IF dw_1.Object.buildtype[li_row] = 1 OR &
  361. dw_1.Object.buildtype[li_row] = 2 THEN
  362. MessageBox('提示','自动建立的出纳帐明细,不能修改',information!,ok!)
  363. RETURN
  364. END IF
  365. s_edit_index_tran s_tran
  366. s_tran.b_long = 2 //新建
  367. s_tran.c_long = ins_accountid
  368. s_tran.d_long = dw_1.Object.rapid[li_row]
  369. OpenWithParm(w_rapmoney_mod,s_tran)
  370. cb_1.TriggerEvent(Clicked!)
  371. end event
  372. type cb_del from uo_imflatbutton within w_rapmoney
  373. integer x = 688
  374. integer width = 165
  375. integer height = 163
  376. integer taborder = 40
  377. boolean bringtotop = true
  378. string text = "删除"
  379. string normalpicname = "delete.bmp"
  380. integer picsize = 16
  381. toolbaralignment pic_align = alignattop!
  382. boolean border = false
  383. end type
  384. event clicked;call super::clicked;if not f_power_ind(140) then
  385. messagebox('提示','你没有使用权限!',information!,ok!)
  386. return
  387. end if
  388. long ll_accountid,ll_rapid
  389. uo_rapmoney uo_rap
  390. string arg_msg
  391. IF dw_1.GETROW()<=0 THEN
  392. MESSAGEBOX('提示','没有操作目标记录!',information!,ok!)
  393. RETURN
  394. END IF
  395. IF MessageBox ("询问","是否确定要删除当前出纳帐记录?",Question!,YesNo! ) = 2 THEN
  396. RETURN
  397. END IF
  398. uo_rap = create uo_rapmoney
  399. uo_rap.commit_transaction = sqlca
  400. ll_accountid=dw_1.OBJECT.accountid[dw_1.GETROW()]
  401. ll_rapid=dw_1.OBJECT.rapid[dw_1.GETROW()]
  402. if uo_rap.del_raprec(ll_rapid,ll_accountid,0,arg_msg,true) = 0 then
  403. messagebox('错误',arg_msg,stopsign!,ok!)
  404. return
  405. end if
  406. destroy uo_rap
  407. messagebox('提示','删除成功',information!,ok!)
  408. cb_1.triggerevent(clicked!)
  409. end event
  410. type cb_3 from uo_imflatbutton within w_rapmoney
  411. integer x = 848
  412. integer width = 165
  413. integer height = 163
  414. integer taborder = 40
  415. boolean bringtotop = true
  416. string text = "转帐"
  417. string normalpicname = "update.bmp"
  418. integer picsize = 16
  419. toolbaralignment pic_align = alignattop!
  420. boolean border = false
  421. end type
  422. event clicked;call super::clicked;if not f_power_ind(142) then
  423. messagebox('提示','你没有使用权限!',information!,ok!)
  424. return
  425. end if
  426. s_edit_index_tran s_tran
  427. s_tran.b_long = 1 //新建
  428. s_tran.c_long = ins_accountid
  429. s_tran.d_long = 0
  430. openwithparm(w_rapmoney_add_del,s_tran)
  431. cb_1.triggerevent(clicked!)
  432. end event
  433. type cbx_use from checkbox within w_rapmoney
  434. integer x = 3423
  435. integer y = 218
  436. integer width = 464
  437. integer height = 61
  438. boolean bringtotop = true
  439. integer textsize = -9
  440. integer weight = 400
  441. fontcharset fontcharset = gb2312charset!
  442. fontpitch fontpitch = variable!
  443. string facename = "宋体"
  444. long textcolor = 33554432
  445. long backcolor = 134217739
  446. string text = "只显示有效帐号"
  447. end type
  448. event clicked;long ll_use
  449. if this.checked then
  450. ll_use = 1
  451. else
  452. ll_use = 0
  453. end if
  454. wf_init_rap()
  455. SetProfileString (sys_inifilename,dw_1.DataObject, "if_use", String(ll_use))
  456. cb_1.triggerevent(clicked!)
  457. end event
  458. event constructor;long ll_ifuse
  459. ll_ifuse=integer(ProfileString (sys_inifilename,dw_1.DATAOBJECT, "if_use", '0'))
  460. if ll_ifuse = 0 then
  461. this.checked = false
  462. else
  463. this.checked = true
  464. end if
  465. end event