public AllocationVM(GLAccountDTO glAccount, decimal amount) : this(new AccountAllocation { Account = glAccount, SubAmount = amount } ) { }
public void SetHost(List <AccountAllocation> listHost, BankAccountDTO bankAccount, ISimpleRepo <GLAccountDTO> glAcctsRepo) { _list = listHost; _bank = bankAccount; //todo: use .IncludeCashInBanks() _glAccts = glAcctsRepo?.GetAll(); _glAccts?.Insert(0, GLAccountDTO.CashInBank(_bank)); UpdateUILists(); }
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); }
public void HasItemamountchangedupdatesitem() { var sut = new AllocationsListVM(); var bank = BankAccountDTO.Named("test bank acct"); var item = new AccountAllocation { Account = GLAccountDTO.CashInBank(bank), SubAmount = 123 }; var host = new List <AccountAllocation> { item }; var amt = 456; sut.SetHost(host, bank, null); sut.OnAmountChanged(amt); sut.Should().HaveCount(1); sut[0].Account.Name.Should().Contain("Cash in Bank"); sut[0].Account.Name.Should().Contain(bank.Name); sut[0].SubAmount.Should().Be(amt); }
private static GLRecapAllocation CreateAllocation(decimal amount, string label, GLAccountDTO acct, DateTime date) { var alloc = new AccountAllocation { Account = acct, SubAmount = amount }; var req = new FundRequestDTO { Purpose = label, DateOffset = date.DaysSinceMin(), }; return(new GLRecapAllocation(alloc, req)); }
public static AccountAllocation NewItem(GLAccountDTO glAccount, decimal unsignedAmount, decimal multiplier) => new AccountAllocation { Account = glAccount, SubAmount = Math.Abs(unsignedAmount) * multiplier };
public static AccountAllocation DefaultCashInBank(BankAccountDTO bankAccount, decimal amount) => NewCredit(GLAccountDTO.CashInBank(bankAccount), amount);
public static AccountAllocation NewCredit(GLAccountDTO glAccount, decimal unsignedAmount) => NewItem(glAccount, unsignedAmount, +1);
public GLRecapAccountGroup(GLAccountDTO glAccountDTO, IEnumerable <GLRecapAllocation> items) : base(items) { Account = glAccountDTO; }