now added cash checks
This commit is contained in:
parent
d4609d1cbe
commit
848f00cfdf
3 changed files with 29 additions and 7 deletions
|
@ -7,8 +7,19 @@ import Handler.Common
|
||||||
getJournalR :: Handler Html
|
getJournalR :: Handler Html
|
||||||
getJournalR = do
|
getJournalR = do
|
||||||
master <- getYesod
|
master <- getYesod
|
||||||
entries <- runDB $ selectList [] [Asc TransactionId]
|
rawEntries <- runDB $ selectList [] [Desc TransactionId, LimitTo 30]
|
||||||
|
entries <- return $ L.reverse rawEntries
|
||||||
total <- return $ L.sum $ I.map (transactionAmount . entityVal) entries
|
total <- return $ L.sum $ I.map (transactionAmount . entityVal) entries
|
||||||
|
timeLimit <- return $ transactionTime $ entityVal $ L.last $ entries
|
||||||
|
cashiers <- runDB $ selectList [CashierCreated <=. timeLimit] [Asc CashierId]
|
||||||
|
list <- return $ merge entries cashiers
|
||||||
cashBalance <- getCashierBalance
|
cashBalance <- getCashierBalance
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
$(widgetFile "journal")
|
$(widgetFile "journal")
|
||||||
|
|
||||||
|
merge :: [Entity Transaction] -> [Entity Cashier] -> [Either Transaction Cashier]
|
||||||
|
merge [] [] = []
|
||||||
|
merge (t:ts) [] = (Left $ entityVal t) : merge ts []
|
||||||
|
merge (t:ts) (c:cs)
|
||||||
|
| transactionTime (entityVal t) < cashierCreated (entityVal c) = (Left $ entityVal t) : merge ts (c:cs)
|
||||||
|
| transactionTime (entityVal t) > cashierCreated (entityVal c) = (Right $ entityVal c) : merge (t:ts) cs
|
||||||
|
|
|
@ -36,6 +36,10 @@ article#func.article {
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr#check {
|
||||||
|
background-color: lightgrey;
|
||||||
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
border-bottom: 1px solid black;
|
border-bottom: 1px solid black;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
|
|
|
@ -9,15 +9,22 @@ $if not $ L.null entries
|
||||||
<th>Zeit
|
<th>Zeit
|
||||||
<th>Beschreibung
|
<th>Beschreibung
|
||||||
<th>Betrag in #{appCurrency $ appSettings master}
|
<th>Betrag in #{appCurrency $ appSettings master}
|
||||||
$forall (Entity eId entry) <- entries
|
$forall (eTransCash) <- list
|
||||||
|
$case eTransCash
|
||||||
|
$of Left trans
|
||||||
<tr>
|
<tr>
|
||||||
<td>#{formatTime defaultTimeLocale "%A %F %H:%M" $ transactionTime entry}
|
<td>#{formatTime defaultTimeLocale "%A %F %H:%M" $ transactionTime trans}
|
||||||
<td>#{transactionDescription entry}
|
<td>#{transactionDescription trans}
|
||||||
<td>#{formatIntCurrency (transactionAmount entry)} #{appCurrency $ appSettings master}
|
<td>#{formatIntCurrency (transactionAmount trans)} #{appCurrency $ appSettings master}
|
||||||
|
$of Right cash
|
||||||
|
<tr #check>
|
||||||
|
<td colspan="2">
|
||||||
|
Kassensturz vom #{formatTime defaultTimeLocale "%A %F %H:%M" $ cashierCreated cash}:
|
||||||
|
<td>#{formatIntCurrency (cashierBalance cash)} #{appCurrency $ appSettings master}
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">Gesamtbetrag:
|
<td colspan="2">Gesamtbetrag:
|
||||||
<td>#{formatIntCurrency (fromIntegral total)} #{appCurrency $ appSettings master}
|
<td>#{formatIntCurrency total} #{appCurrency $ appSettings master}
|
||||||
<p>
|
<p>
|
||||||
Kassenbestand: #{formatIntCurrency (fromIntegral cashBalance)} #{appCurrency $ appSettings master}
|
Kassenbestand: #{formatIntCurrency (fromIntegral cashBalance)} #{appCurrency $ appSettings master}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue