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