public AccountTransactionDocumentAccountMapViewModel(IAccountService accountService, AccountTransactionDocumentAccountMap accountTransactionDocumentAccountMap, AccountType masterAccountType, AccountType mappingAccountType) { Model = accountTransactionDocumentAccountMap; AccountSelector = new AccountSelectViewModel(accountService, masterAccountType, Model.AccountName, (x, y) => { Model.AccountId = y; Model.AccountName = x; }); if (mappingAccountType != null) { MappedAccountSelector = new AccountSelectViewModel(accountService, mappingAccountType, Model.MappedAccountName, (x, y) => { Model.MappedAccountId = y; Model.MappedAccountName = x; }); } }
public AccountSelectViewModel(IAccountService accountService, AccountType accountType, string accountName, Action<string, int> updateAction) : this(accountService, accountType) { _accountName = accountName; UpdateAction = updateAction; }
public AccountSelectViewModel(IAccountService accountService, AccountType accountType, int accountId, string accountName) : this(accountService, accountType) { _accountName = accountName; _selectedAccountId = accountId; }
public AccountSelectViewModel(IAccountService accountService, AccountType accountType) { _accountService = accountService; AccountType = accountType; }
public void Setup() { Pizza = CreateMenuItem(1, "Pizza", 10); Cola = CreateMenuItem(2, "Cola", 5); Beer = CreateMenuItem(3, "Beer", 10); var saleAccountType = new AccountType { Name = "Sales Accounts", Id = 1 }; var taxAccountType = new AccountType { Name = "Tax Accounts", Id = 2 }; var receivableAccountType = new AccountType { Name = "Receivable Accounts", Id = 3 }; var discountAccountType = new AccountType { Name = "Discount Accounts", Id = 4 }; var defaultSaleAccount = new Account { AccountTypeId = saleAccountType.Id, Name = "Sales", Id = 1 }; ReceivableAccount = new Account { AccountTypeId = receivableAccountType.Id, Name = "Receivables", Id = 2 }; var stateTaxAccount = new Account { AccountTypeId = taxAccountType.Id, Name = "State Tax", Id = 3 }; var localTaxAccount = new Account { AccountTypeId = taxAccountType.Id, Name = "Local Tax", Id = 4 }; var defaultDiscountAccount = new Account { AccountTypeId = discountAccountType.Id, Name = "Discount", Id = 5 }; var saleTransactionType = new AccountTransactionType { Id = 1, Name = "Sale Transaction", SourceAccountTypeId = saleAccountType.Id, TargetAccountTypeId = receivableAccountType.Id, DefaultSourceAccountId = defaultSaleAccount.Id, DefaultTargetAccountId = ReceivableAccount.Id }; var localTaxTransactionType = new AccountTransactionType { Id = 2, Name = "Local Tax Transaction", SourceAccountTypeId = taxAccountType.Id, TargetAccountTypeId = receivableAccountType.Id, DefaultSourceAccountId = localTaxAccount.Id, DefaultTargetAccountId = ReceivableAccount.Id }; var stateTaxTransactionType = new AccountTransactionType { Id = 3, Name = "State Tax Transaction", SourceAccountTypeId = taxAccountType.Id, TargetAccountTypeId = receivableAccountType.Id, DefaultSourceAccountId = stateTaxAccount.Id, DefaultTargetAccountId = ReceivableAccount.Id }; DiscountTransactionType = new AccountTransactionType { Id = 4, Name = "Discount Transaction", SourceAccountTypeId = receivableAccountType.Id, TargetAccountTypeId = discountAccountType.Id, DefaultSourceAccountId = ReceivableAccount.Id, DefaultTargetAccountId = defaultDiscountAccount.Id }; var stateTax = new TaxTemplate { Name = "State Tax", Rate = 25, Id = 1 }; stateTax.TaxTemplateMaps.Add(new TaxTemplateMap()); stateTax.AccountTransactionType = stateTaxTransactionType; var localTax = new TaxTemplate { Name = "Local Tax", Rate = 3, Id = 2 }; localTax.TaxTemplateMaps.Add(new TaxTemplateMap { MenuItemId = Cola.Id }); localTax.TaxTemplateMaps.Add(new TaxTemplateMap { MenuItemId = Beer.Id }); localTax.AccountTransactionType = localTaxTransactionType; TaxTemplates = new List<TaxTemplate> { stateTax, localTax }; TicketType = new TicketType { SaleTransactionType = saleTransactionType, TaxIncluded = true }; }
public void Setup() { Pizza = CreateMenuItem(1, "Pizza", 10); Cola = CreateMenuItem(2, "Cola", 5); Beer = CreateMenuItem(3, "Beer", 10); Product = CreateMenuItem(4, "Product", 1); var saleAccountType = new AccountType { Name = "Sales Accounts", Id = 1 }; var taxAccountType = new AccountType { Name = "Tax Accounts", Id = 2 }; var receivableAccountType = new AccountType { Name = "Receivable Accounts", Id = 3 }; var discountAccountType = new AccountType { Name = "Discount Accounts", Id = 4 }; var defaultSaleAccount = new Account { AccountTypeId = saleAccountType.Id, Name = "Sales", Id = 1 }; var receivableAccount = new Account { AccountTypeId = receivableAccountType.Id, Name = "Receivables", Id = 2 }; var stateTaxAccount = new Account { AccountTypeId = taxAccountType.Id, Name = "State Tax", Id = 3 }; var localTaxAccount = new Account { AccountTypeId = taxAccountType.Id, Name = "Local Tax", Id = 4 }; var defaultDiscountAccount = new Account { AccountTypeId = discountAccountType.Id, Name = "Discount", Id = 5 }; var saleTransactionType = new AccountTransactionType { Id = 1, Name = "Sale Transaction", SourceAccountTypeId = saleAccountType.Id, TargetAccountTypeId = receivableAccountType.Id, DefaultSourceAccountId = defaultSaleAccount.Id, DefaultTargetAccountId = receivableAccount.Id }; var localTaxTransactionType = new AccountTransactionType { Id = 2, Name = "Local Tax Transaction", SourceAccountTypeId = taxAccountType.Id, TargetAccountTypeId = receivableAccountType.Id, DefaultSourceAccountId = localTaxAccount.Id, DefaultTargetAccountId = receivableAccount.Id }; var stateTaxTransactionType = new AccountTransactionType { Id = 3, Name = "State Tax Transaction", SourceAccountTypeId = taxAccountType.Id, TargetAccountTypeId = receivableAccountType.Id, DefaultSourceAccountId = stateTaxAccount.Id, DefaultTargetAccountId = receivableAccount.Id }; DiscountTransactionType = new AccountTransactionType { Id = 4, Name = "Discount Transaction", SourceAccountTypeId = receivableAccountType.Id, TargetAccountTypeId = discountAccountType.Id, DefaultSourceAccountId = receivableAccount.Id, DefaultTargetAccountId = defaultDiscountAccount.Id }; var stateTax = TaxTemplateBuilder.Create("State Tax") .WithRate(25) .WithRounding(2) .WithAccountTransactionType(stateTaxTransactionType) .AddDefaultTaxTemplateMap() .Build(); var localTax = TaxTemplateBuilder.Create("Local Tax").WithRate(3) .AddTaxTemplateMap(new TaxTemplateMap {MenuItemId = Cola.Id}) .AddTaxTemplateMap(new TaxTemplateMap {MenuItemId = Beer.Id}) .WithAccountTransactionType(localTaxTransactionType) .WithRounding(2) .Build(); TaxTemplates = new List<TaxTemplate> { stateTax, localTax }; TicketType = new TicketType { SaleTransactionType = saleTransactionType, TaxIncluded = true }; }
public AccountBuilder WithAccountType(AccountType accountType) { _accountType = accountType; return this; }
private Account CreateAccount(AccountType accountType, string accountName, int accountId, ForeignCurrency currency = null) { var result = AccountBuilder.Create(accountName) .WithId(accountId) .WithAccountType(accountType) .WithForeignCurrency(currency) .Build(); Workspace.Add(result); Workspace.CommitChanges(); return result; }
private AccountTransactionDocumentType CreateTransactionDocument(AccountType masterAccountType, params AccountTransactionType[] transactionTypes) { var result = new AccountTransactionDocumentType(); foreach (var accountTransactionType in transactionTypes) { result.TransactionTypes.Add(accountTransactionType); } result.MasterAccountTypeId = masterAccountType.Id; Workspace.Add(result); Workspace.CommitChanges(); return result; }