journal: get decimal hint from default commodity
If appropriate commodity directive is missing fallback to default commodity directive to get number representation style.
This commit is contained in:
		
							parent
							
								
									b7dbe044b0
								
							
						
					
					
						commit
						7cbdeb40a4
					
				| @ -150,7 +150,11 @@ getDefaultDecimalHint :: JournalParser m (Maybe Char) | ||||
| getDefaultDecimalHint = maybe Nothing (asdecimalpoint . snd) <$> getDefaultCommodityAndStyle | ||||
| 
 | ||||
| getDecimalHint :: CommoditySymbol -> JournalParser m (Maybe Char) | ||||
| getDecimalHint commodity = maybe Nothing asdecimalpoint . maybe Nothing cformat . M.lookup commodity . jcommodities <$> get | ||||
| getDecimalHint commodity = do | ||||
|     specificStyle <-  maybe Nothing cformat . M.lookup commodity . jcommodities <$> get | ||||
|     defaultStyle <- fmap snd <$> getDefaultCommodityAndStyle | ||||
|     let effectiveStyle = listToMaybe $ catMaybes [specificStyle, defaultStyle] | ||||
|     return $ maybe Nothing asdecimalpoint effectiveStyle | ||||
| 
 | ||||
| pushAccount :: AccountName -> JournalParser m () | ||||
| pushAccount acct = modify' (\j -> j{jaccounts = acct : jaccounts j}) | ||||
|  | ||||
| @ -50,7 +50,7 @@ D 1,000.00 EUR | ||||
| 
 | ||||
| 2017/1/1 | ||||
| 	a   1,000 | ||||
| 	b  -1,000.00 | ||||
| 	b  -1,000 EUR | ||||
| >>> | ||||
|         1,000.00 EUR  a | ||||
|        -1,000.00 EUR  b | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user