cashiers should know, when they were created

This commit is contained in:
nek0 2015-04-10 18:19:48 +02:00
parent ac433a683d
commit 0242b31e22
3 changed files with 5 additions and 2 deletions

View file

@ -14,8 +14,9 @@ postCashCheckR = do
((res, _), _) <- runFormPost createCashCheckForm ((res, _), _) <- runFormPost createCashCheckForm
case res of case res of
FormSuccess c -> do FormSuccess c -> do
currentTime <- liftIO getCurrentTime
runDB $ insert_ c runDB $ insert_ c
runDB $ insert_ $ Cashier (cashCheckBalance c) runDB $ insert_ $ Cashier (cashCheckBalance c) currentTime
setMessage "Kassensturz durchgeführt. Kasse aktualisiert" setMessage "Kassensturz durchgeführt. Kasse aktualisiert"
redirect $ HomeR redirect $ HomeR
_ -> do _ -> do

View file

@ -33,7 +33,8 @@ updateCashier amount desc = do
runDB $ update (entityKey entCash) [CashierBalance +=. amount] runDB $ update (entityKey entCash) [CashierBalance +=. amount]
runDB $ insert_ trans runDB $ insert_ trans
Nothing -> do Nothing -> do
runDB $ insert_ $ Cashier amount currentTime <- liftIO getCurrentTime
runDB $ insert_ $ Cashier amount currentTime
runDB $ insert_ trans runDB $ insert_ trans
getCashierBalance :: Handler Int getCashierBalance :: Handler Int

View file

@ -19,6 +19,7 @@ Transaction
deriving Typeable Show deriving Typeable Show
Cashier Cashier
balance Int balance Int
created UTCTime
deriving Typeable Show deriving Typeable Show
CashCheck CashCheck
balance Int balance Int