GnuCashew ~ GnuCash Enabled Web
GCW
AccountComboModel.cpp
Go to the documentation of this file.
1 #line 2 "src/Eng/AccountComboModel.cpp"
2 
3 #include <Wt/WStandardItem.h>
4 #include <Wt/WStandardItemModel.h>
5 
6 #include "../App.h"
7 #include "../Dbo/Accounts/Accounts.h"
8 #include "AccountComboModel.h"
9 
12 : Wt::WStandardItemModel( 0, 2 )
13 {
14 
15  Wt::Dbo::Transaction t( GCW::app()-> gnucashew_session() );
16  for( auto accountItem : GCW::Dbo::Accounts::allAccounts() )
17  {
18  std::vector< std::unique_ptr< Wt::WStandardItem > > row;
19  row.push_back( std::make_unique< Wt::WStandardItem >( accountItem-> guid() ) );
20  row.push_back( std::make_unique< Wt::WStandardItem >( GCW::Dbo::Accounts::fullName( accountItem-> guid() ) ) );
21  appendRow( std::move( row ) );
22 
23  } // endfor( auto accountItem : GCW::Dbo::Accounts::allAccounts() )
24 
25 } // endAccountSuggestionModel()
26 
27 
const Wt::WFormModel::Field guid
Definition: Accounts.cpp:46
auto allAccounts() -> Item::Vector
Load all accounts.
Definition: Accounts.cpp:217
auto fullName(const std::string &_guid) -> std::string
Account Fullname via GUID.
Definition: Accounts.cpp:282
App * app()
Definition: App.cpp:67
Definition: GncLock.h:6