fix: skip budget grand total and average if they look zero
Makes them consistent with the remaining cells and fixes awkward alignment issue in commodity-column mode where we don't display anything
This commit is contained in:
		
							parent
							
								
									234caae557
								
							
						
					
					
						commit
						5989ca0381
					
				| @ -202,14 +202,14 @@ combineBudgetAndActual ropts j | |||||||
|         mbrsorted = map prrFullName . sortRows ropts j . map (fmap $ fromMaybe nullmixedamt . fst) |         mbrsorted = map prrFullName . sortRows ropts j . map (fmap $ fromMaybe nullmixedamt . fst) | ||||||
|         rows = rows1 ++ rows2 |         rows = rows1 ++ rows2 | ||||||
| 
 | 
 | ||||||
|     -- TODO: grand total & average shows 0% when there are no actual amounts, inconsistent with other cells |  | ||||||
|     totalrow = PeriodicReportRow () |     totalrow = PeriodicReportRow () | ||||||
|         [ (Map.lookup p totActualByPeriod, Map.lookup p totBudgetByPeriod) | p <- periods ] |         [ (Map.lookup p totActualByPeriod, Map.lookup p totBudgetByPeriod) | p <- periods ] | ||||||
|         ( Just actualgrandtot, Just budgetgrandtot ) |         ( Just actualgrandtot, budget budgetgrandtot ) | ||||||
|         ( Just actualgrandavg, Just budgetgrandavg ) |         ( Just actualgrandavg, budget budgetgrandavg ) | ||||||
|       where |       where | ||||||
|         totBudgetByPeriod = Map.fromList $ zip budgetperiods budgettots :: Map DateSpan BudgetTotal |         totBudgetByPeriod = Map.fromList $ zip budgetperiods budgettots :: Map DateSpan BudgetTotal | ||||||
|         totActualByPeriod = Map.fromList $ zip actualperiods actualtots :: Map DateSpan Change |         totActualByPeriod = Map.fromList $ zip actualperiods actualtots :: Map DateSpan Change | ||||||
|  |         budget b = if mixedAmountLooksZero b then Nothing else Just b | ||||||
| 
 | 
 | ||||||
| -- | Render a budget report as plain text suitable for console output. | -- | Render a budget report as plain text suitable for console output. | ||||||
| budgetReportAsText :: ReportOpts -> BudgetReport -> TL.Text | budgetReportAsText :: ReportOpts -> BudgetReport -> TL.Text | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user