module Handler.Wallet where import Import import Data.List (unfoldr) import Data.Time.Clock import Text.Printf buttonIntervals :: [(Int64,String)] buttonIntervals = [ (2,"2 hours") , (6,"6 hours") , (12,"12 hours") , (24,"1 day") , (48,"2 days") , (7*24,"7 days") , (31*24,"31 days") ] getWalletR :: Handler Html getWalletR = getWalletDetailsR 6 7 getWalletDetailsR :: Int64 -> Int64 -> Handler Html getWalletDetailsR hrs days = loginOrDo (\(uid,user) -> do now <- liftIO getCurrentTime trans <- runDB $ selectList [TransactionDateTime >. (addUTCTime ((fromIntegral $ -(hrs*3600)) :: NominalDiffTime) now)] [Desc TransactionDateTime] defaultLayout $ [whamlet|
Time | P/C | B/S | Item | ## | ISK/Item | ISK total | ISK profit | % | Time | Client | Station | ? | $forall Entity _ t <- trans | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
#{show $ utctDay $ transactionDateTime $ t} #{showTime $ round $ utctDayTime $ transactionDateTime $ t} $if transactionTransForCorp t | C $else | P $if transactionTransIsSell t | S $else | B | #{transactionTypeName t} | #{transactionQuantity t} | #{prettyISK $ transactionPriceCents t} | #{prettyISK $ transactionQuantity t * transactionPriceCents t} $maybe profit <- transRealProfit t $if (&&) (transactionTransIsSell t) (profit > 0) | #{prettyISK $ profit} $elseif (&&) (transactionTransIsSell t) (profit < 0) | #{prettyISK $ profit} $elseif not (transactionTransIsSell t) | #{prettyISK $ profit} $else | #{prettyISK $ profit} | #{profitPercent profit t}% $nothing | - | $maybe secs <- transactionSecondsToSell t #{showSecsToSell secs} $nothing | #{transactionClientName t} | #{transactionStationName t} |
Statistices for the last #{days} days:
|