imp: balcmds: support --declared on bs/cf/is also (#1765)
This commit is contained in:
		
							parent
							
								
									6319d6148f
								
							
						
					
					
						commit
						7f320ebfa9
					
				| @ -159,16 +159,18 @@ compoundBalanceReportWith rspec' j priceoracle subreportspecs = cbr | ||||
|             ( cbcsubreporttitle | ||||
|             -- Postprocess the report, negating balances and taking percentages if needed | ||||
|             , cbcsubreporttransform $ | ||||
|                 generateMultiBalanceReport rspec{_rsReportOpts=ropts} j priceoracle colps' startbals' | ||||
|                 generateMultiBalanceReport rspecsub j priceoracle colps' startbals' | ||||
|             , cbcsubreportincreasestotal | ||||
|             ) | ||||
|           where | ||||
|             -- Filter the column postings according to each subreport | ||||
|             colps'     = map (second $ filter (matchesPosting q)) colps | ||||
|             -- We need to filter historical postings directly, rather than their accumulated balances. (#1698) | ||||
|             startbals' = startingBalances rspec j priceoracle $ filter (matchesPosting q) startps | ||||
|             ropts      = cbcsubreportoptions $ _rsReportOpts rspec | ||||
|             -- Add a restriction to this subreport to the report query. | ||||
|             -- XXX in non-thorough way, consider updateReportSpec ? | ||||
|             q = cbcsubreportquery j | ||||
|             ropts = cbcsubreportoptions $ _rsReportOpts rspec | ||||
|             rspecsub = rspec{_rsReportOpts=ropts, _rsQuery=And [q, _rsQuery rspec]} | ||||
|             -- Starting balances and column postings specific to this subreport. | ||||
|             startbals' = startingBalances rspecsub j priceoracle $ filter (matchesPosting q) startps | ||||
|             colps'     = map (second $ filter (matchesPosting q)) colps | ||||
| 
 | ||||
|     -- Sum the subreport totals by column. Handle these cases: | ||||
|     -- - no subreports | ||||
|  | ||||
| @ -308,7 +308,7 @@ balancemode = hledgerCommandMode | ||||
|     ] | ||||
|     ++ flattreeflags True ++ | ||||
|     [flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts (in flat mode)" | ||||
|     ,flagNone ["declared"] (setboolopt "declared") "include accounts which have been declared but not yet used" | ||||
|     ,flagNone ["declared"] (setboolopt "declared") "include non-parent declared accounts (best used with -E)" | ||||
|     ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)" | ||||
|     ,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead" | ||||
|     ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)" | ||||
|  | ||||
| @ -77,6 +77,7 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = | ||||
|     ] | ||||
|     ++ flattreeflags True ++ | ||||
|     [flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts" | ||||
|     ,flagNone ["declared"] (setboolopt "declared") "include non-parent declared accounts (best used with -E)" | ||||
|     ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)" | ||||
|     ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)" | ||||
|     ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row" | ||||
|  | ||||
| @ -302,3 +302,26 @@ Income Statement 2008 | ||||
|  expenses:supplies ||       0   50.0 %       0       0   50.0 %   50.0 %  | ||||
| >>>= 0 | ||||
| 
 | ||||
| # 9. With --declared, declared leaf accounts are included, and in the right place. | ||||
| hledger -f - incomestatement -N -E --declared | ||||
| <<< | ||||
| account revenues | ||||
| account revenues:aa | ||||
| account revenues:ab | ||||
| account revenues:ac:aca | ||||
| account expenses | ||||
| >>> | ||||
| Income Statement .. | ||||
| 
 | ||||
|                  || ..  | ||||
| =================++==== | ||||
|  Revenues        ||     | ||||
| -----------------++---- | ||||
|  revenues:aa     ||  0  | ||||
|  revenues:ab     ||  0  | ||||
|  revenues:ac:aca ||  0  | ||||
| =================++==== | ||||
|  Expenses        ||     | ||||
| -----------------++---- | ||||
|  expenses        ||  0  | ||||
| >>>= 0 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user