├── index.html ├── Tests ├── pch.cpp ├── Assets │ └── Test.sqlite ├── pch.h ├── Main.cpp ├── Tests.vcxproj.user ├── packages.config ├── Environment.cpp └── DataConnectionTest.cpp ├── Clerk.v12.suo ├── Screenshot.png ├── Clerk ├── Resource.rc ├── Resources │ ├── Logo.ico │ ├── Logo.png │ ├── Locales │ │ ├── en.mo │ │ └── ru_RU.mo │ ├── Database.sqlite │ ├── Menu Icons │ │ ├── 0.png │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ ├── 5.png │ │ ├── 6.png │ │ ├── 7.png │ │ ├── 8.png │ │ ├── 9.png │ │ ├── 10.png │ │ ├── 11.png │ │ └── 12.png │ ├── Accounts Icons │ │ ├── 0.png │ │ ├── 1.png │ │ ├── 10.png │ │ ├── 11.png │ │ ├── 12.png │ │ ├── 13.png │ │ ├── 14.png │ │ ├── 15.png │ │ ├── 16.png │ │ ├── 17.png │ │ ├── 18.png │ │ ├── 19.png │ │ ├── 2.png │ │ ├── 20.png │ │ ├── 21.png │ │ ├── 22.png │ │ ├── 23.png │ │ ├── 24.png │ │ ├── 25.png │ │ ├── 26.png │ │ ├── 27.png │ │ ├── 28.png │ │ ├── 29.png │ │ ├── 3.png │ │ ├── 30.png │ │ ├── 31.png │ │ ├── 32.png │ │ ├── 33.png │ │ ├── 34.png │ │ ├── 35.png │ │ ├── 36.png │ │ ├── 37.png │ │ ├── 38.png │ │ ├── 39.png │ │ ├── 4.png │ │ ├── 40.png │ │ ├── 41.png │ │ ├── 42.png │ │ ├── 43.png │ │ ├── 44.png │ │ ├── 45.png │ │ ├── 46.png │ │ ├── 47.png │ │ ├── 48.png │ │ ├── 49.png │ │ ├── 5.png │ │ ├── 50.png │ │ ├── 51.png │ │ ├── 52.png │ │ ├── 53.png │ │ ├── 54.png │ │ ├── 55.png │ │ ├── 56.png │ │ ├── 57.png │ │ ├── 58.png │ │ ├── 59.png │ │ ├── 6.png │ │ ├── 60.png │ │ ├── 61.png │ │ ├── 62.png │ │ ├── 7.png │ │ ├── 8.png │ │ ├── 9.png │ │ ├── building.png │ │ ├── building-low.png │ │ └── building-small.png │ ├── Play.svg │ ├── Pause.svg │ ├── Plus.svg │ ├── ArrowDown.svg │ ├── ArrowUp.svg │ ├── ArrowLeft.svg │ ├── ArrowRight.svg │ ├── Delete.svg │ ├── Merge.svg │ ├── Tab.svg │ ├── Split.svg │ ├── Copy.svg │ ├── Pencil.svg │ ├── Undo.svg │ ├── Duplicate.svg │ ├── Percent.svg │ ├── Bell.svg │ ├── BellActive.svg │ ├── Cached.svg │ ├── CalendarMonth.svg │ ├── TabRemove.svg │ └── Wallet.svg ├── UI │ ├── MainMenu │ │ ├── MainMenu.cpp │ │ ├── Enums.h │ │ ├── MainMenuViewModel.h │ │ ├── MainMenuViewModel.cpp │ │ └── MainMenu.h │ ├── TreeMenu │ │ ├── AccountContextMenu.cpp │ │ ├── TreeContextMenu.cpp │ │ ├── TreeMenuItemData.h │ │ ├── TreeContextMenu.h │ │ ├── DefaultContextMenu.h │ │ ├── ReportContextMenu.cpp │ │ ├── ReportContextMenu.h │ │ ├── AccountsContextMenu.h │ │ ├── AccountContextMenu.h │ │ └── Enums.h │ ├── Controls │ │ ├── Enums.h │ │ ├── AmountField.h │ │ ├── DataViewProgressRender.h │ │ ├── ToolbarButton.h │ │ ├── CheckboxComboPopup.h │ │ ├── DropDownButton.h │ │ ├── AccountsComboBox.h │ │ ├── CheckboxComboPopup.cpp │ │ ├── PeriodFilterPanel.h │ │ └── DataViewProgressRender.cpp │ ├── AboutDialog.h │ ├── Reports │ │ ├── Enums.h │ │ ├── Tooltip │ │ │ ├── ReportChartTooltipPopup.h │ │ │ ├── ReportChartTooltipPopup.cpp │ │ │ └── ReportChartTooltipPanel.h │ │ ├── ReportExpensesForPeriodPanel.h │ │ ├── ReportBalanceByMonthPanel.h │ │ └── ReportReceiptsAndExpensesByMonthPanel.h │ ├── DataPanel │ │ ├── DataPanel.cpp │ │ ├── DataPanel.h │ │ └── DataListPanel.h │ ├── Charts │ │ ├── PieChart.h │ │ ├── BarChart.h │ │ ├── LineChart.h │ │ └── GroupedBarChart.h │ ├── Goals │ │ ├── Enums.h │ │ ├── GoalContextMenu.h │ │ ├── GoalsListPanel.h │ │ ├── GoalViewModel.h │ │ ├── GoalsListDataModel.h │ │ └── GoalDialog.h │ ├── Budgets │ │ ├── Enums.h │ │ ├── BudgetContextMenu.h │ │ ├── BudgetsListPanel.h │ │ ├── BudgetsListDataModel.h │ │ ├── BudgetViewModel.h │ │ └── BudgetDialog.h │ ├── Tabs │ │ ├── Enums.h │ │ └── TabsContextMenu.h │ ├── Account │ │ ├── Enums.h │ │ ├── InterestAccrualViewModel.h │ │ └── InterestAccrualDialog.h │ ├── Transactions │ │ ├── TransactionsTagsRender.h │ │ ├── TransactionsAmountRender.h │ │ ├── Enums.h │ │ ├── TransactionContextMenu.h │ │ ├── TransactionsListDataModel.h │ │ └── TransactionsAmountRender.cpp │ ├── Alerts │ │ ├── Enums.h │ │ ├── AlertContextMenu.h │ │ ├── AlertsListPanel.h │ │ └── AlertsListDataModel.h │ ├── Schedulers │ │ ├── Enums.h │ │ ├── SchedulerContextMenu.h │ │ ├── SchedulersListPanel.h │ │ ├── SchedulerDialog.h │ │ ├── SchedulersListDataModel.h │ │ └── SchedulerTransactionPanel.h │ ├── TagsField │ │ ├── TagPanel.h │ │ ├── TagsPopup.h │ │ ├── TagsField.h │ │ └── TagPanel.cpp │ ├── Dashboard │ │ ├── DashboardDebtsPanel.h │ │ ├── DashboardGoalsPanel.h │ │ ├── DashboardBalancePanel.h │ │ ├── DashboardBudgetsPanel.h │ │ ├── DashboardReceiptsPanel.h │ │ ├── DashboardExpensesPanel.h │ │ ├── DashboardSchedulersPanel.h │ │ ├── DashboardAccountsPanel.h │ │ └── DashboardPanel.h │ ├── Statusbar │ │ ├── Statusbar.h │ │ └── StatusbarViewModel.h │ ├── NewTransactionButton │ │ ├── NewTransactionViewModel.h │ │ ├── NewTransactionViewModel.cpp │ │ └── NewTransactionButton.h │ ├── Notifications │ │ ├── NotificationAlertPanel.h │ │ ├── NotificationsButton.h │ │ ├── NotificationsPopup.h │ │ └── NotificationSchedulerPanel.h │ ├── TrashPanel.h │ ├── PreferencesDialog.h │ └── TagsPanel.h ├── Data │ ├── Models │ │ ├── TagModel.cpp │ │ ├── Model.cpp │ │ ├── ReportModel.cpp │ │ ├── Model.h │ │ ├── CurrencyModel.cpp │ │ ├── ReportModel.h │ │ ├── TagModel.h │ │ ├── GoalModel.cpp │ │ ├── CurrencyModel.h │ │ ├── BudgetModel.cpp │ │ ├── AccountModel.cpp │ │ ├── TransactionModel.cpp │ │ ├── GoalModel.h │ │ ├── AlertModel.cpp │ │ ├── BudgetModel.h │ │ ├── SchedulerModel.cpp │ │ ├── TransactionModel.h │ │ ├── AccountModel.h │ │ ├── AlertModel.h │ │ └── SchedulerModel.h │ ├── PresentationModels │ │ ├── ReportPresentationModel.cpp │ │ ├── ReportPresentationModel.h │ │ ├── CurrencyPresentationModel.h │ │ ├── TagPresentationModel.h │ │ ├── CurrencyPresentationModel.cpp │ │ ├── TagPresentationModel.cpp │ │ ├── GoalPresentationModel.h │ │ ├── Types.h │ │ ├── BudgetPresentationModel.h │ │ ├── TransactionPresentationModel.h │ │ ├── AccountPresentationModel.h │ │ ├── AlertPresentationModel.h │ │ ├── SchedulerPresentationModel.h │ │ └── GoalPresentationModel.cpp │ ├── Repositories │ │ ├── BaseRepository.cpp │ │ ├── BaseRepository.h │ │ ├── ReportsRepository.h │ │ ├── TagsRepository.h │ │ ├── AlertsRepository.h │ │ ├── GoalsRepository.h │ │ ├── CurrenciesRepository.h │ │ ├── SchedulersRepository.h │ │ ├── BudgetsRepository.h │ │ ├── ReportsRepository.cpp │ │ ├── TransactionsRepository.h │ │ └── AccountsRepository.h │ ├── ExchangeRates │ │ ├── CBRRatesLoader.h │ │ └── ExchangeRatesLoader.h │ ├── DataConnection.h │ ├── Services │ │ ├── ReportsService.h │ │ ├── TagsService.h │ │ ├── AccountingService.h │ │ ├── CurrenciesService.h │ │ ├── GoalsService.h │ │ ├── AlertsService.h │ │ ├── HashService.h │ │ ├── BudgetsService.h │ │ └── ReportsService.cpp │ └── Enums.h ├── Commands │ ├── Command.h │ ├── QuitCommand.cpp │ ├── AboutCommand.cpp │ ├── Goal │ │ ├── NewGoalCommand.cpp │ │ ├── NewGoalCommand.h │ │ ├── EditGoalCommand.cpp │ │ ├── EditGoalCommand.h │ │ ├── DeleteGoalCommand.h │ │ └── DeleteGoalCommand.cpp │ ├── Alert │ │ ├── NewAlertCommand.cpp │ │ ├── NewAlertCommand.h │ │ ├── EditAlertCommand.cpp │ │ ├── EditAlertCommand.h │ │ ├── DeleteAlertCommand.h │ │ └── DeleteAlertCommand.cpp │ ├── Budget │ │ ├── NewBudgetCommand.cpp │ │ ├── NewBudgetCommand.h │ │ ├── EditBudgetCommand.cpp │ │ ├── EditBudgetCommand.h │ │ ├── DeleteBudgetCommand.h │ │ └── DeleteBudgetCommand.cpp │ ├── Scheduler │ │ ├── NewSchedulerCommand.cpp │ │ ├── NewSchedulerCommand.h │ │ ├── EditSchedulerCommand.cpp │ │ ├── EditSchedulerCommand.h │ │ ├── RunSchedulerCommand.h │ │ ├── PauseSchedulerCommand.h │ │ ├── DeleteSchedulerCommand.h │ │ ├── RunSchedulerCommand.cpp │ │ ├── PauseSchedulerCommand.cpp │ │ └── DeleteSchedulerCommand.cpp │ ├── OpenPreferencesCommand.cpp │ ├── QuitCommand.h │ ├── AboutCommand.h │ ├── Tabs │ │ ├── OpenTabCommand.cpp │ │ ├── OpenReportTabCommand.cpp │ │ ├── OpenAccountTabCommand.cpp │ │ ├── OpenReportTabCommand.h │ │ ├── OpenAccountTabCommand.h │ │ ├── OpenAccountsTabCommand.cpp │ │ ├── OpenTabCommand.h │ │ └── OpenAccountsTabCommand.h │ ├── OpenPreferencesCommand.h │ ├── Account │ │ ├── EditAccountCommand.cpp │ │ ├── InterestAccrualCommand.cpp │ │ ├── EditAccountCommand.h │ │ ├── NewAccountCommand.cpp │ │ ├── ArchiveAccountCommand.h │ │ ├── InterestAccrualCommand.h │ │ ├── RestoreAccountCommand.h │ │ ├── ArchiveAccountCommand.cpp │ │ ├── RestoreAccountCommand.cpp │ │ └── NewAccountCommand.h │ ├── Transaction │ │ ├── NewTransactionCommand.cpp │ │ ├── CopyTransactionCommand.cpp │ │ ├── EditTransactionCommand.cpp │ │ ├── NewTransactionCommand.h │ │ ├── SplitTransactionCommand.cpp │ │ ├── CopyTransactionCommand.h │ │ ├── EditTransactionCommand.h │ │ ├── SplitTransactionCommand.h │ │ ├── DeleteTransactionCommand.h │ │ ├── DuplicateTransactionCommand.h │ │ ├── DeleteTransactionCommand.cpp │ │ └── DuplicateTransactionCommand.cpp │ └── ICommandsReceiver.h ├── Clerk.vcxproj.user ├── Utils │ ├── Types.h │ ├── EventEmitter │ │ ├── EventEmitter.h │ │ ├── EventEmitter.cpp │ │ └── DataEventEmitter.h │ ├── Settings │ │ └── Types.h │ └── Icons.h ├── Defines.h ├── Clerk.h └── resource.h ├── .vs └── Clerk │ ├── v14 │ └── .suo │ └── v15 │ └── .suo ├── .gitignore ├── sonar-project.properties ├── README.md ├── LICENSE └── TODO.txt /index.html: -------------------------------------------------------------------------------- 1 | Github.io test 2 | -------------------------------------------------------------------------------- /Tests/pch.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pch.cpp 3 | // 4 | 5 | #include "pch.h" 6 | -------------------------------------------------------------------------------- /Clerk.v12.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk.v12.suo -------------------------------------------------------------------------------- /Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Screenshot.png -------------------------------------------------------------------------------- /Clerk/Resource.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resource.rc -------------------------------------------------------------------------------- /.vs/Clerk/v14/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/.vs/Clerk/v14/.suo -------------------------------------------------------------------------------- /.vs/Clerk/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/.vs/Clerk/v15/.suo -------------------------------------------------------------------------------- /Clerk/Resources/Logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Logo.ico -------------------------------------------------------------------------------- /Clerk/Resources/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Logo.png -------------------------------------------------------------------------------- /Tests/Assets/Test.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Tests/Assets/Test.sqlite -------------------------------------------------------------------------------- /Clerk/Resources/Locales/en.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Locales/en.mo -------------------------------------------------------------------------------- /Clerk/Resources/Database.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Database.sqlite -------------------------------------------------------------------------------- /Clerk/Resources/Locales/ru_RU.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Locales/ru_RU.mo -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/0.png -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/1.png -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/2.png -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/3.png -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/4.png -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/5.png -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/6.png -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/7.png -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/8.png -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/9.png -------------------------------------------------------------------------------- /Clerk/UI/MainMenu/MainMenu.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/UI/MainMenu/MainMenu.cpp -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/10.png -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/11.png -------------------------------------------------------------------------------- /Clerk/Resources/Menu Icons/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Menu Icons/12.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/0.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/1.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/10.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/11.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/12.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/13.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/14.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/15.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/16.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/17.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/18.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/19.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/2.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/20.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/21.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/22.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/23.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/24.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/25.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/26.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/27.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/28.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/29.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/3.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/30.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/31.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/32.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/33.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/34.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/35.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/36.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/37.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/38.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/39.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/4.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/40.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/41.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/42.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/43.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/44.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/45.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/46.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/46.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/47.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/48.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/49.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/49.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/5.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/50.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/51.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/51.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/52.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/52.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/53.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/53.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/54.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/54.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/55.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/55.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/56.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/56.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/57.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/58.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/59.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/59.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/6.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/60.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/61.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/61.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/62.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/62.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/7.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/8.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/9.png -------------------------------------------------------------------------------- /Clerk/Resources/Play.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Resources/Pause.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/UI/TreeMenu/AccountContextMenu.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/UI/TreeMenu/AccountContextMenu.cpp -------------------------------------------------------------------------------- /Tests/pch.h: -------------------------------------------------------------------------------- 1 | // 2 | // pch.h 3 | // 4 | 5 | #pragma once 6 | 7 | #include "gtest/gtest.h" 8 | #include 9 | #include -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/building.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/building.png -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/building-low.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/building-low.png -------------------------------------------------------------------------------- /Clerk/Resources/Plus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Resources/Accounts Icons/building-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sergeylenkov/Clerk/HEAD/Clerk/Resources/Accounts Icons/building-small.png -------------------------------------------------------------------------------- /Clerk/Resources/ArrowDown.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Resources/ArrowUp.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Tests/Main.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | 3 | int main(int argc, char* argv[]) { 4 | ::testing::InitGoogleTest(&argc, argv); 5 | 6 | return RUN_ALL_TESTS(); 7 | } -------------------------------------------------------------------------------- /Clerk/Resources/ArrowLeft.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Resources/ArrowRight.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Data/Models/TagModel.cpp: -------------------------------------------------------------------------------- 1 | #include "TagModel.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | TagModel::TagModel() 6 | { 7 | this->id = -1; 8 | this->name = std::wstring(); 9 | } -------------------------------------------------------------------------------- /Clerk/Resources/Delete.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Commands/Command.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace Commands { 5 | class Command { 6 | public: 7 | virtual void Execute() = 0; 8 | }; 9 | } 10 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/Model.cpp: -------------------------------------------------------------------------------- 1 | #include "Model.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | bool Model::operator== (const Clerk::Data::Model& model) 6 | { 7 | return model.id == this->id; 8 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/ReportModel.cpp: -------------------------------------------------------------------------------- 1 | #include "ReportModel.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | ReportModel::ReportModel() 6 | { 7 | this->id = -1; 8 | this->name = std::wstring(); 9 | } -------------------------------------------------------------------------------- /Clerk/Resources/Merge.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Tests/Tests.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Clerk/Resources/Tab.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/UI/Controls/Enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace UI { 5 | enum class PeriodFilterType { 6 | Transactions = 0, 7 | Report = 1, 8 | }; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Clerk/Resources/Split.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Tests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Clerk/Data/Models/Model.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace Data { 5 | class Model 6 | { 7 | public: 8 | int id; 9 | bool operator== (const Model& model); 10 | }; 11 | } 12 | } -------------------------------------------------------------------------------- /Clerk/Resources/Copy.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/UI/TreeMenu/TreeContextMenu.cpp: -------------------------------------------------------------------------------- 1 | #include "TreeContextMenu.h" 2 | 3 | using namespace Clerk::UI; 4 | 5 | TreeContextMenu::TreeContextMenu(DataContext& context, Icons& icons): 6 | _context(context), 7 | _icons(icons) 8 | { 9 | } -------------------------------------------------------------------------------- /Clerk/Commands/QuitCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "QuitCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | QuitCommand::QuitCommand(wxFrame& frame): 6 | _frame(frame) { 7 | } 8 | 9 | void QuitCommand::Execute() { 10 | _frame.Close(); 11 | } -------------------------------------------------------------------------------- /Clerk/Resources/Pencil.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Clerk.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /Clerk/Resources/Undo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Utils/Types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | template 8 | using shared_vector = std::vector>; 9 | 10 | using exhange_rate_map = std::map, float>; -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/ReportPresentationModel.cpp: -------------------------------------------------------------------------------- 1 | #include "ReportPresentationModel.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | ReportPresentationModel::ReportPresentationModel(ReportModel& report) { 6 | this->id = report.id; 7 | this->name = report.name; 8 | } -------------------------------------------------------------------------------- /Clerk/Resources/Duplicate.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Resources/Percent.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Commands/AboutCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "AboutCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | AboutCommand::AboutCommand(ICommandsReceiver& receiver): _receiver(receiver) { 6 | } 7 | 8 | void AboutCommand::Execute() { 9 | _receiver.OpenAboutDialog(); 10 | } -------------------------------------------------------------------------------- /Clerk/UI/AboutDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../Defines.h" 5 | 6 | class AboutDialog : public wxFrame 7 | { 8 | public: 9 | AboutDialog(wxFrame *parent, const wxChar *title, int xpos, int ypos, int width, int height); 10 | }; 11 | 12 | -------------------------------------------------------------------------------- /Clerk/Data/Models/CurrencyModel.cpp: -------------------------------------------------------------------------------- 1 | #include "CurrencyModel.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | CurrencyModel::CurrencyModel() 6 | { 7 | this->id = -1; 8 | this->name = std::wstring(); 9 | this->shortName = std::wstring(); 10 | this->sign = std::wstring(); 11 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/ReportModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Model.h" 5 | 6 | namespace Clerk { 7 | namespace Data { 8 | class ReportModel : public Model 9 | { 10 | public: 11 | ReportModel(); 12 | 13 | std::wstring name; 14 | }; 15 | } 16 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/TagModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Model.h" 5 | 6 | namespace Clerk { 7 | namespace Data { 8 | class TagModel : public Model 9 | { 10 | public: 11 | TagModel(); 12 | 13 | std::wstring name; 14 | }; 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Clerk/Defines.h: -------------------------------------------------------------------------------- 1 | #ifndef Defines_h 2 | #define Defines_h 3 | 4 | constexpr auto APP_NAME = "Clerk"; 5 | constexpr auto APP_VERSION = "0.6.7"; 6 | 7 | #ifdef _DEBUG 8 | #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) 9 | #else 10 | #define DBG_NEW new 11 | #endif 12 | 13 | #endif -------------------------------------------------------------------------------- /Clerk/Resources/Bell.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Resources/BellActive.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/UI/Reports/Enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace UI { 5 | enum class ReportType { 6 | ReceiptsByMonth = 0, 7 | ExpensesByMonth = 1, 8 | ExpensesForPeriod = 2, 9 | BalanceByMonth = 3, 10 | ReceiptsAndExpensesByMonth = 4 11 | }; 12 | } 13 | } -------------------------------------------------------------------------------- /Clerk/Commands/Goal/NewGoalCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "NewGoalCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | NewGoalCommand::NewGoalCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver) { 7 | } 8 | 9 | void NewGoalCommand::Execute() { 10 | _receiver.OpenNewGoalDialog(); 11 | } -------------------------------------------------------------------------------- /Clerk/Commands/Alert/NewAlertCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "NewAlertCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | NewAlertCommand::NewAlertCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver) { 7 | } 8 | 9 | void NewAlertCommand::Execute() { 10 | _receiver.OpenNewAlertDialog(); 11 | } -------------------------------------------------------------------------------- /Tests/Environment.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | 3 | #include "../Clerk/Data/DataContext.h" 4 | #include "../Clerk/Utils/Settings/Settings.h" 5 | 6 | class Environment : public ::testing::Environment { 7 | public: 8 | void SetUp() override { 9 | } 10 | 11 | void TearDown() override { 12 | } 13 | }; -------------------------------------------------------------------------------- /Clerk/Commands/Budget/NewBudgetCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "NewBudgetCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | NewBudgetCommand::NewBudgetCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver) { 7 | } 8 | 9 | void NewBudgetCommand::Execute() { 10 | _receiver.OpenNewBudgetDialog(); 11 | } -------------------------------------------------------------------------------- /Clerk/UI/DataPanel/DataPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "DataPanel.h" 2 | 3 | DataPanel::DataPanel(wxWindow *parent, DataContext& context, Icons& icons): 4 | wxPanel(parent), 5 | _context(context), 6 | _icons(icons) 7 | { 8 | id = 0; 9 | type = TabType::Dashboard; 10 | } 11 | 12 | void DataPanel::Update() { 13 | } 14 | -------------------------------------------------------------------------------- /Clerk/Data/Repositories/BaseRepository.cpp: -------------------------------------------------------------------------------- 1 | #include "BaseRepository.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | BaseRepository::BaseRepository(DataConnection& connection) : _connection(connection) { 6 | 7 | } 8 | 9 | sqlite3* BaseRepository::GetConnection() { 10 | return _connection.GetConnection(); 11 | } -------------------------------------------------------------------------------- /Clerk/Resources/Cached.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Resources/CalendarMonth.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Data/Models/GoalModel.cpp: -------------------------------------------------------------------------------- 1 | #include "GoalModel.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | GoalModel::GoalModel() 6 | { 7 | this->id = -1; 8 | this->name = std::wstring(); 9 | this->amount = 0; 10 | this->date = std::wstring(); 11 | this->created = std::wstring(); 12 | this->accountIds = std::wstring(); 13 | } -------------------------------------------------------------------------------- /Clerk/Commands/Scheduler/NewSchedulerCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "NewSchedulerCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | NewSchedulerCommand::NewSchedulerCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver) { 7 | } 8 | 9 | void NewSchedulerCommand::Execute() { 10 | _receiver.OpenNewSchedulerDialog(); 11 | } -------------------------------------------------------------------------------- /Clerk/Resources/TabRemove.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Commands/OpenPreferencesCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "OpenPreferencesCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | OpenPreferencesCommand::OpenPreferencesCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver) { 7 | } 8 | 9 | void OpenPreferencesCommand::Execute() { 10 | _receiver.OpenPreferencesDialog(); 11 | } -------------------------------------------------------------------------------- /Clerk/UI/TreeMenu/TreeMenuItemData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Enums.h" 5 | 6 | namespace Clerk { 7 | namespace UI { 8 | class TreeMenuItemData : public wxTreeItemData { 9 | public: 10 | TreeMenuItemType type{TreeMenuItemType::Account}; 11 | std::shared_ptr object; 12 | }; 13 | } 14 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Debug/ 2 | Clerk/Thumbs.db 3 | Clerk/Resources/Thumbs.db 4 | Clerk.opensdf 5 | Clerk.VC.db 6 | Clerk.sdf 7 | .vs/Clerk/v15/Browse.VC.db 8 | .vs/Clerk/v15/ipch 9 | .vs/Clerk/v15/Browse.VC.opendb 10 | .vs/Clerk/v15/.suo 11 | .vs 12 | Clerk/Resource.aps 13 | packages 14 | Clerk/LastCoverageResults.log 15 | .opencppcov 16 | Debug x64 17 | -------------------------------------------------------------------------------- /Clerk/Commands/QuitCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Command.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class QuitCommand : public Command { 9 | public: 10 | QuitCommand(wxFrame& frame); 11 | 12 | void Execute() override; 13 | 14 | private: 15 | wxFrame& _frame; 16 | }; 17 | } 18 | } -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/ReportPresentationModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../Models/ReportModel.h" 5 | 6 | namespace Clerk { 7 | namespace Data { 8 | class ReportPresentationModel { 9 | public: 10 | ReportPresentationModel(ReportModel& report); 11 | 12 | int id; 13 | wxString name; 14 | }; 15 | } 16 | } -------------------------------------------------------------------------------- /Clerk/UI/MainMenu/Enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace UI { 5 | enum class MainMenuType { 6 | NewTransaction = 1, 7 | NewAccount = 2, 8 | NewBudget = 3, 9 | NewScheduler = 4, 10 | NewGoal = 5, 11 | NewAlert = 6, 12 | About = 7, 13 | Preferences = 8, 14 | Exit = 9 15 | }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Clerk/Resources/Wallet.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Clerk/Data/Models/CurrencyModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "Model.h" 6 | 7 | namespace Clerk { 8 | namespace Data { 9 | class CurrencyModel : public Model 10 | { 11 | public: 12 | CurrencyModel(); 13 | 14 | std::wstring name; 15 | std::wstring shortName; 16 | std::wstring sign; 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/BudgetModel.cpp: -------------------------------------------------------------------------------- 1 | #include "BudgetModel.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | BudgetModel::BudgetModel() 6 | { 7 | this->id = -1; 8 | this->name = std::wstring(); 9 | this->amount = 0; 10 | this->period = BudgetPeriod::Month; 11 | this->date = std::wstring(); 12 | this->created = std::wstring(); 13 | this->accountsIds = std::wstring(); 14 | } -------------------------------------------------------------------------------- /Clerk/Commands/AboutCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Command.h" 4 | #include "ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class AboutCommand : public Command { 9 | public: 10 | AboutCommand(ICommandsReceiver& _receiver); 11 | 12 | void Execute() override; 13 | 14 | private: 15 | ICommandsReceiver& _receiver; 16 | }; 17 | } 18 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/AccountModel.cpp: -------------------------------------------------------------------------------- 1 | #include "AccountModel.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | AccountModel::AccountModel() 6 | { 7 | id = -1; 8 | name = std::wstring(); 9 | note = std::wstring(); 10 | type = AccountType::Deposit; 11 | iconId = 0; 12 | orderId = 1000; 13 | currencyId = 152; 14 | creditLimit = 0; 15 | isActive = true; 16 | created = std::wstring(); 17 | } -------------------------------------------------------------------------------- /Clerk/Commands/Goal/NewGoalCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class NewGoalCommand : public Command { 9 | public: 10 | NewGoalCommand(ICommandsReceiver& _receiver); 11 | void Execute() override; 12 | 13 | private: 14 | ICommandsReceiver& _receiver; 15 | }; 16 | } 17 | } -------------------------------------------------------------------------------- /Clerk/Commands/Alert/NewAlertCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class NewAlertCommand : public Command { 9 | public: 10 | NewAlertCommand(ICommandsReceiver& _receiver); 11 | void Execute() override; 12 | 13 | private: 14 | ICommandsReceiver& _receiver; 15 | }; 16 | } 17 | } -------------------------------------------------------------------------------- /Clerk/Commands/Goal/EditGoalCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "EditGoalCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | EditGoalCommand::EditGoalCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _goalId(-1) { 8 | } 9 | 10 | void EditGoalCommand::SetGoalId(int id) { 11 | _goalId = id; 12 | } 13 | 14 | void EditGoalCommand::Execute() { 15 | _receiver.OpenEditGoalDialog(_goalId); 16 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/TransactionModel.cpp: -------------------------------------------------------------------------------- 1 | #include "TransactionModel.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | TransactionModel::TransactionModel() 6 | { 7 | this->id = -1; 8 | this->fromAccountId = -1; 9 | this->toAccountId = -1; 10 | this->fromAmount = 0; 11 | this->toAmount = 0; 12 | this->note = std::wstring(); 13 | this->date = std::wstring(); 14 | this->created = std::wstring(); 15 | } -------------------------------------------------------------------------------- /Clerk/Commands/Budget/NewBudgetCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class NewBudgetCommand : public Command { 9 | public: 10 | NewBudgetCommand(ICommandsReceiver& _receiver); 11 | void Execute() override; 12 | 13 | private: 14 | ICommandsReceiver& _receiver; 15 | }; 16 | } 17 | } -------------------------------------------------------------------------------- /Clerk/Commands/Tabs/OpenTabCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "OpenTabCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | OpenTabCommand::OpenTabCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _tabType(TabType::Dashboard) { 8 | } 9 | 10 | void OpenTabCommand::SetType(TabType type) { 11 | _tabType = type; 12 | } 13 | 14 | void OpenTabCommand::Execute() { 15 | _receiver.OpenTab(_tabType); 16 | } -------------------------------------------------------------------------------- /Clerk/Commands/Alert/EditAlertCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "EditAlertCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | EditAlertCommand::EditAlertCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _alertId(-1) { 8 | } 9 | 10 | void EditAlertCommand::SetAlertId(int id) { 11 | _alertId = id; 12 | } 13 | 14 | void EditAlertCommand::Execute() { 15 | _receiver.OpenEditAlertDialog(_alertId); 16 | } -------------------------------------------------------------------------------- /Clerk/Commands/OpenPreferencesCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Command.h" 4 | #include "ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class OpenPreferencesCommand : public Command { 9 | public: 10 | OpenPreferencesCommand(ICommandsReceiver& _receiver); 11 | 12 | void Execute() override; 13 | 14 | private: 15 | ICommandsReceiver& _receiver; 16 | }; 17 | } 18 | } -------------------------------------------------------------------------------- /Clerk/Commands/Scheduler/NewSchedulerCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class NewSchedulerCommand : public Command { 9 | public: 10 | NewSchedulerCommand(ICommandsReceiver& _receiver); 11 | void Execute() override; 12 | 13 | private: 14 | ICommandsReceiver& _receiver; 15 | }; 16 | } 17 | } -------------------------------------------------------------------------------- /Clerk/Data/ExchangeRates/CBRRatesLoader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ExchangeRatesLoader.h" 4 | #include 5 | #include 6 | 7 | using namespace rapidxml; 8 | 9 | class CBRRatesLoader : public ExchangeRatesLoader 10 | { 11 | public: 12 | CBRRatesLoader(sqlite3 *db); 13 | void Load(); 14 | 15 | private: 16 | std::string _url; 17 | void Parse(std::string *data); 18 | }; 19 | -------------------------------------------------------------------------------- /Clerk/Data/Models/GoalModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "Model.h" 6 | 7 | namespace Clerk { 8 | namespace Data { 9 | class GoalModel : public Model 10 | { 11 | public: 12 | GoalModel(); 13 | 14 | std::wstring name; 15 | float amount; 16 | std::wstring date; 17 | std::wstring created; 18 | std::wstring accountIds; 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Clerk/Commands/Budget/EditBudgetCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "EditBudgetCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | EditBudgetCommand::EditBudgetCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _budgetId(-1) { 8 | } 9 | 10 | void EditBudgetCommand::SetBudgetId(int id) { 11 | _budgetId = id; 12 | } 13 | 14 | void EditBudgetCommand::Execute() { 15 | _receiver.OpenEditBudgetDialog(_budgetId); 16 | } -------------------------------------------------------------------------------- /Clerk/UI/Charts/PieChart.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | class PieChart : public wxPanel { 8 | public: 9 | PieChart(wxWindow *parent); 10 | ~PieChart(); 11 | 12 | void SetValues(std::map values); 13 | void Draw(); 14 | 15 | private: 16 | std::map _values; 17 | void OnPaint(wxPaintEvent& event); 18 | }; -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=clerk 2 | sonar.projectName=Clerk 3 | sonar.projectVersion=1.0 4 | sonar.host.url=http://localhost:9000 5 | sonar.login=889ce371f651aa98c0c8285439bbe87c16ab546c 6 | sonar.sources=Clerk 7 | sonar.sourceEncoding=UTF-8 8 | sonar.language=cxx 9 | sonar.tests=Tests 10 | sonar.cfamily.build-wrapper-output=build_wrapper_output_directory 11 | #sonar.testExecutionReportPaths=Tests/sonar-reporter.xml -------------------------------------------------------------------------------- /Clerk/Commands/Tabs/OpenReportTabCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "OpenReportTabCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | OpenReportTabCommand::OpenReportTabCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _reportId(-1) { 8 | } 9 | 10 | void OpenReportTabCommand::SetReportId(int id) { 11 | _reportId = id; 12 | } 13 | 14 | void OpenReportTabCommand::Execute() { 15 | _receiver.OpenReportTab(_reportId); 16 | } -------------------------------------------------------------------------------- /Clerk/Commands/Account/EditAccountCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "EditAccountCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | EditAccountCommand::EditAccountCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _accountId(-1) { 8 | } 9 | 10 | void EditAccountCommand::SetAccountId(int id) { 11 | _accountId = id; 12 | } 13 | 14 | void EditAccountCommand::Execute() { 15 | _receiver.OpenEditAccountDialog(_accountId); 16 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/AlertModel.cpp: -------------------------------------------------------------------------------- 1 | #include "AlertModel.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | AlertModel::AlertModel() 6 | { 7 | id = -1; 8 | name = std::wstring(); 9 | message = std::wstring(); 10 | type = AlertType::Balance; 11 | period = AlertPeriod::Month; 12 | condition = AlertCondition::Equal; 13 | importance = AlertImportance::Low; 14 | amount = 0; 15 | accountIds = std::wstring(); 16 | created = std::wstring(); 17 | } -------------------------------------------------------------------------------- /Clerk/Commands/Tabs/OpenAccountTabCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "OpenAccountTabCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | OpenAccountTabCommand::OpenAccountTabCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _accountId(-1) { 8 | } 9 | 10 | void OpenAccountTabCommand::SetAccountId(int id) { 11 | _accountId = id; 12 | } 13 | 14 | void OpenAccountTabCommand::Execute() { 15 | _receiver.OpenAccountTab(_accountId); 16 | } -------------------------------------------------------------------------------- /Clerk/Data/ExchangeRates/ExchangeRatesLoader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | class ExchangeRatesLoader 10 | { 11 | public: 12 | ExchangeRatesLoader(sqlite3 *db); 13 | void Load(); 14 | 15 | private: 16 | 17 | 18 | protected: 19 | sqlite3 *_db; 20 | 21 | void UpdateValue(wxDateTime *date, string *from, string *to, float value, int count); 22 | }; 23 | -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/CurrencyPresentationModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../Models/CurrencyModel.h" 5 | 6 | namespace Clerk { 7 | namespace Data { 8 | class CurrencyPresentationModel { 9 | public: 10 | CurrencyPresentationModel(); 11 | CurrencyPresentationModel(CurrencyModel& model); 12 | 13 | int id; 14 | wxString name; 15 | wxString shortName; 16 | wxString sign; 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Clerk/Commands/Transaction/NewTransactionCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "NewTransactionCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | NewTransactionCommand::NewTransactionCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _accountId(-1) { 8 | } 9 | 10 | void NewTransactionCommand::SetAccountId(int id) { 11 | _accountId = id; 12 | } 13 | 14 | void NewTransactionCommand::Execute() { 15 | _receiver.NewTransaction(_accountId); 16 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Clerk 2 | Personal finance application. Written on c++ and using wxWidgets. 3 | [wxWidgets](https://www.wxwidgets.org/downloads/logos/powered-by-wxwidgets-80x15.png) 4 | 5 | ![Clerk](Screenshot.png) 6 | 7 | ## Dependencies 8 | - [wxWidgets](https://wxwidgets.org) 9 | - [sqlite](https://www.sqlite.org/index.html) 10 | - [rapidJson](http://rapidjson.org/) 11 | - [rapidXML](http://rapidxml.sourceforge.net/) 12 | - [curl](https://curl.haxx.se/) 13 | -------------------------------------------------------------------------------- /Clerk/Commands/Goal/EditGoalCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class EditGoalCommand : public Command { 9 | public: 10 | EditGoalCommand(ICommandsReceiver& receiver); 11 | void SetGoalId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | ICommandsReceiver& _receiver; 16 | int _goalId; 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Clerk/Commands/Scheduler/EditSchedulerCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "EditSchedulerCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | EditSchedulerCommand::EditSchedulerCommand(ICommandsReceiver& receiver) : 6 | _receiver(receiver), 7 | _schedulerId(-1) { 8 | } 9 | 10 | void EditSchedulerCommand::SetSchedulerId(int id) { 11 | _schedulerId = id; 12 | } 13 | 14 | void EditSchedulerCommand::Execute() { 15 | _receiver.OpenEditSchedulerDialog(_schedulerId); 16 | } -------------------------------------------------------------------------------- /Clerk/Commands/Account/InterestAccrualCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "InterestAccrualCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | InterestAccrualCommand::InterestAccrualCommand(ICommandsReceiver& receiver) : 6 | _receiver(receiver), 7 | _accountId(-1) { 8 | } 9 | 10 | void InterestAccrualCommand::SetAccountId(int id) { 11 | _accountId = id; 12 | } 13 | 14 | void InterestAccrualCommand::Execute() { 15 | _receiver.OpenInterestAccrualDialog(_accountId); 16 | } -------------------------------------------------------------------------------- /Clerk/Commands/Alert/EditAlertCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class EditAlertCommand : public Command { 9 | public: 10 | EditAlertCommand(ICommandsReceiver& receiver); 11 | void SetAlertId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | ICommandsReceiver& _receiver; 16 | int _alertId; 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Clerk/Commands/Goal/DeleteGoalCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../../Data/Services/GoalsService.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class DeleteGoalCommand : public Command { 9 | public: 10 | DeleteGoalCommand(GoalsService& service); 11 | void SetGoalId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | GoalsService& _service; 16 | int _goalId; 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Clerk/Data/DataConnection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace Clerk { 7 | namespace Data { 8 | class DataConnection { 9 | public: 10 | DataConnection(std::string&& path); 11 | ~DataConnection(); 12 | 13 | void Open(); 14 | void Close(); 15 | sqlite3* GetConnection(); 16 | void CreateDatabase(); 17 | 18 | private: 19 | std::string _path; 20 | sqlite3* _connection; 21 | }; 22 | }; 23 | }; -------------------------------------------------------------------------------- /Clerk/Data/Repositories/BaseRepository.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "../DataConnection.h" 7 | #include "../Models/Model.h" 8 | 9 | namespace Clerk { 10 | namespace Data { 11 | class BaseRepository 12 | { 13 | public: 14 | BaseRepository(DataConnection& connection); 15 | sqlite3* GetConnection(); 16 | 17 | protected: 18 | DataConnection& _connection; 19 | }; 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Clerk/Data/Repositories/ReportsRepository.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "BaseRepository.h" 7 | #include "../Models/ReportModel.h" 8 | 9 | namespace Clerk { 10 | namespace Data { 11 | class ReportsRepository : BaseRepository { 12 | public: 13 | using BaseRepository::BaseRepository; 14 | 15 | std::vector GetAll(); 16 | ReportModel* GetById(int id); 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Clerk/Commands/Account/EditAccountCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class EditAccountCommand : public Command { 9 | public: 10 | EditAccountCommand(ICommandsReceiver& receiver); 11 | void SetAccountId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | ICommandsReceiver& _receiver; 16 | int _accountId; 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Clerk/Commands/Account/NewAccountCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "NewAccountCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | NewAccountCommand::NewAccountCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _accountType(AccountType::Deposit) { 8 | } 9 | 10 | void NewAccountCommand::SetAccountType(AccountType type) { 11 | _accountType = type; 12 | } 13 | 14 | void NewAccountCommand::Execute() { 15 | _receiver.OpenNewAccountDialog(_accountType); 16 | } -------------------------------------------------------------------------------- /Clerk/Commands/Budget/EditBudgetCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class EditBudgetCommand : public Command { 9 | public: 10 | EditBudgetCommand(ICommandsReceiver& receiver); 11 | void SetBudgetId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | ICommandsReceiver& _receiver; 16 | int _budgetId; 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Clerk/Commands/Goal/DeleteGoalCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "DeleteGoalCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | DeleteGoalCommand::DeleteGoalCommand(GoalsService& service): 6 | _service(service), 7 | _goalId(-1) { 8 | } 9 | 10 | void DeleteGoalCommand::SetGoalId(int id) { 11 | _goalId = id; 12 | } 13 | 14 | void DeleteGoalCommand::Execute() { 15 | auto goal = _service.GetById(_goalId); 16 | 17 | if (goal) { 18 | _service.Delete(*goal); 19 | } 20 | } -------------------------------------------------------------------------------- /Clerk/Commands/Alert/DeleteAlertCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../../Data/Services/AlertsService.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class DeleteAlertCommand : public Command { 9 | public: 10 | DeleteAlertCommand(AlertsService& service); 11 | void SetAlertId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | AlertsService& _service; 16 | int _alertId; 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Clerk/Commands/Transaction/CopyTransactionCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "CopyTransactionCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | CopyTransactionCommand::CopyTransactionCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _transactionId(-1) { 8 | } 9 | 10 | void CopyTransactionCommand::SetTransactionId(int id) { 11 | _transactionId = id; 12 | } 13 | 14 | void CopyTransactionCommand::Execute() { 15 | _receiver.CopyTransaction(_transactionId); 16 | } -------------------------------------------------------------------------------- /Clerk/Commands/Transaction/EditTransactionCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "EditTransactionCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | EditTransactionCommand::EditTransactionCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _transactionId(-1) { 8 | } 9 | 10 | void EditTransactionCommand::SetTransactionId(int id) { 11 | _transactionId = id; 12 | } 13 | 14 | void EditTransactionCommand::Execute() { 15 | _receiver.EditTransaction(_transactionId); 16 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/BudgetModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "Model.h" 6 | #include "../Enums.h" 7 | 8 | namespace Clerk { 9 | namespace Data { 10 | class BudgetModel : public Model 11 | { 12 | public: 13 | BudgetModel(); 14 | 15 | std::wstring name; 16 | float amount; 17 | BudgetPeriod period; 18 | std::wstring date; 19 | std::wstring created; 20 | std::wstring accountsIds; 21 | }; 22 | } 23 | } -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/TagPresentationModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../Models/TagModel.h" 5 | 6 | namespace Clerk { 7 | namespace Data { 8 | class TagPresentationModel { 9 | public: 10 | TagPresentationModel(); 11 | TagPresentationModel(TagModel& tag); 12 | 13 | int id; 14 | wxString name; 15 | int count; 16 | 17 | operator TagModel& (); 18 | 19 | private: 20 | TagModel& GetModel(); 21 | }; 22 | } 23 | } -------------------------------------------------------------------------------- /Clerk/Commands/Budget/DeleteBudgetCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../../Data/Services/BudgetsService.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class DeleteBudgetCommand : public Command { 9 | public: 10 | DeleteBudgetCommand(BudgetsService& service); 11 | void SetBudgetId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | BudgetsService& _service; 16 | int _budgetId; 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Clerk/Commands/Alert/DeleteAlertCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "DeleteAlertCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | DeleteAlertCommand::DeleteAlertCommand(AlertsService& service): 6 | _service(service), 7 | _alertId(-1) { 8 | } 9 | 10 | void DeleteAlertCommand::SetAlertId(int id) { 11 | _alertId = id; 12 | } 13 | 14 | void DeleteAlertCommand::Execute() { 15 | auto alert = _service.GetById(_alertId); 16 | 17 | if (alert) { 18 | _service.Delete(*alert); 19 | } 20 | } -------------------------------------------------------------------------------- /Clerk/Commands/Transaction/NewTransactionCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class NewTransactionCommand : public Command { 9 | public: 10 | NewTransactionCommand(ICommandsReceiver& _receiver); 11 | void SetAccountId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | ICommandsReceiver& _receiver; 16 | int _accountId; 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Clerk/Commands/Transaction/SplitTransactionCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "SplitTransactionCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | SplitTransactionCommand::SplitTransactionCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _transactionId(-1) { 8 | } 9 | 10 | void SplitTransactionCommand::SetTransactionId(int id) { 11 | _transactionId = id; 12 | } 13 | 14 | void SplitTransactionCommand::Execute() { 15 | _receiver.SplitTransaction(_transactionId); 16 | } -------------------------------------------------------------------------------- /Clerk/Commands/Account/ArchiveAccountCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../../Data/Services/AccountsService.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class ArchiveAccountCommand : public Command { 9 | public: 10 | ArchiveAccountCommand(AccountsService& service); 11 | void SetAccountId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | AccountsService& _service; 16 | int _accountId; 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Clerk/Commands/Account/InterestAccrualCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class InterestAccrualCommand : public Command { 9 | public: 10 | InterestAccrualCommand(ICommandsReceiver& receiver); 11 | void SetAccountId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | ICommandsReceiver& _receiver; 16 | int _accountId; 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Clerk/Commands/Account/RestoreAccountCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../../Data/Services/AccountsService.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class RestoreAccountCommand : public Command { 9 | public: 10 | RestoreAccountCommand(AccountsService& service); 11 | void SetAccountId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | AccountsService& _service; 16 | int _accountId; 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Clerk/Commands/Scheduler/EditSchedulerCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class EditSchedulerCommand : public Command { 9 | public: 10 | EditSchedulerCommand(ICommandsReceiver& _receiver); 11 | void SetSchedulerId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | ICommandsReceiver& _receiver; 16 | int _schedulerId; 17 | }; 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Clerk/Commands/Transaction/CopyTransactionCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class CopyTransactionCommand : public Command { 9 | public: 10 | CopyTransactionCommand(ICommandsReceiver& _receiver); 11 | void SetTransactionId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | ICommandsReceiver& _receiver; 16 | int _transactionId; 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Clerk/Commands/Transaction/EditTransactionCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class EditTransactionCommand : public Command { 9 | public: 10 | EditTransactionCommand(ICommandsReceiver& _receiver); 11 | void SetTransactionId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | ICommandsReceiver& _receiver; 16 | int _transactionId; 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Clerk/UI/TreeMenu/TreeContextMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Data/DataContext.h" 5 | #include "../../Utils/Icons.h" 6 | 7 | using namespace Clerk::Commands; 8 | using namespace Clerk::Utils; 9 | 10 | namespace Clerk { 11 | namespace UI { 12 | class TreeContextMenu : public wxMenu { 13 | public: 14 | TreeContextMenu(DataContext& context, Icons& icons); 15 | 16 | protected: 17 | DataContext& _context; 18 | Icons& _icons; 19 | }; 20 | } 21 | } -------------------------------------------------------------------------------- /Clerk/Commands/Budget/DeleteBudgetCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "DeleteBudgetCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | DeleteBudgetCommand::DeleteBudgetCommand(BudgetsService& service): 6 | _service(service), 7 | _budgetId(-1) { 8 | } 9 | 10 | void DeleteBudgetCommand::SetBudgetId(int id) { 11 | _budgetId = id; 12 | } 13 | 14 | void DeleteBudgetCommand::Execute() { 15 | auto budget = _service.GetById(_budgetId); 16 | 17 | if (budget) { 18 | _service.Delete(*budget); 19 | } 20 | } -------------------------------------------------------------------------------- /Clerk/Commands/Scheduler/RunSchedulerCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../../Data/Services/SchedulersService.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class RunSchedulerCommand : public Command { 9 | public: 10 | RunSchedulerCommand(SchedulersService& service); 11 | void SetSchedulerId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | SchedulersService& _service; 16 | int _schedulerId; 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Clerk/Commands/Transaction/SplitTransactionCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class SplitTransactionCommand : public Command { 9 | public: 10 | SplitTransactionCommand(ICommandsReceiver& _receiver); 11 | void SetTransactionId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | ICommandsReceiver& _receiver; 16 | int _transactionId; 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/SchedulerModel.cpp: -------------------------------------------------------------------------------- 1 | #include "SchedulerModel.h" 2 | 3 | SchedulerModel::SchedulerModel() 4 | { 5 | id = -1; 6 | name = std::wstring(); 7 | type = SchedulerType::Daily; 8 | day = 1; 9 | week = 1; 10 | month = 1; 11 | fromAccountId = -1; 12 | toAccountId = -1; 13 | fromAmount = 0; 14 | toAmount = 0; 15 | tagsIds = std::wstring(); 16 | previousDate = std::wstring(); 17 | nextDate = std::wstring(); 18 | active = false; 19 | created = std::wstring(); 20 | } -------------------------------------------------------------------------------- /Clerk/UI/Controls/AmountField.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class AmountField: public wxTextCtrl 7 | { 8 | public: 9 | AmountField(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); 10 | ~AmountField(); 11 | 12 | float GetFloatValue(); 13 | 14 | private: 15 | wxString ClearAmountValue(wxString& value); 16 | float GetValueFromString(wxString& value); 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /Clerk/Commands/Scheduler/PauseSchedulerCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../../Data/Services/SchedulersService.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class PauseSchedulerCommand : public Command { 9 | public: 10 | PauseSchedulerCommand(SchedulersService& service); 11 | void SetSchedulerId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | SchedulersService& _service; 16 | int _schedulerId; 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Clerk/Commands/Scheduler/DeleteSchedulerCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../../Data/Services/SchedulersService.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class DeleteSchedulerCommand : public Command { 9 | public: 10 | DeleteSchedulerCommand(SchedulersService& service); 11 | void SetSchedulerId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | SchedulersService& _service; 16 | int _schedulerId; 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Clerk/Commands/Tabs/OpenReportTabCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | using namespace Clerk::UI; 7 | 8 | namespace Clerk { 9 | namespace Commands { 10 | class OpenReportTabCommand : public Command { 11 | public: 12 | OpenReportTabCommand(ICommandsReceiver& _receiver); 13 | void SetReportId(int id); 14 | void Execute() override; 15 | 16 | private: 17 | ICommandsReceiver& _receiver; 18 | int _reportId; 19 | }; 20 | } 21 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/TransactionModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "Model.h" 6 | 7 | namespace Clerk { 8 | namespace Data { 9 | class TransactionModel : public Model 10 | { 11 | public: 12 | TransactionModel(); 13 | 14 | int toAccountId; 15 | int fromAccountId; 16 | float fromAmount; 17 | float toAmount; 18 | std::wstring date; 19 | std::wstring note; 20 | std::wstring created; 21 | std::vector tagsIds; 22 | }; 23 | } 24 | } -------------------------------------------------------------------------------- /Clerk/UI/Goals/Enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace UI { 5 | enum class GoalContextMenuTypes { 6 | Add = 1, 7 | Edit = 2, 8 | Delete = 3, 9 | }; 10 | 11 | enum class GoalsListColumns 12 | { 13 | Name, 14 | DueDate, 15 | DaysRemain, 16 | Goal, 17 | Current, 18 | Remain, 19 | Progress, 20 | Last 21 | }; 22 | 23 | enum class GoalViewModelField { 24 | Name = 0, 25 | Date = 1, 26 | Amount = 2, 27 | Accounts = 3 28 | }; 29 | } 30 | } -------------------------------------------------------------------------------- /Clerk/UI/Reports/Tooltip/ReportChartTooltipPopup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "../../Data/PresentationModels/Types.h" 6 | #include "ReportChartTooltipPanel.h" 7 | 8 | class ReportChartTooltipPopup : public wxPopupWindow 9 | { 10 | public: 11 | ReportChartTooltipPopup(wxWindow* parent); 12 | 13 | void Update(wxString title, float total, std::vector values); 14 | 15 | private: 16 | ReportChartTooltipPanel* _panel; 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /Clerk/Commands/Tabs/OpenAccountTabCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | 6 | using namespace Clerk::UI; 7 | 8 | namespace Clerk { 9 | namespace Commands { 10 | class OpenAccountTabCommand : public Command { 11 | public: 12 | OpenAccountTabCommand(ICommandsReceiver& _receiver); 13 | void SetAccountId(int id); 14 | void Execute() override; 15 | 16 | private: 17 | ICommandsReceiver& _receiver; 18 | int _accountId; 19 | }; 20 | } 21 | } -------------------------------------------------------------------------------- /Clerk/Commands/Account/ArchiveAccountCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "ArchiveAccountCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | ArchiveAccountCommand::ArchiveAccountCommand(AccountsService& service): 6 | _service(service), 7 | _accountId(-1) { 8 | } 9 | 10 | void ArchiveAccountCommand::SetAccountId(int id) { 11 | _accountId = id; 12 | } 13 | 14 | void ArchiveAccountCommand::Execute() { 15 | auto account = _service.GetById(_accountId); 16 | 17 | if (account) { 18 | _service.Archive(*account); 19 | } 20 | } -------------------------------------------------------------------------------- /Clerk/Commands/Account/RestoreAccountCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "RestoreAccountCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | RestoreAccountCommand::RestoreAccountCommand(AccountsService& service) : 6 | _service(service), 7 | _accountId(-1) { 8 | } 9 | 10 | void RestoreAccountCommand::SetAccountId(int id) { 11 | _accountId = id; 12 | } 13 | 14 | void RestoreAccountCommand::Execute() { 15 | auto account = _service.GetById(_accountId); 16 | 17 | if (account) { 18 | _service.Restore(*account); 19 | } 20 | } -------------------------------------------------------------------------------- /Clerk/Commands/Transaction/DeleteTransactionCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../../Data/Services/TransactionsService.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class DeleteTransactionCommand : public Command { 9 | public: 10 | DeleteTransactionCommand(TransactionsService& service); 11 | void SetTransactionId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | TransactionsService& _service; 16 | int _transactionId; 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Clerk/Commands/Scheduler/RunSchedulerCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "RunSchedulerCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | RunSchedulerCommand::RunSchedulerCommand(SchedulersService& service) : 6 | _service(service), 7 | _schedulerId(-1) { 8 | } 9 | 10 | void RunSchedulerCommand::SetSchedulerId(int id) { 11 | _schedulerId = id; 12 | } 13 | 14 | void RunSchedulerCommand::Execute() { 15 | auto scheduler = _service.GetById(_schedulerId); 16 | 17 | if (scheduler) { 18 | _service.Run(*scheduler); 19 | } 20 | } -------------------------------------------------------------------------------- /Clerk/Commands/Tabs/OpenAccountsTabCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "OpenAccountsTabCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | OpenAccountsTabCommand::OpenAccountsTabCommand(ICommandsReceiver& receiver): 6 | _receiver(receiver), 7 | _accountType(std::nullopt) { 8 | } 9 | 10 | void OpenAccountsTabCommand::SetAccountType(AccountType type) { 11 | _accountType = type; 12 | } 13 | 14 | void OpenAccountsTabCommand::Execute() { 15 | _receiver.OpenAccountsTab(_accountType); 16 | 17 | _accountType = std::nullopt; 18 | } -------------------------------------------------------------------------------- /Clerk/UI/Budgets/Enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace UI { 5 | enum class BudgetContextMenuTypes { 6 | Add = 1, 7 | Edit = 2, 8 | Delete = 3, 9 | }; 10 | 11 | enum class BudgetsListColumns 12 | { 13 | Name, 14 | Period, 15 | Limit, 16 | Current, 17 | Remain, 18 | Progress, 19 | Last 20 | }; 21 | 22 | enum class BudgetViewModelField { 23 | Name = 0, 24 | Period = 1, 25 | Date = 2, 26 | Amount = 3, 27 | Accounts = 4 28 | }; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Clerk/Commands/Transaction/DuplicateTransactionCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../../Data/Services/TransactionsService.h" 5 | 6 | namespace Clerk { 7 | namespace Commands { 8 | class DuplicateTransactionCommand : public Command { 9 | public: 10 | DuplicateTransactionCommand(TransactionsService& service); 11 | void SetTransactionId(int id); 12 | void Execute() override; 13 | 14 | private: 15 | TransactionsService& _service; 16 | int _transactionId; 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/AccountModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "Model.h" 6 | #include "../Enums.h" 7 | 8 | namespace Clerk { 9 | namespace Data { 10 | class AccountModel : public Model 11 | { 12 | public: 13 | AccountModel(); 14 | 15 | std::wstring name; 16 | std::wstring note; 17 | AccountType type; 18 | int iconId; 19 | int orderId; 20 | int currencyId; 21 | float creditLimit; 22 | bool isActive; 23 | std::wstring created; 24 | }; 25 | } 26 | } -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/CurrencyPresentationModel.cpp: -------------------------------------------------------------------------------- 1 | #include "CurrencyPresentationModel.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | CurrencyPresentationModel::CurrencyPresentationModel() { 6 | id = -1; 7 | name = wxString(""); 8 | shortName = wxString(""); 9 | sign = wxString(""); 10 | } 11 | 12 | CurrencyPresentationModel::CurrencyPresentationModel(CurrencyModel& model) { 13 | id = model.id; 14 | name = wxString(model.name); 15 | shortName = wxString(model.shortName); 16 | sign = wxString(model.sign); 17 | } -------------------------------------------------------------------------------- /Clerk/UI/Tabs/Enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace UI { 5 | enum class TabsContextMenuType { 6 | Left = 1, 7 | Right = 2, 8 | Close = 3 9 | }; 10 | 11 | enum class TabType { 12 | Dashboard = 0, 13 | Transactions = 1, 14 | Deposits = 2, 15 | Receipts = 3, 16 | Expenses = 4, 17 | Debts = 5, 18 | Virtual = 6, 19 | Reports = 7, 20 | Budgets = 8, 21 | Schedulers = 9, 22 | Goals = 10, 23 | Tags = 11, 24 | Alerts = 12, 25 | Trash = 13 26 | }; 27 | } 28 | } -------------------------------------------------------------------------------- /Clerk/Commands/Scheduler/PauseSchedulerCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "PauseSchedulerCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | PauseSchedulerCommand::PauseSchedulerCommand(SchedulersService& service) : 6 | _service(service), 7 | _schedulerId(-1) { 8 | } 9 | 10 | void PauseSchedulerCommand::SetSchedulerId(int id) { 11 | _schedulerId = id; 12 | } 13 | 14 | void PauseSchedulerCommand::Execute() { 15 | auto scheduler = _service.GetById(_schedulerId); 16 | 17 | if (scheduler) { 18 | _service.Pause(*scheduler); 19 | } 20 | } -------------------------------------------------------------------------------- /Clerk/Commands/Tabs/OpenTabCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | #include "../../UI/Tabs/Enums.h" 6 | 7 | using namespace Clerk::UI; 8 | 9 | namespace Clerk { 10 | namespace Commands { 11 | class OpenTabCommand : public Command { 12 | public: 13 | OpenTabCommand(ICommandsReceiver& _receiver); 14 | void SetType(TabType type); 15 | void Execute() override; 16 | 17 | private: 18 | ICommandsReceiver& _receiver; 19 | TabType _tabType; 20 | }; 21 | } 22 | } -------------------------------------------------------------------------------- /Clerk/Commands/Scheduler/DeleteSchedulerCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "DeleteSchedulerCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | DeleteSchedulerCommand::DeleteSchedulerCommand(SchedulersService& service): 6 | _service(service), 7 | _schedulerId(-1) { 8 | } 9 | 10 | void DeleteSchedulerCommand::SetSchedulerId(int id) { 11 | _schedulerId = id; 12 | } 13 | 14 | void DeleteSchedulerCommand::Execute() { 15 | auto scheduler = _service.GetById(_schedulerId); 16 | 17 | if (scheduler) { 18 | _service.Delete(*scheduler); 19 | } 20 | } -------------------------------------------------------------------------------- /Clerk/Data/Models/AlertModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Model.h" 5 | #include "../Enums.h" 6 | 7 | namespace Clerk { 8 | namespace Data { 9 | class AlertModel : public Model 10 | { 11 | public: 12 | AlertModel(); 13 | 14 | std::wstring name; 15 | std::wstring message; 16 | AlertType type; 17 | AlertPeriod period; 18 | AlertCondition condition; 19 | AlertImportance importance; 20 | float amount; 21 | std::wstring accountIds; 22 | std::wstring created; 23 | }; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Clerk/UI/DataPanel/DataPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../Tabs/Enums.h" 5 | #include "../../Data/DataContext.h" 6 | #include "../../Utils/Icons.h" 7 | 8 | using namespace Clerk::Data; 9 | using namespace Clerk::UI; 10 | using namespace Clerk::Utils; 11 | 12 | class DataPanel : public wxPanel 13 | { 14 | public: 15 | DataPanel(wxWindow* parent, DataContext& context, Icons& icons); 16 | virtual void Update(); 17 | 18 | TabType type; 19 | int id; 20 | 21 | protected: 22 | DataContext& _context; 23 | Icons& _icons; 24 | }; -------------------------------------------------------------------------------- /Clerk/Clerk.h: -------------------------------------------------------------------------------- 1 | #include "wx/wx.h" 2 | #include 3 | #include "UI/MainWindow.h" 4 | #include "Data/DataConnection.h" 5 | #include "Data/DataContext.h" 6 | #include "Utils/Icons.h" 7 | 8 | using namespace Clerk::Data; 9 | using namespace Clerk::Utils; 10 | 11 | class ClerkApp : public wxApp { 12 | virtual bool OnInit(); 13 | virtual int OnExit(); 14 | 15 | private: 16 | DataConnection* _connection{}; 17 | DataContext* _context{}; 18 | Icons* _icons{}; 19 | wxLocale* _locale; 20 | 21 | void InitLocale(); 22 | void InitContext(); 23 | }; -------------------------------------------------------------------------------- /Clerk/Commands/Account/NewAccountCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Command.h" 4 | #include "../ICommandsReceiver.h" 5 | #include "../../Data/Enums.h" 6 | 7 | using namespace Clerk::Data; 8 | 9 | namespace Clerk { 10 | namespace Commands { 11 | class NewAccountCommand : public Command { 12 | public: 13 | NewAccountCommand(ICommandsReceiver& receiver); 14 | void SetAccountType(AccountType type); 15 | void Execute() override; 16 | 17 | private: 18 | ICommandsReceiver& _receiver; 19 | AccountType _accountType; 20 | }; 21 | } 22 | } -------------------------------------------------------------------------------- /Clerk/Utils/EventEmitter/EventEmitter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace Clerk { 8 | namespace Utils { 9 | class EventEmitter { 10 | public: 11 | EventEmitter(); 12 | ~EventEmitter(); 13 | unsigned int Subscribe(std::function function); 14 | void Unsubscribe(unsigned int key); 15 | void Emit(); 16 | void Clear(); 17 | 18 | private: 19 | unsigned int _subscribeId; 20 | std::map> _subscriptions; 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Clerk/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Resource.rc 4 | // 5 | #define IDI_ICON1 101 6 | #define APP_ICON 101 7 | 8 | // Next default values for new objects 9 | // 10 | #ifdef APSTUDIO_INVOKED 11 | #ifndef APSTUDIO_READONLY_SYMBOLS 12 | #define _APS_NEXT_RESOURCE_VALUE 102 13 | #define _APS_NEXT_COMMAND_VALUE 40001 14 | #define _APS_NEXT_CONTROL_VALUE 1001 15 | #define _APS_NEXT_SYMED_VALUE 101 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /Clerk/Commands/Transaction/DeleteTransactionCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "DeleteTransactionCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | DeleteTransactionCommand::DeleteTransactionCommand(TransactionsService& service): 6 | _service(service), 7 | _transactionId(-1) 8 | { 9 | } 10 | 11 | void DeleteTransactionCommand::SetTransactionId(int id) { 12 | _transactionId = id; 13 | } 14 | 15 | void DeleteTransactionCommand::Execute() { 16 | auto transaction = _service.GetById(_transactionId); 17 | 18 | if (transaction) { 19 | _service.Delete(*transaction); 20 | } 21 | } -------------------------------------------------------------------------------- /Clerk/UI/TreeMenu/DefaultContextMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Enums.h" 5 | #include "TreeContextMenu.h" 6 | 7 | using namespace Clerk::Data; 8 | using namespace Clerk::Commands; 9 | using namespace Clerk::UI; 10 | 11 | namespace Clerk { 12 | namespace UI { 13 | class DefaultContextMenu : public TreeContextMenu { 14 | public: 15 | DefaultContextMenu(DataContext& context, Icons& icons, TreeMenuItemType type); 16 | 17 | private: 18 | TreeMenuItemType _type; 19 | 20 | void OnMenuSelect(wxCommandEvent& event); 21 | }; 22 | } 23 | } -------------------------------------------------------------------------------- /Clerk/Commands/Tabs/OpenAccountsTabCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../Command.h" 5 | #include "../ICommandsReceiver.h" 6 | 7 | using namespace Clerk::UI; 8 | 9 | namespace Clerk { 10 | namespace Commands { 11 | class OpenAccountsTabCommand : public Command { 12 | public: 13 | OpenAccountsTabCommand(ICommandsReceiver& _receiver); 14 | void SetAccountType(AccountType type); 15 | void Execute() override; 16 | 17 | private: 18 | ICommandsReceiver& _receiver; 19 | std::optional _accountType; 20 | }; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Clerk/Commands/Transaction/DuplicateTransactionCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "DuplicateTransactionCommand.h" 2 | 3 | using namespace Clerk::Commands; 4 | 5 | DuplicateTransactionCommand::DuplicateTransactionCommand(TransactionsService& service) : 6 | _service(service), 7 | _transactionId(-1) 8 | { 9 | } 10 | 11 | void DuplicateTransactionCommand::SetTransactionId(int id) { 12 | _transactionId = id; 13 | } 14 | 15 | void DuplicateTransactionCommand::Execute() { 16 | auto transaction = _service.GetById(_transactionId); 17 | 18 | if (transaction) { 19 | _service.Duplicate(*transaction); 20 | } 21 | } -------------------------------------------------------------------------------- /Clerk/UI/Account/Enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace UI { 5 | enum class AccountViewModelField { 6 | Name = 0, 7 | Type = 1, 8 | Icon = 2, 9 | InitialAmount = 3, 10 | Note = 4, 11 | Currency = 5, 12 | CreditLimit = 6, 13 | }; 14 | } 15 | } 16 | 17 | namespace Clerk { 18 | namespace UI { 19 | enum class InterestAccrualViewModelField { 20 | Amount = 0, 21 | Percent = 1, 22 | Type = 2 23 | }; 24 | } 25 | } 26 | 27 | namespace Clerk { 28 | namespace UI { 29 | enum class AccrualType { 30 | Amount = 0, 31 | Percent = 1 32 | }; 33 | } 34 | } -------------------------------------------------------------------------------- /Clerk/UI/Charts/BarChart.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "../../Data/PresentationModels/Types.h" 8 | #include "../../Utils/Utils.h" 9 | 10 | using namespace Clerk::Data; 11 | using namespace Clerk::Utils; 12 | 13 | class BarChart : public wxPanel { 14 | public: 15 | BarChart(wxWindow *parent); 16 | ~BarChart(); 17 | 18 | void SetValues(std::vector values); 19 | void Draw(); 20 | 21 | private: 22 | std::vector _values; 23 | 24 | void OnPaint(wxPaintEvent& event); 25 | }; -------------------------------------------------------------------------------- /Clerk/UI/Transactions/TransactionsTagsRender.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "wx/dataview.h" 5 | #include "../../Utils/Utils.h" 6 | 7 | class TransactionsTagsRender : public wxDataViewCustomRenderer 8 | { 9 | public: 10 | TransactionsTagsRender(); 11 | ~TransactionsTagsRender(); 12 | 13 | virtual bool Render(wxRect rect, wxDC *dc, int state) wxOVERRIDE; 14 | virtual wxSize GetSize() const wxOVERRIDE; 15 | virtual bool SetValue(const wxVariant &value) wxOVERRIDE; 16 | virtual bool GetValue(wxVariant &WXUNUSED(value)) const wxOVERRIDE; 17 | 18 | private: 19 | wxArrayString _value; 20 | }; 21 | -------------------------------------------------------------------------------- /Clerk/UI/Transactions/TransactionsAmountRender.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "wx/dataview.h" 5 | #include "../../Utils/Utils.h" 6 | 7 | class TransactionsAmountRender : public wxDataViewCustomRenderer 8 | { 9 | public: 10 | TransactionsAmountRender(); 11 | ~TransactionsAmountRender(); 12 | 13 | virtual bool Render(wxRect rect, wxDC *dc, int state) wxOVERRIDE; 14 | virtual wxSize GetSize() const wxOVERRIDE; 15 | virtual bool SetValue(const wxVariant &value) wxOVERRIDE; 16 | virtual bool GetValue(wxVariant &WXUNUSED(value)) const wxOVERRIDE; 17 | 18 | private: 19 | wxArrayString _value; 20 | }; 21 | -------------------------------------------------------------------------------- /Clerk/Data/Repositories/TagsRepository.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "BaseRepository.h" 7 | #include "../Models/TagModel.h" 8 | 9 | namespace Clerk { 10 | namespace Data { 11 | class TagsRepository : BaseRepository { 12 | public: 13 | using BaseRepository::BaseRepository; 14 | 15 | std::vector GetAll(); 16 | TagModel* GetById(int id); 17 | int GetCount(int id); 18 | int Save(const TagModel& tag); 19 | void Delete(const TagModel& tag); 20 | 21 | private: 22 | TagModel* Load(int id); 23 | }; 24 | } 25 | } 26 | #pragma once 27 | -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/TagPresentationModel.cpp: -------------------------------------------------------------------------------- 1 | #include "TagPresentationModel.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | TagPresentationModel::TagPresentationModel() { 6 | id = -1; 7 | name = ""; 8 | count = 0; 9 | } 10 | 11 | TagPresentationModel::TagPresentationModel(TagModel& tag) { 12 | id = tag.id; 13 | name = wxString(tag.name); 14 | count = 0; 15 | } 16 | 17 | TagPresentationModel::operator TagModel& () { 18 | return GetModel(); 19 | } 20 | 21 | TagModel& TagPresentationModel::GetModel() { 22 | TagModel* model = new TagModel(); 23 | 24 | model->id = id; 25 | model->name = name; 26 | 27 | return *model; 28 | } -------------------------------------------------------------------------------- /Clerk/Data/Repositories/AlertsRepository.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "BaseRepository.h" 6 | #include "../Models/AlertModel.h" 7 | 8 | namespace Clerk { 9 | namespace Data { 10 | class AlertsRepository : BaseRepository { 11 | public: 12 | using BaseRepository::BaseRepository; 13 | 14 | AlertModel* GetById(int id); 15 | std::vector GetAll(); 16 | float GetBalance(const std::wstring& accountsIds); 17 | int Save(const AlertModel& alert); 18 | void Delete(const AlertModel& alert); 19 | 20 | private: 21 | AlertModel* Load(int id); 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Clerk/UI/Alerts/Enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace UI { 5 | enum class AlertContextMenuTypes { 6 | Add = 1, 7 | Edit = 2, 8 | Delete = 3, 9 | }; 10 | 11 | enum class AlertsListColumns 12 | { 13 | Name, 14 | Message, 15 | Type, 16 | Period, 17 | Condition, 18 | Importance, 19 | Amount, 20 | Remain, 21 | Progress, 22 | Last 23 | }; 24 | 25 | enum class AlertViewModelField { 26 | Name = 0, 27 | Message = 1, 28 | Type = 2, 29 | Period = 3, 30 | Condition = 4, 31 | Importance = 5, 32 | Amount = 6, 33 | Accounts = 7 34 | }; 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Clerk/UI/Controls/DataViewProgressRender.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "wx/dataview.h" 5 | #include "../../Utils/Utils.h" 6 | 7 | using namespace Clerk::Utils; 8 | 9 | class DataViewProgressRender : public wxDataViewCustomRenderer 10 | { 11 | public: 12 | DataViewProgressRender(bool isReverse); 13 | 14 | virtual bool Render(wxRect rect, wxDC *dc, int state) wxOVERRIDE; 15 | virtual wxSize GetSize() const wxOVERRIDE; 16 | virtual bool SetValue(const wxVariant &value) wxOVERRIDE; 17 | virtual bool GetValue(wxVariant &WXUNUSED(value)) const wxOVERRIDE; 18 | 19 | private: 20 | float _value{}; 21 | bool _isReverse; 22 | }; -------------------------------------------------------------------------------- /Clerk/UI/Transactions/Enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace UI { 5 | enum class TransactionContextMenuType { 6 | Add = 1, 7 | Edit = 2, 8 | Delete = 3, 9 | Duplicate = 4, 10 | Split = 5, 11 | Merge = 6, 12 | Copy = 7, 13 | }; 14 | 15 | enum class TransactionsListColumns 16 | { 17 | Date, 18 | FromAccount, 19 | ToAccount, 20 | Tags, 21 | Note, 22 | Amount, 23 | Last 24 | }; 25 | 26 | enum class TransactionViewModelField { 27 | FromAccount = 0, 28 | ToAccount = 1, 29 | FromAmount = 2, 30 | ToAmount = 3, 31 | Date = 4, 32 | Tags = 5, 33 | Note = 6, 34 | }; 35 | } 36 | } -------------------------------------------------------------------------------- /Clerk/Data/Repositories/GoalsRepository.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "BaseRepository.h" 8 | #include "../Models/GoalModel.h" 9 | 10 | namespace Clerk { 11 | namespace Data { 12 | class GoalsRepository : BaseRepository { 13 | public: 14 | using BaseRepository::BaseRepository; 15 | 16 | GoalModel* GetById(int id); 17 | std::vector GetAll(); 18 | float GetBalance(std::string accountsIds); 19 | 20 | int Save(const GoalModel& goal); 21 | void Delete(const GoalModel& goal); 22 | 23 | private: 24 | GoalModel* Load(int id); 25 | }; 26 | } 27 | } -------------------------------------------------------------------------------- /Clerk/UI/Schedulers/Enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace UI { 5 | enum class SchedulerContextMenuTypes { 6 | Add = 1, 7 | Edit = 2, 8 | Delete = 3, 9 | Run = 4, 10 | Pause = 5 11 | }; 12 | 13 | enum class SchedulersListColumns 14 | { 15 | Name, 16 | Type, 17 | Amount, 18 | NextDate, 19 | DaysLeft, 20 | Status, 21 | Last 22 | }; 23 | 24 | enum class SchedulerViewModelField { 25 | Name = 0, 26 | FromAccount = 1, 27 | ToAccount = 2, 28 | FromAmount = 3, 29 | ToAmount = 4, 30 | Tags = 5, 31 | Type = 6, 32 | Day = 7, 33 | Week = 8, 34 | Month = 9 35 | }; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Clerk/Data/Services/ReportsService.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Utils/Types.h" 4 | #include "../Repositories/ReportsRepository.h" 5 | #include "../PresentationModels/ReportPresentationModel.h" 6 | #include "HashService.h" 7 | 8 | namespace Clerk { 9 | namespace Data { 10 | class ReportsService : HashService> { 11 | public: 12 | ReportsService(ReportsRepository& reportsRepository); 13 | 14 | std::shared_ptr GetById(int id); 15 | shared_vector GetAll(); 16 | 17 | private: 18 | ReportsRepository& _reportsRepository; 19 | }; 20 | } 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /Clerk/UI/TreeMenu/ReportContextMenu.cpp: -------------------------------------------------------------------------------- 1 | #include "ReportContextMenu.h" 2 | 3 | const int reportOffset = 1000; 4 | 5 | ReportContextMenu::ReportContextMenu(DataContext& context, Icons& icons, ReportPresentationModel& report): 6 | TreeContextMenu(context, icons), 7 | _report(report) 8 | { 9 | wxMenuItem* item = Append(static_cast(TreeContextMenuType::NewTab), _("Open in New Tab")); 10 | item->SetBitmap(_icons.GetIconByType(IconType::Tab)); 11 | 12 | Bind(wxEVT_COMMAND_MENU_SELECTED, &ReportContextMenu::OnMenuSelect, this); 13 | } 14 | 15 | void ReportContextMenu::OnMenuSelect(wxCommandEvent& event) { 16 | _context.GetCommandsInvoker().OpenReportTab(_report.id); 17 | } -------------------------------------------------------------------------------- /Clerk/Data/Repositories/CurrenciesRepository.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "BaseRepository.h" 7 | #include "../Models/CurrencyModel.h" 8 | #include "../../Utils/Types.h" 9 | 10 | namespace Clerk { 11 | namespace Data { 12 | class CurrenciesRepository : public BaseRepository { 13 | public: 14 | using BaseRepository::BaseRepository; 15 | 16 | CurrencyModel* GetById(int id); 17 | std::vector GetAll(); 18 | exhange_rate_map LoadExchangeRates(); 19 | 20 | private: 21 | CurrencyModel* Load(int id); 22 | 23 | int _baseCurrencyId; 24 | }; 25 | } 26 | } 27 | #pragma once 28 | -------------------------------------------------------------------------------- /Clerk/Data/Models/SchedulerModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Model.h" 5 | #include "../Enums.h" 6 | 7 | using namespace Clerk::Data; 8 | 9 | namespace Clerk { 10 | namespace Data { 11 | class SchedulerModel : public Model 12 | { 13 | public: 14 | SchedulerModel(); 15 | 16 | std::wstring name; 17 | SchedulerType type; 18 | int day; 19 | int week; 20 | int month; 21 | int fromAccountId; 22 | int toAccountId; 23 | float fromAmount; 24 | float toAmount; 25 | std::wstring tagsIds; 26 | std::wstring previousDate; 27 | std::wstring nextDate; 28 | bool active; 29 | std::wstring created; 30 | }; 31 | } 32 | } -------------------------------------------------------------------------------- /Clerk/UI/Reports/Tooltip/ReportChartTooltipPopup.cpp: -------------------------------------------------------------------------------- 1 | #include "ReportChartTooltipPopup.h" 2 | 3 | ReportChartTooltipPopup::ReportChartTooltipPopup(wxWindow* parent) : wxPopupWindow(parent) { 4 | wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL); 5 | 6 | _panel = new ReportChartTooltipPanel(this); 7 | mainSizer->Add(_panel, 1, wxEXPAND, 0); 8 | 9 | SetSizer(mainSizer); 10 | Layout(); 11 | } 12 | 13 | void ReportChartTooltipPopup::Update(wxString title, float total, std::vector values) { 14 | _panel->SetTotal(total); 15 | _panel->SetTitle(title); 16 | _panel->SetValues(values); 17 | 18 | _panel->Update(); 19 | 20 | SetClientSize(_panel->GetMinSize()); 21 | } -------------------------------------------------------------------------------- /Clerk/Data/Repositories/SchedulersRepository.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "BaseRepository.h" 9 | #include "../Models/SchedulerModel.h" 10 | 11 | namespace Clerk { 12 | namespace Data { 13 | class SchedulersRepository : BaseRepository { 14 | public: 15 | using BaseRepository::BaseRepository; 16 | 17 | SchedulerModel* GetById(int id); 18 | std::vector GetAll(); 19 | int Save(const SchedulerModel& scheduler); 20 | void Delete(const SchedulerModel& scheduler); 21 | 22 | private: 23 | SchedulerModel* Load(int id); 24 | }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Clerk/UI/TreeMenu/ReportContextMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Data/PresentationModels/ReportPresentationModel.h" 5 | #include "Enums.h" 6 | #include "TreeContextMenu.h" 7 | 8 | using namespace Clerk::Data; 9 | using namespace Clerk::Commands; 10 | using namespace Clerk::UI; 11 | using namespace Clerk::Utils; 12 | 13 | namespace Clerk { 14 | namespace UI { 15 | class ReportContextMenu : public TreeContextMenu { 16 | public: 17 | ReportContextMenu(DataContext& context, Icons& icons, ReportPresentationModel& report); 18 | 19 | private: 20 | ReportPresentationModel& _report; 21 | 22 | void OnMenuSelect(wxCommandEvent& event); 23 | }; 24 | } 25 | } -------------------------------------------------------------------------------- /Clerk/UI/TagsField/TagPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "wx/wx.h" 4 | #include "../../Data/PresentationModels/TagPresentationModel.h" 5 | #include "../../Utils/Types.h" 6 | 7 | using namespace Clerk::Data; 8 | 9 | class TagPanel : public wxPanel 10 | { 11 | public: 12 | TagPanel(wxWindow* parent, const wxPoint& position = wxDefaultPosition, const wxSize& size = wxDefaultSize); 13 | 14 | void SetTag(std::shared_ptr tag); 15 | std::function)> OnDelete; 16 | 17 | private: 18 | std::shared_ptr _tag; 19 | 20 | wxBoxSizer* _mainSizer; 21 | wxStaticText* _label; 22 | 23 | void OnDeleteClick(wxCommandEvent& event); 24 | }; 25 | -------------------------------------------------------------------------------- /Clerk/UI/Dashboard/DashboardDebtsPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../../Data/PresentationModels/Types.h" 6 | #include "DashboardViewModel.h" 7 | 8 | using namespace Clerk::Data; 9 | using namespace Clerk::Utils; 10 | using namespace Clerk::UI; 11 | 12 | class DashboardDebtsPanel : public wxPanel 13 | { 14 | public: 15 | DashboardDebtsPanel(wxWindow *parent); 16 | 17 | void SetViewModel(DashboardViewModel* viewModel); 18 | 19 | private: 20 | DashboardViewModel* _viewModel{}; 21 | std::vector _values; 22 | float _totalValue = 0.0; 23 | 24 | void Update(); 25 | void Draw(wxPaintDC &dc); 26 | void OnPaint(wxPaintEvent& event); 27 | }; -------------------------------------------------------------------------------- /Clerk/UI/Dashboard/DashboardGoalsPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "../../Data/PresentationModels/Types.h" 6 | #include "../../Utils/Utils.h" 7 | #include "DashboardViewModel.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Utils; 11 | using namespace Clerk::UI; 12 | 13 | class DashboardGoalsPanel : public wxPanel 14 | { 15 | public: 16 | DashboardGoalsPanel(wxWindow *parent); 17 | 18 | void SetViewModel(DashboardViewModel* viewModel); 19 | 20 | 21 | private: 22 | DashboardViewModel* _viewModel{}; 23 | std::vector _values; 24 | 25 | void Update(); 26 | void Draw(wxPaintDC &dc); 27 | void OnPaint(wxPaintEvent& event); 28 | }; 29 | -------------------------------------------------------------------------------- /Clerk/Utils/EventEmitter/EventEmitter.cpp: -------------------------------------------------------------------------------- 1 | #include "EventEmitter.h" 2 | 3 | using namespace Clerk::Utils; 4 | 5 | EventEmitter::EventEmitter() { 6 | _subscribeId = 1; 7 | } 8 | EventEmitter::~EventEmitter() { 9 | _subscriptions.clear(); 10 | } 11 | 12 | unsigned int EventEmitter::Subscribe(std::function function) { 13 | _subscribeId++; 14 | 15 | _subscriptions[_subscribeId] = function; 16 | 17 | return _subscribeId; 18 | } 19 | 20 | void EventEmitter::Unsubscribe(unsigned int key) { 21 | _subscriptions.erase(key); 22 | } 23 | 24 | void EventEmitter::Emit() { 25 | for (const auto& [key, fn] : _subscriptions) { 26 | fn(); 27 | } 28 | } 29 | 30 | void EventEmitter::Clear() { 31 | _subscriptions.clear(); 32 | } -------------------------------------------------------------------------------- /Clerk/Data/Repositories/BudgetsRepository.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "BaseRepository.h" 8 | #include "../Models/BudgetModel.h" 9 | 10 | namespace Clerk { 11 | namespace Data { 12 | class BudgetsRepository : BaseRepository { 13 | public: 14 | using BaseRepository::BaseRepository; 15 | 16 | BudgetModel* GetById(int id); 17 | std::vector GetAll(); 18 | float GetExpenses(std::string accountsIds, std::string& fromDate, std::string& toDate); 19 | int Save(const BudgetModel& budget); 20 | void Delete(const BudgetModel& budget); 21 | 22 | private: 23 | BudgetModel* Load(int id); 24 | }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/GoalPresentationModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../Models/GoalModel.h" 6 | 7 | using namespace Clerk::Utils; 8 | 9 | namespace Clerk { 10 | namespace Data { 11 | class GoalPresentationModel { 12 | public: 13 | GoalPresentationModel(); 14 | GoalPresentationModel(GoalModel& goal); 15 | 16 | int id; 17 | wxString name; 18 | float amount; 19 | float balance; 20 | wxDateTime created; 21 | wxDateTime date; 22 | std::vector accountsIds; 23 | float remainAmount; 24 | float remainPercent; 25 | 26 | operator GoalModel& (); 27 | 28 | private: 29 | GoalModel& GetModel(); 30 | }; 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Clerk/UI/Controls/ToolbarButton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | class ToolbarButton : public wxPanel 8 | { 9 | public: 10 | ToolbarButton(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); 11 | 12 | protected: 13 | void OnKillFocus(wxFocusEvent& event); 14 | void OnMouseLeave(wxMouseEvent& event); 15 | void OnMouseEnter(wxMouseEvent& event); 16 | void OnLeftButtonUp(wxMouseEvent& event); 17 | void OnLeftButtonDown(wxMouseEvent& event); 18 | void OnPaint(wxPaintEvent& event); 19 | bool Enable(bool enable = true) override; 20 | void ProcessClick(); 21 | 22 | int _state = 0; 23 | bool _isEnabled = true; 24 | }; -------------------------------------------------------------------------------- /Clerk/UI/MainMenu/MainMenuViewModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Data/Services/TransactionsService.h" 4 | #include "../../Utils/EventEmitter/EventEmitter.h" 5 | #include "../../Utils/Types.h" 6 | 7 | using namespace Clerk::Data; 8 | using namespace Clerk::Utils; 9 | 10 | namespace Clerk { 11 | namespace UI { 12 | class MainMenuViewModel { 13 | public: 14 | MainMenuViewModel(TransactionsService& transactionsService); 15 | ~MainMenuViewModel(); 16 | 17 | shared_vector GetRecents(); 18 | 19 | void OnUpdate(std::function fn); 20 | 21 | private: 22 | TransactionsService& _transactionsService; 23 | EventEmitter* _eventEmitter; 24 | unsigned int _subscriptionId; 25 | }; 26 | } 27 | } -------------------------------------------------------------------------------- /Clerk/UI/Controls/CheckboxComboPopup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | class CheckboxComboPopup : public wxListCtrl, public wxComboPopup 8 | { 9 | public: 10 | virtual void Init() override; 11 | virtual bool Create(wxWindow *parent) override; 12 | virtual wxWindow *GetControl() override; 13 | virtual void SetStringValue(const wxString &s) override; 14 | virtual wxString GetStringValue() const override; 15 | 16 | std::function OnItemSelect; 17 | 18 | private: 19 | wxString _value; 20 | 21 | void OnMouseMove(wxMouseEvent& event); 22 | void OnMouseClick(wxMouseEvent& event); 23 | void OnCheck(wxListEvent& event); 24 | }; 25 | 26 | -------------------------------------------------------------------------------- /Clerk/Utils/Settings/Types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct TabSettings { 4 | int type; 5 | int id; 6 | }; 7 | 8 | struct ListColumnsSettings { 9 | int model; 10 | int order; 11 | int width; 12 | bool sorted; 13 | bool sortedAscending; 14 | }; 15 | 16 | struct ListFilterSettings { 17 | int type; 18 | int id; 19 | int period; 20 | wxDateTime fromDate; 21 | wxDateTime toDate; 22 | }; 23 | 24 | enum class TransactionsListType { 25 | All = 0, 26 | Receipts = 1, 27 | Deposits = 2, 28 | Expenses = 3, 29 | }; 30 | 31 | struct ReportFilterSettings { 32 | int id; 33 | wxString accountIds; 34 | int period; 35 | wxDateTime fromDate; 36 | wxDateTime toDate; 37 | bool average; 38 | }; 39 | 40 | struct Language { 41 | int id; 42 | wxString name; 43 | }; -------------------------------------------------------------------------------- /Clerk/UI/Statusbar/Statusbar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../../Utils/Icons.h" 6 | #include "StatusbarViewModel.h" 7 | 8 | using namespace Clerk::Utils; 9 | using namespace Clerk::Data; 10 | using namespace Clerk::UI; 11 | 12 | class Statusbar : public wxPanel 13 | { 14 | public: 15 | Statusbar(StatusbarViewModel& viewModel, Icons& icons, wxWindow *parent, const wxPoint& pos, const wxSize& size); 16 | ~Statusbar(); 17 | 18 | private: 19 | StatusbarViewModel& _viewModel; 20 | Icons& _icons; 21 | wxStaticText* _periodLabel; 22 | wxStaticText* _receiptsLabel; 23 | wxStaticText* _expensesLabel; 24 | wxStaticText* _balanceLabel; 25 | wxStaticText* _exchangeRatesLabel; 26 | 27 | void Update(); 28 | }; -------------------------------------------------------------------------------- /Clerk/UI/Dashboard/DashboardBalancePanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "../../Utils/Utils.h" 6 | #include "../../Data/PresentationModels/Types.h" 7 | #include "DashboardViewModel.h" 8 | 9 | using namespace Clerk::Utils; 10 | using namespace Clerk::Data; 11 | using namespace Clerk::UI; 12 | 13 | class DashboardBalancePanel : public wxPanel 14 | { 15 | public: 16 | DashboardBalancePanel(wxWindow *parent); 17 | 18 | void SetViewModel(DashboardViewModel* viewModel); 19 | 20 | private: 21 | DashboardViewModel* _viewModel{}; 22 | float _total = 0.0; 23 | float _ownFunds = 0.0; 24 | float _creditFunds = 0.0; 25 | 26 | void Update(); 27 | void Draw(wxPaintDC &dc); 28 | void OnPaint(wxPaintEvent& event); 29 | }; 30 | -------------------------------------------------------------------------------- /Clerk/UI/MainMenu/MainMenuViewModel.cpp: -------------------------------------------------------------------------------- 1 | #include "MainMenuViewModel.h" 2 | 3 | using namespace Clerk::UI; 4 | 5 | MainMenuViewModel::MainMenuViewModel(TransactionsService& transactionsService) : _transactionsService(transactionsService) 6 | { 7 | _eventEmitter = new EventEmitter(); 8 | 9 | _subscriptionId = _transactionsService.Subscribe([&]() { 10 | _eventEmitter->Emit(); 11 | }); 12 | } 13 | 14 | MainMenuViewModel::~MainMenuViewModel() { 15 | _transactionsService.Unsubscribe(_subscriptionId); 16 | delete _eventEmitter; 17 | } 18 | 19 | void MainMenuViewModel::OnUpdate(std::function fn) { 20 | _eventEmitter->Subscribe(fn); 21 | } 22 | 23 | shared_vector MainMenuViewModel::GetRecents() { 24 | return _transactionsService.GetRecents(10); 25 | } -------------------------------------------------------------------------------- /Clerk/UI/NewTransactionButton/NewTransactionViewModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Data/Services/TransactionsService.h" 4 | #include "../../Utils/EventEmitter/EventEmitter.h" 5 | #include "../../Utils/Types.h" 6 | 7 | using namespace Clerk::Data; 8 | using namespace Clerk::Utils; 9 | 10 | namespace Clerk { 11 | namespace UI { 12 | class NewTransactionViewModel { 13 | public: 14 | NewTransactionViewModel(TransactionsService& transactionsService); 15 | ~NewTransactionViewModel(); 16 | 17 | shared_vector GetRecents(); 18 | 19 | void OnUpdate(std::function fn); 20 | 21 | private: 22 | TransactionsService& _transactionsService; 23 | EventEmitter* _eventEmitter; 24 | unsigned int _subscriptionId; 25 | }; 26 | } 27 | } -------------------------------------------------------------------------------- /Clerk/UI/TreeMenu/AccountsContextMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Data/PresentationModels/TransactionPresentationModel.h" 5 | #include "../../Data/PresentationModels/AccountPresentationModel.h" 6 | #include "Enums.h" 7 | #include "TreeContextMenu.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Commands; 11 | using namespace Clerk::UI; 12 | 13 | namespace Clerk { 14 | namespace UI { 15 | class AccountsContextMenu : public TreeContextMenu { 16 | public: 17 | AccountsContextMenu(DataContext& context, Icons& icons, TreeMenuItemType type); 18 | 19 | private: 20 | TreeMenuItemType _type; 21 | 22 | void OnMenuSelect(wxCommandEvent& event); 23 | AccountType GetAccountTypeByMenuType(TreeMenuItemType type); 24 | }; 25 | } 26 | } -------------------------------------------------------------------------------- /Clerk/UI/Dashboard/DashboardBudgetsPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../../Data/PresentationModels/BudgetPresentationModel.h" 6 | #include "DashboardViewModel.h" 7 | 8 | using namespace Clerk::Data; 9 | using namespace Clerk::Utils; 10 | using namespace Clerk::UI; 11 | 12 | class DashboardBudgetsPanel : public wxPanel 13 | { 14 | public: 15 | DashboardBudgetsPanel(wxWindow *parent); 16 | 17 | void SetViewModel(DashboardViewModel* viewModel); 18 | 19 | private: 20 | DashboardViewModel* _viewModel{}; 21 | shared_vector _budgets; 22 | int _daysCount = 0; 23 | int _currentDay = 0; 24 | 25 | void Update(); 26 | void Draw(wxPaintDC &dc); 27 | void OnPaint(wxPaintEvent& event); 28 | }; 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Clerk/UI/Dashboard/DashboardReceiptsPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../../Utils/Types.h" 6 | #include "../../Data/PresentationModels/Types.h" 7 | #include "DashboardViewModel.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Utils; 11 | using namespace Clerk::UI; 12 | 13 | class DashboardReceiptsPanel : public wxPanel 14 | { 15 | public: 16 | DashboardReceiptsPanel(wxWindow* parent); 17 | 18 | void SetViewModel(DashboardViewModel* viewModel); 19 | 20 | private: 21 | DashboardViewModel* _viewModel{}; 22 | float _maxValue = 0; 23 | shared_vector _accounts; 24 | float _total = 0.0; 25 | 26 | void Update(); 27 | void Draw(wxPaintDC& dc); 28 | void OnPaint(wxPaintEvent& event); 29 | }; 30 | -------------------------------------------------------------------------------- /Clerk/UI/Goals/GoalContextMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Commands/CommandsInvoker.h" 5 | #include "../../Utils/Icons.h" 6 | #include "../../Data/PresentationModels/GoalPresentationModel.h" 7 | #include "Enums.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Commands; 11 | using namespace Clerk::Utils; 12 | 13 | namespace Clerk { 14 | namespace UI { 15 | class GoalContextMenu : public wxMenu { 16 | public: 17 | GoalContextMenu(CommandsInvoker& commandsInvoker, Icons& icons, std::shared_ptr goal); 18 | 19 | private: 20 | CommandsInvoker& _commandsInvoker; 21 | Icons& _icons; 22 | std::shared_ptr _goal; 23 | 24 | void OnMenuSelect(wxCommandEvent& event); 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Clerk/UI/Alerts/AlertContextMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Commands/CommandsInvoker.h" 5 | #include "../../Utils/Icons.h" 6 | #include "../../Data/PresentationModels/AlertPresentationModel.h" 7 | #include "Enums.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Commands; 11 | using namespace Clerk::Utils; 12 | 13 | namespace Clerk { 14 | namespace UI { 15 | class AlertContextMenu : public wxMenu { 16 | public: 17 | AlertContextMenu(CommandsInvoker& commandsInvoker, Icons& icons, std::shared_ptr alert); 18 | 19 | private: 20 | CommandsInvoker& _commandsInvoker; 21 | Icons& _icons; 22 | std::shared_ptr _alert; 23 | 24 | void OnMenuSelect(wxCommandEvent& event); 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/Types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "CurrencyPresentationModel.h" 6 | 7 | namespace Clerk { 8 | namespace Data { 9 | struct DashboardProgressValue 10 | { 11 | wxString name; 12 | wxString amount; 13 | wxString currentAmount; 14 | wxString remainAmount; 15 | float percent; 16 | }; 17 | 18 | struct StringValueViewModel { 19 | wxString string; 20 | float value; 21 | }; 22 | 23 | struct DateValueViewModel { 24 | wxDateTime date; 25 | float value; 26 | }; 27 | 28 | struct CurrencyValueViewModel { 29 | CurrencyPresentationModel currency; 30 | float value; 31 | }; 32 | 33 | struct StringValuesViewModel { 34 | wxString string; 35 | std::vector values; 36 | }; 37 | } 38 | } -------------------------------------------------------------------------------- /Clerk/UI/TreeMenu/AccountContextMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Data/PresentationModels/TransactionPresentationModel.h" 5 | #include "../../Data/PresentationModels/AccountPresentationModel.h" 6 | #include "TreeContextMenu.h" 7 | #include "Enums.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Commands; 11 | using namespace Clerk::Utils; 12 | 13 | namespace Clerk { 14 | namespace UI { 15 | class AccountContextMenu : public TreeContextMenu { 16 | public: 17 | AccountContextMenu(DataContext& context, Icons& icons, AccountPresentationModel& account, std::vector> transactions); 18 | 19 | private: 20 | AccountPresentationModel& _account; 21 | void OnMenuSelect(wxCommandEvent& event); 22 | }; 23 | } 24 | } -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/BudgetPresentationModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../Models/BudgetModel.h" 6 | 7 | using namespace Clerk::Utils; 8 | 9 | namespace Clerk { 10 | namespace Data { 11 | class BudgetPresentationModel { 12 | public: 13 | BudgetPresentationModel(); 14 | BudgetPresentationModel(BudgetModel& model); 15 | 16 | int id; 17 | wxString name; 18 | float amount; 19 | float balance; 20 | BudgetPeriod period; 21 | wxString periodName; 22 | wxDateTime periodDate; 23 | wxDateTime date; 24 | std::vector accountsIds; 25 | float remainAmount; 26 | float remainPercent; 27 | wxDateTime created; 28 | 29 | operator BudgetModel& (); 30 | 31 | private: 32 | BudgetModel& GetModel(); 33 | }; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Clerk/UI/Controls/DropDownButton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "ToolbarButton.h" 7 | 8 | class DropDownButton : public ToolbarButton 9 | { 10 | public: 11 | DropDownButton(wxWindow *parent, const wxBitmap& bitmap, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); 12 | ~DropDownButton(); 13 | 14 | wxMenu *GetMenu(); 15 | void ClearMenu(); 16 | 17 | protected: 18 | void OnLeftButtonUp(wxMouseEvent& event); 19 | void OnLeftButtonDown(wxMouseEvent& event); 20 | void OnMenuClose(wxMenuEvent& event); 21 | void OnPaint(wxPaintEvent &event); 22 | 23 | private: 24 | wxBitmap _image; 25 | wxString _label; 26 | wxMenu *_menu = nullptr; 27 | 28 | bool _isMenuVisible = false; 29 | int _arrowButtonWidth = 0; 30 | }; -------------------------------------------------------------------------------- /Clerk/UI/NewTransactionButton/NewTransactionViewModel.cpp: -------------------------------------------------------------------------------- 1 | #include "NewTransactionViewModel.h" 2 | 3 | using namespace Clerk::UI; 4 | 5 | NewTransactionViewModel::NewTransactionViewModel(TransactionsService& transactionsService) : _transactionsService(transactionsService) 6 | { 7 | _eventEmitter = new EventEmitter(); 8 | 9 | _subscriptionId = _transactionsService.Subscribe([&]() { 10 | _eventEmitter->Emit(); 11 | }); 12 | } 13 | 14 | NewTransactionViewModel::~NewTransactionViewModel() { 15 | _transactionsService.Unsubscribe(_subscriptionId); 16 | delete _eventEmitter; 17 | } 18 | 19 | void NewTransactionViewModel::OnUpdate(std::function fn) { 20 | _eventEmitter->Subscribe(fn); 21 | } 22 | 23 | shared_vector NewTransactionViewModel::GetRecents() { 24 | return _transactionsService.GetRecents(15); 25 | } -------------------------------------------------------------------------------- /Clerk/UI/Notifications/NotificationAlertPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "wx/wx.h" 4 | #include "../../Data/PresentationModels/AlertPresentationModel.h" 5 | #include "../../Utils/Types.h" 6 | #include "../../Utils/Utils.h" 7 | 8 | using namespace Clerk::Data; 9 | using namespace Clerk::Utils; 10 | 11 | class NotificationAlertPanel : public wxPanel 12 | { 13 | public: 14 | NotificationAlertPanel(wxWindow* parent, const wxPoint& position, const wxSize& size); 15 | 16 | void SetAlert(std::shared_ptr alert); 17 | std::function)> OnDismiss; 18 | 19 | private: 20 | std::shared_ptr _alert; 21 | 22 | wxStaticText* _label; 23 | 24 | void Update(); 25 | void OnPaint(wxPaintEvent& event); 26 | void OnDismissClick(wxCommandEvent& event); 27 | }; 28 | -------------------------------------------------------------------------------- /Clerk/UI/Schedulers/SchedulerContextMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Commands/CommandsInvoker.h" 5 | #include "../../Utils/Icons.h" 6 | #include "../../Data/PresentationModels/SchedulerPresentationModel.h" 7 | #include "Enums.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Commands; 11 | using namespace Clerk::Utils; 12 | 13 | namespace Clerk { 14 | namespace UI { 15 | class SchedulerContextMenu : public wxMenu { 16 | public: 17 | SchedulerContextMenu(CommandsInvoker& commandsInvoker, Icons& icons, std::shared_ptr scheduler); 18 | 19 | private: 20 | CommandsInvoker& _commandsInvoker; 21 | Icons& _icons; 22 | std::shared_ptr _scheduler; 23 | 24 | void OnMenuSelect(wxCommandEvent& event); 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Clerk/UI/Budgets/BudgetContextMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Commands/CommandsInvoker.h" 5 | #include "../../Utils/Icons.h" 6 | #include "../../Data/PresentationModels/BudgetPresentationModel.h" 7 | #include "Enums.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Commands; 11 | using namespace Clerk::UI; 12 | using namespace Clerk::Utils; 13 | 14 | namespace Clerk { 15 | namespace UI { 16 | class BudgetContextMenu : public wxMenu { 17 | public: 18 | BudgetContextMenu(CommandsInvoker& commandsInvoker, Icons& icons, std::shared_ptr budget); 19 | 20 | private: 21 | CommandsInvoker& _commandsInvoker; 22 | Icons& _icons; 23 | std::shared_ptr _budget; 24 | 25 | void OnMenuSelect(wxCommandEvent& event); 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Clerk/UI/DataPanel/DataListPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "wx/dataview.h" 4 | #include "DataPanel.h" 5 | #include "../../Utils/Settings/Settings.h" 6 | 7 | class DataListPanel : public DataPanel 8 | { 9 | public: 10 | DataListPanel(wxWindow* parent, DataContext& context, Icons& icons); 11 | 12 | protected: 13 | wxBoxSizer* _mainSizer; 14 | wxDataViewCtrl* _list; 15 | 16 | virtual void CreateListColumns() = 0; 17 | virtual void SaveColumnsSettings() = 0; 18 | virtual void ShowContextMenu() = 0; 19 | virtual void EditSelectedItem() = 0; 20 | void RestoreSorting(std::vector columns); 21 | std::vector UpdateColumnsSettings(std::vector columns); 22 | 23 | private: 24 | void OnListItemDoubleClick(wxDataViewEvent& event); 25 | void OnRightClick(wxDataViewEvent& event); 26 | }; -------------------------------------------------------------------------------- /Clerk/UI/MainMenu/MainMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Data/DataContext.h" 5 | #include "../../Utils/Icons.h" 6 | #include "Enums.h" 7 | #include "MainMenuViewModel.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Commands; 11 | using namespace Clerk::UI; 12 | using namespace Clerk::Utils; 13 | 14 | namespace Clerk { 15 | namespace UI { 16 | class MainMenu : public wxMenuBar { 17 | public: 18 | MainMenu(MainMenuViewModel& viewModel, DataContext& context, Icons& icons); 19 | ~MainMenu(); 20 | 21 | private: 22 | MainMenuViewModel& _viewModel; 23 | DataContext& _context; 24 | Icons& _icons; 25 | wxMenu* _menuFile; 26 | 27 | void Update(); 28 | void OnMenuSelect(wxCommandEvent& event); 29 | void OnTransactionSelect(wxCommandEvent& event); 30 | }; 31 | } 32 | } -------------------------------------------------------------------------------- /Clerk/UI/Tabs/TabsContextMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "../../Utils/Icons.h" 6 | #include "Enums.h" 7 | 8 | using namespace Clerk::UI; 9 | using namespace Clerk::Utils; 10 | 11 | namespace Clerk { 12 | namespace UI { 13 | class TabsContextMenu : public wxMenu { 14 | public: 15 | TabsContextMenu(Icons& icons, int tabId, bool isLeftEnabled, bool isRightEnabled, bool isCloseEnabled); 16 | 17 | std::function OnMoveLeft; 18 | std::function OnMoveRight; 19 | std::function OnClose; 20 | 21 | private: 22 | Icons& _icons; 23 | int _tabId = -1; 24 | bool _isLeftEnabled = true; 25 | bool _isRightEnabled = true; 26 | bool _isCloseEnabled = true; 27 | 28 | void OnMenuSelect(wxCommandEvent& event); 29 | }; 30 | } 31 | } -------------------------------------------------------------------------------- /Clerk/UI/Reports/Tooltip/ReportChartTooltipPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "../../Data/PresentationModels/Types.h" 10 | #include "../../Utils/Utils.h" 11 | 12 | using namespace Clerk::Utils; 13 | using namespace Clerk::Data; 14 | 15 | class ReportChartTooltipPanel : public wxPanel 16 | { 17 | public: 18 | ReportChartTooltipPanel(wxWindow *parent); 19 | 20 | void SetTitle(wxString title); 21 | void SetTotal(float total); 22 | void SetValues(std::vector values); 23 | void Update(); 24 | 25 | private: 26 | wxString title; 27 | float total; 28 | std::vector values; 29 | 30 | void Draw(wxPaintDC &dc); 31 | void OnPaint(wxPaintEvent& event); 32 | }; -------------------------------------------------------------------------------- /Clerk/UI/TreeMenu/Enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace UI { 5 | enum class TreeMenuItemType { 6 | Dashboard = 1, 7 | Accounts = 2, 8 | Account = 3, 9 | Expenses = 4, 10 | Receipts = 5, 11 | Deposits = 6, 12 | Debts = 7, 13 | Virtual = 8, 14 | Reports = 9, 15 | Report = 10, 16 | Budgets = 11, 17 | Schedulers = 12, 18 | Goals = 13, 19 | Tags = 14, 20 | Alerts = 15, 21 | Trash = 16, 22 | Archive = 17 23 | }; 24 | 25 | enum class TreeContextMenuType { 26 | NewTab = 1, 27 | NewAccount = 2, 28 | EditAccount = 3, 29 | ArchiveAccount = 4, 30 | NewTransaction = 5, 31 | NewBudget = 6, 32 | NewScheduler = 7, 33 | RestoreAccount = 8, 34 | EmptyTrash = 9, 35 | NewGoal = 10, 36 | NewAlert = 11, 37 | InterestAccrual = 12 38 | }; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Clerk/Data/Services/TagsService.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Utils/Types.h" 4 | #include "../../Utils/Utils.h" 5 | #include "../Repositories/TagsRepository.h" 6 | #include "../PresentationModels/TagPresentationModel.h" 7 | #include "HashService.h" 8 | 9 | using namespace Clerk::Utils; 10 | 11 | namespace Clerk { 12 | namespace Data { 13 | class TagsService : HashService> { 14 | public: 15 | TagsService(TagsRepository& tagsRepository); 16 | 17 | shared_vector GetAll(); 18 | std::shared_ptr GetById(int id); 19 | shared_vector GetBySearch(wxString search); 20 | std::shared_ptr Save(TagPresentationModel& tag); 21 | 22 | private: 23 | TagsRepository& _tagsRepository; 24 | }; 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /Clerk/UI/Dashboard/DashboardExpensesPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../../Utils/Types.h" 6 | #include "../../Data/PresentationModels/Types.h" 7 | #include "../../Data/PresentationModels/AccountPresentationModel.h" 8 | #include "DashboardViewModel.h" 9 | 10 | using namespace Clerk::Data; 11 | using namespace Clerk::Utils; 12 | using namespace Clerk::UI; 13 | 14 | class DashboardExpensesPanel : public wxPanel 15 | { 16 | public: 17 | DashboardExpensesPanel(wxWindow *parent); 18 | 19 | void SetViewModel(DashboardViewModel* viewModel); 20 | 21 | private: 22 | DashboardViewModel* _viewModel{}; 23 | float _maxValue = 0; 24 | shared_vector _accounts; 25 | float _total = 0.0; 26 | 27 | void Update(); 28 | void Draw(wxPaintDC &dc); 29 | void OnPaint(wxPaintEvent& event); 30 | }; 31 | -------------------------------------------------------------------------------- /Clerk/UI/Notifications/NotificationsButton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../Controls/ToolbarButton.h" 5 | #include "../../Utils/Icons.h" 6 | #include "NotificationsPopup.h" 7 | #include "NotificationsViewModel.h" 8 | 9 | using namespace Clerk::Utils; 10 | 11 | namespace Clerk { 12 | namespace UI { 13 | class NotificationsButton : public ToolbarButton 14 | { 15 | public: 16 | NotificationsButton(NotificationsViewModel& viewModel, Icons& icons, wxWindow* parent, const wxPoint& pos, const wxSize& size); 17 | ~NotificationsButton(); 18 | 19 | protected: 20 | void OnPaint(wxPaintEvent& event); 21 | 22 | private: 23 | NotificationsViewModel& _viewModel; 24 | Icons& _icons; 25 | NotificationsPopup* _popup; 26 | wxBitmap _image; 27 | 28 | void Update(); 29 | void OnClick(wxCommandEvent& event); 30 | }; 31 | } 32 | } -------------------------------------------------------------------------------- /Clerk/UI/Goals/GoalsListPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../DataPanel/DataListPanel.h" 5 | #include "../Controls/DataViewProgressRender.h" 6 | #include "GoalsListDataModel.h" 7 | #include "GoalContextMenu.h" 8 | 9 | using namespace Clerk::Data; 10 | 11 | class GoalsListPanel : public DataListPanel 12 | { 13 | public: 14 | GoalsListPanel(wxWindow* parent, DataContext& context, Icons& icons); 15 | ~GoalsListPanel(); 16 | 17 | void Update(); 18 | 19 | private: 20 | wxObjectDataPtr _model; 21 | shared_vector _goals; 22 | GoalsService* _goalsService; 23 | unsigned int _subscriptionId; 24 | 25 | std::shared_ptr GetGoal(); 26 | void CreateListColumns() override; 27 | void SaveColumnsSettings() override; 28 | void ShowContextMenu() override; 29 | void EditSelectedItem() override; 30 | }; -------------------------------------------------------------------------------- /Clerk/UI/Dashboard/DashboardSchedulersPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "../../Data/PresentationModels/SchedulerPresentationModel.h" 7 | #include "DashboardViewModel.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::UI; 11 | 12 | class DashboardSchedulersPanel : public wxPanel 13 | { 14 | public: 15 | DashboardSchedulersPanel(wxWindow *parent); 16 | 17 | void SetViewModel(DashboardViewModel* viewModel); 18 | 19 | private: 20 | DashboardViewModel* _viewModel{}; 21 | std::vector> _schedulers; 22 | std::map _values; 23 | float _maxValue = 0; 24 | 25 | void Update(); 26 | void Draw(wxPaintDC &dc); 27 | void DrawCalendar(wxPaintDC &dc); 28 | void DrawTable(wxPaintDC &dc); 29 | void OnPaint(wxPaintEvent& event); 30 | }; 31 | 32 | 33 | -------------------------------------------------------------------------------- /Clerk/Data/Enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Clerk { 4 | namespace Data { 5 | enum class AccountType { 6 | Receipt = 0, 7 | Deposit = 1, 8 | Expense = 2, 9 | Debt = 3, 10 | Virtual = 4, 11 | }; 12 | 13 | enum class BudgetPeriod { 14 | Week = 0, 15 | Month = 1, 16 | Year = 2, 17 | Custom = 3 18 | }; 19 | 20 | enum class SchedulerType { 21 | Daily = 0, 22 | Weekly = 1, 23 | Monthly = 2, 24 | Yearly = 3 25 | }; 26 | 27 | enum class AlertType { 28 | Receipt = 0, 29 | Expense = 1, 30 | Balance = 2 31 | }; 32 | 33 | enum class AlertPeriod { 34 | Week = 0, 35 | Month = 1, 36 | Year = 2, 37 | }; 38 | 39 | enum class AlertCondition { 40 | Less = 0, 41 | More = 1, 42 | Equal = 2 43 | }; 44 | 45 | enum class AlertImportance { 46 | Low = 0, 47 | Medium = 1, 48 | High = 2 49 | }; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Clerk/UI/Alerts/AlertsListPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../DataPanel/DataListPanel.h" 5 | #include "../Controls/DataViewProgressRender.h" 6 | #include "AlertsListDataModel.h" 7 | #include "AlertContextMenu.h" 8 | 9 | using namespace Clerk::Data; 10 | 11 | class AlertsListPanel : public DataListPanel 12 | { 13 | public: 14 | AlertsListPanel(wxWindow *parent, DataContext& context, Icons& icons); 15 | ~AlertsListPanel(); 16 | 17 | void Update(); 18 | 19 | private: 20 | wxObjectDataPtr _model; 21 | shared_vector _alerts; 22 | AlertsService* _alertsService; 23 | unsigned int _subscriptionId; 24 | 25 | std::shared_ptr GetAlert(); 26 | void CreateListColumns() override; 27 | void SaveColumnsSettings() override; 28 | void ShowContextMenu() override; 29 | void EditSelectedItem() override; 30 | }; -------------------------------------------------------------------------------- /Clerk/UI/TagsField/TagsPopup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "../../Data/PresentationModels/TagPresentationModel.h" 9 | #include "../../Utils/Types.h" 10 | 11 | using namespace Clerk::Data; 12 | 13 | class TagsPopup : public wxPopupWindow 14 | { 15 | public: 16 | TagsPopup(wxWindow *parent); 17 | 18 | void Position(wxPoint position, wxSize size); 19 | void Update(shared_vector tags); 20 | void SelectNext(); 21 | void SelectPrev(); 22 | std::shared_ptr GetSelectedTag(); 23 | std::function)> OnSelect; 24 | 25 | private: 26 | wxScrolledWindow *_panel; 27 | wxListCtrl *_list; 28 | shared_vector _tags; 29 | 30 | void OnListItemDoubleClick(wxListEvent &event); 31 | }; -------------------------------------------------------------------------------- /Clerk/UI/Reports/ReportExpensesForPeriodPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "../../Data/PresentationModels/Types.h" 7 | #include "../../Utils/Settings/Settings.h" 8 | #include "../Charts/BarChart.h" 9 | #include "../DataPanel/DataPanel.h" 10 | #include "../Controls/PeriodFilterPanel.h" 11 | #include "Enums.h" 12 | 13 | using namespace Clerk::Data; 14 | using namespace Clerk::Utils; 15 | 16 | class ReportExpensesForPeriodPanel : public DataPanel 17 | { 18 | public: 19 | ReportExpensesForPeriodPanel(wxWindow *parent, DataContext& context, Icons& icons); 20 | ~ReportExpensesForPeriodPanel(); 21 | 22 | void Update(); 23 | 24 | private: 25 | BarChart *_chart; 26 | PeriodFilterPanel* _periodFilterPanel; 27 | std::vector _values = {}; 28 | 29 | void RestoreFilterSettings(); 30 | void SaveFilterSettings(); 31 | }; 32 | 33 | -------------------------------------------------------------------------------- /Clerk/UI/TrashPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "DataPanel/DataPanel.h" 6 | #include "../Data/PresentationModels/TransactionPresentationModel.h" 7 | 8 | using namespace Clerk::Data; 9 | using namespace Clerk::UI; 10 | 11 | enum class TrashPanelMenuTypes { 12 | Restore = 1, 13 | Delete = 2, 14 | ClearAll = 3, 15 | }; 16 | 17 | class TrashPanel : public DataPanel 18 | { 19 | public: 20 | TrashPanel(wxWindow *parent, DataContext& context, Icons& icons); 21 | 22 | std::shared_ptr GetTransaction(); 23 | void Update(); 24 | void RestoreTransaction(); 25 | void DeleteTransaction(); 26 | void ClearAll(); 27 | 28 | private: 29 | wxListCtrl *transactionsList; 30 | std::vector> _transactions; 31 | 32 | void OnListItemClick(wxListEvent &event); 33 | void OnMenuSelect(wxCommandEvent &event); 34 | }; 35 | -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/TransactionPresentationModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Types.h" 5 | #include "../Models/TransactionModel.h" 6 | #include "TagPresentationModel.h" 7 | #include "AccountPresentationModel.h" 8 | 9 | namespace Clerk { 10 | namespace Data { 11 | class TransactionPresentationModel { 12 | public: 13 | TransactionPresentationModel(); 14 | TransactionPresentationModel(TransactionModel& model); 15 | 16 | int id; 17 | std::shared_ptr fromAccount; 18 | std::shared_ptr toAccount; 19 | float fromAmount; 20 | float toAmount; 21 | wxString note; 22 | wxDateTime date; 23 | wxDateTime created; 24 | shared_vector tags; 25 | wxString tagsString; 26 | 27 | operator TransactionModel& (); 28 | 29 | private: 30 | TransactionModel& GetModel(); 31 | }; 32 | } 33 | } -------------------------------------------------------------------------------- /Clerk/UI/Dashboard/DashboardAccountsPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../../Utils/Types.h" 6 | #include "../../Data/PresentationModels/AccountPresentationModel.h" 7 | #include "../../Data/Services/CurrenciesService.h" 8 | #include "DashboardViewModel.h" 9 | 10 | using namespace Clerk::Data; 11 | using namespace Clerk::Utils; 12 | using namespace Clerk::UI; 13 | 14 | class DashboardAccountsPanel : public wxPanel 15 | { 16 | public: 17 | DashboardAccountsPanel(wxWindow *parent); 18 | 19 | void SetViewModel(DashboardViewModel* viewModel); 20 | 21 | private: 22 | DashboardViewModel* _viewModel{}; 23 | shared_vector _accounts; 24 | float _total; 25 | int _width; 26 | int _height; 27 | 28 | void Update(); 29 | 30 | void Draw(wxPaintDC &dc); 31 | void OnPaint(wxPaintEvent& event); 32 | void DrawValue(wxPaintDC& dc, wxString value, int y); 33 | }; -------------------------------------------------------------------------------- /Clerk/UI/NewTransactionButton/NewTransactionButton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Data/DataContext.h" 4 | #include "../../Utils/Icons.h" 5 | #include "../Controls/DropDownButton.h" 6 | #include "NewTransactionViewModel.h" 7 | 8 | using namespace Clerk::Data; 9 | using namespace Clerk::Commands; 10 | using namespace Clerk::UI; 11 | using namespace Clerk::Utils; 12 | 13 | namespace Clerk { 14 | namespace UI { 15 | class NewTransactionButton : public DropDownButton 16 | { 17 | public: 18 | NewTransactionButton(NewTransactionViewModel& viewModel, DataContext& context, Icons& icons, wxWindow* parent, const wxPoint& pos, const wxSize& size); 19 | ~NewTransactionButton(); 20 | 21 | private: 22 | DataContext& _context; 23 | NewTransactionViewModel& _viewModel; 24 | Icons& _icons; 25 | 26 | void Update(); 27 | void OnClick(wxCommandEvent& event); 28 | void OnMenuSelect(wxCommandEvent& event); 29 | 30 | }; 31 | } 32 | } -------------------------------------------------------------------------------- /Clerk/UI/Notifications/NotificationsPopup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "../../Utils/Types.h" 5 | #include "NotificationAlertPanel.h" 6 | #include "NotificationSchedulerPanel.h" 7 | 8 | class NotificationsPopup : public wxPopupTransientWindow 9 | { 10 | public: 11 | NotificationsPopup(wxWindow* parent); 12 | 13 | void Update(shared_vector alerts, shared_vector schedulers); 14 | std::function)> OnDismissAlert; 15 | std::function)> OnDismissScheduler; 16 | std::function)> OnExecScheduler; 17 | std::function)> OnSkipScheduler; 18 | 19 | private: 20 | wxScrolledWindow* _panel; 21 | wxBoxSizer* _notificationsSizer; 22 | 23 | void UpdatePositionAndSize(); 24 | }; -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/AccountPresentationModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "CurrencyPresentationModel.h" 5 | #include "../Models/AccountModel.h" 6 | #include "../Enums.h" 7 | 8 | namespace Clerk { 9 | namespace Data { 10 | class AccountPresentationModel { 11 | public: 12 | AccountPresentationModel(); 13 | AccountPresentationModel(AccountModel& model); 14 | 15 | int id; 16 | wxString name; 17 | wxString note; 18 | AccountType type; 19 | int icon; 20 | int order; 21 | float creditLimit; 22 | bool isCredit = false; 23 | std::shared_ptr currency; 24 | float balance; 25 | float totalExpenses; 26 | float totalReceipts; 27 | float currentExpenses; 28 | float currentReceipts; 29 | boolean isActive = false; 30 | wxDateTime date; 31 | 32 | operator AccountModel& (); 33 | 34 | private: 35 | AccountModel& GetModel(); 36 | }; 37 | } 38 | } -------------------------------------------------------------------------------- /Clerk/UI/Transactions/TransactionContextMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Commands/CommandsInvoker.h" 5 | #include "../../Utils/Icons.h" 6 | #include "../../Data/PresentationModels/TransactionPresentationModel.h" 7 | #include "Enums.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Commands; 11 | using namespace Clerk::UI; 12 | using namespace Clerk::Utils; 13 | 14 | namespace Clerk { 15 | namespace UI { 16 | class TransactionContextMenu : public wxMenu { 17 | public: 18 | TransactionContextMenu(CommandsInvoker& commandsInvoker, Icons& icons, std::shared_ptr transaction, std::vector selectedIds); 19 | 20 | private: 21 | CommandsInvoker& _commandsInvoker; 22 | Icons& _icons; 23 | std::shared_ptr _transaction; 24 | std::vector _selectedIds; 25 | 26 | void OnMenuSelect(wxCommandEvent& event); 27 | }; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Clerk/UI/Budgets/BudgetsListPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../DataPanel/DataListPanel.h" 5 | #include "../Controls/DataViewProgressRender.h" 6 | #include "BudgetsListDataModel.h" 7 | #include "BudgetContextMenu.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Utils; 11 | using namespace Clerk::UI; 12 | 13 | class BudgetsListPanel : public DataListPanel 14 | { 15 | public: 16 | BudgetsListPanel(wxWindow *parent, DataContext& context, Icons& icons); 17 | ~BudgetsListPanel(); 18 | 19 | void Update(); 20 | 21 | private: 22 | wxObjectDataPtr _model; 23 | shared_vector _budgets; 24 | BudgetsService* _budgetsService; 25 | unsigned int _subscriptionId; 26 | 27 | std::shared_ptr GetBudget(); 28 | void CreateListColumns() override; 29 | void SaveColumnsSettings() override; 30 | void ShowContextMenu() override; 31 | void EditSelectedItem() override; 32 | }; -------------------------------------------------------------------------------- /Clerk/UI/Schedulers/SchedulersListPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Data/PresentationModels/SchedulerPresentationModel.h" 5 | #include "../DataPanel/DataListPanel.h" 6 | #include "SchedulersListDataModel.h" 7 | #include "SchedulerContextMenu.h" 8 | 9 | using namespace Clerk::Data; 10 | 11 | class SchedulersListPanel : public DataListPanel 12 | { 13 | public: 14 | SchedulersListPanel(wxWindow *parent, DataContext& context, Icons& icons); 15 | ~SchedulersListPanel(); 16 | 17 | void Update(); 18 | 19 | private: 20 | wxObjectDataPtr _model; 21 | shared_vector _schedulers; 22 | SchedulersService* _schedulersService; 23 | unsigned int _subscriptionId; 24 | 25 | std::shared_ptr GetScheduler(); 26 | void CreateListColumns() override; 27 | void SaveColumnsSettings() override; 28 | void ShowContextMenu() override; 29 | void EditSelectedItem() override; 30 | }; -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/AlertPresentationModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../Models/AlertModel.h" 6 | #include "../Enums.h" 7 | 8 | using namespace Clerk::Utils; 9 | 10 | namespace Clerk { 11 | namespace Data { 12 | class AlertPresentationModel { 13 | public: 14 | AlertPresentationModel(); 15 | AlertPresentationModel(AlertModel& model); 16 | 17 | int id; 18 | wxString name; 19 | wxString message; 20 | AlertType type; 21 | AlertPeriod period; 22 | AlertCondition condition; 23 | AlertImportance importance; 24 | float amount; 25 | float balance; 26 | float remainAmount; 27 | float remainPercent; 28 | wxDateTime created; 29 | wxString typeName; 30 | wxString periodName; 31 | wxString conditionName; 32 | wxString importanceName; 33 | std::vector accountsIds; 34 | 35 | operator AlertModel& (); 36 | 37 | private: 38 | AlertModel& GetModel(); 39 | }; 40 | } 41 | } -------------------------------------------------------------------------------- /Clerk/Data/Services/AccountingService.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/EventEmitter/EventEmitter.h" 5 | #include "AccountsService.h" 6 | #include "CurrenciesService.h" 7 | 8 | using namespace Clerk::Data; 9 | using namespace Clerk::Utils; 10 | 11 | namespace Clerk { 12 | namespace Data { 13 | class AccountingService { 14 | public: 15 | AccountingService(AccountsService& accountsService, CurrenciesService& currenciesService); 16 | ~AccountingService(); 17 | 18 | float GetReceipts(const wxDateTime& fromDate, const wxDateTime& toDate); 19 | float GetExpenses(const wxDateTime& fromDate, const wxDateTime& toDate); 20 | float GetBalance(); 21 | float GetCredit(); 22 | 23 | unsigned int Subscribe(std::function fn); 24 | void Unsubscribe(unsigned int subscriptionId); 25 | 26 | private: 27 | AccountsService& _accountsService; 28 | CurrenciesService& _currenciesService; 29 | EventEmitter* _eventEmitter; 30 | }; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Clerk/UI/PreferencesDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "../Data/DataContext.h" 6 | #include "../Utils/Types.h" 7 | #include "../Utils/Settings/Settings.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Utils; 11 | 12 | class PreferencesDialog : public wxFrame 13 | { 14 | public: 15 | PreferencesDialog(wxFrame *parent, const wxChar *title, int xpos, int ypos, int width, int height, DataContext& context); 16 | 17 | private: 18 | DataContext& _context; 19 | shared_vector _currencies; 20 | std::vector _languages; 21 | 22 | wxComboBox* _languagesList; 23 | wxComboBox *_currenciesList; 24 | wxCheckBox *_convertCurrenciesCheckBox; 25 | wxCheckBox *_loadExchangeRatesCheckBox; 26 | wxCheckBox* _showCreditFundsCheckBox; 27 | wxCheckBox* _showBaseCurrencyAmountCheckBox; 28 | 29 | void OnOK(wxCommandEvent &event); 30 | void OnCancel(wxCommandEvent &event); 31 | void OnKeyDown(wxKeyEvent &event); 32 | }; 33 | -------------------------------------------------------------------------------- /Clerk/UI/TagsField/TagsField.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "wx/wx.h" 4 | #include "../../Data/Services/TagsService.h" 5 | #include "../../Utils/Types.h" 6 | #include "TagsPopup.h" 7 | #include "TagPanel.h" 8 | 9 | using namespace Clerk::Data; 10 | 11 | class TagsField : public wxPanel 12 | { 13 | public: 14 | TagsField(wxWindow* parent, TagsService& tagsService, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); 15 | 16 | void SetTags(shared_vector tags); 17 | shared_vector GetTags(); 18 | std::function OnChange; 19 | 20 | private: 21 | TagsService& _tagsService; 22 | shared_vector _tags; 23 | 24 | wxBoxSizer* _tagsSizer; 25 | wxTextCtrl* _textField; 26 | TagsPopup* _popup; 27 | 28 | void Update(); 29 | void AddTag(std::shared_ptr tag); 30 | void DeleteTag(std::shared_ptr tag); 31 | void OnTextChanged(wxKeyEvent& event); 32 | void OnTextKeyDown(wxKeyEvent& event); 33 | }; 34 | 35 | -------------------------------------------------------------------------------- /Clerk/UI/Controls/AccountsComboBox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "../../Data/PresentationModels/AccountPresentationModel.h" 8 | #include "../../Utils/Types.h" 9 | #include "CheckboxComboPopup.h" 10 | 11 | using namespace Clerk::Data; 12 | 13 | class AccountsComboBox : public wxComboCtrl 14 | { 15 | public: 16 | AccountsComboBox(wxWindow* parent, const wxPoint& pos, const wxSize& size, bool showAllButton); 17 | 18 | std::function ids)> OnChange; 19 | 20 | void SetAccounts(shared_vector accounts); 21 | void SetSelection(std::set ids); 22 | 23 | private: 24 | CheckboxComboPopup *_accountsList; 25 | shared_vector _accounts; 26 | std::set _selectedIds; 27 | bool _ignoreSelection; 28 | bool _showAllButton; 29 | bool _allSelected; 30 | 31 | void UpdateList(); 32 | void UpdateNames(); 33 | void UpdateSelection(); 34 | void OnAccountSelect(wxListItem item); 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /Clerk/UI/TagsField/TagPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "TagPanel.h" 2 | 3 | TagPanel::TagPanel(wxWindow* parent, const wxPoint& position, const wxSize& size) : wxPanel(parent, wxID_ANY, position, size) 4 | { 5 | SetBackgroundColour(wxColor(241, 248, 255)); 6 | 7 | _mainSizer = new wxBoxSizer(wxHORIZONTAL); 8 | 9 | _label = new wxStaticText(this, wxID_ANY, ""); 10 | _mainSizer->Add(_label, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(5)); 11 | 12 | wxButton* button = new wxButton(this, wxID_ANY, L"🞪", wxDefaultPosition, FromDIP(wxSize(20, 20)), wxBORDER_NONE); 13 | button->SetBackgroundColour(wxColor(241, 248, 255)); 14 | 15 | button->Bind(wxEVT_BUTTON, &TagPanel::OnDeleteClick, this); 16 | 17 | _mainSizer->Add(button, 0, wxALIGN_CENTER_VERTICAL); 18 | 19 | SetSizer(_mainSizer); 20 | Layout(); 21 | } 22 | 23 | void TagPanel::SetTag(std::shared_ptr tag) { 24 | _tag = tag; 25 | 26 | _label->SetLabel(tag->name); 27 | } 28 | 29 | void TagPanel::OnDeleteClick(wxCommandEvent& event) { 30 | if (OnDelete) { 31 | OnDelete(_tag); 32 | } 33 | } -------------------------------------------------------------------------------- /Clerk/Utils/EventEmitter/DataEventEmitter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace Clerk { 8 | namespace Utils { 9 | template 10 | class DataEventEmitter { 11 | public: 12 | DataEventEmitter() { 13 | _subscribeId = 1; 14 | } 15 | 16 | ~DataEventEmitter() { 17 | _subscriptions.clear(); 18 | } 19 | 20 | unsigned int Subscribe(std::function function) { 21 | _subscribeId++; 22 | 23 | _subscriptions[_subscribeId] = function; 24 | 25 | return _subscribeId; 26 | } 27 | 28 | void Unsubscribe(unsigned int key) { 29 | _subscriptions.erase(key); 30 | } 31 | 32 | void Emit(Args... args) { 33 | for (const auto& [key, fn] : _subscriptions) { 34 | fn(args...); 35 | } 36 | } 37 | 38 | void Clear() { 39 | _subscriptions.clear(); 40 | } 41 | 42 | private: 43 | unsigned int _subscribeId; 44 | std::map> _subscriptions; 45 | }; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Clerk/UI/Controls/CheckboxComboPopup.cpp: -------------------------------------------------------------------------------- 1 | #include "CheckboxComboPopup.h" 2 | 3 | void CheckboxComboPopup::Init() { 4 | Bind(wxEVT_LIST_ITEM_CHECKED, &CheckboxComboPopup::OnCheck, this); 5 | Bind(wxEVT_LIST_ITEM_UNCHECKED, &CheckboxComboPopup::OnCheck, this); 6 | } 7 | 8 | bool CheckboxComboPopup::Create(wxWindow *parent) { 9 | return wxListCtrl::Create(parent, 1, wxPoint(0, 0), wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER); 10 | } 11 | 12 | wxWindow *CheckboxComboPopup::GetControl() { 13 | return this; 14 | } 15 | 16 | void CheckboxComboPopup::SetStringValue(const wxString &s) { 17 | _value = s; 18 | } 19 | 20 | wxString CheckboxComboPopup::GetStringValue() const { 21 | return _value; 22 | } 23 | 24 | void CheckboxComboPopup::OnCheck(wxListEvent &event) { 25 | if (OnItemSelect) { 26 | OnItemSelect(event.GetItem()); 27 | } 28 | } 29 | 30 | void CheckboxComboPopup::OnMouseMove(wxMouseEvent& event) { 31 | event.Skip(); 32 | } 33 | 34 | void CheckboxComboPopup::OnMouseClick(wxMouseEvent& WXUNUSED(event)) { 35 | Dismiss(); 36 | } -------------------------------------------------------------------------------- /Clerk/Data/Services/CurrenciesService.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Utils/Types.h" 4 | #include "../ExchangeRates/CBRRatesLoader.h" 5 | #include "../Repositories/CurrenciesRepository.h" 6 | #include "../PresentationModels/CurrencyPresentationModel.h" 7 | #include "HashService.h" 8 | 9 | namespace Clerk { 10 | namespace Data { 11 | class CurrenciesService : HashService> { 12 | public: 13 | CurrenciesService(CurrenciesRepository& currenciesRepository); 14 | 15 | void SetBaseCurrency(int id); 16 | shared_vector GetAll(); 17 | std::shared_ptr GetById(int id); 18 | std::shared_ptr GetBaseCurrency(); 19 | float GetExchangeRate(const CurrencyPresentationModel& fromCurrency, const CurrencyPresentationModel& toCurrency); 20 | void UpdatedExchangeRates(); 21 | 22 | private: 23 | CurrenciesRepository& _currenciesRepository; 24 | 25 | int _baseCurrencyId = 0; 26 | exhange_rate_map _exchangeRates; 27 | }; 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Clerk/UI/Controls/PeriodFilterPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "../../Utils/Types.h" 9 | #include "../../Utils/Utils.h" 10 | #include "Enums.h" 11 | 12 | using namespace Clerk::Utils; 13 | using namespace Clerk::UI; 14 | 15 | class PeriodFilterPanel : public wxPanel 16 | { 17 | public: 18 | PeriodFilterPanel(wxWindow* parent, PeriodFilterType type); 19 | 20 | void SetPeriod(int period); 21 | int GetPeriod(); 22 | void SetFromDate(wxDateTime date); 23 | wxDateTime GetFromDate(); 24 | void SetToDate(wxDateTime date); 25 | wxDateTime GetToDate(); 26 | 27 | std::function OnChange; 28 | 29 | private: 30 | wxComboBox* _periodList; 31 | wxDatePickerCtrl* _fromDatePicker; 32 | wxDatePickerCtrl* _toDatePicker; 33 | wxDateTime _periodFromDate; 34 | wxDateTime _periodToDate; 35 | PeriodFilterType _type; 36 | 37 | void CalculatePeriod(); 38 | void OnPeriodSelect(wxCommandEvent& event); 39 | void OnDateChanged(wxDateEvent& event); 40 | }; -------------------------------------------------------------------------------- /Clerk/UI/Schedulers/SchedulerDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Icons.h" 5 | #include "../../Data/DataContext.h" 6 | #include "SchedulerViewModel.h" 7 | #include "SchedulerPatternPanel.h" 8 | #include "SchedulerTransactionPanel.h" 9 | 10 | using namespace Clerk::Data; 11 | using namespace Clerk::UI; 12 | using namespace Clerk::Utils; 13 | 14 | class SchedulerDialog : public wxFrame 15 | { 16 | public: 17 | SchedulerDialog(wxFrame *parent, const wxChar *title, int xpos, int ypos, int width, int height, Icons& icons, DataContext& context); 18 | ~SchedulerDialog(); 19 | 20 | void SetViewModel(SchedulerViewModel* viewModel); 21 | 22 | private: 23 | SchedulerViewModel* _viewModel; 24 | Icons& _icons; 25 | DataContext& _context; 26 | wxTextCtrl *_nameField; 27 | SchedulerPatternPanel* _schedulerPatternPanel; 28 | SchedulerTransactionPanel* _schedulerTransactionPanel; 29 | 30 | void OnNameKillFocus(wxFocusEvent& event); 31 | void OnOK(wxCommandEvent &event); 32 | void OnCancel(wxCommandEvent &event); 33 | void OnKeyDown(wxKeyEvent &event); 34 | }; 35 | -------------------------------------------------------------------------------- /Clerk/Data/Services/GoalsService.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Utils/EventEmitter/EventEmitter.h" 4 | #include "../../Utils/Types.h" 5 | #include "../Repositories/GoalsRepository.h" 6 | #include "../PresentationModels/GoalPresentationModel.h" 7 | #include "HashService.h" 8 | 9 | using namespace Clerk::Utils; 10 | 11 | namespace Clerk { 12 | namespace Data { 13 | class GoalsService : HashService> { 14 | public: 15 | GoalsService(GoalsRepository& goalsRepository); 16 | ~GoalsService(); 17 | 18 | std::shared_ptr GetById(int id); 19 | shared_vector GetAll(); 20 | 21 | std::shared_ptr Save(GoalPresentationModel& budget); 22 | void Delete(GoalPresentationModel& budget); 23 | 24 | unsigned int Subscribe(std::function fn); 25 | void Unsubscribe(unsigned int subscriptionId); 26 | 27 | private: 28 | GoalsRepository& _goalsRepository; 29 | EventEmitter* _eventEmitter; 30 | 31 | float GetBalance(GoalPresentationModel& goal); 32 | }; 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /Tests/DataConnectionTest.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | 3 | #include "../Clerk/Data/DataConnection.h" 4 | 5 | using namespace Clerk::Data; 6 | 7 | namespace Clerk { 8 | class TestConnection : public testing::Test { 9 | public: 10 | TestConnection() {} 11 | ~TestConnection() {} 12 | void SetUp() { 13 | existingPath = std::string("..//..//Tests//Assets//Test.sqlite"); 14 | nonExistentPath = std::string("No.sqlite"); 15 | } 16 | void TearDown() {} 17 | 18 | protected: 19 | std::string existingPath; 20 | std::string nonExistentPath; 21 | }; 22 | 23 | TEST_F(TestConnection, TestConnectionSuccess) { 24 | DataConnection* connection = new DataConnection(std::move(existingPath)); 25 | 26 | EXPECT_TRUE(connection->GetConnection() != NULL); 27 | 28 | connection->Close(); 29 | } 30 | 31 | TEST_F(TestConnection, DataConnectionFail) { 32 | DataConnection* connection = new DataConnection(std::move(nonExistentPath)); 33 | 34 | EXPECT_TRUE(connection->GetConnection() == NULL); 35 | } 36 | } -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/SchedulerPresentationModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Types.h" 5 | #include "../../Utils/Utils.h" 6 | #include "../Models/SchedulerModel.h" 7 | #include "TagPresentationModel.h" 8 | #include "AccountPresentationModel.h" 9 | 10 | using namespace Clerk::Utils; 11 | 12 | namespace Clerk { 13 | namespace Data { 14 | class SchedulerPresentationModel { 15 | public: 16 | SchedulerPresentationModel(); 17 | SchedulerPresentationModel(SchedulerModel& scheduler); 18 | 19 | int id; 20 | wxString name; 21 | SchedulerType type; 22 | wxDateTime previousDate; 23 | wxDateTime nextDate; 24 | int day; 25 | int week; 26 | int month; 27 | bool isActive; 28 | std::shared_ptr fromAccount; 29 | std::shared_ptr toAccount; 30 | float fromAmount; 31 | float toAmount; 32 | shared_vector tags; 33 | wxDateTime created; 34 | wxString typeName; 35 | 36 | operator SchedulerModel& (); 37 | 38 | private: 39 | SchedulerModel& GetModel(); 40 | }; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Sergey Lenkov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Clerk/UI/Charts/LineChart.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "../../Data/PresentationModels/Types.h" 11 | 12 | using namespace Clerk::Data; 13 | 14 | class LineChart : public wxPanel 15 | { 16 | public: 17 | LineChart(wxWindow *parent); 18 | 19 | void SetValues(std::vector values); 20 | void SetDrawAverage(bool value); 21 | void Draw(); 22 | 23 | std::function OnShowPopup; 24 | std::function OnHidePopup; 25 | std::function OnUpdatePopup; 26 | 27 | private: 28 | std::vector _values; 29 | std::vector> _points; 30 | float _maxValue; 31 | float _totalValue; 32 | int _width; 33 | int _height; 34 | int _graphWidth; 35 | float _stepX; 36 | float _stepY; 37 | int _offsetX; 38 | int _offsetY; 39 | int _currentPopupIndex; 40 | bool _drawAverage; 41 | 42 | void DrawGraph(); 43 | void OnPaint(wxPaintEvent& event); 44 | void OnMouseMove(wxMouseEvent& event); 45 | }; -------------------------------------------------------------------------------- /Clerk/Data/Repositories/ReportsRepository.cpp: -------------------------------------------------------------------------------- 1 | #include "ReportsRepository.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | std::vector ReportsRepository::GetAll() { 6 | std::vector result; 7 | 8 | ReportModel* report = new ReportModel(); 9 | 10 | report->id = 1; 11 | report->name = std::wstring(L"Expenses By Month"); 12 | 13 | result.push_back(report); 14 | 15 | report = new ReportModel(); 16 | 17 | report->id = 2; 18 | report->name = std::wstring(L"Expenses For Period"); 19 | 20 | result.push_back(report); 21 | 22 | report = new ReportModel(); 23 | 24 | report->id = 3; 25 | report->name = std::wstring(L"Balance By Month"); 26 | 27 | result.push_back(report); 28 | 29 | report = new ReportModel(); 30 | 31 | report->id = 4; 32 | report->name = std::wstring(L"Receipts By Month"); 33 | 34 | result.push_back(report); 35 | 36 | report = new ReportModel(); 37 | 38 | report->id = 5; 39 | report->name = std::wstring(L"Receipts And Expenses By Month"); 40 | 41 | result.push_back(report); 42 | 43 | return result; 44 | } 45 | 46 | ReportModel* ReportsRepository::GetById(int id) { 47 | return nullptr; 48 | } -------------------------------------------------------------------------------- /Clerk/UI/Notifications/NotificationSchedulerPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "wx/wx.h" 4 | #include "../../Data/PresentationModels/SchedulerPresentationModel.h" 5 | #include "../../Utils/Types.h" 6 | #include "../../Utils/Utils.h" 7 | 8 | using namespace Clerk::Data; 9 | using namespace Clerk::Utils; 10 | 11 | class NotificationSchedulerPanel : public wxPanel 12 | { 13 | public: 14 | NotificationSchedulerPanel(wxWindow* parent, const wxPoint& position, const wxSize& size); 15 | 16 | void SetScheduler(std::shared_ptr scheduler); 17 | std::function)> OnDismiss; 18 | std::function)> OnSkip; 19 | std::function)> OnExec; 20 | 21 | private: 22 | std::shared_ptr _scheduler; 23 | 24 | wxStaticText* _label; 25 | AlertImportance _importance; 26 | 27 | void Update(); 28 | void OnPaint(wxPaintEvent& event); 29 | void OnDismissClick(wxCommandEvent& event); 30 | void OnSkipClick(wxCommandEvent& event); 31 | void OnExecClick(wxCommandEvent& event); 32 | }; 33 | 34 | -------------------------------------------------------------------------------- /Clerk/Data/Repositories/TransactionsRepository.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "BaseRepository.h" 9 | #include "../Models/TransactionModel.h" 10 | #include "../Models/AccountModel.h" 11 | 12 | namespace Clerk { 13 | namespace Data { 14 | class TransactionsRepository : BaseRepository { 15 | public: 16 | using BaseRepository::BaseRepository; 17 | 18 | TransactionModel* GetById(int id); 19 | std::vector GetAll(); 20 | std::vector GetDeleted(); 21 | std::vector GetRecents(int count); 22 | std::vector GetRecents(int accountId, int count); 23 | std::vector GetForPeriod(std::string& fromDate, std::string& toDate); 24 | TransactionModel* GetInitialTransactionForAccount(int accountId); 25 | 26 | int Save(const TransactionModel& transaction); 27 | void Delete(const TransactionModel& transaction); 28 | 29 | private: 30 | TransactionModel* Load(int id); 31 | void UpdateTags(int id, std::vector tagsIds); 32 | }; 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /Clerk/Data/Services/AlertsService.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Utils/EventEmitter/EventEmitter.h" 4 | #include "../../Utils/Types.h" 5 | #include "../Repositories/AlertsRepository.h" 6 | #include "../PresentationModels/AlertPresentationModel.h" 7 | #include "AccountsService.h" 8 | #include "HashService.h" 9 | 10 | using namespace Clerk::Utils; 11 | 12 | namespace Clerk { 13 | namespace Data { 14 | class AlertsService : HashService> { 15 | public: 16 | AlertsService(AlertsRepository& alertsRepository); 17 | ~AlertsService(); 18 | 19 | std::shared_ptr GetById(int id); 20 | shared_vector GetAll(); 21 | shared_vector GetActive(); 22 | void Reload(); 23 | 24 | std::shared_ptr Save(AlertPresentationModel& alert); 25 | void Delete(AlertPresentationModel& alert); 26 | 27 | unsigned int Subscribe(std::function fn); 28 | void Unsubscribe(unsigned int subscriptionId); 29 | 30 | private: 31 | AlertsRepository& _alertsRepository; 32 | EventEmitter* _eventEmitter; 33 | }; 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Clerk/UI/Transactions/TransactionsListDataModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Data/PresentationModels/TransactionPresentationModel.h" 5 | #include "../../Utils/Utils.h" 6 | #include "../../Utils/Types.h" 7 | #include "Enums.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Utils; 11 | using namespace Clerk::UI; 12 | 13 | class TransactionsListDataModel : public wxDataViewIndexListModel 14 | { 15 | public: 16 | TransactionsListDataModel(); 17 | 18 | void SetItems(shared_vector transactions); 19 | 20 | unsigned int GetColumnCount() const; 21 | wxString GetColumnType(unsigned int column) const; 22 | virtual void GetValueByRow(wxVariant &variant, unsigned int row, unsigned int column) const; 23 | virtual bool SetValueByRow(const wxVariant& variant, unsigned int row, unsigned int column); 24 | virtual int Compare(const wxDataViewItem& item1, const wxDataViewItem& item2, unsigned int column, bool ascending) const; 25 | virtual bool HasDefaultCompare() const; 26 | unsigned int GetCount() const override; 27 | 28 | private: 29 | shared_vector _transactions; 30 | }; 31 | 32 | -------------------------------------------------------------------------------- /Clerk/Utils/Icons.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace Clerk { 8 | namespace Utils { 9 | enum class IconType { 10 | Plus, 11 | Tab, 12 | TabRemove, 13 | Pencil, 14 | Copy, 15 | Delete, 16 | Split, 17 | Pause, 18 | Play, 19 | Duplicate, 20 | ArrowRight, 21 | ArrowLeft, 22 | ArrowDown, 23 | ArrowUp, 24 | Wallet, 25 | CalendarMonth, 26 | Cached, 27 | Bell, 28 | BellActive, 29 | Merge, 30 | Undo, 31 | Percent 32 | }; 33 | 34 | class Icons { 35 | public: 36 | Icons(); 37 | ~Icons(); 38 | 39 | wxImageList* GetImageList(); 40 | int GetIconIndexForAccount(int index); 41 | int GetAccountIconsCount(); 42 | wxBitmap* GetAccountIcon(int index); 43 | wxBitmapBundle GetIconByType(IconType type); 44 | 45 | private: 46 | wxImageList* _imageList; 47 | int _menuIconsCount; 48 | int _accountIconsCount; 49 | int _defaultAccountIcon; 50 | std::vector _images; 51 | std::map _icons; 52 | 53 | void LoadMenuIcons(); 54 | void LoadAccountsIcons(); 55 | void LoadSvgIcons(); 56 | }; 57 | } 58 | } -------------------------------------------------------------------------------- /Clerk/UI/Account/InterestAccrualViewModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Data/Services/AccountsService.h" 4 | #include "../../Data/Services/TransactionsService.h" 5 | #include "../../Utils/Types.h" 6 | #include "Enums.h" 7 | 8 | using namespace Clerk::Data; 9 | 10 | namespace Clerk { 11 | namespace UI { 12 | class InterestAccrualViewModel { 13 | public: 14 | InterestAccrualViewModel(AccountsService& accountsService, TransactionsService& transactionsService); 15 | 16 | void SetAccountId(int id); 17 | void SetType(AccrualType type); 18 | AccrualType GetType(); 19 | void SetAmount(float amount); 20 | float GetAmount(); 21 | void SetPercent(float amount); 22 | float GetPercent(); 23 | wxString GetCurrencyName(); 24 | float GetBalance(); 25 | float GetNewBalance(); 26 | 27 | void Save(); 28 | std::function OnUpdate; 29 | 30 | private: 31 | AccountsService& _accountsService; 32 | TransactionsService& _transactionsService; 33 | int _id; 34 | AccrualType _type; 35 | float _amount; 36 | float _percent; 37 | float _newBalance; 38 | 39 | void CalculateNewBalance(); 40 | }; 41 | } 42 | } -------------------------------------------------------------------------------- /Clerk/UI/Goals/GoalViewModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Data/Services/GoalsService.h" 4 | #include "../../Data/Services/AccountsService.h" 5 | #include "../../Utils/Types.h" 6 | #include "./Enums.h" 7 | 8 | using namespace Clerk::Data; 9 | 10 | namespace Clerk { 11 | namespace UI { 12 | class GoalViewModel { 13 | public: 14 | GoalViewModel(GoalsService& goalsService, AccountsService& accountsService); 15 | 16 | void SetGoalId(int id); 17 | bool IsNew(); 18 | void SetName(wxString name); 19 | wxString GetName(); 20 | void SetDate(wxDateTime date); 21 | wxDateTime GetDate(); 22 | void SetAmount(float amount); 23 | float GetAmount(); 24 | void SetAccountsIds(std::vector ids); 25 | std::vector GetAccountsIds(); 26 | shared_vector GetAccounts(); 27 | 28 | void Save(); 29 | std::function OnUpdate; 30 | 31 | private: 32 | GoalsService& _goalsService; 33 | AccountsService& _accountsService; 34 | 35 | int _id; 36 | wxString _name; 37 | BudgetPeriod _period; 38 | wxDateTime _date; 39 | float _amount; 40 | std::vector _accountsIds; 41 | }; 42 | } 43 | } -------------------------------------------------------------------------------- /Clerk/Data/Services/HashService.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | using namespace Clerk::Data; 7 | 8 | namespace Clerk { 9 | namespace Data { 10 | template 11 | class HashService { 12 | public: 13 | ~HashService() { 14 | _hash.clear(); 15 | _list.clear(); 16 | } 17 | 18 | std::vector GetHashList() { 19 | return _list; 20 | } 21 | 22 | void AddToHash(int id, T t) { 23 | if (t) { 24 | _hash[id] = t; 25 | _list.push_back(t); 26 | } 27 | } 28 | 29 | T GetFromHash(int id) { 30 | auto search = _hash.find(id); 31 | 32 | if (search != _hash.end()) { 33 | return search->second; 34 | } 35 | 36 | return nullptr; 37 | } 38 | 39 | void RemoveFromHash(int id) { 40 | auto model = GetFromHash(id); 41 | 42 | if (model) { 43 | _hash.erase(id); 44 | 45 | auto search = std::find_if(_list.begin(), _list.end(), [&model](T _t) { return (_t == model); }); 46 | 47 | if (search != _list.end()) { 48 | _list.erase(search); 49 | } 50 | } 51 | } 52 | 53 | protected: 54 | bool _isLoading; 55 | std::vector _list; 56 | std::map _hash; 57 | }; 58 | } 59 | } -------------------------------------------------------------------------------- /Clerk/Data/Services/BudgetsService.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Utils/EventEmitter/EventEmitter.h" 4 | #include "../../Utils/Types.h" 5 | #include "../Repositories/BudgetsRepository.h" 6 | #include "../PresentationModels/BudgetPresentationModel.h" 7 | #include "HashService.h" 8 | 9 | using namespace Clerk::Utils; 10 | 11 | namespace Clerk { 12 | namespace Data { 13 | class BudgetsService : HashService> { 14 | public: 15 | BudgetsService(BudgetsRepository& budgetsRepository); 16 | ~BudgetsService(); 17 | 18 | std::shared_ptr GetById(int id); 19 | shared_vector GetAll(); 20 | void UpdateBalance(); 21 | 22 | std::shared_ptr Save(BudgetPresentationModel& budget); 23 | void Delete(BudgetPresentationModel& budget); 24 | 25 | unsigned int Subscribe(std::function fn); 26 | void Unsubscribe(unsigned int subscriptionId); 27 | 28 | private: 29 | BudgetsRepository& _budgetsRepository; 30 | EventEmitter* _eventEmitter; 31 | 32 | float GetExpenses(BudgetPresentationModel& budget, std::string& fromDate, std::string& toDate); 33 | }; 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Clerk/UI/Dashboard/DashboardPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../DataPanel/DataPanel.h" 5 | #include "./DashboardSchedulersPanel.h" 6 | #include "./DashboardBudgetsPanel.h" 7 | #include "./DashboardExpensesPanel.h" 8 | #include "./DashboardReceiptsPanel.h" 9 | #include "./DashboardAccountsPanel.h" 10 | #include "./DashboardBalancePanel.h" 11 | #include "./DashboardGoalsPanel.h" 12 | #include "./DashboardDebtsPanel.h" 13 | #include "DashboardViewModel.h" 14 | 15 | using namespace Clerk::Data; 16 | 17 | class DashboardPanel : public DataPanel 18 | { 19 | public: 20 | DashboardPanel(wxWindow *parent, DataContext& context, Icons& icons); 21 | ~DashboardPanel(); 22 | 23 | void Update(); 24 | 25 | private: 26 | wxScrolledWindow*_scrolledWindow; 27 | wxPanel* _leftPanel; 28 | wxPanel* _rightPanel; 29 | DashboardSchedulersPanel* _schedulersPanel; 30 | DashboardBudgetsPanel* _budgetsPanel; 31 | DashboardExpensesPanel* _expensesPanel; 32 | DashboardReceiptsPanel* _receiptsPanel; 33 | DashboardAccountsPanel* _accountsPanel; 34 | DashboardBalancePanel* _balancePanel; 35 | DashboardGoalsPanel* _goalsPanel; 36 | DashboardDebtsPanel* _debtsPanel; 37 | DashboardViewModel* _viewModel; 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /Clerk/UI/Goals/GoalsListDataModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../../Utils/Types.h" 6 | #include "../../Data/PresentationModels/GoalPresentationModel.h" 7 | #include "Enums.h" 8 | 9 | using namespace Clerk::Utils; 10 | using namespace Clerk::Data; 11 | using namespace Clerk::UI; 12 | 13 | class GoalsListDataModel : public wxDataViewIndexListModel 14 | { 15 | public: 16 | GoalsListDataModel(); 17 | 18 | void SetItems(shared_vector goals); 19 | 20 | unsigned int GetColumnCount() const; 21 | wxString GetColumnType(unsigned int column) const; 22 | virtual void GetValueByRow(wxVariant& variant, unsigned int row, unsigned int column) const; 23 | virtual bool SetValueByRow(const wxVariant& variant, unsigned int row, unsigned int column); 24 | virtual bool GetAttrByRow(unsigned int row, unsigned int column, wxDataViewItemAttr& attr) const; 25 | virtual int Compare(const wxDataViewItem& item1, const wxDataViewItem& item2, unsigned int column, bool ascending) const; 26 | virtual bool HasDefaultCompare() const; 27 | unsigned int GetCount() const override; 28 | 29 | private: 30 | shared_vector _goals; 31 | }; 32 | 33 | -------------------------------------------------------------------------------- /Clerk/UI/Alerts/AlertsListDataModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../../Utils/Types.h" 6 | #include "../../Data/PresentationModels/AlertPresentationModel.h" 7 | #include "Enums.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Utils; 11 | using namespace Clerk::UI; 12 | 13 | class AlertsListDataModel : public wxDataViewIndexListModel 14 | { 15 | public: 16 | AlertsListDataModel(); 17 | 18 | void SetItems(shared_vector alerts); 19 | 20 | unsigned int GetColumnCount() const; 21 | wxString GetColumnType(unsigned int column) const; 22 | virtual void GetValueByRow(wxVariant& variant, unsigned int row, unsigned int column) const; 23 | virtual bool SetValueByRow(const wxVariant& variant, unsigned int row, unsigned int column); 24 | virtual bool GetAttrByRow(unsigned int row, unsigned int column, wxDataViewItemAttr& attr) const; 25 | virtual int Compare(const wxDataViewItem& item1, const wxDataViewItem& item2, unsigned int column, bool ascending) const; 26 | virtual bool HasDefaultCompare() const; 27 | unsigned int GetCount() const override; 28 | 29 | private: 30 | shared_vector _alerts; 31 | }; 32 | 33 | -------------------------------------------------------------------------------- /Clerk/UI/Account/InterestAccrualDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "../../Utils/Icons.h" 7 | #include "../../Utils/Utils.h" 8 | #include "../Controls/AmountField.h" 9 | #include "InterestAccrualViewModel.h" 10 | 11 | using namespace Clerk::Data; 12 | using namespace Clerk::Utils; 13 | using namespace Clerk::UI; 14 | 15 | class InterestAccrualDialog : public wxFrame 16 | { 17 | public: 18 | InterestAccrualDialog(wxFrame* parent, const wxChar* title, int xpos, int ypos, int width, int height); 19 | ~InterestAccrualDialog(); 20 | 21 | void SetViewModel(InterestAccrualViewModel* viewModel); 22 | 23 | private: 24 | InterestAccrualViewModel* _viewModel; 25 | wxStaticText* _balanceLabel; 26 | wxComboBox* _typeList; 27 | AmountField* _amountField; 28 | AmountField* _percentField; 29 | wxStaticText* _currencyLabel; 30 | 31 | void Update(); 32 | void UpdateType(); 33 | void UpdateBalance(); 34 | void OnOK(wxCommandEvent& event); 35 | void OnCancel(wxCommandEvent& event); 36 | void OnAmountKillFocus(wxFocusEvent& event); 37 | void OnPercentKillFocus(wxFocusEvent& event); 38 | void OnTypeSelect(wxCommandEvent& event); 39 | void OnKeyDown(wxKeyEvent& event); 40 | }; -------------------------------------------------------------------------------- /Clerk/UI/Budgets/BudgetsListDataModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../../Utils/Types.h" 6 | #include "../../Data/PresentationModels/BudgetPresentationModel.h" 7 | #include "Enums.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Utils; 11 | using namespace Clerk::UI; 12 | 13 | class BudgetsListDataModel : public wxDataViewIndexListModel 14 | { 15 | public: 16 | BudgetsListDataModel(); 17 | 18 | void SetItems(shared_vector budgets); 19 | 20 | unsigned int GetColumnCount() const; 21 | wxString GetColumnType(unsigned int column) const; 22 | virtual void GetValueByRow(wxVariant& variant, unsigned int row, unsigned int column) const; 23 | virtual bool SetValueByRow(const wxVariant& variant, unsigned int row, unsigned int column); 24 | virtual bool GetAttrByRow(unsigned int row, unsigned int column, wxDataViewItemAttr& attr) const; 25 | virtual int Compare(const wxDataViewItem& item1, const wxDataViewItem& item2, unsigned int column, bool ascending) const; 26 | virtual bool HasDefaultCompare() const; 27 | unsigned int GetCount() const override; 28 | 29 | private: 30 | shared_vector _budgets; 31 | }; 32 | 33 | -------------------------------------------------------------------------------- /Clerk/UI/Goals/GoalDialog.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "../Controls/AmountField.h" 7 | #include "../../Utils/Icons.h" 8 | #include "GoalViewModel.h" 9 | 10 | using namespace Clerk::Data; 11 | using namespace Clerk::UI; 12 | using namespace Clerk::Utils; 13 | 14 | class GoalDialog : public wxFrame 15 | { 16 | public: 17 | GoalDialog(wxFrame *parent, const wxChar *title, int xpos, int ypos, int width, int height, Icons& icons); 18 | ~GoalDialog(); 19 | 20 | void SetViewModel(GoalViewModel* viewModel); 21 | 22 | private: 23 | GoalViewModel* _viewModel; 24 | Icons& _icons; 25 | wxTextCtrl* _nameField; 26 | wxDatePickerCtrl* _datePicker; 27 | wxListCtrl* _accountsList; 28 | AmountField* _amountField; 29 | shared_vector _accounts; 30 | 31 | void Update(); 32 | void UpdateAccounts(); 33 | void OnAccountsChange(wxListEvent& event); 34 | void OnNameKillFocus(wxFocusEvent& event); 35 | void OnAmountKillFocus(wxFocusEvent& event); 36 | void OnDateChanged(wxDateEvent& event); 37 | void OnOK(wxCommandEvent &event); 38 | void OnCancel(wxCommandEvent &event); 39 | void OnKeyDown(wxKeyEvent &event); 40 | }; 41 | 42 | -------------------------------------------------------------------------------- /Clerk/Data/Repositories/AccountsRepository.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "BaseRepository.h" 9 | #include "../Models/AccountModel.h" 10 | 11 | namespace Clerk { 12 | namespace Data { 13 | class AccountsRepository : BaseRepository { 14 | public: 15 | using BaseRepository::BaseRepository; 16 | 17 | AccountModel* GetById(int id); 18 | std::vector GetAll(); 19 | float GetBalance(int accountId, AccountType type); 20 | float GetBalanceForDate(int accountId, AccountType type, std::string& date); 21 | float GetExpenses(int accountId); 22 | float GetReceipts(int accountId); 23 | float GetExpenses(int accountId, std::string& fromDate, std::string& toDate); 24 | float GetReceipts(int accountId, std::string& fromDate, std::string& toDate); 25 | float GetInitialAmount(int accountId, AccountType type); 26 | int GetPairAccountId(int accountId, AccountType type, std::string& fromDate); 27 | int GetLastUsedAccountId(std::string& fromDate); 28 | 29 | int Save(const AccountModel& account); 30 | void Delete(const AccountModel& account); 31 | 32 | private: 33 | AccountModel* Load(int id); 34 | }; 35 | } 36 | } -------------------------------------------------------------------------------- /Clerk/UI/Schedulers/SchedulersListDataModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../Utils/Utils.h" 5 | #include "../../Utils/Types.h" 6 | #include "../../Data/PresentationModels/SchedulerPresentationModel.h" 7 | #include "Enums.h" 8 | 9 | using namespace Clerk::Data; 10 | using namespace Clerk::Utils; 11 | using namespace Clerk::UI; 12 | 13 | class SchedulersListDataModel : public wxDataViewIndexListModel 14 | { 15 | public: 16 | SchedulersListDataModel(); 17 | 18 | void SetItems(shared_vector schedulers); 19 | 20 | unsigned int GetColumnCount() const; 21 | wxString GetColumnType(unsigned int column) const; 22 | virtual void GetValueByRow(wxVariant& variant, unsigned int row, unsigned int column) const; 23 | virtual bool SetValueByRow(const wxVariant& variant, unsigned int row, unsigned int column); 24 | virtual bool GetAttrByRow(unsigned int row, unsigned int column, wxDataViewItemAttr& attr) const; 25 | virtual int Compare(const wxDataViewItem& item1, const wxDataViewItem& item2, unsigned int column, bool ascending) const; 26 | virtual bool HasDefaultCompare() const; 27 | unsigned int GetCount() const override; 28 | 29 | private: 30 | shared_vector _schedulers; 31 | }; 32 | 33 | -------------------------------------------------------------------------------- /Clerk/Data/Services/ReportsService.cpp: -------------------------------------------------------------------------------- 1 | #include "ReportsService.h" 2 | 3 | ReportsService::ReportsService(ReportsRepository& reportsRepository) : 4 | _reportsRepository(reportsRepository) 5 | { 6 | _isLoading = false; 7 | } 8 | 9 | std::shared_ptr ReportsService::GetById(int id) { 10 | auto report = GetFromHash(id); 11 | 12 | if (report) { 13 | return report; 14 | } 15 | 16 | auto model = _reportsRepository.GetById(id); 17 | 18 | if (model) { 19 | report = std::make_shared(*model); 20 | 21 | AddToHash(report->id, report); 22 | 23 | delete model; 24 | 25 | return report; 26 | } 27 | 28 | return nullptr; 29 | } 30 | 31 | shared_vector ReportsService::GetAll() { 32 | if (_isLoading && GetHashList().size() > 0) { 33 | return GetHashList(); 34 | } 35 | 36 | auto models = _reportsRepository.GetAll(); 37 | 38 | for (auto& model : models) { 39 | if (!GetFromHash(model->id)) { 40 | auto report = std::make_shared(*model); 41 | AddToHash(report->id, report); 42 | } 43 | } 44 | 45 | for (auto p : models) { 46 | delete p; 47 | } 48 | 49 | models.erase(models.begin(), models.end()); 50 | 51 | _isLoading = true; 52 | 53 | return GetHashList(); 54 | } -------------------------------------------------------------------------------- /Clerk/UI/Budgets/BudgetViewModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Data/Services/BudgetsService.h" 4 | #include "../../Data/Services/AccountsService.h" 5 | #include "../../Utils/Types.h" 6 | #include "./Enums.h" 7 | 8 | using namespace Clerk::Data; 9 | 10 | namespace Clerk { 11 | namespace UI { 12 | class BudgetViewModel { 13 | public: 14 | BudgetViewModel(BudgetsService& budgetService, AccountsService& accountsService); 15 | 16 | void SetBudgetId(int id); 17 | bool IsNew(); 18 | void SetName(wxString name); 19 | wxString GetName(); 20 | void SetPeriod(BudgetPeriod period); 21 | BudgetPeriod GetPeriod(); 22 | void SetDate(wxDateTime date); 23 | wxDateTime GetDate(); 24 | void SetAmount(float amount); 25 | float GetAmount(); 26 | void SetAccountsIds(std::vector ids); 27 | std::vector GetAccountsIds(); 28 | shared_vector GetAccounts(); 29 | 30 | void Save(); 31 | std::function OnUpdate; 32 | 33 | private: 34 | BudgetsService& _budgetsService; 35 | AccountsService& _accountsService; 36 | 37 | int _id; 38 | wxString _name; 39 | BudgetPeriod _period; 40 | wxDateTime _date; 41 | float _amount; 42 | std::vector _accountsIds; 43 | }; 44 | } 45 | } -------------------------------------------------------------------------------- /Clerk/UI/Reports/ReportBalanceByMonthPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "../../Data/PresentationModels/Types.h" 8 | #include "../../Utils/Types.h" 9 | #include "../../Utils/Settings/Settings.h" 10 | #include "../DataPanel/DataPanel.h" 11 | #include "../Charts/LineChart.h" 12 | #include "../Controls/AccountsComboBox.h" 13 | #include "../Controls/PeriodFilterPanel.h" 14 | #include "Tooltip/ReportChartTooltipPopup.h" 15 | #include "Enums.h" 16 | 17 | using namespace Clerk::Data; 18 | using namespace Clerk::Utils; 19 | using namespace Clerk::UI; 20 | 21 | class ReportBalanceByMonthPanel : public DataPanel 22 | { 23 | public: 24 | ReportBalanceByMonthPanel(wxWindow *parent, DataContext& context, Icons& icons); 25 | ~ReportBalanceByMonthPanel(); 26 | 27 | void Update(); 28 | 29 | private: 30 | LineChart *_chart; 31 | AccountsComboBox* _accountsComboBox; 32 | PeriodFilterPanel* _periodFilterPanel; 33 | ReportChartTooltipPopup* _chartPopup; 34 | shared_vector _accounts; 35 | std::vector _values; 36 | std::set _selectedIds; 37 | 38 | void ShowPopup(); 39 | void HidePopup(); 40 | void UpdatePopup(int x, int y, int index); 41 | void RestoreFilterSettings(); 42 | void SaveFilterSettings(); 43 | }; -------------------------------------------------------------------------------- /Clerk/Data/PresentationModels/GoalPresentationModel.cpp: -------------------------------------------------------------------------------- 1 | #include "GoalPresentationModel.h" 2 | 3 | using namespace Clerk::Data; 4 | 5 | GoalPresentationModel::GoalPresentationModel() { 6 | id = -1; 7 | name = wxString(""); 8 | amount = 0; 9 | date = wxDateTime::Today(); 10 | balance = 0; 11 | remainAmount = 0; 12 | remainPercent = 0; 13 | created = wxDateTime::Now(); 14 | } 15 | 16 | GoalPresentationModel::GoalPresentationModel(GoalModel& model) { 17 | id = model.id; 18 | name = model.name; 19 | amount = model.amount; 20 | 21 | date = wxDateTime::Today(); 22 | date.ParseISODate(model.date); 23 | 24 | balance = 0; 25 | remainAmount = 0; 26 | remainPercent = 0; 27 | accountsIds = String::Split(model.accountIds, ','); 28 | 29 | created = wxDateTime::Now(); 30 | created.ParseISODate(model.created); 31 | } 32 | 33 | GoalPresentationModel::operator GoalModel& () { 34 | return GetModel(); 35 | } 36 | 37 | GoalModel& GoalPresentationModel::GetModel() { 38 | GoalModel* model = new GoalModel(); 39 | 40 | model->id = id; 41 | model->name = name; 42 | model->amount = amount; 43 | model->date = date.FormatISODate(); 44 | model->created = created.FormatISOCombined(' '); 45 | 46 | std::string ids = String::Join(accountsIds, ","); 47 | 48 | model->accountIds = std::wstring(ids.begin(), ids.end()); 49 | 50 | return *model; 51 | } -------------------------------------------------------------------------------- /Clerk/UI/TagsPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "../../Data/PresentationModels/TagPresentationModel.h" 8 | #include "DataPanel/DataPanel.h" 9 | 10 | using namespace Clerk::Data; 11 | 12 | enum class TagsPanelMenuTypes { 13 | Show = 1, 14 | Rename = 2, 15 | Delete = 3, 16 | }; 17 | 18 | class TagsPanel : public DataPanel 19 | { 20 | public: 21 | TagsPanel(wxWindow *parent, DataContext& context, Icons& icons); 22 | ~TagsPanel(); 23 | 24 | void Update(); 25 | std::shared_ptr GetTag(); 26 | 27 | private: 28 | wxTextCtrl *searchField; 29 | wxListCtrl *list; 30 | std::vector> tags; 31 | std::vector> filteredTags; 32 | long editedIndex; 33 | 34 | void Filter(); 35 | void UpdateList(); 36 | void ShowTransactions(); 37 | void Rename(); 38 | void Delete(); 39 | long GetSelectedIndex(); 40 | void DeleteItemAtIndex(long index); 41 | void OnSearchChanged(wxCommandEvent &event); 42 | void OnListItemBeginEdit(wxListEvent &event); 43 | void OnListItemEndEdit(wxListEvent &event); 44 | void OnListItemDoubleClick(wxListEvent &event); 45 | void OnRightClick(wxContextMenuEvent &event); 46 | void OnMenuSelect(wxCommandEvent &event); 47 | }; 48 | 49 | -------------------------------------------------------------------------------- /Clerk/UI/Charts/GroupedBarChart.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "../../Data/PresentationModels/Types.h" 11 | #include "../../Utils/Utils.h" 12 | 13 | using namespace Clerk::Data; 14 | using namespace Clerk::Utils; 15 | 16 | class GroupedBarChart : public wxPanel 17 | { 18 | public: 19 | GroupedBarChart(wxWindow* parent); 20 | 21 | void SetValues(std::vector values); 22 | void Draw(); 23 | 24 | std::function OnShowPopup; 25 | std::function OnHidePopup; 26 | std::function OnUpdatePopup; 27 | 28 | private: 29 | std::vector _values; 30 | std::vector> _points; 31 | float _maxValue; 32 | float _totalValue; 33 | int _width; 34 | int _height; 35 | int _graphWidth; 36 | int _barGraphWidth; 37 | float _stepX; 38 | float _stepY; 39 | float _barStepX; 40 | int _offsetX; 41 | int _offsetY; 42 | int _barOffsetX; 43 | int _currentPopupIndex; 44 | int _barSize; 45 | int _barOffset; 46 | 47 | void DrawGraph(); 48 | void DrawBars(wxClientDC& dc, std::vector values, int x); 49 | void OnPaint(wxPaintEvent& event); 50 | void OnMouseMove(wxMouseEvent& event); 51 | }; -------------------------------------------------------------------------------- /Clerk/UI/Reports/ReportReceiptsAndExpensesByMonthPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "../../Data/PresentationModels/Types.h" 7 | #include "../../Utils/Settings/Settings.h" 8 | #include "../Charts/GroupedBarChart.h" 9 | #include "../DataPanel/DataPanel.h" 10 | #include "../Controls/AccountsComboBox.h" 11 | #include "../Controls/PeriodFilterPanel.h" 12 | #include "Tooltip/ReportChartTooltipPopup.h" 13 | #include "Enums.h" 14 | 15 | using namespace Clerk::Data; 16 | using namespace Clerk::Utils; 17 | 18 | class ReportReceiptsAndExpensesByMonthPanel : public DataPanel 19 | { 20 | public: 21 | ReportReceiptsAndExpensesByMonthPanel(wxWindow* parent, DataContext& context, Icons& icons); 22 | ~ReportReceiptsAndExpensesByMonthPanel(); 23 | 24 | void Update(); 25 | 26 | private: 27 | GroupedBarChart* _chart; 28 | AccountsComboBox* _accountsComboBox; 29 | PeriodFilterPanel* _periodFilterPanel; 30 | ReportChartTooltipPopup* _chartPopup; 31 | shared_vector _accounts; 32 | std::vector _receipts = {}; 33 | std::vector _expenses = {}; 34 | std::set _selectedIds; 35 | 36 | void ShowPopup(); 37 | void HidePopup(); 38 | void UpdatePopup(int x, int y, int index); 39 | void RestoreFilterSettings(); 40 | void SaveFilterSettings(); 41 | }; 42 | 43 | -------------------------------------------------------------------------------- /Clerk/UI/Statusbar/StatusbarViewModel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Utils/EventEmitter/EventEmitter.h" 4 | #include "../../Utils/Utils.h" 5 | #include "../../Utils/Settings/Settings.h" 6 | #include "../../Data/Services/AccountingService.h" 7 | #include "../../Data/Services/CurrenciesService.h" 8 | #include "../../Data/Services/TransactionsService.h" 9 | 10 | using namespace Clerk::Utils; 11 | 12 | namespace Clerk { 13 | namespace UI { 14 | class StatusbarViewModel { 15 | public: 16 | StatusbarViewModel(AccountingService& accountingService, CurrenciesService& currenciesService, TransactionsService& transactionsService, std::vector selectedRates); 17 | ~StatusbarViewModel(); 18 | 19 | float GetBalance(); 20 | float GetReceipts(); 21 | float GetExpenses(); 22 | wxString GetExchangeRates(); 23 | std::shared_ptr GetBaseCurrency(); 24 | void SetIsExchangeRatesLoading(boolean isLoading); 25 | boolean GetIsExchangeRatesLoading(); 26 | void OnUpdate(std::function fn); 27 | 28 | private: 29 | AccountingService& _accountingService; 30 | CurrenciesService& _currenciesService; 31 | TransactionsService& _transactionsService; 32 | 33 | std::vector _selectedRates; 34 | boolean _isExchangeRatesLoading; 35 | EventEmitter* _eventEmitter; 36 | unsigned int _subscriptionId; 37 | }; 38 | } 39 | } -------------------------------------------------------------------------------- /Clerk/UI/Budgets/BudgetDialog.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "../Controls/AmountField.h" 7 | #include "../../Utils/Icons.h" 8 | #include "BudgetViewModel.h" 9 | 10 | using namespace Clerk::Data; 11 | using namespace Clerk::UI; 12 | using namespace Clerk::Utils; 13 | 14 | class BudgetDialog : public wxFrame 15 | { 16 | public: 17 | BudgetDialog(wxFrame *parent, const wxChar *title, int xpos, int ypos, int width, int height, Icons& icons); 18 | ~BudgetDialog(); 19 | 20 | void SetViewModel(BudgetViewModel* viewModel); 21 | 22 | private: 23 | BudgetViewModel* _viewModel; 24 | Icons& _icons; 25 | wxTextCtrl *_nameField; 26 | wxComboBox *_periodList; 27 | wxDatePickerCtrl *_datePicker; 28 | wxListCtrl* _accountsList; 29 | AmountField* _amountField; 30 | float amountValue = 0.0; 31 | shared_vector _accounts; 32 | 33 | void Update(); 34 | void UpdateAccounts(); 35 | void OnAccountsChange(wxListEvent& event); 36 | void OnPeriodSelect(wxCommandEvent &event); 37 | void OnNameKillFocus(wxFocusEvent& event); 38 | void OnAmountKillFocus(wxFocusEvent& event); 39 | void OnDateChanged(wxDateEvent& event); 40 | void OnOK(wxCommandEvent &event); 41 | void OnCancel(wxCommandEvent &event); 42 | void OnKeyDown(wxKeyEvent &event); 43 | }; 44 | 45 | -------------------------------------------------------------------------------- /Clerk/UI/Schedulers/SchedulerTransactionPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "wx/wx.h" 4 | #include 5 | #include "../../Data/Services/TagsService.h" 6 | #include "../../Utils/Icons.h" 7 | #include "../Controls/AmountField.h" 8 | #include "../TagsField/TagsField.h" 9 | #include "SchedulerViewModel.h" 10 | 11 | using namespace Clerk::Data; 12 | using namespace Clerk::Utils; 13 | 14 | class SchedulerTransactionPanel : public wxPanel 15 | { 16 | public: 17 | SchedulerTransactionPanel(wxWindow* parent, const wxPoint& position, const wxSize& size, Icons& icons, TagsService& tagsService); 18 | 19 | void SetViewModel(SchedulerViewModel* viewModel); 20 | 21 | private: 22 | SchedulerViewModel* _viewModel; 23 | Icons& _icons; 24 | TagsService& _tagsService; 25 | wxBitmapComboBox* _fromList; 26 | wxBitmapComboBox* _toList; 27 | TagsField* _tagsField; 28 | wxStaticText* _fromCurrencyLabel; 29 | AmountField* _fromAmountField; 30 | wxStaticText* _toCurrencyLabel; 31 | AmountField* _toAmountField; 32 | 33 | void Update(); 34 | void UpdateToList(); 35 | void UpdateFromList(); 36 | void SelectFromAccount(int index); 37 | void SelectToAccount(int index); 38 | void OnFromAccountSelect(wxCommandEvent& event); 39 | void OnToAccountSelect(wxCommandEvent& event); 40 | void OnFromAmountKillFocus(wxFocusEvent& event); 41 | void OnToAmountKillFocus(wxFocusEvent& event); 42 | }; 43 | -------------------------------------------------------------------------------- /Clerk/UI/Transactions/TransactionsAmountRender.cpp: -------------------------------------------------------------------------------- 1 | #include "TransactionsAmountRender.h" 2 | 3 | TransactionsAmountRender::TransactionsAmountRender() : wxDataViewCustomRenderer("arrstring", wxDATAVIEW_CELL_INERT, wxDVR_DEFAULT_ALIGNMENT) 4 | { 5 | } 6 | 7 | TransactionsAmountRender::~TransactionsAmountRender() 8 | { 9 | } 10 | 11 | bool TransactionsAmountRender::Render(wxRect rect, wxDC *dc, int state) 12 | { 13 | wxString text = _value[0]; 14 | 15 | wxSize size = dc->GetTextExtent(text); 16 | int offset = (rect.GetHeight() - size.GetHeight()) / 2; 17 | 18 | int x = (rect.GetX() + rect.GetWidth()) - size.GetWidth(); 19 | 20 | dc->SetTextForeground(wxColor(0, 0, 0)); 21 | dc->DrawText(text, wxPoint(x, rect.GetY() + offset)); 22 | 23 | if (_value.Count() > 1) { 24 | text = _value[1]; 25 | 26 | size = dc->GetTextExtent(text); 27 | 28 | x = x - size.GetWidth() - 10; 29 | 30 | dc->SetTextForeground(wxColor(100, 100, 100)); 31 | dc->DrawText(text, wxPoint(x, rect.GetY() + offset)); 32 | } 33 | 34 | return true; 35 | } 36 | 37 | wxSize TransactionsAmountRender::GetSize() const 38 | { 39 | return wxDefaultSize; 40 | } 41 | 42 | bool TransactionsAmountRender::SetValue(const wxVariant &value) 43 | { 44 | _value = value.GetArrayString(); 45 | 46 | return true; 47 | } 48 | 49 | bool TransactionsAmountRender::GetValue(wxVariant &WXUNUSED(value)) const 50 | { 51 | return true; 52 | } -------------------------------------------------------------------------------- /Clerk/UI/Controls/DataViewProgressRender.cpp: -------------------------------------------------------------------------------- 1 | #include "DataViewProgressRender.h" 2 | 3 | DataViewProgressRender::DataViewProgressRender(bool isReverse): 4 | wxDataViewCustomRenderer("string", wxDATAVIEW_CELL_INERT, wxDVR_DEFAULT_ALIGNMENT), 5 | _isReverse(isReverse) 6 | { 7 | } 8 | 9 | bool DataViewProgressRender::Render(wxRect rect, wxDC *dc, int state) 10 | { 11 | int x = rect.GetX() + 5; 12 | int width = rect.GetWidth() - 10; 13 | 14 | int percentWidth = (width / 100.0) * _value; 15 | int y = (rect.GetHeight() - 4) / 2; 16 | 17 | dc->SetPen(wxPen(wxColor(216, 216, 216), 1)); 18 | dc->SetBrush(wxBrush(wxColor(216, 216, 216))); 19 | 20 | dc->DrawRectangle(x, rect.GetY() + y, width, 4); 21 | 22 | wxColor color = Colors::ColorForProgress(_value, _isReverse); 23 | 24 | dc->SetPen(wxPen(color, 1)); 25 | dc->SetBrush(wxBrush(color)); 26 | 27 | dc->DrawRectangle(x, rect.GetY() + y, percentWidth, 4); 28 | 29 | return true; 30 | } 31 | 32 | wxSize DataViewProgressRender::GetSize() const 33 | { 34 | return wxDefaultSize; 35 | } 36 | 37 | bool DataViewProgressRender::SetValue(const wxVariant &value) 38 | { 39 | _value = value.GetDouble(); 40 | 41 | if (_value > 100) { 42 | _value = 100; 43 | } 44 | else if (_value < 1) { 45 | _value = 1; 46 | } 47 | 48 | return true; 49 | } 50 | 51 | bool DataViewProgressRender::GetValue(wxVariant &WXUNUSED(value)) const { 52 | return true; 53 | } -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | При нажатии на столбик в отчете выводить список транзакций по счету и за период 2 | ? Добавлять (копировать) транзакцию через поиск 3 | Средний расход в день 4 | Расход за предыдущий месяц (общий + категории) 5 | + Разбитие чека (транзакции) 6 | + Бюджет (лимит, цель) 7 | + Добавление/редактирование/удаление счетов 8 | Фильтр по тегам в отчетах 9 | + В отчетах в попапе выводить список расходов/доходов 10 | + Добавить в дашбоард долги 11 | + Копирование транзакции 12 | В отчетах показывать средний расход за месяц, максимальный 13 | Для кредита ввести поля срок, процент. Рассчитывать сумму переплату полностью и показывать ее 14 | Автоматически вычислять повторяющиеся транзакции и предлагать их ввести 15 | - Предлагать последние теги для пар аккаунтов 16 | ? Цвета для тегов 17 | - Календарь - выводить транзакции на календаре + возможные транзакции 18 | Если в отчетах выбран счет с бюджетом, рисовать линию бюджета на графике 19 | Добавить кастомные фильтры по транзакциям 20 | + Добавить повторяющиеся транзакции 21 | + Выводить попап с подтверждением повторяющихся транзакций 22 | + В списке schedulers выводить Day remains 23 | + Добавить алерты (приближение к определенной сумме на счету, превышение бюджета и т.д.) 24 | Открывать транзации из списка тегов 25 | Добавить мини калькулятор в поле суммы 26 | + Вывести поле Notes в список транзакций 27 | + Сохранять настройки списка для каждого счета 28 | + Добавить базовую валюту -------------------------------------------------------------------------------- /Clerk/Commands/ICommandsReceiver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../Data/Enums.h" 5 | #include "../UI/Tabs/Enums.h" 6 | 7 | using namespace Clerk::Data; 8 | using namespace Clerk::UI; 9 | 10 | namespace Clerk { 11 | namespace Commands { 12 | class ICommandsReceiver { 13 | public: 14 | virtual void OpenPreferencesDialog() = 0; 15 | virtual void OpenAboutDialog() = 0; 16 | virtual void OpenTab(TabType type) = 0; 17 | virtual void OpenAccountTab(int accountId) = 0; 18 | virtual void OpenAccountsTab(std::optional type) = 0; 19 | virtual void OpenReportTab(int id) = 0; 20 | virtual void NewTransaction(int id) = 0; 21 | virtual void CopyTransaction(int id) = 0; 22 | virtual void SplitTransaction(int id) = 0; 23 | virtual void EditTransaction(int id) = 0; 24 | virtual void OpenNewAccountDialog(AccountType type) = 0; 25 | virtual void OpenEditAccountDialog(int id) = 0; 26 | virtual void OpenInterestAccrualDialog(int id) = 0; 27 | virtual void OpenNewAlertDialog() = 0; 28 | virtual void OpenEditAlertDialog(int id) = 0; 29 | virtual void OpenNewBudgetDialog() = 0; 30 | virtual void OpenEditBudgetDialog(int id) = 0; 31 | virtual void OpenNewGoalDialog() = 0; 32 | virtual void OpenEditGoalDialog(int id) = 0; 33 | virtual void OpenNewSchedulerDialog() = 0; 34 | virtual void OpenEditSchedulerDialog(int id) = 0; 35 | }; 36 | } 37 | } --------------------------------------------------------------------------------