private SortedList <int, List <RentExpense> > GetExpensesByYears() { var map = new SortedList <int, List <RentExpense> >(); foreach (var t in Transactions._cache) { var cat = Categories.Get(t.Category); if (this.building.IsCategoriesMatched(cat)) { AddPayement(map, t.DateTime, t.Amount, t.PayeeAsText); } else { var listOfIncomesForThisBuilding = Splits.GetSplitsForTransaction(t.Id); foreach (var split in listOfIncomesForThisBuilding) { if (split.Category == this.building.CategoryForIncome) { AddPayement(map, t.DateTime, split.Amount, split.Memo); } } } } return(map); }
private Dictionary <int, List <RentPayment> > GetIncomesByYears() { var map = new Dictionary <int, List <RentPayment> >(); foreach (var t in Transactions._cache) { var category = Categories.Get(t.Category); if (category != null && category.IsDescedantOrMatching(this.building.CategoryForIncome)) { AddPayement(map, t.DateTime, t.Amount, t.PayeeAsText, t.CategoryAsText); } else { var listOfIncomesForThisBuilding = Splits.GetSplitsForTransaction(t.Id); foreach (var split in listOfIncomesForThisBuilding) { var categorySplit = Categories.Get(split.Category); if (categorySplit != null && categorySplit.IsDescedantOrMatching(this.building.CategoryForIncome)) { AddPayement(map, t.DateTime, split.Amount, split.Memo, split.CategoryAsText == "" ? t.CategoryAsText : split.CategoryAsText); } } } } return(map); }
private void ShowView() { var scroll = new ScrollView() { BackgroundColor = Color.White, }; { int horizontalMargins = App.IsSmallDevice() ? 5 : 40; var stack = new StackLayout() { Padding = new Thickness(horizontalMargins, 10, horizontalMargins, 0), Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand, }; scroll.Content = stack; // Account stack.Children.Add( this.CreateViewCaptionValue( "#Account", null, this.transaction.AccountAsText, async() => { var filter = new Filter { AccountId = this.transaction.Account }; await Navigation.PushAsync(new PageTransactions(filter)); }) ); // Date stack.Children.Add( this.CreateViewCaptionValue( "#Date", null, this.transaction.DateAsText, async() => { var filter = new Filter { DateText = this.transaction.DateAsText }; await Navigation.PushAsync(new PageTransactions(filter)); }) ); // Amount stack.Children.Add( this.CreateViewCaptionValue( "#Amount", null, this.transaction.Amount, async() => { var filter = new Filter { Amount = this.transaction.Amount }; await Navigation.PushAsync(new PageTransactions(filter)); }) ); // Payee stack.Children.Add( this.CreateViewCaptionValue( "#Payee", null, this.transaction.PayeeAsText, async() => { var filter = new Filter { PayeeId = this.transaction.Payee }; await Navigation.PushAsync(new PageTransactions(filter)); }) ); // Category stack.Children.Add( this.CreateViewCaptionValue( "#Category", null, this.transaction.CategoryAsText, async() => { var filter = new Filter(); filter.CategoryIds.Add(this.transaction.Category); await Navigation.PushAsync(new PageTransactions(filter)); }) ); // Memo stack.Children.Add(new Label { Text = this.transaction.Memo, TextColor = Color.Gray, FontAttributes = FontAttributes.Italic }); // Splits if (this.transaction.IsSplit) { stack.Children.Add(CreateSeparatorHorizontal(10)); var splits = Splits.GetSplitsForTransaction(this.transaction.Id); foreach (var split in splits) { stack.Children.Add(CreateViewHeaderCaptionAndValue(split.CategoryAsText, split.Amount)); stack.Children.Add(new Label { Text = split.Memo, TextColor = Color.Gray, FontAttributes = FontAttributes.Italic, Margin = new Thickness(0, 0, 0, 5) }); } } } this.Content = scroll; }
public bool IsValid(Transactions transaction) { if (this.AccountId != -1) { if (this.AccountId != transaction.Account) { return(false); } } if (this.CategoryIds.Any()) { if (transaction.Category == Categories.SplitCategoryId()) { List <Splits> splits = Splits.GetSplitsForTransaction(transaction.Id); bool categoryFoundInSplits = false; foreach (Splits split in splits) { if (this.CategoryIds.Contains(split.Category)) { categoryFoundInSplits = true; break; } } if (!categoryFoundInSplits) { return(false); } } else { if (!this.CategoryIds.Contains(transaction.Category)) { return(false); } } } if (this.PayeeId != -1) { if (this.PayeeId != transaction.Payee) { return(false); } } if (this.Amount != null) { if (this.Amount != transaction.Amount) { return(false); } } if (this.Year != null) { if (this.Year != transaction.DateTime.Year) { return(false); } } if (this.DateText != string.Empty) { if (this.DateText != transaction.DateAsText) { return(false); } } if (this.SearchText != string.Empty && this.SearchText != null) { if (!transaction.IsTextMatch(this.SearchText)) { return(false); } } return(true); }