lib,cli: Restore old --change option for per-period summation, use --sum for basic ValueChange balance report.
This commit is contained in:
		
							parent
							
								
									ae73eea7cb
								
							
						
					
					
						commit
						3f408c2117
					
				| @ -300,7 +300,7 @@ reporttypeopt :: RawOpts -> ReportType | ||||
| reporttypeopt = | ||||
|   fromMaybe ChangeReport . choiceopt parse where | ||||
|     parse = \case | ||||
|       "change"      -> Just ChangeReport | ||||
|       "sum"         -> Just ChangeReport | ||||
|       "valuechange" -> Just ValueChangeReport | ||||
|       "budget"      -> Just BudgetReport | ||||
|       _             -> Nothing | ||||
| @ -311,7 +311,7 @@ balancetypeopt = | ||||
|     parse = \case | ||||
|       "historical" -> Just HistoricalBalance | ||||
|       "cumulative" -> Just CumulativeChange | ||||
|       "periodic"   -> Just PeriodChange | ||||
|       "change"     -> Just PeriodChange | ||||
|       _            -> Nothing | ||||
| 
 | ||||
| -- Get the period specified by any -b/--begin, -e/--end and/or -p/--period | ||||
|  | ||||
| @ -39,7 +39,7 @@ aregistermode = hledgerCommandMode | ||||
|    flagNone ["txn-dates"] (setboolopt "txn-dates")  | ||||
|      "filter strictly by transaction date, not posting date. Warning: this can show a wrong running balance." | ||||
|    ,flagNone ["no-elide"] (setboolopt "no-elide") "don't show only 2 commodities per amount" | ||||
|   --  flagNone ["cumulative"] (setboolopt "change") | ||||
|   --  flagNone ["cumulative"] (setboolopt "cumulative") | ||||
|   --    "show running total from report start date (default)" | ||||
|   -- ,flagNone ["historical","H"] (setboolopt "historical") | ||||
|   --    "show historical running total/balance (includes postings before report start date)\n " | ||||
|  | ||||
| @ -125,7 +125,7 @@ interval is specified (eg with @--monthly@), one column for each sub-period. | ||||
| There are three accumulation strategies for multi-column balance report, indicated by | ||||
| the heading: | ||||
| 
 | ||||
| * A \"period balance\" (or \"flow\") report (with @--periodic@, the default) shows the | ||||
| * A \"period balance\" (or \"flow\") report (with @--change@, the default) shows the | ||||
|   change of account balance in each period, which is equivalent to the sum of postings | ||||
|   in each period. Here, checking's balance increased by 10 in Feb: | ||||
| 
 | ||||
| @ -177,7 +177,7 @@ By default: | ||||
| * single-column: accounts with non-zero balance in report period. | ||||
|                  (With @--flat@: accounts with non-zero balance and postings.) | ||||
| 
 | ||||
| * periodic:      accounts with postings and non-zero period balance in any period | ||||
| * change:        accounts with postings and non-zero period balance in any period | ||||
| 
 | ||||
| * cumulative:    accounts with non-zero cumulative balance in any period | ||||
| 
 | ||||
| @ -187,7 +187,7 @@ With @-E/--empty@: | ||||
| 
 | ||||
| * single-column: accounts with postings in report period | ||||
| 
 | ||||
| * periodic:      accounts with postings in report period | ||||
| * change:        accounts with postings in report period | ||||
| 
 | ||||
| * cumulative:    accounts with postings in report period | ||||
| 
 | ||||
| @ -205,7 +205,7 @@ by default: | ||||
| 
 | ||||
| * single-column: N/A | ||||
| 
 | ||||
| * periodic:      all periods within the overall report period, | ||||
| * change:        all periods within the overall report period, | ||||
|                  except for leading and trailing empty periods | ||||
| 
 | ||||
| * cumulative:    all periods within the overall report period, | ||||
| @ -218,7 +218,7 @@ With @-E/--empty@: | ||||
| 
 | ||||
| * single-column: N/A | ||||
| 
 | ||||
| * periodic:      all periods within the overall report period | ||||
| * change:        all periods within the overall report period | ||||
| 
 | ||||
| * cumulative:    all periods within the overall report period | ||||
| 
 | ||||
| @ -280,14 +280,14 @@ import Hledger.Read.CsvReader (CSV, printCSV) | ||||
| -- | Command line options for this command. | ||||
| balancemode = hledgerCommandMode | ||||
|   $(embedFileRelative "Hledger/Cli/Commands/Balance.txt") | ||||
|   ([flagNone ["change"] (setboolopt "change") | ||||
|   ([flagNone ["sum"] (setboolopt "sum") | ||||
|       "show sum of posting amounts (default)" | ||||
|    ,flagNone ["valuechange"] (setboolopt "valuechange") | ||||
|       "show change of value of period-end historical balances" | ||||
|    ,flagNone ["budget"] (setboolopt "budget") | ||||
|       "show sum of posting amounts compared to budget goals defined by periodic transactions\n " | ||||
| 
 | ||||
|    ,flagNone ["periodic"] (setboolopt "periodic") | ||||
|    ,flagNone ["change"] (setboolopt "change") | ||||
|       "accumulate amounts from column start to column end (in multicolumn reports, default)" | ||||
|    ,flagNone ["cumulative"] (setboolopt "cumulative") | ||||
|       "accumulate amounts from report start (specified by e.g. -b/--begin) to column end" | ||||
|  | ||||
| @ -42,7 +42,7 @@ followed by more detailed descriptions and examples. | ||||
| 
 | ||||
| ..either.. | ||||
| 
 | ||||
| - per period ([`--periodic`](#accumulation-type), the default accumulation type) | ||||
| - per period ([`--change`](#accumulation-type), the default accumulation type) | ||||
| - or accumulated since report start date ([`--cumulative`](#accumulation-type)) | ||||
| - or accumulated since account creation ([`--historical/-H`](#accumulation-type)) | ||||
| 
 | ||||
| @ -348,8 +348,8 @@ For more flexible reporting, there are three important option groups: | ||||
| The general thing that is calculated/shown in each cell.  | ||||
| It is one of: | ||||
| 
 | ||||
| - `--change` : show a sum of posting amounts (**default**) | ||||
| - `--budget` : like --change but also show a budget goal amount | ||||
| - `--sum` : show a sum of posting amounts (**default**) | ||||
| - `--budget` : like --sum but also show a budget goal amount | ||||
| - `--valuechange` : show change of value of period-end historical balances | ||||
| <!-- - `--gain` : show change of value of period-end historical balances caused by market price fluctuations --> | ||||
| 
 | ||||
| @ -358,7 +358,7 @@ Which previous periods' postings should be included in calculations | ||||
| (especially in multiperiod reports). | ||||
| It is one of: | ||||
| 
 | ||||
| - `--periodic` : postings from column start to column end. Ie, show | ||||
| - `--change` : postings from column start to column end. Ie, show | ||||
|   [changes] in each period. Typically used when reviewing | ||||
|   revenues/expenses. (**default for balance, incomestatement**) | ||||
| 
 | ||||
| @ -400,16 +400,16 @@ since summing already-summed end balances usually does not make sense. | ||||
| 
 | ||||
| Some important reports are: | ||||
| 
 | ||||
| - `bal revenues expenses` (`bal --periodic --change revenues expenses`)\ | ||||
| - `bal revenues expenses` (`bal --change --sum revenues expenses`)\ | ||||
|   revenues/expenses in each period, an income statement / profit & loss report | ||||
|    | ||||
| - `bal -H assets liabilities` (`bal --historical --change assets liabilities`)\ | ||||
| - `bal -H assets liabilities` (`bal --historical --sum assets liabilities`)\ | ||||
|   historical asset/liability balances at end of each period, a simplified balance sheet | ||||
| 
 | ||||
| - `bal -H assets liabilities equity` (`bal --historical --change assets liabilities equity`)\ | ||||
|   historical asset/liability/equity balances at end of each period, a full balance sheet | ||||
| 
 | ||||
| - `bal assets not:receivable` (`bal --periodic --change assets not:receivable`)\ | ||||
| - `bal assets not:receivable` (`bal --change --sum assets not:receivable`)\ | ||||
|   liquid asset changes in each period, a cashflow report | ||||
| 
 | ||||
| Since these are so often used, they are also available as (enhanced) separate commands:\ | ||||
| @ -428,7 +428,7 @@ Here is what the accumulation / valuation type combinations show: | ||||
| 
 | ||||
| | Valuation: ><br>Accumulation: v | no valuation                                                     | `--value= then`                                                    | `--value= end`                                              | `--value= YYYY-MM-DD /now`                            | | ||||
| |---------------------------------|------------------------------------------------------------------|--------------------------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------| | ||||
| | `--periodic`                    | change in period                                                 | sum of posting-date market values in period                        | period-end value of change in period                        | DATE-value of change in period                        | | ||||
| | `--change`                      | change in period                                                 | sum of posting-date market values in period                        | period-end value of change in period                        | DATE-value of change in period                        | | ||||
| | `--cumulative`                  | change from report start to period end                           | sum of posting-date market values from report start to period end  | period-end value of change from report start to period end  | DATE-value of change from report start to period end  | | ||||
| | `--historical /-H`              | change from journal start to period end (historical end balance) | sum of posting-date market values from journal start to period end | period-end value of change from journal start to period end | DATE-value of change from journal start to period end | | ||||
| 
 | ||||
|  | ||||
| @ -36,7 +36,7 @@ import Hledger.Cli.Utils | ||||
| 
 | ||||
| registermode = hledgerCommandMode | ||||
|   $(embedFileRelative "Hledger/Cli/Commands/Register.txt") | ||||
|   ([flagNone ["cumulative"] (setboolopt "periodic") | ||||
|   ([flagNone ["cumulative"] (setboolopt "cumulative") | ||||
|      "show running total from report start date (default)" | ||||
|   ,flagNone ["historical","H"] (setboolopt "historical") | ||||
|      "show historical running total/balance (includes postings before report start date)\n " | ||||
|  | ||||
| @ -61,14 +61,14 @@ compoundBalanceCommandMode :: CompoundBalanceCommandSpec -> Mode RawOpts | ||||
| compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = | ||||
|   hledgerCommandMode | ||||
|    cbcdoc | ||||
|    ([flagNone ["change"] (setboolopt "change") | ||||
|    ([flagNone ["sum"] (setboolopt "sum") | ||||
|       "show sum of posting amounts (default)" | ||||
|    ,flagNone ["valuechange"] (setboolopt "valuechange") | ||||
|       "show change of value of period-end historical balances" | ||||
|    ,flagNone ["budget"] (setboolopt "budget") | ||||
|       "show sum of posting amounts compared to budget goals defined by periodic transactions\n " | ||||
| 
 | ||||
|    ,flagNone ["periodic"] (setboolopt "periodic") | ||||
|    ,flagNone ["change"] (setboolopt "change") | ||||
|        ("accumulate amounts from column start to column end (in multicolumn reports)" | ||||
|            ++ defType PeriodChange) | ||||
|     ,flagNone ["cumulative"] (setboolopt "cumulative") | ||||
| @ -111,7 +111,7 @@ compoundBalanceCommand CompoundBalanceCommandSpec{..} opts@CliOpts{reportspec_=r | ||||
|         parse = \case | ||||
|           "historical" -> Just HistoricalBalance | ||||
|           "cumulative" -> Just CumulativeChange | ||||
|           "periodic"   -> Just PeriodChange | ||||
|           "change"     -> Just PeriodChange | ||||
|           _            -> Nothing | ||||
|     balancetype = fromMaybe cbctype mBalanceTypeOverride | ||||
|     -- Set balance type in the report options. | ||||
|  | ||||
| @ -55,7 +55,7 @@ Ending balances (historical) in 2000-01-01..2000-04-30, valued at period ends: | ||||
|         ||       15 B         8 B        15 B        20 B  | ||||
| 
 | ||||
| # 4. Balance sheet also reports on value change | ||||
| $ hledger -f- balancesheet -MN --valuechange --periodic -b 2000 | ||||
| $ hledger -f- balancesheet -MN --valuechange --change -b 2000 | ||||
| Balance Sheet 2000-01-01..2000-04-30 (Period-End Value Changes) | ||||
| 
 | ||||
|              ||  Jan   Feb  Mar  Apr  | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user