我将事务添加到字典中,使用UUID作为键,事务对象作为值--这就是我所称的ledger
示例(entriesForPosting是Array的一个Set,每个Array包含一个信用项和一个借方项):
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. 但这会引发呈现错误:

发布于 2013-07-09 05:20:50
WAReportColumn理解#sortBlock:。这个块被初始化为[ :a :b | a <= b ],其中a和b将是我假设的一些glPosting对象。如果这种排序行为不适合您,只需将不同的排序块传递给列。WAReportTable理解#sortColumn:。在默认情况下传递想要排序的列,如下所示:添加:(columnToSortBy := (WAReportColumn renderBlock::WAReportColumn renderBlock html的重点强调:(GeneralLedger getTransactionByID : each ) mAmount标题:‘WAReportColumn’;您自己);.rowColors:#(浅蓝色);rowPeriod: 1;sortColumn: columnToSortBy;您自己。发布于 2013-07-14 15:36:17
如果你在你的账簿上加上了下面的内容,
GeneralLedger>>columnDescriptions
^#('Transaction Date' #(mDate)
'Amount' #(mAmount)
'GLAC' #(mGlac mAccountCode)
'Fund' #(mFund mFundCode))您可以像这样构建报表列
ledger columnDescriptions pairsDo: [ :title :accessorCollection | |column|
column := WAReportColumn new
title: title;
renderBlock: [:each :html | |temp|
temp := GeneralLedger getTransactionById: each.
accessorCollection do: [ :accessor |
temp := temp perform: accessor ].
html emphasis: temp];
yourself.
report columns add: column].如果您需要不同类型的报告,那么开始使用Magritte (或Deltawerken)是有意义的。在这里,您用单独的对象定义字段,并告诉报表要呈现哪些字段。
https://stackoverflow.com/questions/17538632
复制相似问题