我将我的事务添加到字典中,使用 UUID 作为键,事务对象作为值 - 这就是我所说的ledger
:
示例(entriesForPosting 是Set
sArray
中的一个,每个包含一个贷方条目和一个借方条目):
postToGL
entriesForPosting do: [ :ea | GeneralLedger ledger at: (ea at: 1) mUID put: (ea at: 1). "credit"
GeneralLedger ledger at:(ea at: 2) mUID put: (ea at: 2) ]. "debit"
然后我们像这样报告这个分类帐:
renderReport
GLReport := WATableReport new
rows: GeneralLedger getGLPostings asOrderedCollection ;
columns: (OrderedCollection new
add: (WAReportColumn
renderBlock: [ :each :html | html emphasis: each ]
title: 'ID');
add: (WAReportColumn
renderBlock: [ :each :html | html emphasis: (GeneralLedger getTransactionByID: each) mDate ]
title: 'Transaction Date');
add: (WAReportColumn
renderBlock: [ :each :html | html emphasis: (GeneralLedger getTransactionByID: each) mAmount ]
title: 'Amount');
add: (WAReportColumn
renderBlock: [ :each :html | html emphasis: ((GeneralLedger getTransactionByID: each) mGLAC mAccountCode)]
title: 'GLAC');
add: (WAReportColumn
renderBlock: [ :each :html | html emphasis: ((GeneralLedger getTransactionByID: each) mFund mFundCode)]
title: 'Fund');
yourself);
rowColors: #(lightblue lightyellow);
rowPeriod: 1;
yourself.
我遇到的问题是,此报告未排序。即,交易显示乱序 - 我看不出任何押韵或理由来说明他们为何被报告为:
例如,
spndMgr buildTransactionFor: 100 against: someGLAC.
spndMgr buildTransactionFor: 110 against: someGLAC.
spndMgr buildTransactionFor: 120 against: someGLAC.
spndMgr buildTransactionFor: 130 against: someGLAC.
spndMgr buildTransactionFor: 140 against: someGLAC.
spndMgr buildTransactionFor: 150 against: someGLAC.
spndMgr buildTransactionFor: 160 against: someGLAC.
spndMgr buildTransactionFor: 170 against: someGLAC.
spndMgr buildTransactionFor: 180 against: someGLAC.
spndMgr buildTransactionFor: 190 against: someGLAC.
spndMgr buildTransactionFor: 200 against: someGLAC.
spndMgr postTransactions.
给了我以下内容:
我尝试了以下方法:
renderReport
|columnToSortBy|
GLReport := WATableReport new
rows: GeneralLedger getGLPostings asOrderedCollection ;
columns: (OrderedCollection new
add: (WAReportColumn
renderBlock: [ :each :html | html emphasis: (GeneralLedger getTransactionByID: each) mIdentity ]
title: 'Identity');
add: (columnToSortBy := (WAReportColumn
renderBlock: [ :each :html | html emphasis: (GeneralLedger getTransactionByID: each) mDate ]
title: 'Transaction Date') );
add: (WAReportColumn
renderBlock: [ :each :html | html emphasis: (GeneralLedger getTransactionByID: each) mAmount ]
title: 'Amount');
add: (WAReportColumn
renderBlock: [ :each :html | html emphasis: ((GeneralLedger getTransactionByID: each) mGLAC mAccountCode)]
title: 'GLAC');
add: (WAReportColumn
renderBlock: [ :each :html | html emphasis: ((GeneralLedger getTransactionByID: each) mFund mFundCode)]
title: 'Fund');
yourself);
rowColors: #(lightblue lightyellow);
rowPeriod: 1;
sortColumn: columnToSortBy;
yourself.
但这会在渲染时引发错误: