private void ActOnTestData5(StatementModel statementModelTestData = null) { this.subject = LedgerBookTestData.TestData5(); this.testDataBudget = BudgetModelTestData.CreateTestData5(); this.testDataStatement = statementModelTestData ?? StatementModelTestData.TestData5(); Console.WriteLine("********************** BEFORE RUNNING RECONCILIATION *******************************"); this.testDataStatement.Output(ReconcileDate.AddMonths(-1)); this.subject.Output(true); var result = Act(bankBalances: new[] { new BankBalance(StatementModelTestData.ChequeAccount, 1850.5M), new BankBalance(StatementModelTestData.SavingsAccount, 1200M) }); this.testDataToDoList = result.Tasks.ToList(); Console.WriteLine(); Console.WriteLine("********************** AFTER RUNNING RECONCILIATION *******************************"); this.subject.Output(true); }
private void ActOnTestData5(StatementModel statementModelTestData = null, bool ignoreWarnings = false) { this.testDataLedgerBook = LedgerBookTestData.TestData5(() => new LedgerBookTestHarness(new Mock <IReconciliationBuilder>().Object)); this.testDataBudgets = new BudgetCollection(new[] { BudgetModelTestData.CreateTestData5() }); this.testDataBudgetContext = new BudgetCurrencyContext(this.testDataBudgets, this.testDataBudgets.CurrentActiveBudget); this.testDataStatement = statementModelTestData ?? StatementModelTestData.TestData5(); Console.WriteLine("********************** BEFORE RUNNING RECONCILIATION *******************************"); this.testDataStatement.Output(ReconcileDate.AddMonths(-1)); this.testDataLedgerBook.Output(true); Act(bankBalances: new[] { new BankBalance(StatementModelTestData.ChequeAccount, 1850.5M), new BankBalance(StatementModelTestData.SavingsAccount, 1200M) }, ignoreWarnings: ignoreWarnings); Console.WriteLine(); Console.WriteLine("********************** AFTER RUNNING RECONCILIATION *******************************"); this.testDataLedgerBook.Output(true); }
public StatementModel Build() { if (this.additionalTransactions.None()) { return(this.model); } // IEnumerable<MethodInfo> privateMergeMethods = this.model.GetType().GetMethods(BindingFlags.Instance | BindingFlags.NonPublic).Where(m => m.Name == "Merge"); // MethodInfo privateMergeMethod = privateMergeMethods.First(m => m.IsPrivate); // privateMergeMethod.Invoke(this.model, new object[] { this.additionalTransactions }); var additionalTransactionsModel = new StatementModel(new FakeLogger()) { LastImport = this.additionalTransactions.Max(t => t.Date).Date, }; additionalTransactionsModel.LoadTransactions(this.additionalTransactions); return(this.model.Merge(additionalTransactionsModel)); }
/// <summary> /// Loads a data source with the provided database reference data asynchronously. /// </summary> /// <exception cref="System.ArgumentNullException"></exception> /// <exception cref="DataFormatException">Statement Model data is corrupt and has been tampered with. Unable to load.</exception> public async Task LoadAsync(ApplicationDatabase applicationDatabase) { if (applicationDatabase == null) { throw new ArgumentNullException(nameof(applicationDatabase)); } StatementModel?.Dispose(); try { StatementModel = await this.statementRepository.LoadAsync(applicationDatabase.FullPath(applicationDatabase.StatementModelStorageKey), applicationDatabase.IsEncrypted); } catch (StatementModelChecksumException ex) { throw new DataFormatException("Statement Model data is corrupt and has been tampered with. Unable to load.", ex); } NewDataAvailable(); }
public void TestInitialise() { this.bucketRepo = new BucketBucketRepoAlwaysFind(); this.subject = new RemainingSurplusWidget(); this.criteriaTestData = new GlobalFilterCriteria { BeginDate = new DateTime(2015, 10, 20), EndDate = new DateTime(2015, 11, 19) }; StatementModelTestDataForThisTest.AccountTypeRepo = new InMemoryAccountTypeRepository(); StatementModelTestDataForThisTest.BudgetBucketRepo = this.bucketRepo; this.statementTestData = StatementModelTestDataForThisTest.TestDataGenerated(); BudgetModel budgetModel = BudgetModelTestData.CreateTestData1(); this.budgetTestData = new BudgetCurrencyContext(new BudgetCollection(budgetModel), budgetModel); this.ledgerBookTestData = new LedgerBookBuilder { StorageKey = "RemainingSurplusWidgetTest.xml", Modified = new DateTime(2015, 11, 23), Name = "Smith Budget 2015" } .IncludeLedger(LedgerBookTestData.PhoneLedger, 130M) .IncludeLedger(LedgerBookTestData.CarMtcLedger, 90M) .IncludeLedger(LedgerBookTestData.PowerLedger) .AppendReconciliation( new DateTime(2015, 10, 20), new BankBalance(LedgerBookTestData.ChequeAccount, 4502.75M)) .WithReconciliationEntries( entryBuilder => { entryBuilder.WithLedger(LedgerBookTestData.PhoneLedger).HasNoTransactions(); entryBuilder.WithLedger(LedgerBookTestData.CarMtcLedger).HasNoTransactions(); entryBuilder.WithLedger(LedgerBookTestData.PowerLedger) .AppendTransactions(txnBuilder => { txnBuilder.WithCredit(3000M, "Oct Savings", new DateTime(2015, 10, 20), "automatchref12"); }); }) .Build(); this.ledgerCalculation = new LedgerCalculation(new FakeLogger()); }
public OverallPerformanceBudgetResult BuildChart(StatementModel statementModel, BudgetCollection budgets, GlobalFilterCriteria criteria) { if (statementModel == null) { throw new ArgumentNullException(nameof(statementModel)); } if (budgets == null) { throw new ArgumentNullException(nameof(budgets)); } if (criteria == null) { throw new ArgumentNullException(nameof(criteria)); } return(this.analyser.Analyse(statementModel, budgets, criteria)); }
public void TestInit() { PrivateAccessor.SetProperty(this.testAppDb, "StatementModelStorageKey", @"Foo.csv"); PrivateAccessor.SetProperty(this.testAppDb, "FileName", @"C:\AppDb.bax"); this.testData = StatementModelTestData.TestData2(); this.mockBudgetBucketRepo = new Mock <IBudgetBucketRepository>(); this.mockStatementRepo = new Mock <IStatementRepository>(); this.mockStatementRepo.Setup(m => m.LoadAsync(It.IsAny <string>(), It.IsAny <bool>())) .Returns(Task.FromResult(this.testData)) .Verifiable(); this.mockBudgetBucketRepo .Setup(m => m.Buckets) .Returns(BudgetBucketTestData.BudgetModelTestData1Buckets); this.budgetBucketRepo = this.mockBudgetBucketRepo.Object; Arrange(); }
public void Reconcile_ShouldThrow_GivenTestData1AndNoStatementModelTransactions() { this.testDataStatement = new StatementModel(new FakeLogger()) { StorageKey = "C:\\Foo.xml" }; try { Act(new DateTime(2013, 10, 15)); } catch (ValidationWarningException ex) { if (ex.Source == "5") { return; } } Assert.Fail(); }
private void CreateStatementTestData() { this.statementTestData = new StatementModelBuilder() .AppendTransaction( new Transaction { Account = StatementModelTestData.SavingsAccount, Amount = -100M, BudgetBucket = StatementModelTestData.InsHomeBucket, Date = new DateTime(2015, 10, 19), Reference1 = "automatchref12", }) .AppendTransaction( new Transaction { Account = StatementModelTestData.ChequeAccount, Amount = 100M, BudgetBucket = StatementModelTestData.PhoneBucket, Date = new DateTime(2015, 10, 19), Reference1 = "automatchref12", }) .AppendTransaction( new Transaction { Account = StatementModelTestData.SavingsAccount, Amount = -10M, BudgetBucket = StatementModelTestData.InsHomeBucket, Date = new DateTime(2015, 10, 1), Reference1 = "Foo" }) .AppendTransaction( new Transaction { Account = StatementModelTestData.ChequeAccount, Amount = -20M, BudgetBucket = StatementModelTestData.PhoneBucket, Date = new DateTime(2015, 10, 1), Reference1 = "Foo" }) .Build(); }
protected async override void OnAppearing() { try { ShowBusy(MessageHelper.Loading); var result = await Task.Run(() => _accountStatementService.GetAllService(houseId)); if (result != null) { this.stmtModel = result; } if (stmtModel != null) { Title = MessageHelper.AccountStatement + stmtModel.House.Name; var statementViewModel = stmtModel.Accounts.Select(c => new AccountStatementViewModel { Date = c.ValueDate, Doc = Convert.ToString(c.DocumentNumber), Description = c.Description, Debit = c.DebitAmount, Credit = c.CreditAmount, DuesBalance = c.DuesBalance, AdvanceBalance = c.AdvanceTotal, }); AccountStatementView.ItemsSource = statementViewModel; HeaderSection.IsVisible = true; } } catch (Exception ex) { if (!CrossConnectivity.Current.IsConnected) { UserDialogs.Instance.ErrorToast(MessageHelper.NoInternet); } } finally { HideBusy(); } base.OnAppearing(); }
public BurnDownChartAnalyserResult CreateNewCustomAggregateChart( StatementModel statementModel, BudgetModel budgetModel, IEnumerable <BudgetBucket> buckets, LedgerBook ledgerBookModel, DateTime beginDate, string chartTitle) { List <BudgetBucket> bucketsList = buckets.ToList(); var result = this.chartAnalyser.Analyse(statementModel, budgetModel, bucketsList, ledgerBookModel, beginDate); result.ChartTitle = chartTitle; var persistChart = new CustomAggregateBurnDownGraph { BucketIds = bucketsList.Select(b => b.Code).ToList(), Name = chartTitle }; this.chartsBuilder.CustomCharts = this.chartsBuilder.CustomCharts.Union(new[] { persistChart }).ToList(); return(result); }
public void Reconcile_ShouldThrowValidationWarning_GivenTwoOrMoreWarningsHaveAlreadyBeenThrown() { // First the statement has a transaction that is not classified with a bucket. this.testDataStatement = new StatementModelBuilder() .TestData1() .AppendTransaction(new Transaction { Account = StatementModelTestData.ChequeAccount, Amount = 12.45M, Date = ReconcileDate.AddDays(-1), Description = "Foo bar" }) .Build(); try { Act(); } catch (ValidationWarningException ex) { if (ex.Source != "3") { Assert.Fail(); } } // Second time thru, we choose to ignore validation warnings messages we've seen before. try { ActOnTestData5(ignoreWarnings: true); } catch (ValidationWarningException ex) { if (ex.Source == "2") { return; } } Assert.Fail(); }
public ReconciliationResult CreateNewMonthlyReconciliation( DateTime reconciliationDateExclusive, BudgetModel budget, StatementModel statement, params BankBalance[] bankBalances) { if (bankBalances == null) { throw new ArgumentNullException(nameof(bankBalances)); } if (budget == null) { throw new ArgumentNullException(nameof(budget)); } if (statement == null) { throw new ArgumentNullException(nameof(statement)); } if (LedgerBook == null) { throw new ArgumentException("The Ledger Book property cannot be null. You must set this prior to calling this method."); } try { this.newReconciliationLine = new LedgerEntryLine(reconciliationDateExclusive, bankBalances); AddNew(budget, statement, CalculateDateForReconcile(LedgerBook, reconciliationDateExclusive)); return(new ReconciliationResult { Reconciliation = this.newReconciliationLine, Tasks = this.toDoList }); } finally { this.newReconciliationLine = null; } }
private static decimal CalculateTrackedSavingLedgersContributions(StatementModel statement, IEnumerable <BudgetBucket> trackedSavingsLedgers) { decimal savingsToDate = 0; foreach (var bucket in trackedSavingsLedgers) { List <Transaction> transactions = statement.Transactions.Where(t => t.BudgetBucket == bucket).ToList(); // This will give interest earned. This is because the transaction list will contain both debits and credits for transfering the savings around. savingsToDate += transactions.Sum(t => t.Amount); // This will give the savings credited. IEnumerable <IGrouping <decimal, decimal> > amounts = transactions .Select(t => Math.Abs(t.Amount)) .GroupBy(amount => amount, amount => amount) .Where(group => @group.Count() > 1); savingsToDate += amounts.Distinct().Sum(g => g.Key); } return(savingsToDate); }
public static void Output(this StatementModel instance, DateTime startDate) { Debug.WriteLine("Date Description Bucket Reference1 Reference2 Amount Account Id"); Debug.WriteLine("====================================================================================================================================="); foreach (Transaction transaction in instance.AllTransactions.Where(t => t.Date >= startDate).OrderBy(t => t.Date)) { Debug.WriteLine( "{0} {1} {2} {3} {4} {5} {6} {7}", transaction.Date.ToString("d-MMM-yy").PadRight(10), transaction.Description.Truncate(15).PadRight(15), transaction.BudgetBucket?.Code.PadRight(10) ?? string.Empty.PadRight(10), transaction.Reference1.Truncate(15).PadRight(15), transaction.Reference2.Truncate(15).PadRight(15), transaction.Amount.ToString("N").PadLeft(10), transaction.Account.Name.PadRight(15), transaction.Id); } Debug.WriteLine("====================================================================================================================================="); Debug.WriteLine($"Total Transactions: {instance.AllTransactions.Count()}"); Debug.WriteLine(string.Empty); }
private void AddBalanceAdjustmentsForFutureTransactions(StatementModel statement, DateTime reconciliationDate) { var adjustmentsMade = false; foreach (var futureTransaction in statement.AllTransactions .Where( t => t.Account.AccountType != AccountType.CreditCard && t.Date >= reconciliationDate && !(t.BudgetBucket is PayCreditCardBucket))) { adjustmentsMade = true; NewReconLine.BalanceAdjustment( -futureTransaction.Amount, "Remove future transaction for " + futureTransaction.Date.ToString("d"), futureTransaction.Account); } if (adjustmentsMade) { TodoTasks.Add(new ToDoTask("Check auto-generated balance adjustments for future transactions.", true)); } }
public void FilterByBucket_ShouldReturn1Bucket_GivenUncatergorisedCode() { var model2 = new StatementModelBuilder() .AppendTransaction( new Transaction { Account = StatementModelTestData.ChequeAccount, Amount = -255.65M, BudgetBucket = null, Date = new DateTime(2013, 9, 10), }) .Merge(this.testData) .Build(); this.testData = model2; Arrange(); var result = this.subject.FilterByBucket(TransactionConstants.UncategorisedFilter); this.testData.Output(DateTime.MinValue); Assert.AreEqual(1, result.Count()); }
public GraphData BuildChart(StatementModel statementModel, GlobalFilterCriteria criteria) { if (statementModel == null) { throw new ArgumentNullException(nameof(statementModel)); } if (criteria == null) { throw new ArgumentNullException(nameof(criteria)); } if (statementModel.Transactions.Any(t => t.BudgetBucket == null)) { throw new ArgumentException("There are uncategorised transactions, finish assigning a bucket to all transactions before this running this graph."); } this.analyser.Analyse(statementModel, criteria); var result = this.analyser.Graph; this.analyser.Reset(); return(result); }
private static void CalculateTotalsAndAverage(DateTime beginDate, StatementModel statement, BudgetCollection budgets, OverallPerformanceBudgetResult result) { // First total the expenses without the saved up for expenses. var totalExpensesSpend = statement.Transactions .Where(t => t.BudgetBucket is ExpenseBucket) .Sum(t => t.Amount); var totalSurplusSpend = statement.Transactions .Where(t => t.BudgetBucket is SurplusBucket) .Sum(t => t.Amount); result.AverageSpend = totalExpensesSpend / result.DurationInMonths; // Expected to be negative result.AverageSurplus = totalSurplusSpend / result.DurationInMonths; // Expected to be negative for (var month = 0; month < result.DurationInMonths; month++) { var budget = budgets.ForDate(beginDate.AddMonths(month)); result.TotalBudgetExpenses += budget.Expenses.Sum(e => e.Amount); } result.OverallPerformance = result.AverageSpend + result.TotalBudgetExpenses; }
/// <summary> /// Calculates the current month bucket spend. /// </summary> /// <exception cref="System.ArgumentNullException"> /// </exception> public virtual decimal CalculateCurrentMonthBucketSpend( [NotNull] LedgerBook ledgerBook, [NotNull] GlobalFilterCriteria filter, [NotNull] StatementModel statement, [NotNull] string bucketCode) { CheckCacheForCleanUp(); if (ledgerBook == null) { throw new ArgumentNullException(nameof(ledgerBook)); } if (filter == null) { throw new ArgumentNullException(nameof(filter)); } if (statement == null) { throw new ArgumentNullException(nameof(statement)); } if (bucketCode.IsNothing()) { throw new ArgumentNullException(nameof(bucketCode)); } if (filter.BeginDate == null) { return(0); } var entryLine = LocateApplicableLedgerLine(ledgerBook, filter); var transactionTotal = CalculateTransactionTotal(filter.BeginDate.Value, statement, entryLine, bucketCode); return(transactionTotal); }
/// <summary> /// Calculates the current month ledger balances. /// </summary> /// <exception cref="System.ArgumentNullException"> /// </exception> public virtual IDictionary <BudgetBucket, decimal> CalculateCurrentMonthLedgerBalances( [NotNull] LedgerBook ledgerBook, [NotNull] GlobalFilterCriteria filter, [NotNull] StatementModel statement) { CheckCacheForCleanUp(); if (ledgerBook == null) { throw new ArgumentNullException(nameof(ledgerBook)); } if (filter == null) { throw new ArgumentNullException(nameof(filter)); } if (statement == null) { throw new ArgumentNullException(nameof(statement)); } var ledgers = new Dictionary <BudgetBucket, decimal>(); if (filter.Cleared || filter.BeginDate == null) { return(ledgers); } Dictionary <BudgetBucket, decimal> ledgersSummary = CalculateLedgersBalanceSummary(ledgerBook, filter.BeginDate.Value, statement); // Check Surplus var surplusBalance = CalculateCurrentMonthSurplusBalance(ledgerBook, filter, statement); ledgersSummary.Add(new SurplusBucket(), surplusBalance); return(ledgersSummary); }
private static List <ReportTransactionWithRunningBalance> CollateStatementTransactions( StatementModel statementModel, IList <BudgetBucket> bucketsToInclude, DateTime beginDate, DateTime lastDate, decimal openingBalance) { // The below query has to cater for special Surplus buckets which are intended to be equivelent but use a type hierarchy with inheritance. List <ReportTransactionWithRunningBalance> query = statementModel.Transactions .Join(bucketsToInclude, t => t.BudgetBucket, b => b, (t, b) => t, new SurplusAgnosticBucketComparer()) .Where(t => t.Date >= beginDate && t.Date <= lastDate) .OrderBy(t => t.Date) .Select( t => new ReportTransactionWithRunningBalance { Amount = t.Amount, Date = t.Date, Narrative = t.Description }) .ToList(); // Insert the opening balance transaction with the earliest date in the list. query.Insert(0, new ReportTransactionWithRunningBalance { Amount = openingBalance, Date = beginDate.AddSeconds(-1), Narrative = "Opening Balance", Balance = openingBalance }); UpdateReportTransactionRunningBalances(query); return(query); }
/// <summary> /// This is effectively stage 2 of the Reconciliation process. /// Called by <see cref="ReconciliationBuilder.CreateNewMonthlyReconciliation" />. It builds the contents of the new /// ledger line based on budget and statement input. /// </summary> /// <param name="budget">The current applicable budget</param> /// <param name="statement">The current period statement.</param> /// <param name="startDateIncl"> /// The date of the previous ledger line. This is used to include transactions from the /// Statement starting from this date and including this date. /// </param> private void AddNew( BudgetModel budget, StatementModel statement, DateTime startDateIncl) { if (!this.newReconciliationLine.IsNew) { throw new InvalidOperationException("Cannot add a new entry to an existing Ledger Line, only new Ledger Lines can have new entries added."); } var reconciliationDate = this.newReconciliationLine.Date; // Date filter must include the start date, which goes back to and includes the previous ledger date up to the date of this ledger line, but excludes this ledger date. // For example if this is a reconciliation for the 20/Feb then the start date is 20/Jan and the finish date is 20/Feb. So transactions pulled from statement are between // 20/Jan (inclusive) and 19/Feb (inclusive) but not including anything for the 20th of Feb. List <Transaction> filteredStatementTransactions = statement?.AllTransactions.Where(t => t.Date >= startDateIncl && t.Date < reconciliationDate).ToList() ?? new List <Transaction>(); IEnumerable <LedgerEntry> previousLedgerBalances = CompileLedgersAndBalances(LedgerBook); var entries = new List <LedgerEntry>(); foreach (var previousLedgerEntry in previousLedgerBalances) { LedgerBucket ledgerBucket; var openingBalance = previousLedgerEntry.Balance; var currentLedger = LedgerBook.Ledgers.Single(l => l.BudgetBucket == previousLedgerEntry.LedgerBucket.BudgetBucket); if (previousLedgerEntry.LedgerBucket.StoredInAccount != currentLedger.StoredInAccount) { // Check to see if a ledger has been moved into a new default account since last reconciliation. ledgerBucket = currentLedger; } else { ledgerBucket = previousLedgerEntry.LedgerBucket; } var newEntry = new LedgerEntry(true) { Balance = openingBalance, LedgerBucket = ledgerBucket }; // Start by adding the budgeted amount to a list of transactions. List <LedgerTransaction> transactions = IncludeBudgetedAmount(budget, ledgerBucket, reconciliationDate); // Append all other transactions for this bucket, if any, to the transaction list. transactions.AddRange(IncludeStatementTransactions(newEntry, filteredStatementTransactions)); AutoMatchTransactionsAlreadyInPreviousPeriod(filteredStatementTransactions, previousLedgerEntry, transactions); newEntry.SetTransactionsForReconciliation(transactions); entries.Add(newEntry); } this.newReconciliationLine.SetNewLedgerEntries(entries); foreach (var behaviour in ReconciliationBehaviourFactory.ListAllBehaviours()) { behaviour.Initialise(filteredStatementTransactions, this.newReconciliationLine, this.toDoList, this.logger, statement); behaviour.ApplyBehaviour(); } // At this point each ledger balance is still set to the opening balance, it hasn't ben updated yet. This should always be done last. foreach (var ledger in this.newReconciliationLine.Entries) { ledger.Balance += ledger.Transactions.Sum(t => t.Amount); } }
public IHttpActionResult GetRightsStatementList(StatementModel _AuthorPubStModel) { try { SqlParameter[] parameters = new SqlParameter[11]; //parameters[0] = new SqlParameter("Year", SqlDbType.VarChar, 4); //parameters[0].Value = "'" + _AuthorPubStModel.Year + "'"; //parameters[1] = new SqlParameter("Month", SqlDbType.VarChar, 2); //parameters[1].Value = "'" + _AuthorPubStModel.Month + "'"; parameters[0] = new SqlParameter("EntryFromYear", SqlDbType.VarChar, 4); parameters[0].Value = "'" + _AuthorPubStModel.EntryFromYear + "'"; parameters[1] = new SqlParameter("EntryFromMonth", SqlDbType.VarChar, 2); parameters[1].Value = "'" + _AuthorPubStModel.EntryFromMonth + "'"; parameters[2] = new SqlParameter("EntryToYear", SqlDbType.VarChar, 4); parameters[2].Value = "'" + _AuthorPubStModel.EntryToYear + "'"; parameters[3] = new SqlParameter("EntryToMonth", SqlDbType.VarChar, 2); parameters[3].Value = "'" + _AuthorPubStModel.EntryToMonth + "'"; parameters[4] = new SqlParameter("FromYear", SqlDbType.VarChar, 4); parameters[4].Value = "'" + _AuthorPubStModel.FromYear + "'"; parameters[5] = new SqlParameter("FromMonth", SqlDbType.VarChar, 2); parameters[5].Value = "'" + _AuthorPubStModel.FromMonth + "'"; parameters[6] = new SqlParameter("ToYear", SqlDbType.VarChar, 4); parameters[6].Value = "'" + _AuthorPubStModel.ToYear + "'"; parameters[7] = new SqlParameter("ToMonth", SqlDbType.VarChar, 2); parameters[7].Value = "'" + _AuthorPubStModel.ToMonth + "'"; //if ((_AuthorPubStModel.AuthorName != null && _AuthorPubStModel.AuthorName != "") || // (_AuthorPubStModel.AuthorCode != null && _AuthorPubStModel.AuthorCode != "") || // (_AuthorPubStModel.AuthorContractCode != null && _AuthorPubStModel.AuthorContractCode != "")) if (_AuthorPubStModel.Type != null && _AuthorPubStModel.Type != "" && _AuthorPubStModel.Type.ToLower() == "authorcontractcode") { parameters[8] = new SqlParameter("AuthorContractCode", SqlDbType.VarChar, 200); parameters[8].Value = "'" + _AuthorPubStModel.AuthorContractCode + "'"; parameters[9] = new SqlParameter("AuthorCode", SqlDbType.VarChar, 200); parameters[9].Value = "'" + _AuthorPubStModel.AuthorCode + "'"; parameters[10] = new SqlParameter("AuthorName", SqlDbType.VarChar, 200); parameters[10].Value = "'" + _AuthorPubStModel.AuthorName + "'"; var _GetAuthorStatement = _dbContext.ExecuteStoredProcedureListNewData <StatementModel>("Proc_Statement_Search_RS_A_get", parameters).ToList(); return(Json(_GetAuthorStatement)); } else { parameters[8] = new SqlParameter("ProductLicenseCode", SqlDbType.VarChar, 200); parameters[8].Value = "'" + _AuthorPubStModel.ProductLicenseCode + "'"; parameters[9] = new SqlParameter("PublishingCompanyCode", SqlDbType.VarChar, 200); parameters[9].Value = "'" + _AuthorPubStModel.PublishingCompanyCode + "'"; parameters[10] = new SqlParameter("PublishingCompanyName", SqlDbType.VarChar, 200); parameters[10].Value = "'" + _AuthorPubStModel.PublishingCompanyName + "'"; var _GetStatement = _dbContext.ExecuteStoredProcedureListNewData <StatementModel>("Proc_Statement_Search_RS_P_get", parameters).ToList(); return(Json(_GetStatement)); } } catch (Exception ex) { return(null); } }
public void Model_Statement_Valid_Exists() { var model = new StatementModel(); Assert.IsNotNull(model); }
partial void ToModelPostprocessing(TransactionSetDto dto, ref StatementModel model) { model.LoadTransactions(dto.Transactions.Select(t => this.transactionMapper.ToModel(t))); }
partial void ToDtoPostprocessing(ref TransactionSetDto dto, StatementModel model) { var transactions10 = model.AllTransactions.Select(this.transactionMapper.ToDto).ToList(); dto.Transactions = transactions10; }
// ReSharper disable once RedundantAssignment partial void ModelFactory(TransactionSetDto dto, ref StatementModel model) { model = new StatementModel(this.logger); }
public ReconciliationResult MonthEndReconciliation( LedgerBook ledgerBook, DateTime reconciliationDate, IBudgetCurrencyContext budgetContext, StatementModel statement, bool ignoreWarnings, params BankBalance[] currentBankBalances) { if (ledgerBook == null) { throw new ArgumentNullException(nameof(ledgerBook)); } if (currentBankBalances == null) { throw new ArgumentNullException(nameof(currentBankBalances)); } if (budgetContext == null) { throw new ArgumentNullException(nameof(budgetContext)); } if (statement == null) { throw new ArgumentNullException(nameof(statement)); } if (!budgetContext.BudgetActive) { throw new ArgumentException("Reconciling against an inactive budget is invalid."); } var stopWatch = Stopwatch.StartNew(); this.logger.LogInfo(l => l.Format("Starting Ledger Book reconciliation {0}", DateTime.Now)); if (!ignoreWarnings) { this.validationMessages = new Collection <string>(); } try { PreReconciliationValidation(ledgerBook, reconciliationDate, statement); } catch (ValidationWarningException ex) { if (ShouldValidationExceptionBeRethrown(ignoreWarnings, ex)) { throw; } } ReconciliationResult recon; using (this.reconciliationConsistency.EnsureConsistency(ledgerBook)) { recon = ledgerBook.Reconcile(reconciliationDate, budgetContext.Model, statement, currentBankBalances); } // Create new single use matching rules - if needed to ensure transfers are assigned a bucket easily without user intervention. foreach (var task in recon.Tasks) { this.logger.LogInfo( l => l.Format("TASK: {0} SystemGenerated:{1}", task.Description, task.SystemGenerated)); var transferTask = task as TransferTask; if (transferTask != null && transferTask.SystemGenerated && transferTask.Reference.IsSomething()) { this.logger.LogInfo( l => l.Format( "TRANSFER-TASK detected- creating new single use rule. SystemGenerated:{1} Reference:{2}", task.Description, task.SystemGenerated, transferTask.Reference)); this.transactionRuleService.CreateNewSingleUseRule(transferTask.BucketCode, null, new[] { transferTask.Reference }, null, null, true); } } stopWatch.Stop(); this.logger.LogInfo(l => l.Format("Finished Ledger Book reconciliation {0}. It took {1:F0}ms", DateTime.Now, stopWatch.ElapsedMilliseconds)); this.validationMessages = null; return(recon); }
private Dictionary <BudgetBucket, decimal> CalculateLedgersBalanceSummary(LedgerBook ledgerBook, DateTime beginDate, StatementModel statement) { var endDate = beginDate.AddMonths(1).AddDays(-1); var currentLegderLine = LocateLedgerEntryLine(ledgerBook, beginDate, endDate); if (currentLegderLine == null) { return(new Dictionary <BudgetBucket, decimal>()); } var ledgersSummary = new Dictionary <BudgetBucket, decimal>(); foreach (var entry in currentLegderLine.Entries) { var closingBalance = CalculateTransactionTotal(beginDate, statement, currentLegderLine, entry.LedgerBucket.BudgetBucket.Code); var balance = entry.Balance + closingBalance; ledgersSummary.Add(entry.LedgerBucket.BudgetBucket, balance); } return(ledgersSummary); }
/// <summary> /// Calculates the current month surplus balance. /// </summary> /// <exception cref="System.ArgumentNullException"> /// </exception> public virtual decimal CalculateCurrentMonthSurplusBalance([NotNull] LedgerBook ledgerBook, [NotNull] GlobalFilterCriteria filter, [NotNull] StatementModel statement) { CheckCacheForCleanUp(); if (ledgerBook == null) { throw new ArgumentNullException(nameof(ledgerBook)); } if (filter == null) { throw new ArgumentNullException(nameof(filter)); } if (statement == null) { throw new ArgumentNullException(nameof(statement)); } if (filter.Cleared || filter.BeginDate == null) { return(0); } var entryLine = LocateApplicableLedgerLine(ledgerBook, filter); if (entryLine == null) { return(0); } var beginningOfMonthBalance = entryLine.CalculatedSurplus; var transactionTotal = CalculateTransactionTotal(filter.BeginDate.Value, statement, entryLine, SurplusBucket.SurplusCode); beginningOfMonthBalance += transactionTotal; // Find any ledgers that are overpsent and subtract them from the Surplus total. This is actually what is happening when you overspend a ledger, it spills over and spend Surplus. Dictionary <BudgetBucket, decimal> ledgersSummary = CalculateLedgersBalanceSummary(ledgerBook, filter.BeginDate.Value, statement); beginningOfMonthBalance += ledgersSummary.Where(kvp => kvp.Value < 0).Sum(kvp => kvp.Value); return(beginningOfMonthBalance); }
public static StatementModel TestDataGenerated() { var model = new StatementModel(new FakeLogger()) { StorageKey = @"C:\Foo\StatementModel.csv", LastImport = new DateTime(2015, 11, 21) }; var transactions = new List <Transaction> { new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -55.00M, BudgetBucket = BudgetBucketRepo.GetByCode("PHNET"), Date = new DateTime(2015, 10, 21), Description = "Lorem Ipsum Dolor", Id = new Guid("ce628396-3f6b-4980-88ff-e4ea68a5c804"), Reference1 = "5235ghkh", Reference2 = "792fgjgghkh", Reference3 = "kjhgjklshgjsh", TransactionType = new NamedTransaction("Payment") }, new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -24.10M, BudgetBucket = BudgetBucketRepo.GetByCode("PHNET"), Date = new DateTime(2015, 10, 21), Description = "Lorem Ipsum Dolor", Id = new Guid("67f9cbff-18ca-4d11-a5ef-22988e04584a"), Reference1 = "5235ghkh", Reference2 = "792fgjgghkh", Reference3 = "kjhgjklshgjsh", TransactionType = new NamedTransaction("Payment") }, new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -3000.00M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 10, 23), Description = "Lorem Ipsum Dolor", Id = new Guid("c66eb722-6d03-48b2-b985-6721701a01ae"), Reference1 = "automatchref12", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Debit Transfer") }, new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -130.00M, BudgetBucket = BudgetBucketRepo.GetByCode("CAR MTC"), Date = new DateTime(2015, 10, 23), Description = "Lorem Ipsum Dolor", Id = new Guid("233a8a87-5583-47ef-ae72-592aa9c10eb8"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Debit Transfer") }, new Transaction { Account = AccountTypeRepo.GetByKey("SAVINGS"), Amount = 3000.00M, BudgetBucket = BudgetBucketRepo.GetByCode("SAVINGS"), Date = new DateTime(2015, 10, 23), Description = "Lorem Ipsum Dolor", Id = new Guid("9ecd767b-b3c7-4c15-a40f-1c0098e422ed"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Transfer") }, new Transaction { Account = AccountTypeRepo.GetByKey("SAVINGS"), Amount = 130.00M, BudgetBucket = BudgetBucketRepo.GetByCode("CAR MTC"), Date = new DateTime(2015, 10, 23), Description = "Lorem Ipsum Dolor", Id = new Guid("1a0dd7ef-2962-4c8c-85cb-7d3e64748211"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Transfer") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -27.44M, BudgetBucket = BudgetBucketRepo.GetByCode("FUEL"), Date = new DateTime(2015, 10, 31), Description = "Lorem Ipsum Dolor", Id = new Guid("7ac24965-e21e-4f63-b3e4-9ec391843f56"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -73.34M, BudgetBucket = BudgetBucketRepo.GetByCode("CAR MTC"), Date = new DateTime(2015, 10, 31), Description = "Lorem Ipsum Dolor", Id = new Guid("7a9dd17a-1957-4ac4-8175-28a93d9a1eb9"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -32.70M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 1), Description = "Lorem Ipsum Dolor", Id = new Guid("31b7af5c-4429-4cf7-b0b4-54ff8d72eb1d"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -49.70M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 1), Description = "Lorem Ipsum Dolor", Id = new Guid("246fe376-d6b2-4a09-a881-f07d1577ffa7"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -30.00M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 2), Description = "Lorem Ipsum Dolor", Id = new Guid("886b4bd5-455c-42bb-826c-cc61edcec84f"), Reference1 = "5235ghkh", Reference2 = "792fgjgghkh", Reference3 = "kjhgjklshgjsh", TransactionType = new NamedTransaction("Atm Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -120.00M, BudgetBucket = BudgetBucketRepo.GetByCode("FOOD"), Date = new DateTime(2015, 11, 2), Description = "Lorem Ipsum Dolor", Id = new Guid("8673ce8f-629a-413f-b7c9-afbcc123cf80"), Reference1 = "5235ghkh", Reference2 = "792fgjgghkh", Reference3 = "kjhgjklshgjsh", TransactionType = new NamedTransaction("Atm Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -10.79M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 3), Description = "Lorem Ipsum Dolor", Id = new Guid("2a3b17cf-c4a0-4c01-893b-73677cc650ad"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -8.30M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 5), Description = "Lorem Ipsum Dolor", Id = new Guid("2a5b1821-802d-4b5e-af72-728dde935931"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -7.99M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 5), Description = "Lorem Ipsum Dolor", Id = new Guid("b87d9668-6d17-444f-89ef-d53cd1ba826c"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -17.32M, BudgetBucket = BudgetBucketRepo.GetByCode("POWER"), Date = new DateTime(2015, 11, 6), Description = "Lorem Ipsum Dolor", Id = new Guid("af952e91-9ca8-442e-9569-13b8796c9eef"), Reference1 = "5235ghkh", Reference2 = "792fgjgghkh", Reference3 = "kjhgjklshgjsh", TransactionType = new NamedTransaction("Payment") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -42.50M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 6), Description = "Lorem Ipsum Dolor", Id = new Guid("00172bd9-0ec4-4d92-94bf-d533299e0dc5"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -30.60M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 6), Description = "Lorem Ipsum Dolor", Id = new Guid("63a9d1dd-a28e-4561-8443-570af6f1da6a"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -11.47M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS.FENCE"), Date = new DateTime(2015, 11, 8), Description = "Lorem Ipsum Dolor", Id = new Guid("e53f7c07-f06b-4a99-8310-57d6f7aef2e8"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -31.49M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 8), Description = "Lorem Ipsum Dolor", Id = new Guid("810c31e3-bdfb-4aef-a6dd-b96a3789e27f"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -14.10M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 8), Description = "Lorem Ipsum Dolor", Id = new Guid("34249540-ac64-4392-9fa7-c0e10ecc06af"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -2.00M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 9), Description = "Lorem Ipsum Dolor", Id = new Guid("f705a9c8-533c-451e-9e4b-70266679af58"), Reference1 = "5235ghkh", Reference2 = "792fgjgghkh", Reference3 = "kjhgjklshgjsh", TransactionType = new NamedTransaction("Eft-Pos") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -38.00M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 11), Description = "Lorem Ipsum Dolor", Id = new Guid("b56e8c82-501e-4c77-b2ba-0fa9e86e19ef"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -8.90M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 12), Description = "Lorem Ipsum Dolor", Id = new Guid("eb465d02-e82c-4d5d-884a-2adb1c86cf4c"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -9.50M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 12), Description = "Lorem Ipsum Dolor", Id = new Guid("0ec1c6b3-8f4c-47d5-99e2-c01168cbae2c"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -40.00M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 13), Description = "Lorem Ipsum Dolor", Id = new Guid("ac3a08f2-3274-4667-b382-9f23e81fa9e8"), Reference1 = "5235ghkh", Reference2 = "792fgjgghkh", Reference3 = "kjhgjklshgjsh", TransactionType = new NamedTransaction("Eft-Pos") }, new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -444.63M, BudgetBucket = BudgetBucketRepo.GetByCode("PHNET"), Date = new DateTime(2015, 11, 13), Description = "Lorem Ipsum Dolor", Id = new Guid("ce618893-06ab-4dab-8fd8-5578e6b90700"), Reference1 = "5235ghkh", Reference2 = "792fgjgghkh", Reference3 = "kjhgjklshgjsh", TransactionType = new NamedTransaction("Payment") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -11.50M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 13), Description = "Lorem Ipsum Dolor", Id = new Guid("5db38e40-a58b-47bb-9b1c-077b5f8cecc5"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -159.00M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS.FENCE"), Date = new DateTime(2015, 11, 14), Description = "Lorem Ipsum Dolor", Id = new Guid("92a6d37b-a846-4b2c-b9b3-14ba85c70295"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -24.10M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 14), Description = "Lorem Ipsum Dolor", Id = new Guid("f32b2ed3-717f-41b5-8892-d48df86579ef"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -471.01M, BudgetBucket = BudgetBucketRepo.GetByCode("CAR MTC"), Date = new DateTime(2015, 11, 14), Description = "Lorem Ipsum Dolor", Id = new Guid("8626f06a-5ba6-45e1-b197-4c0b0ab927c3"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -8.64M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 14), Description = "Lorem Ipsum Dolor", Id = new Guid("0f3d74ba-4456-41a1-a58e-b006534b664b"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -141.79M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 15), Description = "Lorem Ipsum Dolor", Id = new Guid("15bde657-e077-42a3-b0eb-1b49f76ba17d"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -5.00M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 16), Description = "Lorem Ipsum Dolor", Id = new Guid("860cce1e-abca-4520-8a03-6e73a2ddca13"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -8.50M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 18), Description = "Lorem Ipsum Dolor", Id = new Guid("8a6cd650-77cc-427b-a481-ac4b286ccfd4"), Reference1 = "5235ghkh", Reference2 = "792fgjgghkh", Reference3 = "kjhgjklshgjsh", TransactionType = new NamedTransaction("Eft-Pos") }, new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -27.74M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 19), Description = "Lorem Ipsum Dolor", Id = new Guid("840acbce-af64-4ce8-a3e9-d33beea48bdb"), Reference1 = "5235ghkh", Reference2 = "792fgjgghkh", Reference3 = "", TransactionType = new NamedTransaction("Payment") }, new Transaction { Account = AccountTypeRepo.GetByKey("CHEQUE"), Amount = -25.30M, BudgetBucket = BudgetBucketRepo.GetByCode("PHNET"), Date = new DateTime(2015, 11, 19), Description = "Lorem Ipsum Dolor", Id = new Guid("9e18b22f-9623-44e7-b391-e868b482d545"), Reference1 = "5235ghkh", Reference2 = "792fgjgghkh", Reference3 = "kjhgjklshgjsh", TransactionType = new NamedTransaction("Payment") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -45.98M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 19), Description = "Lorem Ipsum Dolor", Id = new Guid("212a5450-81c7-4441-a851-84a1830e7a4a"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -3.50M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 19), Description = "Lorem Ipsum Dolor", Id = new Guid("aeb3c1ac-fb5a-4164-8125-3b5cf3487616"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") }, new Transaction { Account = AccountTypeRepo.GetByKey("VISA"), Amount = -31.90M, BudgetBucket = BudgetBucketRepo.GetByCode("SURPLUS"), Date = new DateTime(2015, 11, 19), Description = "Lorem Ipsum Dolor", Id = new Guid("02861f41-a92c-4ffd-bd22-8194dc402f8d"), Reference1 = "5235ghkh", Reference2 = "", Reference3 = "", TransactionType = new NamedTransaction("Credit Card Debit") } }; return(model.LoadTransactions(transactions)); }
public Task <OperationResult> CreateAsync([FromBody, Required] StatementModel statement, CancellationToken token = default) => _statementService.CreateStatementAsync(statement, token);