web: alternate background color per transaction, not posting, on register view

(doesn't yet work for successive identical transactions)
This commit is contained in:
Simon Michael 2011-06-05 20:45:58 +00:00
parent 9fac61eb0d
commit 2320a1610b
2 changed files with 11 additions and 1 deletions

View File

@ -6,5 +6,5 @@
<th.amount align=right>Amount
<th.balance align=right>#{balancelabel}
$forall i <- numbered items
$forall i <- numberTransactions items
^{itemAsHtml vd i}

View File

@ -445,3 +445,13 @@ getMessageOr mnewmsg = do
return $ maybe oldmsg (Just . toHtml) mnewmsg
numbered = zip [1..]
-- Add incrementing transaction numbers to a list of register report items starting at 1.
numberTransactions :: [RegisterReportItem] -> [(Int,RegisterReportItem)]
numberTransactions [] = []
numberTransactions is = number 0 is
where
number _ [] = []
number n (i@(Just _, _, _):is) = (n+1,i):(number (n+1) is)
number n (i@(Nothing, _, _):is) = (n,i):(number n is)