better journal summary
This commit is contained in:
parent
1d19538a83
commit
6e2fef78f8
1 changed files with 6 additions and 4 deletions
|
@ -7,10 +7,12 @@ import Handler.Common
|
||||||
getJournalR :: Handler Html
|
getJournalR :: Handler Html
|
||||||
getJournalR = do
|
getJournalR = do
|
||||||
master <- getYesod
|
master <- getYesod
|
||||||
rawEntries <- runDB $ selectList [] [Desc TransactionId, LimitTo 30]
|
rawEntries <- runDB $ selectList [] [Desc TransactionId]
|
||||||
entries <- return $ L.reverse rawEntries
|
entries <- return $ L.reverse $ L.take 30 rawEntries
|
||||||
total <- return $ L.sum $ I.map (transactionAmount . entityVal) entries
|
total <- return $ L.sum $ I.map (transactionAmount . entityVal) rawEntries
|
||||||
timeLimit <- return $ transactionTime $ entityVal $ L.head $ entries
|
timeLimit <- case L.null entries of
|
||||||
|
False -> return $ transactionTime $ entityVal $ L.head $ entries
|
||||||
|
True -> liftIO getCurrentTime
|
||||||
cashChecks <- runDB $ selectList [CashCheckTime >=. timeLimit] [Asc CashCheckId]
|
cashChecks <- runDB $ selectList [CashCheckTime >=. timeLimit] [Asc CashCheckId]
|
||||||
list <- return $ merge entries cashChecks
|
list <- return $ merge entries cashChecks
|
||||||
cashBalance <- getCashierBalance
|
cashBalance <- getCashierBalance
|
||||||
|
|
Loading…
Reference in a new issue