/// <summary> /// Creates credit items and return them /// </summary> /// <param name="grossNetType"></param> /// <param name="taxType"></param> /// <param name="amount"></param> /// <param name="costAccount"></param> /// <param name="description"></param> /// <returns></returns> public List <Credit> CreateCredits(GrossNetType grossNetType, TaxType taxType, decimal amount, CostAccount costAccount, string description = "") { if (costAccount == null) { throw new Exception("Bitte Kontenrahmen angeben."); } List <Credit> credits = new List <Credit>(); Credit credit = new Credit(amount, costAccount.CostAccountId, 0); credit.CostAccount = costAccount; CalculateTax(grossNetType, taxType, amount, out decimal tax, out decimal amountWithoutTax); credit.CreditId = tempCreditDebitId; if (tax > 0) { Credit creditTax = new Credit(tax, taxType.RefCostAccount, 0); creditTax.CostAccount = CostAccounts.GetById(taxType.RefCostAccount); creditTax.RefCreditId = tempCreditDebitId; creditTax.CreditId = ++tempCreditDebitId; creditTax.IsTax = true; credits.Add(creditTax); } credit.Amount = amountWithoutTax; credit.Description = description; credits.Add(credit); tempCreditDebitId++; return(credits); }
private void SaveDebitor(int ClientId) { if (SelectedDebitor.DebitorId == 0) { int DebitorNumber = CostAccounts.GetNextDebitorNumber(); SelectedDebitor.RefClientId = CompanyViewModel.Client.ClientId; SelectedDebitor.CostAccount.RefTaxTypeId = CompanyViewModel.SelectedTaxTypeId; SelectedDebitor.CostAccount.AccountNumber = DebitorNumber; SelectedDebitor.CostAccount.RefCostAccountCategoryId = CostAccountCategories.GetDebitorId(); SelectedDebitor.CostAccount.Description = CompanyViewModel.Client.Name; SelectedDebitor.CostAccount.IsVisible = true; SelectedDebitor.RefCostAccountId = CostAccounts.Insert(SelectedDebitor.CostAccount); Debitors.Insert(SelectedDebitor); } else { Clients.Update(CompanyViewModel.Client); if (CompanyViewModel.SelectedClientType == ClientType.Business) { Companies.Update(CompanyViewModel.Client.Company); } CostAccounts.Update(SelectedDebitor.CostAccount); Debitors.Update(SelectedDebitor); } }
private void GetData() { FilteredTaxTypes = new SvenTechCollection <TaxType>(Globals.CoreData.TaxTypeList); CostAccountList = CostAccounts.GetAllVisible().ToList(); CostCenterCategoryList = CostCenterCategories.GetAll().ToSvenTechCollection(); ProjectList = Projects.GetAll().ToSvenTechCollection(); FixedCostAllocationList = FixedCostAllocations.GetAll().ToSvenTechCollection(); }
public void RefreshLists() { CostAccountCategoryList = CostAccountCategories.GetAll().ToSvenTechCollection(); CostAccountCategoriesHierachical = CostAccountCategoryList.ToHierachicalCollection <CostAccountCategory>() .ToSvenTechCollection(); TaxTypeList = TaxTypes.GetAll().ToSvenTechCollection(); _CostAccounts = CostAccounts.GetAll().ToSvenTechCollection(); }
private void GetCostAccounts() { CostAccountList = CostAccounts.GetAll().ToSvenTechCollection(); }
private void RefreshCostAccounts() { _CostAccounts = CostAccounts.GetAll().ToList(); }