parent
							
								
									32d9365fc2
								
							
						
					
					
						commit
						ea7a7d78aa
					
				| @ -70,11 +70,11 @@ main = do | |||||||
|         let ropts_ = ropts{accountlistmode_=ALFlat} |         let ropts_ = ropts{accountlistmode_=ALFlat} | ||||||
|             q = queryFromOpts today ropts_ |             q = queryFromOpts today ropts_ | ||||||
|             (acctbals,_) = balanceReport ropts_ q j |             (acctbals,_) = balanceReport ropts_ q j | ||||||
|             balancingamt = negate $ sum $ map (\(_,_,_,b) -> b) acctbals |             balancingamt = negate $ sum $ map (\(_,_,_,b) -> normaliseMixedAmountSquashPricesForDisplay b) acctbals | ||||||
|             ps = [posting{paccount=a, pamount=b} | (a,_,_,b) <- acctbals] |             ps = [posting{paccount=a, pamount=normaliseMixedAmountSquashPricesForDisplay b} | (a,_,_,b) <- acctbals] | ||||||
|                  ++ [posting{paccount="equity:opening balances", pamount=balancingamt}] |                  ++ [posting{paccount="equity:opening balances", pamount=balancingamt}] | ||||||
|             enddate = fromMaybe today $ queryEndDate (date2_ ropts_) q |             enddate = fromMaybe today $ queryEndDate (date2_ ropts_) q | ||||||
|             nps = [posting{paccount=a, pamount=negate b} | (a,_,_,b) <- acctbals] |             nps = [posting{paccount=a, pamount=negate $ normaliseMixedAmountSquashPricesForDisplay b} | (a,_,_,b) <- acctbals] | ||||||
|                  ++ [posting{paccount="equity:closing balances", pamount=negate balancingamt}] |                  ++ [posting{paccount="equity:closing balances", pamount=negate balancingamt}] | ||||||
|         putStr $ showTransaction (nulltransaction{tdate=addDays (-1) enddate, tdescription="closing balances", tpostings=nps}) |         putStr $ showTransaction (nulltransaction{tdate=addDays (-1) enddate, tdescription="closing balances", tpostings=nps}) | ||||||
|         putStr $ showTransaction (nulltransaction{tdate=enddate, tdescription="opening balances", tpostings=ps}) |         putStr $ showTransaction (nulltransaction{tdate=enddate, tdescription="opening balances", tpostings=ps}) | ||||||
|  | |||||||
| @ -34,6 +34,42 @@ runghc ../../bin/hledger-equity.hs -f- -p 2016 assets liabilities | |||||||
| 
 | 
 | ||||||
| >>>=0 | >>>=0 | ||||||
| 
 | 
 | ||||||
|  | # Test aggregation of postings with prices | ||||||
|  | runghc ../../bin/hledger-equity.hs -f- -p 2016 assets liabilities | ||||||
|  | <<< | ||||||
|  | Y2016 | ||||||
|  | 01/31 | ||||||
|  | 	liabilities:employer  $5,000.00 | ||||||
|  | 	income:salary | ||||||
|  | 
 | ||||||
|  | 02/05 | ||||||
|  | 	liabilities:employer  -$5,000.00 @ 0.95 EUR | ||||||
|  | 	expenses:tax  1,852.50 EUR | ||||||
|  | 	assets:bank  2,897.00 EUR | ||||||
|  | 	liabilities:employer | ||||||
|  | 
 | ||||||
|  | 02/29 | ||||||
|  | 	liabilities:employer  $5,000.00 | ||||||
|  | 	income:salary | ||||||
|  | 
 | ||||||
|  | 03/04 | ||||||
|  | 	liabilities:employer  -$5,000.0 @ 0.93 EUR | ||||||
|  | 	expenses:tax  1,813.50 EUR | ||||||
|  | 	assets:bank  2,836.00 EUR | ||||||
|  | 	liabilities:employer | ||||||
|  | >>> | ||||||
|  | 2016/12/31 closing balances | ||||||
|  |     assets:bank              -5,733.00 EUR | ||||||
|  |     liabilities:employer         -1.00 EUR | ||||||
|  |     equity:closing balances | ||||||
|  | 
 | ||||||
|  | 2017/01/01 opening balances | ||||||
|  |     assets:bank               5,733.00 EUR | ||||||
|  |     liabilities:employer          1.00 EUR | ||||||
|  |     equity:opening balances | ||||||
|  | 
 | ||||||
|  | >>>=0 | ||||||
|  | 
 | ||||||
| # Verify effect of period | # Verify effect of period | ||||||
| runghc ../../bin/hledger-equity.hs -f- -p 2016 assets liabilities | runghc ../../bin/hledger-equity.hs -f- -p 2016 assets liabilities | ||||||
| <<< | <<< | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user