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)); } }
private JournalVoucherDTO ValidSampleDTO() => new JournalVoucherDTO { Id = 0, SerialNum = 123, Description = "sample JV", DateOffset = DateTime.Now.DaysSinceMin(), Amount = 789, Allocations = new List <AccountAllocation> { AccountAllocation.NewCredit(GLAccountDTO.Named("test GL 1"), 789), AccountAllocation.NewDebit(GLAccountDTO.Named("test GL 2"), 789), } };
private static GLRecapAccountGroup CreateAcctGrp(DateTime date, ITenantDBsDir dir, Dictionary <int, GLAccountDTO> glDict) { var dlyColxn = new DailyColxnsReport(date, dir); var colxnAcct = GLAccountDTO.Named($"Daily Collections for {dlyColxn.Date:d-MMM-yyyy}"); var acctGrp = new GLRecapAccountGroup(colxnAcct, new List <GLRecapAllocation> { CreateAllocation(dlyColxn.TotalRent, "Rent Collections", colxnAcct, date), CreateAllocation(dlyColxn.TotalRights, "Rights Collections", colxnAcct, date), CreateAllocation(dlyColxn.TotalElectric, "Electric Collections", colxnAcct, date), CreateAllocation(dlyColxn.TotalWater, "Water Collections", colxnAcct, date), CreateAllocation(dlyColxn.TotalAmbulant, "Ambulant Collections", colxnAcct, date), }); foreach (var othr in dlyColxn.Others) { var glAcct = glDict[othr.Key]; acctGrp.Add(CreateAllocation(othr.Value, glAcct.Name, glAcct, date)); } return(acctGrp); }