diff --git a/CHANGELOG.md b/CHANGELOG.md index 42b4075..5115c58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Edit Bucket Dialog shows now a calculated next applying target date for Bucket type `Expense every X Months` and `Save X until Y date` [#201](https://github.com/TheAxelander/OpenBudgeteer/issues/201) * File content preview on Import Page no longer wraps, instead it uses horizontal scrolling [#227](https://github.com/TheAxelander/OpenBudgeteer/issues/227) * Migrated reports from ChartJs.Blazor to Blazor-ApexCharts +* Bucket Movements will be now stored with the current date instead on first of the month [#240](https://github.com/TheAxelander/OpenBudgeteer/issues/240) Thanks [Lucaber](https://github.com/Lucaber) ## 1.8.3 (2024-05-20) diff --git a/OpenBudgeteer.Core.Data.Contracts/Services/IBucketService.cs b/OpenBudgeteer.Core.Data.Contracts/Services/IBucketService.cs index 55dbaff..2038d0f 100644 --- a/OpenBudgeteer.Core.Data.Contracts/Services/IBucketService.cs +++ b/OpenBudgeteer.Core.Data.Contracts/Services/IBucketService.cs @@ -16,5 +16,5 @@ public interface IBucketService : IBaseService public Bucket Update(Bucket bucket, BucketVersion bucketVersion, DateTime yearMonth);*/ //public Bucket Close(Bucket entity, DateTime yearMonth); public void Close(Guid id, DateTime yearMonth); - public BucketMovement CreateMovement(Guid bucketId, decimal amount, DateTime yearMonth); + public BucketMovement CreateMovement(Guid bucketId, decimal amount, DateTime movementDate); } \ No newline at end of file diff --git a/OpenBudgeteer.Core.Data.Services/BucketService.cs b/OpenBudgeteer.Core.Data.Services/BucketService.cs index 0157c5c..f7ed701 100644 --- a/OpenBudgeteer.Core.Data.Services/BucketService.cs +++ b/OpenBudgeteer.Core.Data.Services/BucketService.cs @@ -428,7 +428,7 @@ public override void Delete(Guid id) } } - public BucketMovement CreateMovement(Guid bucketId, decimal amount, DateTime yearMonth) + public BucketMovement CreateMovement(Guid bucketId, decimal amount, DateTime movementDate) { try { @@ -440,7 +440,7 @@ public BucketMovement CreateMovement(Guid bucketId, decimal amount, DateTime yea Id = Guid.Empty, BucketId = bucketId, Amount = amount, - MovementDate = yearMonth + MovementDate = movementDate }; var result = repository.Create(newBucketMovement); if (result == 0) throw new Exception($"Unable to create {typeof(BucketMovement)} in database"); diff --git a/OpenBudgeteer.Core/ViewModels/EntityViewModels/BucketViewModel.cs b/OpenBudgeteer.Core/ViewModels/EntityViewModels/BucketViewModel.cs index 6edb591..d0a2dbd 100644 --- a/OpenBudgeteer.Core/ViewModels/EntityViewModels/BucketViewModel.cs +++ b/OpenBudgeteer.Core/ViewModels/EntityViewModels/BucketViewModel.cs @@ -704,7 +704,8 @@ public ViewModelOperationResult HandleInOutInput() try { var date = DateTime.Now; - if (_currentYearMonth.Year != date.Year || _currentYearMonth.Month != date.Month) { + if (_currentYearMonth.Year != date.Year || _currentYearMonth.Month != date.Month) + { var day = (date > _currentYearMonth) ? DateTime.DaysInMonth(_currentYearMonth.Year, _currentYearMonth.Month) : 1; date = new DateTime(_currentYearMonth.Year, _currentYearMonth.Month, day); }