private void PrintHouseholdPost(HouseholdPost householdPost)
        {
            int topIndex = _worksheetWriter.CurrentPosition.Y;

            _worksheetWriter
            .SetBackgroundColor(Color.LightYellow)
            .Write(householdPost.Category.ToString())
            .MoveRight();

            int year = 2020;

            for (int monthNumber = 1; monthNumber < 13; monthNumber++)
            {
                var yearMonth       = new YearMonth(year, monthNumber);
                var incomeInMonth   = householdPost.GetIncome(yearMonth);
                var expensesInMonth = householdPost.GetExpenses(yearMonth);

                _worksheetWriter
                .SetBackgroundColor(Color.FromArgb(255, 199, 206))
                .SetFontColor(Color.Black)
                .Write(-1 * expensesInMonth)
                .MoveDown()
                .SetBackgroundColor(Color.LightGreen)
                .Write(incomeInMonth)
                .MoveDown()
                .SetBackgroundColor(Color.Gainsboro)
                .SetFontColor(Color.Black)
                .PlaceFormula(new Point(_worksheetWriter.CurrentPosition.X, topIndex), new Point(_worksheetWriter.CurrentPosition.X, _worksheetWriter.CurrentPosition.Y - 1), FormulaType.SUM)
                .MoveRight()
                .MoveUp()
                .MoveUp();
            }

            _worksheetWriter
            .PlaceFormula(new Point(2, _worksheetWriter.CurrentPosition.Y), new Point(_worksheetWriter.CurrentPosition.X - 1, _worksheetWriter.CurrentPosition.Y), FormulaType.SUM)
            .MoveRight()
            .PlaceFormula(new Point(2, _worksheetWriter.CurrentPosition.Y), new Point(_worksheetWriter.CurrentPosition.X - 2, _worksheetWriter.CurrentPosition.Y), FormulaType.AVERAGE)
            .MoveDown()
            .MoveLeft()
            .PlaceFormula(new Point(2, _worksheetWriter.CurrentPosition.Y), new Point(_worksheetWriter.CurrentPosition.X - 1, _worksheetWriter.CurrentPosition.Y), FormulaType.SUM)
            .MoveRight()
            .PlaceFormula(new Point(2, _worksheetWriter.CurrentPosition.Y), new Point(_worksheetWriter.CurrentPosition.X - 2, _worksheetWriter.CurrentPosition.Y), FormulaType.AVERAGE)
            .NewLine()
            .NewLine()
            .NewLine();
        }
Exemple #2
0
 public void Initialize()
 {
     _fixture = new Fixture();
     _sut     = new HouseholdPost(_fixture.Create <Category>());
 }