diff --git a/MMEX/Data/AccountData.swift b/MMEX/Data/AccountData.swift index 2b5d8db..1547030 100644 --- a/MMEX/Data/AccountData.swift +++ b/MMEX/Data/AccountData.swift @@ -59,7 +59,7 @@ enum AccountType: String, ChoiceProtocol { case .asset: return "house.fill" case .shares: - return "person.3.fill" + return "chart.line.uptrend.xyaxis" } } } @@ -145,11 +145,29 @@ extension AccountData { initialBal: 200.0, favoriteAcct: .boolTrue, currencyId: 2 ), AccountData( - id: 3, name: "Investment Account", type: AccountType.investment, + id: 3, name: "Inv Account", type: AccountType.investment, status: AccountStatus.open, notes: "", initialDate: DateString(Date()), initialBal: 0.0, favoriteAcct: .boolTrue, currencyId: 1 ), + AccountData( + id: 4, name: "House", type: AccountType.asset, + status: AccountStatus.open, notes: "", + initialDate: DateString(Date()), + initialBal: 0.0, favoriteAcct: .boolTrue, currencyId: 1 + ), + AccountData( + id: 5, name: "Car", type: AccountType.asset, + status: AccountStatus.open, notes: "", + initialDate: DateString(Date()), + initialBal: 0.0, favoriteAcct: .boolFalse, currencyId: 1 + ), + AccountData( + id: 6, name: "Apple", type: AccountType.shares, + status: AccountStatus.open, notes: "links of Stock: Apple", + initialDate: DateString(Date()), + initialBal: 0.0, favoriteAcct: .boolTrue, currencyId: 1 + ), ] static var sampleDataIds : [DataId] { diff --git a/MMEX/Repository/AccountRepository.swift b/MMEX/Repository/AccountRepository.swift index c785dee..132f5d9 100644 --- a/MMEX/Repository/AccountRepository.swift +++ b/MMEX/Repository/AccountRepository.swift @@ -150,13 +150,17 @@ struct AccountRepository: RepositoryProtocol { static func filterUsed(_ table: SQLite.Table) -> SQLite.Table { typealias I = InfotableRepository typealias S = StockRepository + typealias A = AssetRepository typealias T = TransactionRepository typealias Q = ScheduledRepository let cond = "EXISTS (" + (I.table.select(1).where( I.table[I.col_name] == InfoKey.defaultAccountID.rawValue && I.table[I.col_value] == cast(Self.table[Self.col_id]) as SQLite.Expression ) ).union(S.table.select(1).where( - S.table[S.col_accountId] == Self.table[Self.col_id] + S.table[S.col_accountId] == Self.table[Self.col_id] || + S.table[S.col_name] == Self.table[Self.col_name] + ) ).union(A.table.select(1).where( + A.table[A.col_name] == Self.table[Self.col_name] ) ).union(T.table.select(1).where( T.table[T.col_accountId] == Self.table[Self.col_id] ) ).union(T.table.select(1).where( diff --git a/MMEX/View/Manage/Repository/RepositoryListView.swift b/MMEX/View/Manage/Repository/RepositoryListView.swift index 898ecae..67cc3f0 100644 --- a/MMEX/View/Manage/Repository/RepositoryListView.swift +++ b/MMEX/View/Manage/Repository/RepositoryListView.swift @@ -1,5 +1,5 @@ // -// RpositoryListView.swift +// RepositoryListView.swift // MMEX // // 2024-10-11: Created by George Ef (george.a.ef@gmail.com) diff --git a/MMEX/View/Manage/Stock/StockFormView.swift b/MMEX/View/Manage/Stock/StockFormView.swift index b569ab6..db7bdb6 100644 --- a/MMEX/View/Manage/Stock/StockFormView.swift +++ b/MMEX/View/Manage/Stock/StockFormView.swift @@ -51,7 +51,9 @@ struct StockFormView: View { Text("(none)").tag(DataId.void) } ForEach(accountOrder, id: \.self) { id in - Text(accountData[id]?.name ?? "").tag(id) + if let account = accountData[id], account.type == AccountType.investment { + Text(accountData[id]?.name ?? "").tag(id) + } } } }, showView: {