w_initbalance.srw 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026
  1. $PBExportHeader$w_initbalance.srw
  2. forward
  3. global type w_initbalance from w_publ_base
  4. end type
  5. type dw_1 from u_dw_rbtnfilter within w_initbalance
  6. end type
  7. type ddlb_1 from dropdownlistbox within w_initbalance
  8. end type
  9. type cb_save from uo_imflatbutton within w_initbalance
  10. end type
  11. type sle_1 from singlelineedit within w_initbalance
  12. end type
  13. type st_2 from statictext within w_initbalance
  14. end type
  15. type cb_1 from uo_imflatbutton within w_initbalance
  16. end type
  17. type ddlb_2 from dropdownlistbox within w_initbalance
  18. end type
  19. type cbx_yl from checkbox within w_initbalance
  20. end type
  21. type ddlb_yl from dropdownlistbox within w_initbalance
  22. end type
  23. type cbx_1 from checkbox within w_initbalance
  24. end type
  25. type cb_2 from uo_imflatbutton within w_initbalance
  26. end type
  27. type cb_psetup from uo_imflatbutton within w_initbalance
  28. end type
  29. type cb_mod from uo_imflatbutton within w_initbalance
  30. end type
  31. type cb_view from uo_imflatbutton within w_initbalance
  32. end type
  33. type st_1 from statictext within w_initbalance
  34. end type
  35. type ln_bar from line within w_initbalance
  36. end type
  37. type ln_bar2 from line within w_initbalance
  38. end type
  39. type r_bar from rectangle within w_initbalance
  40. end type
  41. type ln_1 from line within w_initbalance
  42. end type
  43. type ln_2 from line within w_initbalance
  44. end type
  45. end forward
  46. global type w_initbalance from w_publ_base
  47. integer width = 3611
  48. integer height = 2380
  49. string title = "帐务数据初始化"
  50. boolean maxbox = true
  51. windowstate windowstate = maximized!
  52. long backcolor = 80269524
  53. dw_1 dw_1
  54. ddlb_1 ddlb_1
  55. cb_save cb_save
  56. sle_1 sle_1
  57. st_2 st_2
  58. cb_1 cb_1
  59. ddlb_2 ddlb_2
  60. cbx_yl cbx_yl
  61. ddlb_yl ddlb_yl
  62. cbx_1 cbx_1
  63. cb_2 cb_2
  64. cb_psetup cb_psetup
  65. cb_mod cb_mod
  66. cb_view cb_view
  67. st_1 st_1
  68. ln_bar ln_bar
  69. ln_bar2 ln_bar2
  70. r_bar r_bar
  71. ln_1 ln_1
  72. ln_2 ln_2
  73. end type
  74. global w_initbalance w_initbalance
  75. type variables
  76. string subid
  77. int hstype[]
  78. boolean if_hswb=false
  79. uo_init uo_initbalance
  80. end variables
  81. forward prototypes
  82. public function integer wf_face ()
  83. end prototypes
  84. public function integer wf_face ();Long ls_index
  85. ls_index = ddlb_1.FindItem (ddlb_1.Text, 0 )
  86. IF ls_index <= 0 THEN RETURN 0
  87. cb_save.Enabled = dw_edit_mode
  88. ddlb_1.Enabled = NOT dw_edit_mode
  89. cb_view.Enabled = NOT dw_edit_mode
  90. IF dw_edit_mode THEN
  91. cb_mod.Text = '放弃'
  92. cb_mod.normalpicname = 'Undo.bmp'
  93. CHOOSE CASE hstype[ls_index]
  94. CASE 0
  95. dw_1.SetTabOrder('cw_initbalance_debit',10)
  96. dw_1.SetTabOrder('cw_initbalance_credit',20)
  97. dw_1.SetTabOrder('cw_initbalance_balance',30)
  98. dw_1.SetTabOrder('cw_initbalance_plhavedone',40)
  99. CASE 1
  100. dw_1.SetTabOrder('cw_initbalance_rawdebit',10)
  101. dw_1.SetTabOrder('cw_initbalance_debit',20)
  102. dw_1.SetTabOrder('cw_initbalance_rawcredit',30)
  103. dw_1.SetTabOrder('cw_initbalance_credit',40)
  104. dw_1.SetTabOrder('cw_initbalance_rawbalance',50)
  105. dw_1.SetTabOrder('cw_initbalance_balance',60)
  106. CASE 2
  107. dw_1.SetTabOrder('cw_initbalance_damount',10)
  108. dw_1.SetTabOrder('cw_initbalance_camount',20)
  109. dw_1.SetTabOrder('cw_initbalance_bamount',30)
  110. END CHOOSE
  111. ELSE
  112. cb_mod.Text = '修改'
  113. cb_mod.normalpicname = 'OPEN.bmp'
  114. CHOOSE CASE hstype[ls_index]
  115. CASE 0
  116. dw_1.SetTabOrder('cw_initbalance_debit',0)
  117. dw_1.SetTabOrder('cw_initbalance_credit',0)
  118. dw_1.SetTabOrder('cw_initbalance_balance',0)
  119. dw_1.SetTabOrder('cw_initbalance_plhavedone',0)
  120. CASE 1
  121. dw_1.SetTabOrder('cw_initbalance_rawdebit',0)
  122. dw_1.SetTabOrder('cw_initbalance_debit',0)
  123. dw_1.SetTabOrder('cw_initbalance_rawcredit',0)
  124. dw_1.SetTabOrder('cw_initbalance_credit',0)
  125. dw_1.SetTabOrder('cw_initbalance_rawbalance',0)
  126. dw_1.SetTabOrder('cw_initbalance_balance',0)
  127. CASE 2
  128. dw_1.SetTabOrder('cw_initbalance_damount',0)
  129. dw_1.SetTabOrder('cw_initbalance_camount',0)
  130. dw_1.SetTabOrder('cw_initbalance_bamount',0)
  131. END CHOOSE
  132. END IF
  133. cb_mod.of_init_draw()
  134. cb_mod.of_paint()
  135. cb_mod.TriggerEvent('ue_textchange')
  136. RETURN 1
  137. end function
  138. on w_initbalance.create
  139. int iCurrent
  140. call super::create
  141. this.dw_1=create dw_1
  142. this.ddlb_1=create ddlb_1
  143. this.cb_save=create cb_save
  144. this.sle_1=create sle_1
  145. this.st_2=create st_2
  146. this.cb_1=create cb_1
  147. this.ddlb_2=create ddlb_2
  148. this.cbx_yl=create cbx_yl
  149. this.ddlb_yl=create ddlb_yl
  150. this.cbx_1=create cbx_1
  151. this.cb_2=create cb_2
  152. this.cb_psetup=create cb_psetup
  153. this.cb_mod=create cb_mod
  154. this.cb_view=create cb_view
  155. this.st_1=create st_1
  156. this.ln_bar=create ln_bar
  157. this.ln_bar2=create ln_bar2
  158. this.r_bar=create r_bar
  159. this.ln_1=create ln_1
  160. this.ln_2=create ln_2
  161. iCurrent=UpperBound(this.Control)
  162. this.Control[iCurrent+1]=this.dw_1
  163. this.Control[iCurrent+2]=this.ddlb_1
  164. this.Control[iCurrent+3]=this.cb_save
  165. this.Control[iCurrent+4]=this.sle_1
  166. this.Control[iCurrent+5]=this.st_2
  167. this.Control[iCurrent+6]=this.cb_1
  168. this.Control[iCurrent+7]=this.ddlb_2
  169. this.Control[iCurrent+8]=this.cbx_yl
  170. this.Control[iCurrent+9]=this.ddlb_yl
  171. this.Control[iCurrent+10]=this.cbx_1
  172. this.Control[iCurrent+11]=this.cb_2
  173. this.Control[iCurrent+12]=this.cb_psetup
  174. this.Control[iCurrent+13]=this.cb_mod
  175. this.Control[iCurrent+14]=this.cb_view
  176. this.Control[iCurrent+15]=this.st_1
  177. this.Control[iCurrent+16]=this.ln_bar
  178. this.Control[iCurrent+17]=this.ln_bar2
  179. this.Control[iCurrent+18]=this.r_bar
  180. this.Control[iCurrent+19]=this.ln_1
  181. this.Control[iCurrent+20]=this.ln_2
  182. end on
  183. on w_initbalance.destroy
  184. call super::destroy
  185. destroy(this.dw_1)
  186. destroy(this.ddlb_1)
  187. destroy(this.cb_save)
  188. destroy(this.sle_1)
  189. destroy(this.st_2)
  190. destroy(this.cb_1)
  191. destroy(this.ddlb_2)
  192. destroy(this.cbx_yl)
  193. destroy(this.ddlb_yl)
  194. destroy(this.cbx_1)
  195. destroy(this.cb_2)
  196. destroy(this.cb_psetup)
  197. destroy(this.cb_mod)
  198. destroy(this.cb_view)
  199. destroy(this.st_1)
  200. destroy(this.ln_bar)
  201. destroy(this.ln_bar2)
  202. destroy(this.r_bar)
  203. destroy(this.ln_1)
  204. destroy(this.ln_2)
  205. end on
  206. event open;call super::open;//hstype[]
  207. //0:本位币
  208. //1:外币
  209. //2:数量
  210. //3:试算平衡
  211. String ls_subid,ls_name,ls_moneyname,ins_moneyname
  212. Long ls_moneyid
  213. Dec ls_rate
  214. Int itmx = 0,ls_hswb
  215. //1.查本位币
  216. SELECT cw_currency.name INTO :ls_moneyname FROM cw_currency
  217. WHERE cw_currency.native = 1
  218. and (cw_currency.accsetid = :sys_accsetid or cw_currency.accsetid = 0 );
  219. IF sqlca.SQLCode <> 0 THEN
  220. ls_moneyname = ''
  221. END IF
  222. ins_moneyname = ls_moneyname
  223. ddlb_1.AddItem('--'+ls_moneyname+'--')
  224. ddlb_2.AddItem('')
  225. itmx++
  226. hstype[itmx] = 0
  227. //2.查外币
  228. DECLARE money_cur CURSOR FOR
  229. SELECT cw_currency.moneyid,cw_currency.name,cw_currency.rate
  230. FROM cw_currency
  231. WHERE cw_currency.native = 0
  232. Order By cw_currency.moneyid;
  233. OPEN money_cur;
  234. FETCH money_cur INTO :ls_moneyid,:ls_moneyname,:ls_rate;
  235. DO WHILE sqlca.SQLCode = 0
  236. itmx++
  237. hstype[itmx] = 1
  238. ddlb_1.AddItem('--'+ls_moneyname+'--')
  239. ddlb_2.AddItem('['+String(ls_moneyid)+']'+String(ls_rate,'#.00##'))
  240. FETCH money_cur INTO :ls_moneyid,:ls_moneyname,:ls_rate;
  241. LOOP
  242. CLOSE money_cur;
  243. //3.数量
  244. ddlb_1.AddItem('--数量--')
  245. ddlb_2.AddItem('')
  246. itmx++
  247. hstype[itmx] = 2
  248. //4.试算平衡
  249. ddlb_1.AddItem('--试算平衡--')
  250. ddlb_2.AddItem('')
  251. itmx++
  252. hstype[itmx] = 3
  253. ////////////////
  254. //ddlb_1.selectitem('--'+ls_moneyname+'--',1)
  255. ddlb_1.Text = '--'+ins_moneyname+'--'
  256. ddlb_1.TriggerEvent(SelectionChanged!)
  257. uo_initbalance = CREATE uo_init
  258. end event
  259. event resize;ln_bar.EndX = THIS.Width
  260. ln_bar2.EndX = THIS.Width
  261. ln_1.EndX = THIS.Width
  262. ln_2.EndX = THIS.Width
  263. r_bar.Width = THIS.Width
  264. dw_1.Width = THIS.Width - dw_1.X - 40
  265. dw_1.Height = THIS.Height - dw_1.Y - 150
  266. end event
  267. event close;destroy uo_initbalance
  268. end event
  269. event closequery;IF dw_edit_mode THEN
  270. Int ls_row = 0
  271. dw_1.AcceptText()
  272. ls_row = dw_1.GetNextModified(0, Primary!)+&
  273. dw_1.GetNextModified(0, Filter!)+dw_1.DeletedCount()
  274. IF ls_row > 0 THEN
  275. IF MessageBox('是否保存','单据数据已经改变,是否先保存?',Question!,YesNo!,1 ) = 1 THEN
  276. RETURN 1
  277. END IF
  278. END IF
  279. END IF
  280. end event
  281. type cb_func from w_publ_base`cb_func within w_initbalance
  282. boolean visible = false
  283. integer x = 1074
  284. integer y = 800
  285. end type
  286. type cb_exit from w_publ_base`cb_exit within w_initbalance
  287. integer x = 1317
  288. integer width = 165
  289. integer height = 172
  290. integer picsize = 16
  291. toolbaralignment pic_align = alignattop!
  292. boolean border = false
  293. end type
  294. type dw_1 from u_dw_rbtnfilter within w_initbalance
  295. integer y = 308
  296. integer width = 3447
  297. integer height = 1724
  298. integer taborder = 60
  299. boolean bringtotop = true
  300. string dataobject = "dw_initbalance_native"
  301. boolean hscrollbar = true
  302. boolean vscrollbar = true
  303. boolean rbutton_filter_use = true
  304. end type
  305. event itemchanged;IF dw_1.DataObject = 'dw_initbalance_wb' THEN
  306. Decimal ls_rate
  307. ls_rate = Dec(sle_1.Text)
  308. IF dw_1.GetRow() <= 0 THEN RETURN
  309. dw_1.AcceptText()
  310. IF cbx_1.Checked THEN
  311. CHOOSE CASE dwo.Name
  312. CASE 'cw_initbalance_rawdebit'
  313. dw_1.Object.cw_initbalance_debit[dw_1.GetRow()] = Round(Dec(dw_1.Object.cw_initbalance_rawdebit[dw_1.GetRow()]) * ls_rate,2)
  314. CASE 'cw_initbalance_rawcredit'
  315. dw_1.Object.cw_initbalance_credit[dw_1.GetRow()] = Round(dw_1.Object.cw_initbalance_rawcredit[dw_1.GetRow()] * ls_rate ,2)
  316. CASE 'cw_initbalance_rawbalance'
  317. dw_1.Object.cw_initbalance_balance[dw_1.GetRow()] = Round(dw_1.Object.cw_initbalance_rawbalance[dw_1.GetRow()] * ls_rate ,2)
  318. END CHOOSE
  319. END IF
  320. END IF
  321. end event
  322. event rowfocuschanged;if currentrow<=0 then return
  323. this.selectrow(0,false)
  324. this.selectrow(currentrow,true)
  325. end event
  326. type ddlb_1 from dropdownlistbox within w_initbalance
  327. integer x = 411
  328. integer y = 200
  329. integer width = 654
  330. integer height = 960
  331. integer taborder = 70
  332. boolean bringtotop = true
  333. integer textsize = -9
  334. integer weight = 400
  335. fontcharset fontcharset = gb2312charset!
  336. fontpitch fontpitch = variable!
  337. string facename = "宋体"
  338. long textcolor = 33554432
  339. boolean sorted = false
  340. boolean vscrollbar = true
  341. borderstyle borderstyle = stylelowered!
  342. end type
  343. event selectionchanged;String mod_str = '',ls_rate
  344. Long ls_sit,ls_moneyid
  345. Dec sum_ydebit,sum_ycrebit,sum_debit,sum_crebit,sum_mdebit,sum_mcrebit
  346. IF IsNull(Index) THEN
  347. Index = ddlb_1.FindItem (ddlb_1.Text, 0 )
  348. END IF
  349. ddlb_2.SelectItem(Index)
  350. IF Index <= 0 THEN RETURN
  351. CHOOSE CASE hstype[Index]
  352. CASE 0
  353. dw_1.DataObject = 'dw_initbalance_native'
  354. dw_1.SetTransObject(sqlca)
  355. dw_1.Retrieve(sys_accsetid)
  356. st_2.Visible = FALSE
  357. cb_save.Visible = TRUE
  358. cb_mod.Visible = TRUE
  359. sle_1.Visible = FALSE
  360. CASE 1
  361. ls_moneyid = Long(Mid ( ddlb_2.Text,Pos(ddlb_2.Text,'[') + 1,Pos(ddlb_2.Text,']') - Pos(ddlb_2.Text,'[') - 1 ))
  362. ls_rate = Mid(ddlb_2.Text,Pos(ddlb_2.Text,']') + 1)
  363. dw_1.DataObject = 'dw_initbalance_wb'
  364. dw_1.SetTransObject(sqlca)
  365. dw_1.Retrieve(sys_accsetid,ls_moneyid)
  366. st_2.Visible = TRUE
  367. cb_save.Visible = TRUE
  368. cb_mod.Visible = TRUE
  369. sle_1.Visible = TRUE
  370. st_2.Text = '初始汇率:'
  371. sle_1.Text = ls_rate
  372. CASE 2
  373. dw_1.DataObject = 'dw_initbalance_qty'
  374. dw_1.SetTransObject(sqlca)
  375. dw_1.Retrieve(sys_accsetid)
  376. st_2.Visible = FALSE
  377. cb_save.Visible = TRUE
  378. cb_mod.Visible = TRUE
  379. sle_1.Visible = FALSE
  380. CASE 3
  381. dw_1.DataObject = 'dw_initbalance_balance'
  382. dw_1.SetTransObject(sqlca)
  383. dw_1.Retrieve(sys_accsetid)
  384. st_2.Visible = FALSE
  385. cb_save.Visible = FALSE
  386. cb_mod.Visible = FALSE
  387. sle_1.Visible = TRUE
  388. sum_ydebit = dw_1.Object.sum_ydebit[1]
  389. sum_ycrebit = dw_1.Object.sum_ydebit[1]
  390. sum_debit = dw_1.Object.sum_debit[1]
  391. sum_crebit = dw_1.Object.sum_crebit[1]
  392. sum_mdebit = dw_1.Object.sum_mdebit[1]
  393. sum_mcrebit = dw_1.Object.sum_mcrebit[1]
  394. IF String(sum_ydebit,'###0.00') <> String(sum_ycrebit,'###0.00') OR String(sum_debit,'###0.00') <> String(sum_crebit,'###0.00') OR String(sum_mdebit,'###0.00') <> String(sum_mcrebit,'###0.00') THEN
  395. sle_1.Text = '试算表不平衡!'
  396. sle_1.TextColor = RGB(255,0,0)
  397. ELSE
  398. sle_1.Text = '试算表平衡,可以开帐'
  399. sle_1.TextColor = RGB(0,100,255)
  400. END IF
  401. END CHOOSE
  402. //cw_subject_dcflag
  403. //yrawbalance
  404. //cw_inititembala_rawdebit
  405. //cw_inititembala_rawcredit
  406. //cw_inititembala_rawbalance
  407. //ybalance
  408. //cw_inititembala_debit
  409. //cw_inititembala_credit
  410. //cw_inititembala_balance
  411. end event
  412. type cb_save from uo_imflatbutton within w_initbalance
  413. integer width = 165
  414. integer height = 172
  415. integer taborder = 30
  416. boolean bringtotop = true
  417. boolean enabled = false
  418. string text = "保存"
  419. string normalpicname = "save.bmp"
  420. integer picsize = 16
  421. toolbaralignment pic_align = alignattop!
  422. boolean border = false
  423. end type
  424. event clicked;IF MessageBox ("IF","是否确定要保存当前帐务初始化数据吗?",Question!,YesNo! ) = 2 THEN RETURN
  425. Long i,cnt,ls_itemid,ls_index,ls_moneyid
  426. Decimal ls_ydebit,ls_ycredit,ls_mdebit,ls_mcredit,ls_debit,ls_credit,ls_balance,ls_plhavedone
  427. Decimal ls_yrawdebit,ls_yrawcredit,ls_mrawdebit,ls_mrawcredit,ls_rawdebit,ls_rawcredit,ls_rawbalance
  428. Decimal ls_damount,ls_camount,bamount
  429. String ls_subid
  430. Int ls_dcflag
  431. Long ll_moneyid
  432. Boolean if_commit = FALSE
  433. String arg_msg
  434. ls_index = ddlb_1.FindItem (ddlb_1.Text, 0 )
  435. IF ls_index <= 0 THEN
  436. MessageBox(publ_operator,'没有可保存的数据')
  437. RETURN
  438. END IF
  439. dw_1.SetFilter('')
  440. dw_1.Filter()
  441. dw_1.AcceptText()
  442. cnt = dw_1.RowCount()
  443. IF cnt <= 0 THEN
  444. MessageBox(publ_operator,'没有可保存的数据')
  445. RETURN
  446. END IF
  447. Open(w_sys_wait)
  448. CHOOSE CASE hstype[ls_index]
  449. CASE 0 //0:本位币
  450. ll_moneyid = 0
  451. IF uo_initbalance.uof_clear_initbalance(0,arg_msg,ll_moneyid) = 0 THEN
  452. Close(w_sys_wait)
  453. MessageBox(publ_operator,'保存数据失败 >>' + arg_msg)
  454. RETURN
  455. END IF
  456. FOR i = 1 TO cnt
  457. ls_subid = dw_1.Object.cw_subject_subid[i]
  458. ls_dcflag = dw_1.Object.cw_subject_dcflag[i]
  459. ls_debit = dw_1.Object.cw_initbalance_debit[i]
  460. ls_credit = dw_1.Object.cw_initbalance_credit[i]
  461. ls_balance = dw_1.Object.cw_initbalance_balance[i]
  462. ls_plhavedone = dw_1.Object.cw_initbalance_plhavedone[i]
  463. IF ls_dcflag = 0 THEN
  464. IF dw_1.Object.cw_initbalance_balance[i] < 0 THEN
  465. ls_ydebit = 0 - dw_1.Object.ybalance[i]
  466. ls_ycredit = 0
  467. ls_mdebit = 0 - dw_1.Object.cw_initbalance_balance[i]
  468. ls_mcredit = 0
  469. ELSE
  470. ls_ydebit = 0
  471. ls_ycredit = dw_1.Object.ybalance[i]
  472. ls_mdebit = 0
  473. ls_mcredit = dw_1.Object.cw_initbalance_balance[i]
  474. END IF
  475. ELSEIF ls_dcflag = 1 THEN
  476. IF dw_1.Object.cw_initbalance_balance[i] < 0 THEN
  477. ls_ydebit = 0
  478. ls_ycredit = 0 - dw_1.Object.ybalance[i]
  479. ls_mdebit = 0
  480. ls_mcredit = 0 - dw_1.Object.cw_initbalance_balance[i]
  481. ELSE
  482. ls_ydebit = dw_1.Object.ybalance[i]
  483. ls_ycredit = 0
  484. ls_mdebit = dw_1.Object.cw_initbalance_balance[i]
  485. ls_mcredit = 0
  486. END IF
  487. END IF
  488. IF uo_initbalance.initbalance(ls_subid,ls_ydebit,ls_ycredit,ls_mdebit,ls_mcredit,ls_debit,ls_credit,ls_balance,ls_plhavedone, &
  489. ls_yrawdebit,ls_yrawcredit,ls_mrawdebit,ls_mrawcredit,ls_rawdebit,ls_rawcredit,ls_rawbalance,&
  490. arg_msg,FALSE) = 0 THEN
  491. Close(w_sys_wait)
  492. MessageBox(publ_operator,arg_msg)
  493. RETURN
  494. END IF
  495. NEXT
  496. IF uo_initbalance.p_update_subid_p(arg_msg) = 0 THEN
  497. Close(w_sys_wait)
  498. MessageBox(publ_operator,'保存数据失败 >>' + arg_msg)
  499. RETURN
  500. END IF
  501. CASE 1 //1:外币
  502. ll_moneyid = Long(Mid ( ddlb_2.Text,Pos(ddlb_2.Text,'[') + 1,Pos(ddlb_2.Text,']') - Pos(ddlb_2.Text,'[') - 1 ))
  503. IF uo_initbalance.uof_clear_initbalance(1,arg_msg,ll_moneyid) = 0 THEN
  504. Close(w_sys_wait)
  505. MessageBox(publ_operator,'保存数据失败 >>' + arg_msg)
  506. RETURN
  507. END IF
  508. FOR i = 1 TO cnt
  509. ls_subid = dw_1.Object.cw_subject_subid[i]
  510. ls_dcflag = dw_1.Object.cw_subject_dcflag[i]
  511. ls_debit = dw_1.Object.cw_initbalance_debit[i]
  512. ls_credit = dw_1.Object.cw_initbalance_credit[i]
  513. ls_balance = dw_1.Object.cw_initbalance_balance[i]
  514. ls_plhavedone = 0
  515. IF ls_dcflag = 0 THEN
  516. ls_ydebit = 0
  517. ls_ycredit = dw_1.Object.ybalance[i]
  518. ls_mdebit = 0
  519. ls_mcredit = dw_1.Object.cw_initbalance_balance[i]
  520. ELSEIF ls_dcflag = 1 THEN
  521. ls_ydebit = dw_1.Object.ybalance[i]
  522. ls_ycredit = 0
  523. ls_mdebit = dw_1.Object.cw_initbalance_balance[i]
  524. ls_mcredit = 0
  525. END IF
  526. ls_rawdebit = dw_1.Object.cw_initbalance_rawdebit[i]
  527. IF IsNull(ls_rawdebit) THEN ls_rawdebit = 0
  528. ls_rawcredit = dw_1.Object.cw_initbalance_rawcredit[i]
  529. IF IsNull(ls_rawcredit) THEN ls_rawcredit = 0
  530. ls_rawbalance = dw_1.Object.cw_initbalance_rawbalance[i]
  531. IF IsNull(ls_rawbalance) THEN ls_rawbalance = 0
  532. IF ls_dcflag = 0 THEN
  533. ls_yrawdebit = 0
  534. ls_yrawcredit = dw_1.Object.yrawbalance[i]
  535. ls_mrawdebit = 0
  536. ls_mrawcredit = dw_1.Object.cw_initbalance_rawbalance[i]
  537. ELSEIF ls_dcflag = 1 THEN
  538. ls_yrawdebit = dw_1.Object.yrawbalance[i]
  539. ls_yrawcredit = 0
  540. ls_mrawdebit = dw_1.Object.cw_initbalance_rawbalance[i]
  541. ls_mrawcredit = 0
  542. END IF
  543. IF uo_initbalance.initbalance(ls_subid,ls_ydebit,ls_ycredit,ls_mdebit,ls_mcredit,ls_debit,ls_credit,ls_balance,ls_plhavedone, &
  544. ls_yrawdebit,ls_yrawcredit,ls_mrawdebit,ls_mrawcredit,ls_rawdebit,ls_rawcredit,ls_rawbalance,&
  545. arg_msg,FALSE) = 0 THEN
  546. Close(w_sys_wait)
  547. MessageBox(publ_operator,arg_msg)
  548. RETURN
  549. END IF
  550. NEXT
  551. IF uo_initbalance.p_update_subid_p(arg_msg) = 0 THEN
  552. Close(w_sys_wait)
  553. MessageBox(publ_operator,'保存数据失败 >>' + arg_msg)
  554. RETURN
  555. END IF
  556. CASE 2 //2.数量
  557. FOR i = 1 TO cnt
  558. ls_subid = dw_1.Object.cw_subject_subid[i]
  559. ls_damount = dw_1.Object.cw_initbalance_damount[i]
  560. ls_camount = dw_1.Object.cw_initbalance_camount[i]
  561. bamount = dw_1.Object.cw_initbalance_bamount[i]
  562. IF i = cnt THEN
  563. if_commit = TRUE
  564. ELSE
  565. if_commit = FALSE
  566. END IF
  567. IF uo_initbalance.initbalance_qty(ls_subid,ls_damount,ls_camount,bamount,arg_msg,if_commit) = 0 THEN
  568. Close(w_sys_wait)
  569. MessageBox(publ_operator,arg_msg)
  570. RETURN
  571. END IF
  572. IF uo_initbalance.p_update_subid_p_qty(arg_msg) = 0 THEN
  573. Close(w_sys_wait)
  574. MessageBox(publ_operator,'保存数据失败 >>' + arg_msg)
  575. RETURN
  576. END IF
  577. NEXT
  578. END CHOOSE
  579. Close(w_sys_wait)
  580. dw_edit_mode = NOT dw_edit_mode
  581. wf_face()
  582. MessageBox(publ_operator,'数据保存成功')
  583. //1.
  584. //cw_subject_subid
  585. //cw_subject_dcflag
  586. //cw_initbalance_debit
  587. //cw_initbalance_credit
  588. //cw_initbalance_balance
  589. //cw_initbalance_plhavedone
  590. //ybalance
  591. //2.
  592. //cw_subject_subid
  593. //cw_subject_dcflag
  594. //cw_initbalance_rawdebit
  595. //cw_initbalance_rawbalance
  596. //cw_initbalance_rawbalance
  597. //cw_initbalance_debit
  598. //cw_initbalance_credit
  599. //cw_initbalance_balance
  600. //yrawbalance
  601. //ybalance
  602. //3.
  603. //cw_subject_subid
  604. //cw_subject_dcflag
  605. //cw_initbalance_damount
  606. //cw_initbalance_debit
  607. //cw_initbalance_camount
  608. //cw_initbalance_credit
  609. //cw_initbalance_bamount
  610. //cw_initbalance_balance
  611. //yqtybalance
  612. //ybalance
  613. end event
  614. type sle_1 from singlelineedit within w_initbalance
  615. integer x = 1522
  616. integer y = 196
  617. integer width = 649
  618. integer height = 92
  619. integer taborder = 40
  620. boolean bringtotop = true
  621. integer textsize = -9
  622. integer weight = 400
  623. fontcharset fontcharset = gb2312charset!
  624. fontpitch fontpitch = variable!
  625. string facename = "宋体"
  626. long textcolor = 33554432
  627. boolean autohscroll = false
  628. boolean displayonly = true
  629. borderstyle borderstyle = stylelowered!
  630. end type
  631. type st_2 from statictext within w_initbalance
  632. integer x = 1115
  633. integer y = 212
  634. integer width = 393
  635. integer height = 60
  636. boolean bringtotop = true
  637. integer textsize = -9
  638. integer weight = 400
  639. fontcharset fontcharset = gb2312charset!
  640. fontpitch fontpitch = variable!
  641. string facename = "宋体"
  642. long textcolor = 33554432
  643. long backcolor = 67108864
  644. boolean enabled = false
  645. alignment alignment = right!
  646. boolean focusrectangle = false
  647. end type
  648. type cb_1 from uo_imflatbutton within w_initbalance
  649. integer x = 603
  650. integer width = 165
  651. integer height = 172
  652. integer taborder = 130
  653. boolean bringtotop = true
  654. string text = "打印"
  655. string normalpicname = "print.bmp"
  656. integer picsize = 16
  657. toolbaralignment pic_align = alignattop!
  658. boolean border = false
  659. end type
  660. event clicked;IF DW_1.ROWCOUNT()>=1 THEN
  661. cbx_YL.CHECKED=TRUE
  662. cbx_YL.TriggerEvent(CLICKED!)
  663. openwithparm(w_sys_printpagesetting,dw_1)
  664. ELSE
  665. MESSAGEBOX(publ_operator,'数据窗口中没有任何记录,不能打印!')
  666. END IF
  667. end event
  668. type ddlb_2 from dropdownlistbox within w_initbalance
  669. boolean visible = false
  670. integer x = 535
  671. integer y = 764
  672. integer width = 480
  673. integer height = 420
  674. integer taborder = 50
  675. boolean bringtotop = true
  676. integer textsize = -9
  677. integer weight = 400
  678. fontcharset fontcharset = gb2312charset!
  679. fontpitch fontpitch = variable!
  680. string facename = "宋体"
  681. long textcolor = 33554432
  682. boolean sorted = false
  683. boolean vscrollbar = true
  684. borderstyle borderstyle = stylelowered!
  685. end type
  686. type cbx_yl from checkbox within w_initbalance
  687. integer x = 1618
  688. integer y = 52
  689. integer width = 206
  690. integer height = 76
  691. boolean bringtotop = true
  692. integer textsize = -9
  693. integer weight = 400
  694. fontcharset fontcharset = gb2312charset!
  695. fontpitch fontpitch = variable!
  696. string facename = "宋体"
  697. long textcolor = 33554432
  698. long backcolor = 67108864
  699. string text = "预览"
  700. end type
  701. event clicked;ddlb_yl.enabled = this.checked
  702. if this.checked then
  703. dw_1.selectrow(0,false)
  704. if lower(dw_1.object.datawindow.print.preview) = 'yes' then return
  705. dw_1.object.datawindow.print.preview = 'yes'
  706. dw_1.object.datawindow.print.duplex = 2
  707. dw_1.object.datawindow.print.preview.rulers = "yes"
  708. else
  709. if lower(dw_1.object.datawindow.print.preview) = 'no' then return
  710. dw_1.object.datawindow.print.preview = 'no'
  711. end if
  712. end event
  713. event constructor;this.backcolor = 14215660
  714. end event
  715. type ddlb_yl from dropdownlistbox within w_initbalance
  716. integer x = 1842
  717. integer y = 48
  718. integer width = 261
  719. integer height = 532
  720. integer taborder = 80
  721. integer textsize = -9
  722. integer weight = 400
  723. fontcharset fontcharset = gb2312charset!
  724. fontpitch fontpitch = variable!
  725. string facename = "宋体"
  726. long textcolor = 33554432
  727. boolean enabled = false
  728. string text = "适当大小"
  729. boolean vscrollbar = true
  730. string item[] = {"100%","75%","50%","25%","200%","150%"}
  731. borderstyle borderstyle = stylelowered!
  732. end type
  733. event constructor;if THIS.TotalItems ( )>=1 then THIS.SelectItem(1)
  734. end event
  735. event selectionchanged;dw_1.Object.DataWindow.Print.Preview.Zoom = INTEGER(LEFT(TRIM(this.text),LEN(TRIM(this.text)) - 1))
  736. dw_1.object.DataWindow.Print.Preview = 'yes'
  737. end event
  738. type cbx_1 from checkbox within w_initbalance
  739. integer x = 2190
  740. integer y = 204
  741. integer width = 576
  742. integer height = 76
  743. boolean bringtotop = true
  744. integer textsize = -9
  745. integer weight = 400
  746. fontcharset fontcharset = gb2312charset!
  747. fontpitch fontpitch = variable!
  748. string facename = "宋体"
  749. long textcolor = 33554432
  750. long backcolor = 67108864
  751. string text = "外币自动按汇率计算"
  752. boolean checked = true
  753. end type
  754. type cb_2 from uo_imflatbutton within w_initbalance
  755. integer x = 1042
  756. integer width = 274
  757. integer height = 172
  758. integer taborder = 100
  759. boolean bringtotop = true
  760. string text = "数据发送"
  761. string normalpicname = "find.bmp"
  762. integer picsize = 16
  763. toolbaralignment pic_align = alignattop!
  764. boolean border = false
  765. end type
  766. event clicked;OPENWITHPARM(w_sentdataout,DW_1)
  767. end event
  768. type cb_psetup from uo_imflatbutton within w_initbalance
  769. integer x = 768
  770. integer width = 274
  771. integer height = 172
  772. integer taborder = 120
  773. boolean bringtotop = true
  774. string text = "页面设置"
  775. string normalpicname = "PRINTFLD.BMP"
  776. integer picsize = 16
  777. toolbaralignment pic_align = alignattop!
  778. boolean border = false
  779. end type
  780. event clicked;OpenWithParm(w_sys_printpage_value,DW_1)
  781. //PRINTSETUP()
  782. end event
  783. type cb_mod from uo_imflatbutton within w_initbalance
  784. integer x = 165
  785. integer width = 165
  786. integer height = 172
  787. integer taborder = 90
  788. boolean bringtotop = true
  789. string text = "修改"
  790. string normalpicname = "open.bmp"
  791. integer picsize = 16
  792. toolbaralignment pic_align = alignattop!
  793. boolean border = false
  794. end type
  795. event clicked;IF dw_edit_mode THEN
  796. IF MessageBox ("询问","是否确定要放弃保存当前数据?",Question!,YesNo! ) = 2 THEN RETURN
  797. END IF
  798. dw_1.SetFilter('')
  799. dw_1.Filter()
  800. dw_edit_mode = NOT dw_edit_mode
  801. wf_face()
  802. end event
  803. type cb_view from uo_imflatbutton within w_initbalance
  804. integer x = 329
  805. integer width = 274
  806. integer height = 172
  807. integer taborder = 90
  808. boolean bringtotop = true
  809. string text = "查看期初"
  810. string normalpicname = "PREVIEW.BMP"
  811. integer picsize = 16
  812. toolbaralignment pic_align = alignattop!
  813. boolean border = false
  814. end type
  815. event clicked;open(w_initbalance_rpt)
  816. end event
  817. type st_1 from statictext within w_initbalance
  818. integer x = 23
  819. integer y = 216
  820. integer width = 389
  821. integer height = 48
  822. boolean bringtotop = true
  823. integer textsize = -9
  824. integer weight = 400
  825. fontcharset fontcharset = gb2312charset!
  826. fontpitch fontpitch = variable!
  827. string facename = "宋体"
  828. long textcolor = 33554432
  829. long backcolor = 67108864
  830. string text = "核算项目科目:"
  831. alignment alignment = right!
  832. boolean focusrectangle = false
  833. end type
  834. type ln_bar from line within w_initbalance
  835. long linecolor = 268435456
  836. integer linethickness = 4
  837. integer beginy = 176
  838. integer endx = 3323
  839. integer endy = 176
  840. end type
  841. type ln_bar2 from line within w_initbalance
  842. long linecolor = 16777215
  843. integer linethickness = 4
  844. integer beginy = 180
  845. integer endx = 3323
  846. integer endy = 180
  847. end type
  848. type r_bar from rectangle within w_initbalance
  849. long linecolor = 16777215
  850. long fillcolor = 1073741824
  851. integer x = 2747
  852. integer width = 73
  853. integer height = 172
  854. end type
  855. event constructor;this.fillcolor = 14215660
  856. this.linecolor = 14215660
  857. this.x = -1
  858. this.y = -1
  859. this.height = ln_bar2.beginy - 5
  860. end event
  861. type ln_1 from line within w_initbalance
  862. long linecolor = 268435456
  863. integer linethickness = 4
  864. integer beginy = 300
  865. integer endx = 3323
  866. integer endy = 300
  867. end type
  868. type ln_2 from line within w_initbalance
  869. long linecolor = 16777215
  870. integer linethickness = 4
  871. integer beginy = 304
  872. integer endx = 3323
  873. integer endy = 304
  874. end type