GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
EmployeesModel.cpp
Go to the documentation of this file.
1#line 2 "src/Eng/CustomersModel.cpp"
2
3#include "../App.h"
4#include "EmployeesModel.h"
5
8: Wt::Dbo::QueryModel< GCW::Dbo::Employees::Item::Ptr >()
9{
11
12#ifdef NEVER
13 dataChanged().connect( [=]( Wt::WModelIndex _index1, Wt::WModelIndex _index2 )
14 {
15// std::cout << __FILE__ << ":" << __LINE__
16// << " r1:" << _index1.row() << " c1:" << _index1.column()
17// << " r2:" << _index2.row() << " c2:" << _index2.column()
18// << std::endl;
19
20 });
21
22 itemChanged().connect( [=]( Wt::WStandardItem * _item )
23 {
24// std::cout << __FILE__ << ":" << __LINE__ << " " << Wt::asString( _item-> data() ) << std::endl;
25
26 });
27#endif
28
29 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
30
31} // endEmployeesModel()
32
34EmployeesModel( const std::vector< Wt::WFormModel::Field > & _fields )
35//: Wt::WStandardItemModel(),
36: Wt::Dbo::QueryModel< GCW::Dbo::Employees::Item::Ptr >(),
37 m_fields( _fields )
38{
40
41}
42
43/*!
44** \brief Refresh From Disk
45**
46*/
47auto
49refreshFromDisk()-> void
50{
51
52 if( GCW::app()-> gnucashew_session().isOpen() )
53 {
54 Wt::Dbo::Transaction t( GCW::app()-> gnucashew_session() );
55
56 auto results =
57 GCW::app()-> gnucashew_session().find< GCW::Dbo::Employees::Item >()
58 ;
59
60 setQuery( results );
61
62 std::cout << __FILE__ << ":" << __LINE__ << " " << rowCount() << std::endl;
63
64 } // endif( GCW::app()-> gnucashew_session().isOpen() )
65
66 if( m_fields.size() > 0 )
67 {
68 for( auto field : m_fields )
69 addColumn( field );
70 }
71
72 else
73 {
74 addAllFieldsAsColumns();
75 }
76
77} // endrefreshFromDisk()-> void
78
79
80
auto refreshFromDisk() -> void
Refresh From Disk.
virtual Signal< WModelIndex, WModelIndex > & dataChanged()
Definition App.h:18
App * app()
Definition App.cpp:75