diff --git a/.vs/HouseholdAccountBook/v15/.suo b/.vs/HouseholdAccountBook/v15/.suo
index 2667fbe..a1095d0 100644
Binary files a/.vs/HouseholdAccountBook/v15/.suo and b/.vs/HouseholdAccountBook/v15/.suo differ
diff --git a/HouseholdAccountBook/ConstValue.cs b/HouseholdAccountBook/ConstValue.cs
index 0f3be72..3b97c2f 100644
--- a/HouseholdAccountBook/ConstValue.cs
+++ b/HouseholdAccountBook/ConstValue.cs
@@ -38,6 +38,14 @@ public enum Tabs
/// 月別グラフタブ
///
MonthlyGraphTab = 3,
+ ///
+ /// 年別一覧タブ
+ ///
+ YearlyListTab = 4,
+ ///
+ /// 年別グラフタブ
+ ///
+ YearlyGraphTab = 5
}
///
diff --git a/HouseholdAccountBook/HouseholdAccountBook.csproj b/HouseholdAccountBook/HouseholdAccountBook.csproj
index 32dc1eb..f35b466 100644
--- a/HouseholdAccountBook/HouseholdAccountBook.csproj
+++ b/HouseholdAccountBook/HouseholdAccountBook.csproj
@@ -60,7 +60,7 @@
- ..\packages\CsvHelper.7.1.0\lib\net45\CsvHelper.dll
+ ..\packages\CsvHelper.7.1.1\lib\net45\CsvHelper.dll
..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll
@@ -87,8 +87,8 @@
..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll
-
- ..\packages\Npgsql.3.2.7\lib\net451\Npgsql.dll
+
+ ..\packages\Npgsql.4.0.0\lib\net451\Npgsql.dll
..\packages\OxyPlot.Core.1.0.0\lib\net45\OxyPlot.dll
@@ -115,12 +115,18 @@
+
+ ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll
+
..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll
True
-
- ..\packages\System.Threading.Tasks.Extensions.4.4.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll
+
+ ..\packages\System.Threading.Tasks.Extensions.4.5.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll
+
+
+ ..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll
diff --git a/HouseholdAccountBook/UpdateLog.txt b/HouseholdAccountBook/UpdateLog.txt
index ed625cc..520283f 100644
--- a/HouseholdAccountBook/UpdateLog.txt
+++ b/HouseholdAccountBook/UpdateLog.txt
@@ -500,12 +500,15 @@
2018/05/26
MainWindow.xaml.cs
帳簿項目の追加時に、対象の帳簿項目が重複して選択されるのを修正した
+2018/06/16
+ MainWindow.xaml.cs
+ +年別一覧、年別グラフを追加した
---------------------------------------------------------------------------------------------------------------------
凡例:+追加 -変更 ×削除 ↑バグ修正
---------------------------------------------------------------------------------------------------------------------
TODO:
- 年別一覧、年別グラフを追加する
+ -
バグ:
-
diff --git a/HouseholdAccountBook/ViewModels/WindowViewModel/MainWindowViewModel.cs b/HouseholdAccountBook/ViewModels/WindowViewModel/MainWindowViewModel.cs
index e367576..e19c1e2 100644
--- a/HouseholdAccountBook/ViewModels/WindowViewModel/MainWindowViewModel.cs
+++ b/HouseholdAccountBook/ViewModels/WindowViewModel/MainWindowViewModel.cs
@@ -391,6 +391,34 @@ public ObservableCollection MonthlySummaryVMList
#endregion
#endregion
+ #region 年別一覧タブ
+ #region プロパティ
+ ///
+ /// 表示年リスト
+ ///
+ #region DisplayedYears
+ public ObservableCollection DisplayedYears
+ {
+ get { return this._DisplayedYears; }
+ set { SetProperty(ref this._DisplayedYears, value); }
+ }
+ private ObservableCollection _DisplayedYears = default(ObservableCollection);
+ #endregion
+
+ ///
+ /// 年別合計項目VMリスト
+ ///
+ #region YearlySummaryVMList
+ public ObservableCollection YearlySummaryVMList
+ {
+ get { return this._YearlySummaryVMList; }
+ set { SetProperty(ref this._YearlySummaryVMList, value); }
+ }
+ private ObservableCollection _YearlySummaryVMList = default(ObservableCollection);
+ #endregion
+ #endregion
+ #endregion
+
#region グラフタブ
#region プロパティ
///
@@ -488,6 +516,44 @@ public PlotModel SelectedItemMonthlyGraphModel
};
#endregion
+ ///
+ /// 全項目年別グラフプロットモデル
+ ///
+ #region WholeItemYearlyGraphModel
+ public PlotModel WholeItemYearlyGraphModel
+ {
+ get { return this._WholeItemYearlyGraphModel; }
+ set { SetProperty(ref this._WholeItemYearlyGraphModel, value); }
+ }
+ private PlotModel _WholeItemYearlyGraphModel = new PlotModel() {
+ Title = "年別グラフ",
+ LegendOrientation = LegendOrientation.Horizontal,
+ LegendPlacement = LegendPlacement.Outside,
+ LegendPosition = LegendPosition.RightTop,
+ LegendTitle = "凡例",
+ LegendFontSize = 10.5
+ };
+ #endregion
+
+ ///
+ /// 選択項目年別グラフプロットモデル
+ ///
+ #region SelectedItemYearlyGraphModel
+ public PlotModel SelectedItemYearlyGraphModel
+ {
+ get { return this._SelectedItemYearlyGraphModel; }
+ set { SetProperty(ref this._SelectedItemYearlyGraphModel, value); }
+ }
+ private PlotModel _SelectedItemYearlyGraphModel = new PlotModel() {
+ Title = "個別グラフ",
+ LegendOrientation = LegendOrientation.Horizontal,
+ LegendPlacement = LegendPlacement.Outside,
+ LegendPosition = LegendPosition.RightTop,
+ LegendTitle = "凡例",
+ LegendFontSize = 10.5
+ };
+ #endregion
+
///
/// コントローラ
///
diff --git a/HouseholdAccountBook/Windows/MainWindow.xaml b/HouseholdAccountBook/Windows/MainWindow.xaml
index dc54e0c..d37e48c 100644
--- a/HouseholdAccountBook/Windows/MainWindow.xaml
+++ b/HouseholdAccountBook/Windows/MainWindow.xaml
@@ -37,6 +37,8 @@
+
+
@@ -110,6 +112,8 @@
+
+
@@ -204,6 +208,12 @@
+
+
+
+
@@ -221,7 +231,7 @@
SelectedIndex="{Binding SelectedTabIndex}" SelectionChanged="TabControl_SelectionChanged">
@@ -542,6 +552,118 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HouseholdAccountBook/Windows/MainWindow.xaml.cs b/HouseholdAccountBook/Windows/MainWindow.xaml.cs
index 5008e5f..a832401 100644
--- a/HouseholdAccountBook/Windows/MainWindow.xaml.cs
+++ b/HouseholdAccountBook/Windows/MainWindow.xaml.cs
@@ -885,6 +885,46 @@ private void IndicateMonthlyGraphTabCommand_Executed(object sender, ExecutedRout
this.WVM.SelectedTab = Tabs.MonthlyGraphTab;
}
+ ///
+ /// 年別一覧タブ表示可能か
+ ///
+ ///
+ ///
+ private void IndicateYearlyListTabCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e)
+ {
+ e.CanExecute = this.WVM.SelectedTab != Tabs.YearlyListTab;
+ }
+
+ ///
+ /// 年別一覧タブを表示する
+ ///
+ ///
+ ///
+ private void IndicateYearlyListTabCommand_Executed(object sender, ExecutedRoutedEventArgs e)
+ {
+ this.WVM.SelectedTab = Tabs.YearlyListTab;
+ }
+
+ ///
+ /// 年別グラフタブ表示可能か
+ ///
+ ///
+ ///
+ private void IndicateYearlyGraphTabCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e)
+ {
+ e.CanExecute = this.WVM.SelectedTab != Tabs.YearlyGraphTab;
+ }
+
+ ///
+ /// 年別グラフタブを表示する
+ ///
+ ///
+ ///
+ private void IndicateYearlyGraphTabCommand_Executed(object sender, ExecutedRoutedEventArgs e)
+ {
+ this.WVM.SelectedTab = Tabs.YearlyGraphTab;
+ }
+
///
/// 画面表示を更新する
///
@@ -903,6 +943,10 @@ private void UpdateCommand_Executed(object sender, ExecutedRoutedEventArgs e)
InitializeMonthlyGraphTabData();
UpdateMonthlyGraphTabData();
+ UpdateYearlyListTabData();
+ InitializeYearlyGraphTabData();
+ UpdateYearlyGraphTabData();
+
this.Cursor = cCursor;
}
@@ -1242,6 +1286,13 @@ private void TabControl_SelectionChanged(object sender, SelectionChangedEventArg
InitializeMonthlyGraphTabData();
UpdateMonthlyGraphTabData();
break;
+ case Tabs.YearlyListTab:
+ UpdateYearlyListTabData();
+ break;
+ case Tabs.YearlyGraphTab:
+ InitializeYearlyGraphTabData();
+ UpdateYearlyGraphTabData();
+ break;
}
this.Cursor = cCursor;
}
@@ -1264,6 +1315,9 @@ private void BookComboBox_SelectionChanged(object sender, SelectionChangedEventA
UpdateMonthlyListTabData();
UpdateMonthlyGraphTabData();
+ UpdateYearlyListTabData();
+ UpdateYearlyGraphTabData();
+
this.Cursor = cCursor;
}
@@ -1283,6 +1337,9 @@ private void GraphKindComboBox_SelectionChanged(object sender, SelectionChangedE
InitializeMonthlyGraphTabData();
UpdateMonthlyGraphTabData();
+ InitializeYearlyGraphTabData();
+ UpdateYearlyGraphTabData();
+
this.Cursor = cCursor;
}
#endregion
@@ -1351,6 +1408,7 @@ private ObservableCollection LoadActionViewModelList(int? bookI
reader = dao.ExecQuery(@"
-- 繰越残高
SELECT -1 AS action_id, @{1} AS act_time, -1 AS category_id, -1 AS item_id, '繰越残高' AS item_name, 0 AS act_value, (
+ -- 残高
SELECT COALESCE(SUM(AA.act_value), 0) + (SELECT COALESCE(SUM(initial_value), 0) FROM mst_book WHERE del_flg = 0)
FROM hst_action AA
INNER JOIN (SELECT * FROM mst_book WHERE del_flg = 0) BB ON BB.book_id = AA.book_id
@@ -1359,6 +1417,7 @@ SELECT COALESCE(SUM(AA.act_value), 0) + (SELECT COALESCE(SUM(initial_value), 0)
UNION
-- 各帳簿項目
SELECT A.action_id AS action_id, A.act_time AS act_time, C.category_id AS category_id, I.item_id AS item_id, I.item_name AS item_name, A.act_value AS act_value, (
+ -- 残高
SELECT COALESCE(SUM(AA.act_value), 0) + (SELECT COALESCE(SUM(initial_value), 0) FROM mst_book WHERE del_flg = 0)
FROM hst_action AA
INNER JOIN (SELECT * FROM mst_book WHERE del_flg = 0) BB ON BB.book_id = AA.book_id
@@ -1381,6 +1440,7 @@ SELECT RBI.item_id
reader = dao.ExecQuery(@"
-- 繰越残高
SELECT -1 AS action_id, @{1} AS act_time, -1 AS category_id, -1 AS item_id, '繰越残高' AS item_name, 0 AS act_value, (
+ -- 残高
SELECT COALESCE(SUM(AA.act_value), 0) + (SELECT initial_value FROM mst_book WHERE book_id = @{0})
FROM hst_action AA
INNER JOIN (SELECT * FROM mst_book WHERE del_flg = 0) BB ON BB.book_id = AA.book_id
@@ -1389,6 +1449,7 @@ SELECT COALESCE(SUM(AA.act_value), 0) + (SELECT initial_value FROM mst_book WHER
UNION
-- 各帳簿項目
SELECT A.action_id AS action_id, A.act_time AS act_time, C.category_id AS category_id, I.item_id AS item_id, I.item_name AS item_name, A.act_value AS act_value, (
+ -- 残高
SELECT COALESCE(SUM(AA.act_value), 0) + (SELECT initial_value FROM mst_book WHERE book_id = @{0})
FROM hst_action AA
WHERE AA.book_id = @{0} AND AA.del_flg = 0 AND (AA.act_time < A.act_time OR (AA.act_time = A.act_time AND AA.action_id <= A.action_id) )
@@ -1412,11 +1473,11 @@ SELECT COALESCE(SUM(AA.act_value), 0) + (SELECT initial_value FROM mst_book WHER
int? groupId = record.ToNullableInt("group_id");
string remark = record["remark"];
bool isMatch = record.ToInt("is_match") == 1;
+
+ int actValue = record.ToInt("act_value");
BalanceKind balanceKind = BalanceKind.Others;
int? income = null;
int? outgo = null;
-
- int actValue = record.ToInt("act_value");
if (actValue == 0) {
balanceKind = BalanceKind.Others;
income = null;
@@ -1559,6 +1620,7 @@ private ObservableCollection LoadSummaryViewModelList(int? boo
// カテゴリ小計
List totalAsCategory = new List();
+ // 収支別に計算する
foreach (IGrouping g1 in summaryVMList.GroupBy(obj => obj.BalanceKind)) {
// 収入/支出の小計を計算する
totalAsBalanceKind.Add(new SummaryViewModel() {
@@ -1865,6 +1927,123 @@ private ObservableCollection LoadMonthlySummaryViewModelList(in
return vmList;
}
+
+ ///
+ /// 年別合計VMリストを取得する
+ ///
+ /// 帳簿ID
+ /// 月別合計項目VMリスト
+ private ObservableCollection LoadYearlySummaryViewModelListWithinDecade(int? bookId)
+ {
+ DateTime startTime = DateTime.Now.GetFirstDateOfFiscalYear(Properties.Settings.Default.App_StartMonth).AddYears(-9);
+ DateTime endTime = startTime.AddYears(10);
+
+ // 開始年までの収支を取得する
+ int balance = 0;
+ using (DaoBase dao = this.builder.Build()) {
+ DaoReader reader;
+ if (bookId == null) {
+ // 全帳簿
+ reader = dao.ExecQuery(@"
+SELECT COALESCE(SUM(AA.act_value), 0) + (SELECT COALESCE(SUM(initial_value), 0) FROM mst_book WHERE del_flg = 0) AS sum
+FROM hst_action AA
+INNER JOIN(SELECT * FROM mst_book WHERE del_flg = 0) BB ON BB.book_id = AA.book_id
+WHERE AA.del_flg = 0 AND AA.act_time < @{1};", null, startTime);
+ }
+ else {
+ // 各帳簿
+ reader = dao.ExecQuery(@"
+SELECT COALESCE(SUM(AA.act_value), 0) + (SELECT initial_value FROM mst_book WHERE book_id = @{0}) AS sum
+FROM hst_action AA
+INNER JOIN (SELECT * FROM mst_book WHERE del_flg = 0) BB ON BB.book_id = AA.book_id
+WHERE AA.book_id = @{0} AND AA.del_flg = 0 AND AA.act_time < @{1};", bookId, startTime);
+ }
+
+ reader.ExecARow((record) => {
+ balance = record.ToInt("sum");
+ });
+ }
+
+ ObservableCollection vmList = new ObservableCollection {
+ new SeriesViewModel() {
+ BalanceKind = -1,
+ CategoryId = -1,
+ CategoryName = string.Empty,
+ ItemId = -1,
+ ItemName = "残高",
+ Values = new List()
+ }
+ };
+ int averageCount = 0; // 平均値計算に使用する年数(去年まで)
+
+ // 最初の年の分を取得する
+ DateTime tmpStartTime = startTime;
+ DateTime tmpEndTime = tmpStartTime.AddYears(1).AddMilliseconds(-1);
+ ObservableCollection summaryVMList = this.LoadSummaryViewModelList(bookId, tmpStartTime, tmpEndTime);
+ balance = balance + summaryVMList[0].Summary;
+ vmList[0].Values.Add(balance); // 残高
+ foreach (SummaryViewModel summaryVM in summaryVMList) {
+ int value = summaryVM.Summary;
+ SeriesViewModel vm = new SeriesViewModel() {
+ BalanceKind = summaryVM.BalanceKind,
+ CategoryId = summaryVM.CategoryId,
+ CategoryName = summaryVM.CategoryName,
+ ItemId = summaryVM.ItemId,
+ ItemName = summaryVM.ItemName,
+ Values = new List(),
+ Summary = value
+ };
+ if (tmpEndTime < DateTime.Now) {
+ vm.Average = value;
+ }
+ else {
+ vm.Average = 0;
+ }
+ vm.Values.Add(value);
+ vmList.Add(vm);
+ }
+ if (tmpEndTime < DateTime.Now) {
+ ++averageCount;
+ }
+
+ // 最初以外の年の分を取得する
+ int years = 10;
+ for (int i = 1; i < years; ++i) {
+ tmpStartTime = tmpStartTime.AddYears(1);
+ tmpEndTime = tmpStartTime.AddYears(1).AddMilliseconds(-1);
+
+ summaryVMList = this.LoadSummaryViewModelList(bookId, tmpStartTime, tmpEndTime);
+ balance = balance + summaryVMList[0].Summary;
+ vmList[0].Values.Add(balance); // 残高
+ for (int j = 0; j < summaryVMList.Count; ++j) {
+ int value = summaryVMList[j].Summary;
+
+ vmList[j + 1].Values.Add(value);
+
+ if (tmpEndTime < DateTime.Now) {
+ vmList[j + 1].Average += value;
+ }
+ vmList[j + 1].Summary += value;
+ }
+ if (tmpEndTime < DateTime.Now) {
+ ++averageCount;
+ }
+ }
+
+ // 平均値を計算する
+ foreach (SeriesViewModel vm in vmList) {
+ if (vm.Average != null) {
+ if (averageCount != 0) {
+ vm.Average /= averageCount;
+ }
+ else {
+ vm.Average = 0;
+ }
+ }
+ }
+
+ return vmList;
+ }
#endregion
#region 帳簿タブ更新用の関数
@@ -2332,7 +2511,6 @@ private void UpdateMonthlyGraphTabData()
}
break;
case GraphKind.Balance: {
- DateTime dateTime = this.WVM.DisplayedYear.GetFirstDateOfFiscalYear(Properties.Settings.Default.App_StartMonth); // 開始日
LineSeries cSeries = new LineSeries() {
Title = "残高",
TrackerFormatString = "{2}月: {4:#,0}" //月: 金額
@@ -2360,6 +2538,218 @@ private void UpdateMonthlyGraphTabData()
}
#endregion
+ #region 年別一覧タブ更新用の関数
+ ///
+ /// 年別一覧タブに表示するデータを更新する
+ ///
+ private void UpdateYearlyListTabData()
+ {
+ if (this.WVM.SelectedTab == Tabs.YearlyListTab) {
+ int startYear = DateTime.Now.Year - 9;
+
+ // 表示する月の文字列を作成する
+ ObservableCollection displayedYears = new ObservableCollection();
+ for (int i = startYear; i < startYear + 10; ++i) {
+ displayedYears.Add(string.Format("{0}年", i));
+ }
+ this.WVM.DisplayedYears = displayedYears;
+ this.WVM.YearlySummaryVMList = LoadYearlySummaryViewModelListWithinDecade(this.WVM.SelectedBookVM.Id);
+ }
+ }
+ #endregion
+
+ #region 年別グラフタブ更新用の関数
+ ///
+ /// 年別グラフタブに表示するデータを初期化する
+ ///
+ private void InitializeYearlyGraphTabData()
+ {
+ if (this.WVM.SelectedTab == Tabs.YearlyGraphTab) {
+ int startYear = DateTime.Now.Year - 9;
+
+ // 全項目
+ this.WVM.WholeItemYearlyGraphModel.Axes.Clear();
+ this.WVM.WholeItemYearlyGraphModel.Series.Clear();
+
+ // 横軸 - 年軸
+ CategoryAxis cAxis1 = new CategoryAxis() { Unit = "年", Position = AxisPosition.Bottom };
+ cAxis1.Labels.Clear(); // 内部的にLabelsの値が共有されているのか、正常な表示にはこのコードが必要
+ // 表示する年の文字列を作成する
+ for (int i = startYear; i < startYear + 10; ++i) {
+ cAxis1.Labels.Add(string.Format("{0}", i));
+ }
+ this.WVM.WholeItemYearlyGraphModel.Axes.Add(cAxis1);
+
+ // 縦軸 - 線形軸
+ LinearAxis lAxis1 = new LinearAxis() {
+ Unit = "円",
+ Position = AxisPosition.Left,
+ MajorGridlineStyle = LineStyle.Solid,
+ MinorGridlineStyle = LineStyle.Dot,
+ StringFormat = "#,0"
+ };
+ switch (this.WVM.SelectedGraphKind) {
+ case GraphKind.IncomeAndOutgo: {
+ lAxis1.Title = "収支";
+ }
+ break;
+ case GraphKind.Balance: {
+ lAxis1.Title = "残高";
+ }
+ break;
+ }
+ this.WVM.WholeItemYearlyGraphModel.Axes.Add(lAxis1);
+
+ this.WVM.WholeItemYearlyGraphModel.InvalidatePlot(true);
+
+ // 選択項目
+ this.WVM.SelectedItemYearlyGraphModel.Axes.Clear();
+ this.WVM.SelectedItemYearlyGraphModel.Series.Clear();
+
+ // 横軸 - 年軸
+ CategoryAxis cAxis2 = new CategoryAxis() { Unit = "年", Position = AxisPosition.Bottom };
+ cAxis2.Labels.Clear(); // 内部的にLabelsの値が共有されているのか、正常な表示にはこのコードが必要
+ // 表示する年の文字列を作成する
+ for (int i = startYear; i < startYear + 10; ++i) {
+ cAxis2.Labels.Add(string.Format("{0}", i));
+ }
+ this.WVM.SelectedItemYearlyGraphModel.Axes.Add(cAxis2);
+
+ // 縦軸 - 線形軸
+ LinearAxis lAxis2 = new LinearAxis() {
+ Unit = "円",
+ Position = AxisPosition.Left,
+ MajorGridlineStyle = LineStyle.Solid,
+ MinorGridlineStyle = LineStyle.Dot,
+ StringFormat = "#,0"
+ };
+ switch (this.WVM.SelectedGraphKind) {
+ case GraphKind.IncomeAndOutgo: {
+ lAxis2.Title = "収支";
+ }
+ break;
+ case GraphKind.Balance: {
+ lAxis2.Title = "残高";
+ }
+ break;
+ }
+ this.WVM.SelectedItemYearlyGraphModel.Axes.Add(lAxis2);
+
+ this.WVM.SelectedItemYearlyGraphModel.InvalidatePlot(true);
+ }
+ }
+
+ ///
+ /// 年別グラフタブに表示するデータを更新する
+ ///
+ private void UpdateYearlyGraphTabData()
+ {
+ if (this.WVM.SelectedTab == Tabs.YearlyGraphTab) {
+ int startYear = DateTime.Now.Year - 9;
+ this.WVM.WholeItemYearlyGraphModel.Series.Clear();
+
+ switch (this.WVM.SelectedGraphKind) {
+ case GraphKind.IncomeAndOutgo: {
+ ObservableCollection vmList = LoadYearlySummaryViewModelListWithinDecade(this.WVM.SelectedBookVM.Id);
+ List sumPlus = new List(); // 年ごとの合計収入
+ List sumMinus = new List(); // 年ごとの合計支出
+
+ foreach (SeriesViewModel tmpVM in vmList) {
+ if (tmpVM.ItemId == -1) { continue; }
+
+ CustomColumnSeries cSeries1 = new CustomColumnSeries() {
+ IsStacked = true,
+ Title = tmpVM.ItemName,
+ ItemsSource = tmpVM.Values.Select((value, index) => new SeriesItemViewModel {
+ Value = value,
+ Number = index + startYear,
+ ItemId = tmpVM.ItemId,
+ CategoryId = tmpVM.CategoryId
+ }),
+ ValueField = "Value",
+ TrackerFormatString = "{0}\n{1}年: {2:#,0}"
+ };
+ // 全項目年間グラフの項目を選択した時のイベントを登録する
+ cSeries1.TrackerHitResultChanged += (sender, e) => {
+ if (e.Value == null) return;
+
+ SeriesItemViewModel itemVM = e.Value.Item as SeriesItemViewModel;
+ SeriesViewModel vm = vmList.FirstOrDefault((tmp) => tmp.ItemId == itemVM.ItemId);
+
+ this.WVM.SelectedItemYearlyGraphModel.Series.Clear();
+
+ CustomColumnSeries cSeries2 = new CustomColumnSeries() {
+ IsStacked = true,
+ Title = vm.ItemName,
+ FillColor = (e.Value.Series as CustomColumnSeries).ActualFillColor,
+ ItemsSource = vm.Values.Select((value, index) => new SeriesItemViewModel {
+ Value = value,
+ Number = index + startYear,
+ ItemId = vm.ItemId,
+ CategoryId = vm.CategoryId
+ }),
+ ValueField = "Value",
+ TrackerFormatString = "{1}年: {2:#,0}" //年: 金額
+ };
+ this.WVM.SelectedItemYearlyGraphModel.Series.Add(cSeries2);
+
+ foreach (Axis axis in this.WVM.SelectedItemYearlyGraphModel.Axes) {
+ if (axis.Position == AxisPosition.Left) {
+ this.SetAxisRange(axis, vm.Values.Min(), vm.Values.Max(), 4, true);
+ break;
+ }
+ }
+
+ this.WVM.SelectedItemYearlyGraphModel.InvalidatePlot(true);
+ };
+ this.WVM.WholeItemYearlyGraphModel.Series.Add(cSeries1);
+
+ // 全項目の月毎の合計を計算する
+ for (int i = 0; i < tmpVM.Values.Count; ++i) {
+ if (sumPlus.Count <= i) { sumPlus.Add(0); sumMinus.Add(0); }
+
+ if (tmpVM.Values[i] < 0) sumMinus[i] += tmpVM.Values[i];
+ else sumPlus[i] += tmpVM.Values[i];
+ }
+ }
+
+ // Y軸の範囲を設定する
+ foreach (Axis axis in this.WVM.WholeItemYearlyGraphModel.Axes) {
+ if (axis.Position == AxisPosition.Left) {
+ this.SetAxisRange(axis, sumMinus.Min(), sumPlus.Max(), 10, true);
+ break;
+ }
+ }
+ }
+ break;
+ case GraphKind.Balance: {
+ LineSeries cSeries = new LineSeries() {
+ Title = "残高",
+ TrackerFormatString = "{2}年: {4:#,0}" //年: 金額
+ };
+ ObservableCollection vmList = LoadYearlySummaryViewModelListWithinDecade(this.WVM.SelectedBookVM.Id);
+ cSeries.Points.AddRange(new List(vmList[0].Values).Select((value, index) => new DataPoint(index, value)));
+
+ this.WVM.WholeItemYearlyGraphModel.Series.Add(cSeries);
+
+ // Y軸の範囲を設定する
+ foreach (Axis axis in this.WVM.WholeItemYearlyGraphModel.Axes) {
+ if (axis.Position == AxisPosition.Left) {
+ this.SetAxisRange(axis, cSeries.Points.Min((value) => value.Y), cSeries.Points.Max((value) => value.Y), 10, true);
+ break;
+ }
+ }
+ }
+ break;
+ }
+ this.WVM.WholeItemYearlyGraphModel.InvalidatePlot(true);
+
+ this.WVM.SelectedItemYearlyGraphModel.Series.Clear();
+ this.WVM.SelectedItemYearlyGraphModel.InvalidatePlot(true);
+ }
+ }
+ #endregion
+
///
/// 軸の範囲を設定する
///
diff --git a/HouseholdAccountBook/packages.config b/HouseholdAccountBook/packages.config
index ee18161..548e577 100644
--- a/HouseholdAccountBook/packages.config
+++ b/HouseholdAccountBook/packages.config
@@ -1,14 +1,14 @@
-
+
-
-
+
+
-
+
@@ -35,6 +35,7 @@
+
@@ -44,8 +45,9 @@
-
+
+
diff --git a/README.md b/README.md
index 07688f6..1afdffc 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
## __Abstract__
It is for your household accounts book via PostgreSQL.
-Currently, the binary file is unscheduled to publish.
+Currently, the binary file is unscheduled to be published.
It is for who can set PostgreSQL environments and build the project yourself.
It is supported for Japanese Language only.
@@ -14,9 +14,12 @@ It is supported for Japanese Language only.
自力で環境設定、ビルドできる方向けです。
## __開発環境__
-IDE: [Visual Studio Community](https://www.microsoft.com/ja-jp/dev/products/community.aspx) 2017
-DB: [PostgreSQL](https://www.postgresql.org/) 9.6
-言語: C# (.NET Framework 4.5.2)
+* IDE
+ [Visual Studio Community](https://www.microsoft.com/ja-jp/dev/products/community.aspx) 2017
+* DB
+ [PostgreSQL](https://www.postgresql.org/) 9.6
+* 言語
+ C# (.NET Framework 4.5.2)
## __機能__
### 実装済
@@ -53,21 +56,26 @@ DB: [PostgreSQL](https://www.postgresql.org/) 9.6
- 「移動」クリック時に選択していた帳簿項目の日付と、初期「日付」の連動
- 「移動元」(支払元帳簿)、「日」(支払日)のデフォルト値の設定(クレジットカードのみ)
* 「日別グラフ」機能
- * 全項目の指定期間内の日単位での収支の推移
- * 選択項目の指定期間内の日単位での収支の推移
- * 指定期間内の日単位での残高の推移
+ * 選択した帳簿における全項目の指定期間内の日単位での収支の推移
+ * 選択した帳簿における選択項目の指定期間内の日単位での収支の推移
+ * 選択した帳簿における指定期間内の日単位での残高の推移
* 「月別一覧」機能
* 記帳風月の「年間一覧」機能に加え、以下をサポートしています。
* 「記帳」機能の表示月と、表示年の連動
* 「今年」表示
* 「月別グラフ」機能
* 記帳風月の「グラフ」機能を一部サポートしています。
- * 全項目の年間(月単位)の収支の推移
- * 選択項目の年間(月単位)の収支の推移
+ * 選択した帳簿における全項目の年間(月単位)の収支の推移
+ * 選択した帳簿における選択項目の年間(月単位)の収支の推移
* また、以下をサポートしています。
- * 年間(月単位)の残高の推移
+ * 選択した帳簿における年間(月単位)の残高の推移
+* 「年別一覧」機能
+ * 「月別一覧」機能の年別版です。過去10年間(年単位)の一覧を表示できます。
+* 「年別グラフ」機能
+ * 「月別グラフ」機能の年別版です。過去10年間(年単位)の推移を表示できます。
* その他の機能
* ファイル関連
+ * 記帳風月からのインポート
* データベースのインポート、エクスポート
* 最小化時の自動バックアップ
* 手動バックアップ