private static bool IsBuggy(FundRequestDTO req, out AccountAllocation bdo1Alloc) { bdo1Alloc = null; //if (req.IsBalanced) return false; if (req.Allocations == null) { return(false); } if (!req.Allocations.Any()) { return(false); } //Cash in Bank - BDO 1 var matches = req.Allocations.Where(_ => _.Account.Id == 37282); if (!matches.Any()) { return(false); } if (matches.Count() > 1) { return(false); } bdo1Alloc = matches.Single(); return(true); }
public static AccountAllocation AddCashInBankEntry(this List <AccountAllocation> list, BankAccountDTO bankAccount, decimal amount) { var alloc = AccountAllocation.DefaultCashInBank(bankAccount, amount); list.Insert(0, alloc); return(alloc); }
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 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 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 FundRequestDTO ValidSampleDTO() => new FundRequestDTO { Id = 0, SerialNum = 123, BankAccountId = 456, Payee = "Mr. Payee Dude", Purpose = "To be Purposeful", DateOffset = DateTime.Now.DaysSinceMin(), Amount = 789, Allocations = new List <AccountAllocation> { AccountAllocation.DefaultCashInBank (new BankAccountDTO(), 789), new AccountAllocation { Account = new GLAccountDTO { Id = 456, Name = "a GL Account" }, SubAmount = -789 }, } };
public AllocationVM(AccountAllocation accountAllocationDTO) { DTO = accountAllocationDTO; }
private static void FixBuggyAlloc(AccountAllocation bdo1Alloc) { bdo1Alloc.Account.Id = 0; bdo1Alloc.Account.Name = "Cash in Bank: BDO"; }
public GLRecapAllocation(AccountAllocation alloc, FundRequestDTO req) { Account = alloc.Account; SubAmount = alloc.SubAmount; Request = req; }