Exemplo n.º 1
0
        public void TestMethod00002()
        {
            var dir = SampleDir.Aug27_GRY();
            var sut = new GLRecapReport(Month.July, 2018, dir);

            sut.ToExcel();
        }
        private void WriteReportSummarySheet(GLRecapReport glRecapReport)
        {
            var subTitle = "Report Summary";

            _src = glRecapReport;
            _xl  = new CellWriter1ByRow("GL_Recap", subTitle);

            WriteSheetHeader(subTitle);

            var labelCol = 2;
            var colSpan  = 8;

            WriteRepSmryRowLabels(labelCol, colSpan);
            WriteTotalsRowLabel(labelCol, colSpan);

            var nextCol  = labelCol + colSpan;
            var rowCount = _src.Count;

            WriteRepSmryAmounts(nextCol, "Debit", _ => _.TotalDebits);
            SummarizeCurrentColumn(rowCount);

            WriteRepSmryAmounts(nextCol + 1, "Credit", _ => _.TotalCredits);
            SummarizeCurrentColumn(rowCount);

            SetRowHeights(rowCount);
        }
Exemplo n.º 3
0
        public void TestMethod00001()
        {
            var dir = SampleDir.Aug27_GRY();
            var sut = new GLRecapReport(Month.July, 2018, dir);

            sut.Should().HaveCount(5);

            var equities = sut.ElementAt(0);

            equities.AccountType.Should().Be(GLAcctType.Equity);
            equities.Should().HaveCount(1);
            equities[0].Account.Name.Should().Be("Drawings");
            equities[0].TotalDebits.Should().Be(230780);
            equities[0].TotalCredits.Should().Be(0);
            equities[0].Should().HaveCount(2);
            equities.TotalDebits.Should().Be(230780);
            equities.TotalCredits.Should().Be(0);

            var assets = sut.ElementAt(1);

            assets.AccountType.Should().Be(GLAcctType.Asset);
            assets.Should().HaveCount(5);
            assets[1].Account.Name.Should().Be("Advances to Officers and Employees");
            assets[1].TotalDebits.Should().Be(1135);
            assets[1].TotalCredits.Should().Be(0);
            assets[1].Should().HaveCount(1);
            assets.TotalDebits.Should().Be(111455.83M);
            assets.TotalCredits.Should().Be(756405.14M);

            sut.TotalDebits.Should().Be(770000.23M);
            sut.TotalCredits.Should().Be(1268102.23M);
        }
Exemplo n.º 4
0
        private List <FundRequestDTO> GetRequestsWithinDates(GLRecapReport main, IFundRequestsRepo repo)
        {
            var start = main.StartDate.DaysSinceMin();
            var end   = main.EndDate.DaysSinceMin();

            return(repo.Find(_ => _.DateOffset >= start &&
                             _.DateOffset <= end));
        }
Exemplo n.º 5
0
        private List <FundRequestDTO> GetCombinedList(GLRecapReport main)
        {
            var repos   = main.DBsDir.Vouchers;
            var activs  = GetRequestsWithinDates(main, repos.ActiveRequests);
            var inactvs = GetRequestsWithinDates(main, repos.InactiveRequests);

            return(activs.Concat(inactvs).ToList());
        }
Exemplo n.º 6
0
        public GLRecapExcelWriter(GLRecapReport glRecapReport)
        {
            WriteReportSummarySheet(glRecapReport);

            foreach (var category in _src)
            {
                WriteCategorySummarySheet(category);
                WriteCategoryDetailsSheet(category);
            }
        }
Exemplo n.º 7
0
        private void GroupByAccount(List <GLRecapAllocation> allocs, GLRecapReport main)
        {
            var grpdByAcct = allocs.GroupBy(_ => _.Account.Name)
                             .OrderBy(_ => _.Key);

            foreach (var grp in grpdByAcct)
            {
                var acct = GLAccountDTO.Named(grp.Key);
                this.Add(new GLRecapAccountGroup(acct, grp));
            }
        }
Exemplo n.º 8
0
        private bool IsWithinDates(FundRequestDTO req, GLRecapReport main)
        {
            var date = req.RequestDate.Date;

            if (date < main.StartDate)
            {
                return(false);
            }
            if (date > main.EndDate)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 9
0
        private void FillWithSubRows(GLRecapReport main)
        {
            var allocs = new List <GLRecapAllocation>();
            //var allReqs = main.DBsDir.Vouchers.AllRequests.GetAll()
            //                  .Where(_ => IsWithinDates(_, main))
            //                  .ToList();
            var allReqs = GetCombinedList(main);

            foreach (var req in allReqs)
            {
                foreach (var alloc in req.Allocations)
                {
                    if (alloc.Account.AccountType == this.AccountType)
                    {
                        allocs.Add(new GLRecapAllocation(alloc, req));
                    }
                }
            }
            GroupByAccount(allocs, main);
        }
Exemplo n.º 10
0
 public GLRecapCategory(GLAcctType acctTyp, GLRecapReport mainReport)
 {
     AccountType = acctTyp;
     FillWithSubRows(mainReport);
 }
Exemplo n.º 11
0
 public static void ToExcel(this GLRecapReport glRecapReport)
 => new GLRecapExcelWriter(glRecapReport).LaunchExcel();